| ... | @@ -312,6 +312,7 @@ pub const LLVMIRModule = struct { | ... | @@ -312,6 +312,7 @@ pub const LLVMIRModule = struct { |
| 312 | .arg => try self.genArg(inst.castTag(.arg).?), | 312 | .arg => try self.genArg(inst.castTag(.arg).?), |
| 313 | .alloc => try self.genAlloc(inst.castTag(.alloc).?), | 313 | .alloc => try self.genAlloc(inst.castTag(.alloc).?), |
| 314 | .store => try self.genStore(inst.castTag(.store).?), | 314 | .store => try self.genStore(inst.castTag(.store).?), |
| | 315 | .load => try self.genLoad(inst.castTag(.load).?), |
| 315 | .dbg_stmt => blk: { | 316 | .dbg_stmt => blk: { |
| 316 | // TODO: implement debug info | 317 | // TODO: implement debug info |
| 317 | break :blk null; | 318 | break :blk null; |
| ... | @@ -396,6 +397,11 @@ pub const LLVMIRModule = struct { | ... | @@ -396,6 +397,11 @@ pub const LLVMIRModule = struct { |
| 396 | return null; | 397 | return null; |
| 397 | } | 398 | } |
| 398 | | 399 | |
| | 400 | fn genLoad(self: *LLVMIRModule, inst: *Inst.UnOp) !?*const llvm.ValueRef { |
| | 401 | const ptr_val = try self.resolveInst(inst.operand); |
| | 402 | return self.builder.buildLoad(ptr_val, ""); |
| | 403 | } |
| | 404 | |
| 399 | fn genBreakpoint(self: *LLVMIRModule, inst: *Inst.NoOp) !?*const llvm.ValueRef { | 405 | fn genBreakpoint(self: *LLVMIRModule, inst: *Inst.NoOp) !?*const llvm.ValueRef { |
| 400 | // TODO: Store this function somewhere such that we dont have to add it again | 406 | // TODO: Store this function somewhere such that we dont have to add it again |
| 401 | const fn_type = llvm.TypeRef.functionType(llvm.voidType(), null, 0, false); | 407 | const fn_type = llvm.TypeRef.functionType(llvm.voidType(), null, 0, false); |