aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-02-05 16:06:06 -0500
committerAndrew Kelley <superjoe30@gmail.com>2017-02-05 16:06:06 -0500
commit135c021c83c08e1ab42f6d24a98f3b14e53b5b62 (patch)
tree2d272426b6cd9d933aec7d8e3bafc00e469f2d12 /src/ir.cpp
parent025051885be8c99bfccc7d3746ac138f7d5546e1 (diff)
downloadzig-135c021c83c08e1ab42f6d24a98f3b14e53b5b62.tar.gz
zig-135c021c83c08e1ab42f6d24a98f3b14e53b5b62.zip
delete unneeded IR code and fix assigning to const ptr
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp29
1 files changed, 1 insertions, 28 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 96f0929fa7..34fcf210c8 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -9262,7 +9262,7 @@ static TypeTableEntry *ir_analyze_instruction_store_ptr(IrAnalyze *ira, IrInstru
if (casted_value == ira->codegen->invalid_instruction)
return ira->codegen->builtin_types.entry_invalid;
- if (ptr->value.special != ConstValSpecialRuntime) {
+ if (ptr->value.special != ConstValSpecialRuntime && ptr->value.data.x_ptr.special != ConstPtrSpecialRuntime) {
bool is_inline = (ptr->value.data.x_ptr.special == ConstPtrSpecialInline);
if (casted_value->value.special != ConstValSpecialRuntime) {
ConstExprValue *dest_val = const_ptr_pointee(&ptr->value);
@@ -9278,33 +9278,6 @@ static TypeTableEntry *ir_analyze_instruction_store_ptr(IrAnalyze *ira, IrInstru
}
}
- if (ptr->value.special != ConstValSpecialRuntime) {
- // This memory location is transforming from known at compile time to known at runtime.
- // We must emit our own var ptr instruction.
- // TODO can we delete this code now that we have inline var?
- ptr->value.special = ConstValSpecialRuntime;
- IrInstruction *new_ptr_inst;
- if (ptr->id == IrInstructionIdVarPtr) {
- IrInstructionVarPtr *var_ptr_inst = (IrInstructionVarPtr *)ptr;
- VariableTableEntry *var = var_ptr_inst->var;
- new_ptr_inst = ir_build_var_ptr(&ira->new_irb, store_ptr_instruction->base.scope,
- store_ptr_instruction->base.source_node, var, false);
- assert(var->mem_slot_index != SIZE_MAX);
- ConstExprValue *mem_slot = &ira->exec_context.mem_slot_list[var->mem_slot_index];
- mem_slot->special = ConstValSpecialRuntime;
- } else if (ptr->id == IrInstructionIdFieldPtr) {
- zig_panic("TODO");
- } else if (ptr->id == IrInstructionIdElemPtr) {
- zig_panic("TODO");
- } else {
- zig_unreachable();
- }
- new_ptr_inst->value.type = ptr->value.type;
- ir_build_store_ptr(&ira->new_irb, store_ptr_instruction->base.scope,
- store_ptr_instruction->base.source_node, new_ptr_inst, casted_value);
- return ir_analyze_void(ira, &store_ptr_instruction->base);
- }
-
ir_build_store_ptr_from(&ira->new_irb, &store_ptr_instruction->base, ptr, casted_value);
return ira->codegen->builtin_types.entry_void;
}