authorgravatar for xtex@astrafall.orgxtex <xtex@astrafall.org> 2026-10-16 09:43:59+08:00
committergravatar for xtex@astrafall.orgxtex <xtex@astrafall.org> 2026-10-17 10:26:20+08:00
log6d7b8dbcc6544c0f9cdbeaa1fecd29596d647db3
treeb241a3d21139f5f95f3924e2e2d8bb8db7050f49
parentd62ffc3487adc03981a40898545ca70c0354e88f
signature Signed by SSH key SHA256:IEYEjkZlkUTr5U9GiDAmZU/4eZus2t2RsxusyhQqwao

loongarch: implement analysis for legalize_compiler_rt_call


1 files changed, 27 insertions(+), 0 deletions(-)

src/codegen/loongarch/Select.zig+27
......@@ -2733,6 +2733,33 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void {
27332733 try isel.analyzeUse(arg);
27342734 }
27352735 },
2736 .legalize_compiler_rt_call => {
2737 const compiler_rt_call = isel.air.unwrapCompilerRtCall(air_inst_index);
2738
2739 for (compiler_rt_call.args) |arg|
2740 try isel.analyzeUse(arg);
2741
2742 var cc_it: CallAbiIterator = .{
2743 .isel = isel,
2744 .cc = &compiler_rt_call.func.@"callconv"(isel.target),
2745 };
2746 if (try cc_it.resolve(compiler_rt_call.func.returnType(), true)) |ret_vi| {
2747 tracking_log.debug("{f} <- %{d} (call return)", .{ ret_vi, @backingInt(air_inst_index) });
2748 switch (ret_vi.parent(isel)) {
2749 .none => {},
2750 .value, .constant => unreachable,
2751 .address => |address_vi| {
2752 defer address_vi.deref(isel);
2753 const ret_value = ret_vi.get(isel);
2754 ret_value.flags.parent_tag = .none;
2755 ret_value.parent_payload = .{ .none = {} };
2756 },
2757 }
2758 try isel.live_values.putNoClobber(gpa, air_inst_index, ret_vi);
2759
2760 try isel.def_order.putNoClobber(gpa, air_inst_index, {});
2761 }
2762 },
27362763 .cond_br => {
27372764 const pl_op = air_data[@backingInt(air_inst_index)].pl_op;
27382765 const extra = isel.air.extraData(Air.CondBr, pl_op.payload);