diff --git a/src/mir/Lowering.cpp b/src/mir/Lowering.cpp index a509514..cfb6285 100644 --- a/src/mir/Lowering.cpp +++ b/src/mir/Lowering.cpp @@ -590,8 +590,11 @@ void LowerInstruction(const ir::Instruction& inst, MachineFunction& function, EmitValueToReg(arg, reg, slots, block, function); fpArgCount++; } else { - // 整数参数 - PhysReg reg = static_cast(static_cast(PhysReg::W0) + intArgCount); + // 区分指针与普通整数:指针使用 64 位 Xn 寄存器 + bool isPointer = argType->IsPtrInt32() || argType->IsPtrFloat() || argType->IsPtrInt1() || + argType->IsArray(); // 数组在作为函数参数时会退化为指针 + PhysReg baseReg = isPointer ? PhysReg::X0 : PhysReg::W0; + PhysReg reg = static_cast(static_cast(baseReg) + intArgCount); EmitValueToReg(arg, reg, slots, block, function); intArgCount++; }