| ... | ... | @@ -333,10 +333,6 @@ static constexpr IrInstructionId ir_instruction_id(IrInstructionEnumTag *) { |
| 333 | 333 | return IrInstructionIdEnumTag; |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | | static constexpr IrInstructionId ir_instruction_id(IrInstructionGeneratedCode *) { |
| 337 | | return IrInstructionIdGeneratedCode; |
| 338 | | } |
| 339 | | |
| 340 | 336 | static constexpr IrInstructionId ir_instruction_id(IrInstructionImport *) { |
| 341 | 337 | return IrInstructionIdImport; |
| 342 | 338 | } |
| ... | ... | @@ -1435,17 +1431,6 @@ static IrInstruction *ir_build_enum_tag_from(IrBuilder *irb, IrInstruction *old_ |
| 1435 | 1431 | return new_instruction; |
| 1436 | 1432 | } |
| 1437 | 1433 | |
| 1438 | | static IrInstruction *ir_build_generated_code(IrBuilder *irb, Scope *scope, AstNode *source_node, |
| 1439 | | IrInstruction *value) |
| 1440 | | { |
| 1441 | | IrInstructionGeneratedCode *instruction = ir_build_instruction<IrInstructionGeneratedCode>(irb, scope, source_node); |
| 1442 | | instruction->value = value; |
| 1443 | | |
| 1444 | | ir_ref_instruction(value, irb->current_basic_block); |
| 1445 | | |
| 1446 | | return &instruction->base; |
| 1447 | | } |
| 1448 | | |
| 1449 | 1434 | static IrInstruction *ir_build_import(IrBuilder *irb, Scope *scope, AstNode *source_node, IrInstruction *name) { |
| 1450 | 1435 | IrInstructionImport *instruction = ir_build_instruction<IrInstructionImport>(irb, scope, source_node); |
| 1451 | 1436 | instruction->name = name; |
| ... | ... | @@ -2466,13 +2451,6 @@ static IrInstruction *ir_instruction_ctz_get_dep(IrInstructionCtz *instruction, |
| 2466 | 2451 | } |
| 2467 | 2452 | } |
| 2468 | 2453 | |
| 2469 | | static IrInstruction *ir_instruction_generatedcode_get_dep(IrInstructionGeneratedCode *instruction, size_t index) { |
| 2470 | | switch (index) { |
| 2471 | | case 0: return instruction->value; |
| 2472 | | default: return nullptr; |
| 2473 | | } |
| 2474 | | } |
| 2475 | | |
| 2476 | 2454 | static IrInstruction *ir_instruction_import_get_dep(IrInstructionImport *instruction, size_t index) { |
| 2477 | 2455 | switch (index) { |
| 2478 | 2456 | case 0: return instruction->name; |
| ... | ... | @@ -2964,8 +2942,6 @@ static IrInstruction *ir_instruction_get_dep(IrInstruction *instruction, size_t |
| 2964 | 2942 | return ir_instruction_clz_get_dep((IrInstructionClz *) instruction, index); |
| 2965 | 2943 | case IrInstructionIdCtz: |
| 2966 | 2944 | return ir_instruction_ctz_get_dep((IrInstructionCtz *) instruction, index); |
| 2967 | | case IrInstructionIdGeneratedCode: |
| 2968 | | return ir_instruction_generatedcode_get_dep((IrInstructionGeneratedCode *) instruction, index); |
| 2969 | 2945 | case IrInstructionIdImport: |
| 2970 | 2946 | return ir_instruction_import_get_dep((IrInstructionImport *) instruction, index); |
| 2971 | 2947 | case IrInstructionIdCImport: |
| ... | ... | @@ -3931,15 +3907,6 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3931 | 3907 | |
| 3932 | 3908 | return ir_build_clz(irb, scope, node, arg0_value); |
| 3933 | 3909 | } |
| 3934 | | case BuiltinFnIdGeneratedCode: |
| 3935 | | { |
| 3936 | | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 3937 | | IrInstruction *arg0_value = ir_gen_node(irb, arg0_node, scope); |
| 3938 | | if (arg0_value == irb->codegen->invalid_instruction) |
| 3939 | | return arg0_value; |
| 3940 | | |
| 3941 | | return ir_build_generated_code(irb, scope, node, arg0_value); |
| 3942 | | } |
| 3943 | 3910 | case BuiltinFnIdImport: |
| 3944 | 3911 | { |
| 3945 | 3912 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| ... | ... | @@ -11227,25 +11194,6 @@ static TypeTableEntry *ir_analyze_instruction_enum_tag(IrAnalyze *ira, IrInstruc |
| 11227 | 11194 | return new_instruction->value.type; |
| 11228 | 11195 | } |
| 11229 | 11196 | |
| 11230 | | static TypeTableEntry *ir_analyze_instruction_generated_code(IrAnalyze *ira, IrInstructionGeneratedCode *instruction) { |
| 11231 | | IrInstruction *value = instruction->value->other; |
| 11232 | | if (type_is_invalid(value->value.type)) |
| 11233 | | return ira->codegen->builtin_types.entry_invalid; |
| 11234 | | |
| 11235 | | if (instr_is_comptime(value)) { |
| 11236 | | ConstExprValue *val = ir_resolve_const(ira, value, UndefOk); |
| 11237 | | if (!val) |
| 11238 | | return ira->codegen->builtin_types.entry_invalid; |
| 11239 | | |
| 11240 | | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); |
| 11241 | | *out_val = *val; |
| 11242 | | return value->value.type; |
| 11243 | | } |
| 11244 | | |
| 11245 | | instruction->base.other = value; |
| 11246 | | return value->value.type; |
| 11247 | | } |
| 11248 | | |
| 11249 | 11197 | static TypeTableEntry *ir_analyze_instruction_import(IrAnalyze *ira, IrInstructionImport *import_instruction) { |
| 11250 | 11198 | IrInstruction *name_value = import_instruction->name->other; |
| 11251 | 11199 | Buf *import_target_str = ir_resolve_str(ira, name_value); |
| ... | ... | @@ -13362,8 +13310,6 @@ static TypeTableEntry *ir_analyze_instruction_nocast(IrAnalyze *ira, IrInstructi |
| 13362 | 13310 | return ir_analyze_instruction_switch_var(ira, (IrInstructionSwitchVar *)instruction); |
| 13363 | 13311 | case IrInstructionIdEnumTag: |
| 13364 | 13312 | return ir_analyze_instruction_enum_tag(ira, (IrInstructionEnumTag *)instruction); |
| 13365 | | case IrInstructionIdGeneratedCode: |
| 13366 | | return ir_analyze_instruction_generated_code(ira, (IrInstructionGeneratedCode *)instruction); |
| 13367 | 13313 | case IrInstructionIdImport: |
| 13368 | 13314 | return ir_analyze_instruction_import(ira, (IrInstructionImport *)instruction); |
| 13369 | 13315 | case IrInstructionIdArrayLen: |
| ... | ... | @@ -13601,7 +13547,6 @@ bool ir_has_side_effects(IrInstruction *instruction) { |
| 13601 | 13547 | case IrInstructionIdSwitchVar: |
| 13602 | 13548 | case IrInstructionIdSwitchTarget: |
| 13603 | 13549 | case IrInstructionIdEnumTag: |
| 13604 | | case IrInstructionIdGeneratedCode: |
| 13605 | 13550 | case IrInstructionIdRef: |
| 13606 | 13551 | case IrInstructionIdMinValue: |
| 13607 | 13552 | case IrInstructionIdMaxValue: |