Skip to content

Commit

Permalink
va_end
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexu committed Dec 13, 2022
1 parent f64b294 commit 4cc0a74
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/codegen/llvm.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5161,7 +5161,12 @@ pub const FuncGen = struct {
const un_op = self.air.instructions.items(.data)[inst].un_op;
const list = try self.resolveInst(un_op);

const llvm_fn = self.getIntrinsic("llvm.va_end", &.{self.dg.context.intType(8).pointerType(0)});
const llvm_fn_name = "llvm.va_end";
const llvm_fn = self.dg.object.llvm_module.getNamedFunction(llvm_fn_name) orelse blk: {
const param_types = [_]*llvm.Type{self.dg.context.intType(8).pointerType(0)};
const fn_type = llvm.functionType(self.context.voidType(), &param_types, param_types.len, .False);
break :blk self.dg.object.llvm_module.addFunction(llvm_fn_name, fn_type);
};
const args: [1]*llvm.Value = .{list};
_ = self.builder.buildCall(llvm_fn.globalGetValueType(), llvm_fn, &args, args.len, .Fast, .Auto, "");
return null;
Expand Down

0 comments on commit 4cc0a74

Please sign in to comment.