summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/RISCV/RISCVCallingConv.td
diff options
context:
space:
mode:
authorAlex Bradbury <asb@lowrisc.org>2017-12-11 12:49:02 +0000
committerAlex Bradbury <asb@lowrisc.org>2017-12-11 12:49:02 +0000
commitdc31c61b18f01b21e18ccea4de0a010569e81887 (patch)
tree0329df021250a81c3a26fa877537892570f8bf26 /llvm/lib/Target/RISCV/RISCVCallingConv.td
parentbfb00d4c1c98c20a7daed6d6e680b47c33692c21 (diff)
downloadbcm5719-llvm-dc31c61b18f01b21e18ccea4de0a010569e81887.tar.gz
bcm5719-llvm-dc31c61b18f01b21e18ccea4de0a010569e81887.zip
[RISCV] Add custom CC_RISCV calling convention and improved call support
The TableGen-based calling convention definitions are inflexible, while writing a function to implement the calling convention is very straight-forward, and allows difficult cases to be handled more easily. With this patch adds support for: * Passing large scalars according to the RV32I calling convention * Byval arguments * Passing values on the stack when the argument registers are exhausted The custom CC_RISCV calling convention is also used for returns. This patch also documents the ABI lowering that a language frontend is expected to perform. I would like to work to simplify these requirements over time, but this will require further discussion within the LLVM community. We add PendingArgFlags CCState, as a companion to PendingLocs. The PendingLocs vector is used by a number of backends to handle arguments that are split during legalisation. However CCValAssign doesn't keep track of the original argument alignment. Therefore, add a PendingArgFlags vector which can be used to keep track of the ISD::ArgFlagsTy for every value added to PendingLocs. Differential Revision: https://reviews.llvm.org/D39898 llvm-svn: 320359
Diffstat (limited to 'llvm/lib/Target/RISCV/RISCVCallingConv.td')
-rw-r--r--llvm/lib/Target/RISCV/RISCVCallingConv.td16
1 files changed, 2 insertions, 14 deletions
diff --git a/llvm/lib/Target/RISCV/RISCVCallingConv.td b/llvm/lib/Target/RISCV/RISCVCallingConv.td
index 0b7a523424c..d2b17c64c9c 100644
--- a/llvm/lib/Target/RISCV/RISCVCallingConv.td
+++ b/llvm/lib/Target/RISCV/RISCVCallingConv.td
@@ -11,20 +11,8 @@
//
//===----------------------------------------------------------------------===//
-// RISCV 32-bit C return-value convention.
-def RetCC_RISCV32 : CallingConv<[CCIfType<[i32], CCAssignToReg<[X10, X11]>>]>;
-
-// RISCV 32-bit C Calling convention.
-def CC_RISCV32 : CallingConv<[
- // Promote i8/i16 args to i32
- CCIfType<[ i8, i16 ], CCPromoteToType<i32>>,
-
- // All arguments get passed in integer registers if there is space.
- CCIfType<[i32], CCAssignToReg<[ X10, X11, X12, X13, X14, X15, X16, X17]>>,
-
- // Could be assigned to the stack in 8-byte aligned units, but unsupported
- CCAssignToStack<8, 8>
-]>;
+// The RISC-V calling convention is handled with custom code in
+// RISCVISelLowering.cpp (CC_RISCV).
def CSR : CalleeSavedRegs<(add X1, X3, X4, X8, X9, (sequence "X%u", 18, 27))>;
OpenPOWER on IntegriCloud