xref: /freebsd/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVCallingConv.td (revision 647cbc5de815c5651677bf8582797f716ec7b48d)
106c3fb27SDimitry Andric//===-- RISCVCallingConv.td - Calling Conventions RISC-V ---*- tablegen -*-===//
20b57cec5SDimitry Andric//
30b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric//
70b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric//
906c3fb27SDimitry Andric// This describes the calling conventions for the RISC-V architecture.
100b57cec5SDimitry Andric//
110b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
120b57cec5SDimitry Andric
130b57cec5SDimitry Andric// The RISC-V calling convention is handled with custom code in
140b57cec5SDimitry Andric// RISCVISelLowering.cpp (CC_RISCV).
150b57cec5SDimitry Andric
160b57cec5SDimitry Andricdef CSR_ILP32_LP64
17*647cbc5dSDimitry Andric    : CalleeSavedRegs<(add X1, X8, X9, (sequence "X%u", 18, 27))>;
180b57cec5SDimitry Andric
190b57cec5SDimitry Andricdef CSR_ILP32F_LP64F
200b57cec5SDimitry Andric    : CalleeSavedRegs<(add CSR_ILP32_LP64,
218bcb0991SDimitry Andric                       F8_F, F9_F, (sequence "F%u_F", 18, 27))>;
220b57cec5SDimitry Andric
230b57cec5SDimitry Andricdef CSR_ILP32D_LP64D
240b57cec5SDimitry Andric    : CalleeSavedRegs<(add CSR_ILP32_LP64,
258bcb0991SDimitry Andric                       F8_D, F9_D, (sequence "F%u_D", 18, 27))>;
260b57cec5SDimitry Andric
270b57cec5SDimitry Andric// Needed for implementation of RISCVRegisterInfo::getNoPreservedMask()
280b57cec5SDimitry Andricdef CSR_NoRegs : CalleeSavedRegs<(add)>;
290b57cec5SDimitry Andric
300b57cec5SDimitry Andric// Interrupt handler needs to save/restore all registers that are used,
310b57cec5SDimitry Andric// both Caller and Callee saved registers.
32*647cbc5dSDimitry Andricdef CSR_Interrupt : CalleeSavedRegs<(add X1, (sequence "X%u", 5, 31))>;
330b57cec5SDimitry Andric
340b57cec5SDimitry Andric// Same as CSR_Interrupt, but including all 32-bit FP registers.
3506c3fb27SDimitry Andricdef CSR_XLEN_F32_Interrupt: CalleeSavedRegs<(add CSR_Interrupt,
3606c3fb27SDimitry Andric                                             (sequence "F%u_F", 0, 31))>;
370b57cec5SDimitry Andric
380b57cec5SDimitry Andric// Same as CSR_Interrupt, but including all 64-bit FP registers.
3906c3fb27SDimitry Andricdef CSR_XLEN_F64_Interrupt: CalleeSavedRegs<(add CSR_Interrupt,
4006c3fb27SDimitry Andric                                             (sequence "F%u_D", 0, 31))>;
41