@@ -16844,10 +16844,6 @@ void RISCVTargetLowering::AdjustInstrPostInstrSelection(MachineInstr &MI,
16844
16844
// register-size fields in the same situations they would be for fixed
16845
16845
// arguments.
16846
16846
16847
- static const MCPhysReg ArgGPRs[] = {
16848
- RISCV::X10, RISCV::X11, RISCV::X12, RISCV::X13,
16849
- RISCV::X14, RISCV::X15, RISCV::X16, RISCV::X17
16850
- };
16851
16847
static const MCPhysReg ArgFPR16s[] = {
16852
16848
RISCV::F10_H, RISCV::F11_H, RISCV::F12_H, RISCV::F13_H,
16853
16849
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,
16872
16868
RISCV::V20M4};
16873
16869
static const MCPhysReg ArgVRM8s[] = {RISCV::V8M8, RISCV::V16M8};
16874
16870
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
+
16875
16879
// Pass a 2*XLEN argument that has been split into two XLEN values through
16876
16880
// registers or the stack as necessary.
16877
16881
static bool CC_RISCVAssign2XLen(unsigned XLen, CCState &State, CCValAssign VA1,
16878
16882
ISD::ArgFlagsTy ArgFlags1, unsigned ValNo2,
16879
16883
MVT ValVT2, MVT LocVT2,
16880
16884
ISD::ArgFlagsTy ArgFlags2) {
16881
16885
unsigned XLenInBytes = XLen / 8;
16886
+ ArrayRef<MCPhysReg> ArgGPRs = RISCV::getArgGPRs();
16882
16887
if (Register Reg = State.AllocateReg(ArgGPRs)) {
16883
16888
// At least one half can be passed via register.
16884
16889
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,
16999
17004
LocInfo = CCValAssign::BCvt;
17000
17005
}
17001
17006
17007
+ ArrayRef<MCPhysReg> ArgGPRs = RISCV::getArgGPRs();
17008
+
17002
17009
// If this is a variadic argument, the RISC-V calling convention requires
17003
17010
// that it is assigned an 'even' or 'aligned' register if it has 8-byte
17004
17011
// alignment (RV32) or 16-byte alignment (RV64). An aligned register should
@@ -17684,7 +17691,7 @@ SDValue RISCVTargetLowering::LowerFormalArguments(
17684
17691
MF.getInfo<RISCVMachineFunctionInfo>()->setIsVectorCall();
17685
17692
17686
17693
if (IsVarArg) {
17687
- ArrayRef<MCPhysReg> ArgRegs = ArrayRef(ArgGPRs );
17694
+ ArrayRef<MCPhysReg> ArgRegs = RISCV::getArgGPRs( );
17688
17695
unsigned Idx = CCInfo.getFirstUnallocated(ArgRegs);
17689
17696
const TargetRegisterClass *RC = &RISCV::GPRRegClass;
17690
17697
MachineFrameInfo &MFI = MF.getFrameInfo();
0 commit comments