[llvm] [RISCV] Share ArgGPRs array between SelectionDAG and GISel. (PR #74152)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 4 00:11:24 PST 2023


================
@@ -986,6 +986,9 @@ bool CC_RISCV_FastCC(const DataLayout &DL, RISCVABI::ABI ABI, unsigned ValNo,
 bool CC_RISCV_GHC(unsigned ValNo, MVT ValVT, MVT LocVT,
                   CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags,
                   CCState &State);
+
+ArrayRef<MCPhysReg> getArgGPRs();
----------------
topperc wrote:

GISel doesn't need the other lists like ArgFPR16s, , ArgFPR32s, ArgFPR64s, ArgVRs, etc. If we move ArgGPRs I think we should move those to, but I don't see any good reason to do that since GISel doesn't need them. We already exported `CC_RISCV`, `CC_RISCV_FastCC`, `CC_RISCV_GHC` functions from SelectionDAG so GISel could use them. Those are the primary users of these arrays.

Or alternatively, maybe I could add something like this that we could share with SelectionDAG and GISel?

```
unsigned RISCV::getVarArgsRegistersToSave(CCState &State) {
  unsigned Idx = State.getFirstUnallocated(ArgRegs);
  return (ArgRegs.size() - Idx);
}
```

https://github.com/llvm/llvm-project/pull/74152


More information about the llvm-commits mailing list