| ... | @@ -9262,7 +9262,7 @@ static TypeTableEntry *ir_analyze_instruction_store_ptr(IrAnalyze *ira, IrInstru | ... | @@ -9262,7 +9262,7 @@ static TypeTableEntry *ir_analyze_instruction_store_ptr(IrAnalyze *ira, IrInstru |
| 9262 | if (casted_value == ira->codegen->invalid_instruction) | 9262 | if (casted_value == ira->codegen->invalid_instruction) |
| 9263 | return ira->codegen->builtin_types.entry_invalid; | 9263 | return ira->codegen->builtin_types.entry_invalid; |
| 9264 | | 9264 | |
| 9265 | if (ptr->value.special != ConstValSpecialRuntime) { | 9265 | if (ptr->value.special != ConstValSpecialRuntime && ptr->value.data.x_ptr.special != ConstPtrSpecialRuntime) { |
| 9266 | bool is_inline = (ptr->value.data.x_ptr.special == ConstPtrSpecialInline); | 9266 | bool is_inline = (ptr->value.data.x_ptr.special == ConstPtrSpecialInline); |
| 9267 | if (casted_value->value.special != ConstValSpecialRuntime) { | 9267 | if (casted_value->value.special != ConstValSpecialRuntime) { |
| 9268 | ConstExprValue *dest_val = const_ptr_pointee(&ptr->value); | 9268 | ConstExprValue *dest_val = const_ptr_pointee(&ptr->value); |
| ... | @@ -9278,33 +9278,6 @@ static TypeTableEntry *ir_analyze_instruction_store_ptr(IrAnalyze *ira, IrInstru | ... | @@ -9278,33 +9278,6 @@ static TypeTableEntry *ir_analyze_instruction_store_ptr(IrAnalyze *ira, IrInstru |
| 9278 | } | 9278 | } |
| 9279 | } | 9279 | } |
| 9280 | | 9280 | |
| 9281 | if (ptr->value.special != ConstValSpecialRuntime) { | | |
| 9282 | // This memory location is transforming from known at compile time to known at runtime. | | |
| 9283 | // We must emit our own var ptr instruction. | | |
| 9284 | // TODO can we delete this code now that we have inline var? | | |
| 9285 | ptr->value.special = ConstValSpecialRuntime; | | |
| 9286 | IrInstruction *new_ptr_inst; | | |
| 9287 | if (ptr->id == IrInstructionIdVarPtr) { | | |
| 9288 | IrInstructionVarPtr *var_ptr_inst = (IrInstructionVarPtr *)ptr; | | |
| 9289 | VariableTableEntry *var = var_ptr_inst->var; | | |
| 9290 | new_ptr_inst = ir_build_var_ptr(&ira->new_irb, store_ptr_instruction->base.scope, | | |
| 9291 | store_ptr_instruction->base.source_node, var, false); | | |
| 9292 | assert(var->mem_slot_index != SIZE_MAX); | | |
| 9293 | ConstExprValue *mem_slot = &ira->exec_context.mem_slot_list[var->mem_slot_index]; | | |
| 9294 | mem_slot->special = ConstValSpecialRuntime; | | |
| 9295 | } else if (ptr->id == IrInstructionIdFieldPtr) { | | |
| 9296 | zig_panic("TODO"); | | |
| 9297 | } else if (ptr->id == IrInstructionIdElemPtr) { | | |
| 9298 | zig_panic("TODO"); | | |
| 9299 | } else { | | |
| 9300 | zig_unreachable(); | | |
| 9301 | } | | |
| 9302 | new_ptr_inst->value.type = ptr->value.type; | | |
| 9303 | ir_build_store_ptr(&ira->new_irb, store_ptr_instruction->base.scope, | | |
| 9304 | store_ptr_instruction->base.source_node, new_ptr_inst, casted_value); | | |
| 9305 | return ir_analyze_void(ira, &store_ptr_instruction->base); | | |
| 9306 | } | | |
| 9307 | | | |
| 9308 | ir_build_store_ptr_from(&ira->new_irb, &store_ptr_instruction->base, ptr, casted_value); | 9281 | ir_build_store_ptr_from(&ira->new_irb, &store_ptr_instruction->base, ptr, casted_value); |
| 9309 | return ira->codegen->builtin_types.entry_void; | 9282 | return ira->codegen->builtin_types.entry_void; |
| 9310 | } | 9283 | } |