aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-06-10 12:24:19 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-06-10 12:24:19 -0400
commit17b1ac5d03cd32e047d917a88e029c143cb5d119 (patch)
tree0bdd3b27eaeaccbc17946a79cca6e8b628bb1d38 /src/codegen.cpp
parent1a51bf63047e9a3cd6ae3273296fded82009235c (diff)
downloadzig-17b1ac5d03cd32e047d917a88e029c143cb5d119.tar.gz
zig-17b1ac5d03cd32e047d917a88e029c143cb5d119.zip
result location semantics for `@bitCast`
```zig export fn entry() void { var x = @bitCast(f32, foo()); } ``` ```llvm define void @entry() #2 !dbg !35 { Entry: %x = alloca float, align 4 %0 = bitcast float* %x to %Foo*, !dbg !42 call fastcc void @foo(%Foo* sret %0), !dbg !42 call void @llvm.dbg.declare(metadata float* %x, metadata !39, metadata !DIExpression()), !dbg !43 ret void, !dbg !44 } ```
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp14
1 files changed, 1 insertions, 13 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index eb2e92f627..894d22d471 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -3145,12 +3145,7 @@ static LLVMValueRef ir_render_bit_cast(CodeGen *g, IrExecutable *executable,
uint32_t alignment = get_abi_alignment(g, actual_type);
return gen_load_untyped(g, bitcasted_ptr, alignment, false, "");
} else {
- assert(instruction->tmp_ptr != nullptr);
- LLVMTypeRef wanted_ptr_type_ref = LLVMPointerType(get_llvm_type(g, actual_type), 0);
- LLVMValueRef bitcasted_ptr = LLVMBuildBitCast(g->builder, instruction->tmp_ptr, wanted_ptr_type_ref, "");
- uint32_t alignment = get_abi_alignment(g, wanted_type);
- gen_store_untyped(g, value, bitcasted_ptr, alignment, false);
- return instruction->tmp_ptr;
+ zig_unreachable();
}
}
@@ -5520,7 +5515,6 @@ static LLVMValueRef ir_render_instruction(CodeGen *g, IrExecutable *executable,
case IrInstructionIdPtrCastSrc:
case IrInstructionIdCmpxchgSrc:
case IrInstructionIdLoadPtr:
- case IrInstructionIdBitCast:
case IrInstructionIdGlobalAsm:
case IrInstructionIdHasDecl:
case IrInstructionIdUndeclaredIdent:
@@ -6837,9 +6831,6 @@ static void do_code_gen(CodeGen *g) {
slot = &ref_instruction->tmp_ptr;
assert(instruction->value.type->id == ZigTypeIdPointer);
slot_type = instruction->value.type->data.pointer.child_type;
- } else if (instruction->id == IrInstructionIdContainerInitList) {
- IrInstructionContainerInitList *container_init_list_instruction = (IrInstructionContainerInitList *)instruction;
- slot = &container_init_list_instruction->tmp_ptr;
} else if (instruction->id == IrInstructionIdSlice) {
IrInstructionSlice *slice_instruction = (IrInstructionSlice *)instruction;
slot = &slice_instruction->tmp_ptr;
@@ -6861,9 +6852,6 @@ static void do_code_gen(CodeGen *g) {
} else if (instruction->id == IrInstructionIdLoadPtrGen) {
IrInstructionLoadPtrGen *load_ptr_inst = (IrInstructionLoadPtrGen *)instruction;
slot = &load_ptr_inst->tmp_ptr;
- } else if (instruction->id == IrInstructionIdBitCastGen) {
- IrInstructionBitCastGen *bit_cast_inst = (IrInstructionBitCastGen *)instruction;
- slot = &bit_cast_inst->tmp_ptr;
} else if (instruction->id == IrInstructionIdVectorToArray) {
IrInstructionVectorToArray *vector_to_array_instruction = (IrInstructionVectorToArray *)instruction;
alignment_bytes = get_abi_alignment(g, vector_to_array_instruction->vector->value.type);