| ... | @@ -964,19 +964,19 @@ pub const Object = struct { | ... | @@ -964,19 +964,19 @@ pub const Object = struct { |
| 964 | else => {}, | 964 | else => {}, |
| 965 | } | 965 | } |
| 966 | } | 966 | } |
| 967 | const ints_llvm_ty = dg.context.structType(field_types.ptr, @intCast(c_uint, field_types.len), .False); | 967 | const floats_llvm_ty = dg.context.structType(field_types.ptr, @intCast(c_uint, field_types.len), .False); |
| 968 | const casted_ptr = builder.buildBitCast(arg_ptr, ints_llvm_ty.pointerType(0), ""); | 968 | const casted_ptr = builder.buildBitCast(arg_ptr, floats_llvm_ty.pointerType(0), ""); |
| 969 | for (llvm_floats) |_, i_usize| { | 969 | for (llvm_floats) |_, i_usize| { |
| 970 | const i = @intCast(c_uint, i_usize); | 970 | const i = @intCast(c_uint, i_usize); |
| 971 | const param = llvm_func.getParam(i); | 971 | const param = llvm_func.getParam(i); |
| 972 | const field_ptr = builder.buildStructGEP(casted_ptr, i, ""); | 972 | const field_ptr = builder.buildStructGEP(floats_llvm_ty, casted_ptr, i, ""); |
| 973 | const store_inst = builder.buildStore(param, field_ptr); | 973 | const store_inst = builder.buildStore(param, field_ptr); |
| 974 | store_inst.setAlignment(target.cpu.arch.ptrBitWidth() / 8); | 974 | store_inst.setAlignment(target.cpu.arch.ptrBitWidth() / 8); |
| 975 | } | 975 | } |
| 976 | | 976 | |
| 977 | const is_by_ref = isByRef(param_ty); | 977 | const is_by_ref = isByRef(param_ty); |
| 978 | const loaded = if (is_by_ref) arg_ptr else l: { | 978 | const loaded = if (is_by_ref) arg_ptr else l: { |
| 979 | const load_inst = builder.buildLoad(arg_ptr, ""); | 979 | const load_inst = builder.buildLoad(param_llvm_ty, arg_ptr, ""); |
| 980 | load_inst.setAlignment(param_alignment); | 980 | load_inst.setAlignment(param_alignment); |
| 981 | break :l load_inst; | 981 | break :l load_inst; |
| 982 | }; | 982 | }; |
| ... | @@ -4529,13 +4529,13 @@ pub const FuncGen = struct { | ... | @@ -4529,13 +4529,13 @@ pub const FuncGen = struct { |
| 4529 | else => {}, | 4529 | else => {}, |
| 4530 | } | 4530 | } |
| 4531 | } | 4531 | } |
| 4532 | const ints_llvm_ty = self.dg.context.structType(field_types.ptr, @intCast(c_uint, field_types.len), .False); | 4532 | const floats_llvm_ty = self.dg.context.structType(field_types.ptr, @intCast(c_uint, field_types.len), .False); |
| 4533 | const casted_ptr = self.builder.buildBitCast(arg_ptr, ints_llvm_ty.pointerType(0), ""); | 4533 | const casted_ptr = self.builder.buildBitCast(arg_ptr, floats_llvm_ty.pointerType(0), ""); |
| 4534 | try llvm_args.ensureUnusedCapacity(it.llvm_types_len); | 4534 | try llvm_args.ensureUnusedCapacity(it.llvm_types_len); |
| 4535 | for (llvm_floats) |_, i_usize| { | 4535 | for (llvm_floats) |_, i_usize| { |
| 4536 | const i = @intCast(c_uint, i_usize); | 4536 | const i = @intCast(c_uint, i_usize); |
| 4537 | const field_ptr = self.builder.buildStructGEP(casted_ptr, i, ""); | 4537 | const field_ptr = self.builder.buildStructGEP(floats_llvm_ty, casted_ptr, i, ""); |
| 4538 | const load_inst = self.builder.buildLoad(field_ptr, ""); | 4538 | const load_inst = self.builder.buildLoad(field_types[i], field_ptr, ""); |
| 4539 | load_inst.setAlignment(target.cpu.arch.ptrBitWidth() / 8); | 4539 | load_inst.setAlignment(target.cpu.arch.ptrBitWidth() / 8); |
| 4540 | llvm_args.appendAssumeCapacity(load_inst); | 4540 | llvm_args.appendAssumeCapacity(load_inst); |
| 4541 | } | 4541 | } |
| ... | @@ -8169,7 +8169,7 @@ pub const FuncGen = struct { | ... | @@ -8169,7 +8169,7 @@ pub const FuncGen = struct { |
| 8169 | | 8169 | |
| 8170 | const llvm_fn = try self.getIsNamedEnumValueFunction(enum_ty); | 8170 | const llvm_fn = try self.getIsNamedEnumValueFunction(enum_ty); |
| 8171 | const params = [_]*const llvm.Value{operand}; | 8171 | const params = [_]*const llvm.Value{operand}; |
| 8172 | return self.builder.buildCall(llvm_fn, &params, params.len, .Fast, .Auto, ""); | 8172 | return self.builder.buildCall(llvm_fn.globalGetValueType(), llvm_fn, &params, params.len, .Fast, .Auto, ""); |
| 8173 | } | 8173 | } |
| 8174 | | 8174 | |
| 8175 | fn getIsNamedEnumValueFunction(self: *FuncGen, enum_ty: Type) !*const llvm.Value { | 8175 | fn getIsNamedEnumValueFunction(self: *FuncGen, enum_ty: Type) !*const llvm.Value { |
| ... | @@ -9249,8 +9249,9 @@ pub const FuncGen = struct { | ... | @@ -9249,8 +9249,9 @@ pub const FuncGen = struct { |
| 9249 | | 9249 | |
| 9250 | switch (target.cpu.arch) { | 9250 | switch (target.cpu.arch) { |
| 9251 | .x86_64 => { | 9251 | .x86_64 => { |
| | 9252 | const array_llvm_ty = usize_llvm_ty.arrayType(6); |
| 9252 | const array_ptr = fg.valgrind_client_request_array orelse a: { | 9253 | const array_ptr = fg.valgrind_client_request_array orelse a: { |
| 9253 | const array_ptr = fg.buildAlloca(usize_llvm_ty.arrayType(6)); | 9254 | const array_ptr = fg.buildAlloca(array_llvm_ty); |
| 9254 | array_ptr.setAlignment(usize_alignment); | 9255 | array_ptr.setAlignment(usize_alignment); |
| 9255 | fg.valgrind_client_request_array = array_ptr; | 9256 | fg.valgrind_client_request_array = array_ptr; |
| 9256 | break :a array_ptr; | 9257 | break :a array_ptr; |
| ... | @@ -9261,7 +9262,7 @@ pub const FuncGen = struct { | ... | @@ -9261,7 +9262,7 @@ pub const FuncGen = struct { |
| 9261 | const indexes = [_]*const llvm.Value{ | 9262 | const indexes = [_]*const llvm.Value{ |
| 9262 | zero, usize_llvm_ty.constInt(@intCast(c_uint, i), .False), | 9263 | zero, usize_llvm_ty.constInt(@intCast(c_uint, i), .False), |
| 9263 | }; | 9264 | }; |
| 9264 | const elem_ptr = fg.builder.buildInBoundsGEP(array_ptr, &indexes, indexes.len, ""); | 9265 | const elem_ptr = fg.builder.buildInBoundsGEP(array_llvm_ty, array_ptr, &indexes, indexes.len, ""); |
| 9265 | const store_inst = fg.builder.buildStore(elem, elem_ptr); | 9266 | const store_inst = fg.builder.buildStore(elem, elem_ptr); |
| 9266 | store_inst.setAlignment(usize_alignment); | 9267 | store_inst.setAlignment(usize_alignment); |
| 9267 | } | 9268 | } |
| ... | @@ -9291,6 +9292,7 @@ pub const FuncGen = struct { | ... | @@ -9291,6 +9292,7 @@ pub const FuncGen = struct { |
| 9291 | ); | 9292 | ); |
| 9292 | | 9293 | |
| 9293 | const call = fg.builder.buildCall( | 9294 | const call = fg.builder.buildCall( |
| | 9295 | fn_llvm_ty, |
| 9294 | asm_fn, | 9296 | asm_fn, |
| 9295 | &args, | 9297 | &args, |
| 9296 | args.len, | 9298 | args.len, |