1 //===-- RISCVCallingConv.td - Calling Conventions RISC-V ---*- tablegen -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This describes the calling conventions for the RISC-V architecture.
11 //===----------------------------------------------------------------------===//
13 // The RISC-V calling convention is handled with custom code in
14 // RISCVISelLowering.cpp (CC_RISCV).
17 : CalleeSavedRegs<(add X1, X3, X4, X8, X9, (sequence "X%u", 18, 27))>;
20 : CalleeSavedRegs<(add CSR_ILP32_LP64,
21 F8_F, F9_F, (sequence "F%u_F", 18, 27))>;
24 : CalleeSavedRegs<(add CSR_ILP32_LP64,
25 F8_D, F9_D, (sequence "F%u_D", 18, 27))>;
27 // Needed for implementation of RISCVRegisterInfo::getNoPreservedMask()
28 def CSR_NoRegs : CalleeSavedRegs<(add)>;
30 // Interrupt handler needs to save/restore all registers that are used,
31 // both Caller and Callee saved registers.
32 def CSR_Interrupt : CalleeSavedRegs<(add X1, (sequence "X%u", 3, 31))>;
34 // Same as CSR_Interrupt, but including all 32-bit FP registers.
35 def CSR_XLEN_F32_Interrupt: CalleeSavedRegs<(add CSR_Interrupt,
36 (sequence "F%u_F", 0, 31))>;
38 // Same as CSR_Interrupt, but including all 64-bit FP registers.
39 def CSR_XLEN_F64_Interrupt: CalleeSavedRegs<(add CSR_Interrupt,
40 (sequence "F%u_D", 0, 31))>;