| ... | ... | @@ -4414,6 +4414,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutableGen *executable, IrIn |
| 4414 | 4414 | } |
| 4415 | 4415 | } |
| 4416 | 4416 | LLVMTypeRef frame_with_args_type = LLVMStructType(field_types, field_count, false); |
| 4417 | heap::c_allocator.deallocate(field_types, field_count); |
| 4417 | 4418 | LLVMTypeRef ptr_frame_with_args_type = LLVMPointerType(frame_with_args_type, 0); |
| 4418 | 4419 | |
| 4419 | 4420 | casted_frame = LLVMBuildBitCast(g->builder, frame_result_loc, ptr_frame_with_args_type, ""); |
| ... | ... | @@ -4825,12 +4826,15 @@ static LLVMValueRef ir_render_asm_gen(CodeGen *g, IrExecutableGen *executable, I |
| 4825 | 4826 | ret_type = get_llvm_type(g, instruction->base.value->type); |
| 4826 | 4827 | } |
| 4827 | 4828 | LLVMTypeRef function_type = LLVMFunctionType(ret_type, param_types, (unsigned)input_and_output_count, false); |
| 4829 | heap::c_allocator.deallocate(param_types, input_and_output_count); |
| 4828 | 4830 | |
| 4829 | 4831 | bool is_volatile = instruction->has_side_effects || (asm_expr->output_list.length == 0); |
| 4830 | 4832 | LLVMValueRef asm_fn = LLVMGetInlineAsm(function_type, buf_ptr(&llvm_template), buf_len(&llvm_template), |
| 4831 | 4833 | buf_ptr(&constraint_buf), buf_len(&constraint_buf), is_volatile, false, LLVMInlineAsmDialectATT); |
| 4832 | 4834 | |
| 4833 | | return LLVMBuildCall(g->builder, asm_fn, param_values, (unsigned)input_and_output_count, ""); |
| 4835 | LLVMValueRef built_call = LLVMBuildCall(g->builder, asm_fn, param_values, (unsigned)input_and_output_count, ""); |
| 4836 | heap::c_allocator.deallocate(param_values, input_and_output_count); |
| 4837 | return built_call; |
| 4834 | 4838 | } |
| 4835 | 4839 | |
| 4836 | 4840 | static LLVMValueRef gen_non_null_bit(CodeGen *g, ZigType *maybe_type, LLVMValueRef maybe_handle) { |
| ... | ... | @@ -5083,6 +5087,8 @@ static LLVMValueRef ir_render_phi(CodeGen *g, IrExecutableGen *executable, IrIns |
| 5083 | 5087 | incoming_blocks[i] = instruction->incoming_blocks[i]->llvm_exit_block; |
| 5084 | 5088 | } |
| 5085 | 5089 | LLVMAddIncoming(phi, incoming_values, incoming_blocks, (unsigned)instruction->incoming_count); |
| 5090 | heap::c_allocator.deallocate(incoming_values, instruction->incoming_count); |
| 5091 | heap::c_allocator.deallocate(incoming_blocks, instruction->incoming_count); |
| 5086 | 5092 | return phi; |
| 5087 | 5093 | } |
| 5088 | 5094 | |
| ... | ... | @@ -7459,10 +7465,14 @@ static LLVMValueRef gen_const_val(CodeGen *g, ZigValue *const_val, const char *n |
| 7459 | 7465 | } |
| 7460 | 7466 | } |
| 7461 | 7467 | if (make_unnamed_struct) { |
| 7462 | | return LLVMConstStruct(fields, type_entry->data.structure.gen_field_count, |
| 7468 | LLVMValueRef unnamed_struct = LLVMConstStruct(fields, type_entry->data.structure.gen_field_count, |
| 7463 | 7469 | type_entry->data.structure.layout == ContainerLayoutPacked); |
| 7470 | heap::c_allocator.deallocate(fields, type_entry->data.structure.gen_field_count); |
| 7471 | return unnamed_struct; |
| 7464 | 7472 | } else { |
| 7465 | | return LLVMConstNamedStruct(get_llvm_type(g, type_entry), fields, type_entry->data.structure.gen_field_count); |
| 7473 | LLVMValueRef named_struct = LLVMConstNamedStruct(get_llvm_type(g, type_entry), fields, type_entry->data.structure.gen_field_count); |
| 7474 | heap::c_allocator.deallocate(fields, type_entry->data.structure.gen_field_count); |
| 7475 | return named_struct; |
| 7466 | 7476 | } |
| 7467 | 7477 | } |
| 7468 | 7478 | case ZigTypeIdArray: |
| ... | ... | @@ -7487,9 +7497,13 @@ static LLVMValueRef gen_const_val(CodeGen *g, ZigValue *const_val, const char *n |
| 7487 | 7497 | values[len] = gen_const_val(g, type_entry->data.array.sentinel, ""); |
| 7488 | 7498 | } |
| 7489 | 7499 | if (make_unnamed_struct) { |
| 7490 | | return LLVMConstStruct(values, full_len, true); |
| 7500 | LLVMValueRef unnamed_struct = LLVMConstStruct(values, full_len, true); |
| 7501 | heap::c_allocator.deallocate(values, full_len); |
| 7502 | return unnamed_struct; |
| 7491 | 7503 | } else { |
| 7492 | | return LLVMConstArray(element_type_ref, values, (unsigned)full_len); |
| 7504 | LLVMValueRef array = LLVMConstArray(element_type_ref, values, (unsigned)full_len); |
| 7505 | heap::c_allocator.deallocate(values, full_len); |
| 7506 | return array; |
| 7493 | 7507 | } |
| 7494 | 7508 | } |
| 7495 | 7509 | case ConstArraySpecialBuf: { |
| ... | ... | @@ -7511,7 +7525,9 @@ static LLVMValueRef gen_const_val(CodeGen *g, ZigValue *const_val, const char *n |
| 7511 | 7525 | ZigValue *elem_value = &const_val->data.x_array.data.s_none.elements[i]; |
| 7512 | 7526 | values[i] = gen_const_val(g, elem_value, ""); |
| 7513 | 7527 | } |
| 7514 | | return LLVMConstVector(values, len); |
| 7528 | LLVMValueRef vector = LLVMConstVector(values, len); |
| 7529 | heap::c_allocator.deallocate(values, len); |
| 7530 | return vector; |
| 7515 | 7531 | } |
| 7516 | 7532 | case ConstArraySpecialBuf: { |
| 7517 | 7533 | Buf *buf = const_val->data.x_array.data.s_buf; |
| ... | ... | @@ -7520,7 +7536,9 @@ static LLVMValueRef gen_const_val(CodeGen *g, ZigValue *const_val, const char *n |
| 7520 | 7536 | for (uint64_t i = 0; i < len; i += 1) { |
| 7521 | 7537 | values[i] = LLVMConstInt(g->builtin_types.entry_u8->llvm_type, buf_ptr(buf)[i], false); |
| 7522 | 7538 | } |
| 7523 | | return LLVMConstVector(values, len); |
| 7539 | LLVMValueRef vector = LLVMConstVector(values, len); |
| 7540 | heap::c_allocator.deallocate(values, len); |
| 7541 | return vector; |
| 7524 | 7542 | } |
| 7525 | 7543 | } |
| 7526 | 7544 | zig_unreachable(); |
| ... | ... | @@ -7742,6 +7760,7 @@ static void generate_error_name_table(CodeGen *g) { |
| 7742 | 7760 | } |
| 7743 | 7761 | |
| 7744 | 7762 | LLVMValueRef err_name_table_init = LLVMConstArray(get_llvm_type(g, str_type), values, (unsigned)g->errors_by_index.length); |
| 7763 | heap::c_allocator.deallocate(values, g->errors_by_index.length); |
| 7745 | 7764 | |
| 7746 | 7765 | g->err_name_table = LLVMAddGlobal(g->module, LLVMTypeOf(err_name_table_init), |
| 7747 | 7766 | get_mangled_name(g, buf_ptr(buf_create_from_str("__zig_err_name_table")))); |