[PATCH] D89788: [RISCV] Add GHC calling convention

luxufan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 19 18:06:17 PST 2020


StephenFan added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:1964-2003
+static bool CC_RISCV_GHC(unsigned ValNo, MVT ValVT, MVT LocVT,
+			 CCValAssign::LocInfo LocInfo,
+			 ISD::ArgFlagsTy ArgFlags, CCState &State) {
+
+  if (LocVT == MVT::i64) {
+    // Pass in STG registers: Base, Sp, Hp, R1, R2, R3, R4, R5, R6, R7, SpLim
+    static const MCPhysReg GPRList[] = {
----------------
jrtc27 wrote:
> lenary wrote:
> > Is this doable with the declarative Calling Convention system in LLVM (an example of this is in `llvm/lib/Target/ARM/ARMCallingConv.td`)
> > 
> > We haven't been able to do this for RISC-V's normal calling convention yet, but this convention seems a lot simpler, so I hope it should be doable.
> We deliberately went with C++ rather than TableGen for Fast, as it's far more readable (and flexible).
In the CallingConvLower.h, the CCAssignFn is a function pointer that represent the function that deal with the calling convention, and this function can be used in many other places, for example, In globalisel's ValueHandler. So I think use the TableGen rather than C++ is more convenient.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89788/new/

https://reviews.llvm.org/D89788



More information about the llvm-commits mailing list