@@ -16844,10 +16844,6 @@ void RISCVTargetLowering::AdjustInstrPostInstrSelection(MachineInstr &MI,
1684416844// register-size fields in the same situations they would be for fixed
1684516845// arguments.
1684616846
16847- static const MCPhysReg ArgGPRs[] = {
16848- RISCV::X10, RISCV::X11, RISCV::X12, RISCV::X13,
16849- RISCV::X14, RISCV::X15, RISCV::X16, RISCV::X17
16850- };
1685116847static const MCPhysReg ArgFPR16s[] = {
1685216848 RISCV::F10_H, RISCV::F11_H, RISCV::F12_H, RISCV::F13_H,
1685316849 RISCV::F14_H, RISCV::F15_H, RISCV::F16_H, RISCV::F17_H
@@ -16872,13 +16868,22 @@ static const MCPhysReg ArgVRM4s[] = {RISCV::V8M4, RISCV::V12M4, RISCV::V16M4,
1687216868 RISCV::V20M4};
1687316869static const MCPhysReg ArgVRM8s[] = {RISCV::V8M8, RISCV::V16M8};
1687416870
16871+ ArrayRef<MCPhysReg> RISCV::getArgGPRs() {
16872+ static const MCPhysReg ArgGPRs[] = {RISCV::X10, RISCV::X11, RISCV::X12,
16873+ RISCV::X13, RISCV::X14, RISCV::X15,
16874+ RISCV::X16, RISCV::X17};
16875+
16876+ return ArrayRef(ArgGPRs);
16877+ }
16878+
1687516879// Pass a 2*XLEN argument that has been split into two XLEN values through
1687616880// registers or the stack as necessary.
1687716881static bool CC_RISCVAssign2XLen(unsigned XLen, CCState &State, CCValAssign VA1,
1687816882 ISD::ArgFlagsTy ArgFlags1, unsigned ValNo2,
1687916883 MVT ValVT2, MVT LocVT2,
1688016884 ISD::ArgFlagsTy ArgFlags2) {
1688116885 unsigned XLenInBytes = XLen / 8;
16886+ ArrayRef<MCPhysReg> ArgGPRs = RISCV::getArgGPRs();
1688216887 if (Register Reg = State.AllocateReg(ArgGPRs)) {
1688316888 // At least one half can be passed via register.
1688416889 State.addLoc(CCValAssign::getReg(VA1.getValNo(), VA1.getValVT(), Reg,
@@ -16999,6 +17004,8 @@ bool RISCV::CC_RISCV(const DataLayout &DL, RISCVABI::ABI ABI, unsigned ValNo,
1699917004 LocInfo = CCValAssign::BCvt;
1700017005 }
1700117006
17007+ ArrayRef<MCPhysReg> ArgGPRs = RISCV::getArgGPRs();
17008+
1700217009 // If this is a variadic argument, the RISC-V calling convention requires
1700317010 // that it is assigned an 'even' or 'aligned' register if it has 8-byte
1700417011 // alignment (RV32) or 16-byte alignment (RV64). An aligned register should
@@ -17684,7 +17691,7 @@ SDValue RISCVTargetLowering::LowerFormalArguments(
1768417691 MF.getInfo<RISCVMachineFunctionInfo>()->setIsVectorCall();
1768517692
1768617693 if (IsVarArg) {
17687- ArrayRef<MCPhysReg> ArgRegs = ArrayRef(ArgGPRs );
17694+ ArrayRef<MCPhysReg> ArgRegs = RISCV::getArgGPRs( );
1768817695 unsigned Idx = CCInfo.getFirstUnallocated(ArgRegs);
1768917696 const TargetRegisterClass *RC = &RISCV::GPRRegClass;
1769017697 MachineFrameInfo &MFI = MF.getFrameInfo();
0 commit comments