1//===-- RISCVCallingConv.cpp - RISC-V Custom CC Routines ------------------===// 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 file contains the custom routines for the RISC-V Calling Convention. 11//===----------------------------------------------------------------------===// 20// Calling Convention Implementation. 21// The expectations for frontend ABI lowering vary from target to target. 22// Ideally, an LLVM frontend would be able to avoid worrying about many ABI 23// details, but this is a longer term goal. For now, we simply try to keep the 24// role of the frontend as simple and well-defined as possible. The rules can 26// * Never split up large scalar arguments. We handle them here. 27// * If a hardfloat calling convention is being used, and the struct may be 28// passed in a pair of registers (fp+fp, int+fp), and both registers are 29// available, then pass as two separate arguments. If either the GPRs or FPRs 30// are exhausted, then pass according to the rule below. 31// * If a struct could never be passed in registers or directly in a stack 32// slot (as it is larger than 2*XLEN and the floating point rules don't 33// apply), then pass it using a pointer with the byval attribute. 34// * If a struct is less than 2*XLEN, then coerce to either a two-element 35// word-sized array or a 2*XLEN scalar (depending on alignment). 36// * The frontend can determine whether a struct is returned by reference or 37// not based on its size and fields. If it will be returned by reference, the 38// frontend must modify the prototype so a pointer with the sret annotation is 39// passed as the first argument. This is not necessary for large scalar 41// * Struct return values and varargs should be coerced to structs containing 42// register-size fields in the same situations they would be for fixed 46 RISCV::F13_H, RISCV::F14_H, RISCV::F15_H,
47 RISCV::F16_H, RISCV::F17_H};
49 RISCV::F13_F, RISCV::F14_F, RISCV::F15_F,
50 RISCV::F16_F, RISCV::F17_F};
52 RISCV::F13_D, RISCV::F14_D, RISCV::F15_D,
53 RISCV::F16_D, RISCV::F17_D};
54// This is an interim calling convention and it may be changed in the future. 56 RISCV::V8, RISCV::V9, RISCV::V10, RISCV::V11, RISCV::V12, RISCV::V13,
57 RISCV::V14, RISCV::V15, RISCV::V16, RISCV::V17, RISCV::V18, RISCV::V19,
58 RISCV::V20, RISCV::V21, RISCV::V22, RISCV::V23};
60 RISCV::V14M2, RISCV::V16M2, RISCV::V18M2,
61 RISCV::V20M2, RISCV::V22M2};
66 RISCV::V8_V9, RISCV::V9_V10, RISCV::V10_V11, RISCV::V11_V12,
67 RISCV::V12_V13, RISCV::V13_V14, RISCV::V14_V15, RISCV::V15_V16,
68 RISCV::V16_V17, RISCV::V17_V18, RISCV::V18_V19, RISCV::V19_V20,
69 RISCV::V20_V21, RISCV::V21_V22, RISCV::V22_V23};
71 RISCV::V8_V9_V10, RISCV::V9_V10_V11, RISCV::V10_V11_V12,
72 RISCV::V11_V12_V13, RISCV::V12_V13_V14, RISCV::V13_V14_V15,
73 RISCV::V14_V15_V16, RISCV::V15_V16_V17, RISCV::V16_V17_V18,
74 RISCV::V17_V18_V19, RISCV::V18_V19_V20, RISCV::V19_V20_V21,
75 RISCV::V20_V21_V22, RISCV::V21_V22_V23};
77 RISCV::V8_V9_V10_V11, RISCV::V9_V10_V11_V12, RISCV::V10_V11_V12_V13,
78 RISCV::V11_V12_V13_V14, RISCV::V12_V13_V14_V15, RISCV::V13_V14_V15_V16,
79 RISCV::V14_V15_V16_V17, RISCV::V15_V16_V17_V18, RISCV::V16_V17_V18_V19,
80 RISCV::V17_V18_V19_V20, RISCV::V18_V19_V20_V21, RISCV::V19_V20_V21_V22,
81 RISCV::V20_V21_V22_V23};
83 RISCV::V8_V9_V10_V11_V12, RISCV::V9_V10_V11_V12_V13,
84 RISCV::V10_V11_V12_V13_V14, RISCV::V11_V12_V13_V14_V15,
85 RISCV::V12_V13_V14_V15_V16, RISCV::V13_V14_V15_V16_V17,
86 RISCV::V14_V15_V16_V17_V18, RISCV::V15_V16_V17_V18_V19,
87 RISCV::V16_V17_V18_V19_V20, RISCV::V17_V18_V19_V20_V21,
88 RISCV::V18_V19_V20_V21_V22, RISCV::V19_V20_V21_V22_V23};
90 RISCV::V8_V9_V10_V11_V12_V13, RISCV::V9_V10_V11_V12_V13_V14,
91 RISCV::V10_V11_V12_V13_V14_V15, RISCV::V11_V12_V13_V14_V15_V16,
92 RISCV::V12_V13_V14_V15_V16_V17, RISCV::V13_V14_V15_V16_V17_V18,
93 RISCV::V14_V15_V16_V17_V18_V19, RISCV::V15_V16_V17_V18_V19_V20,
94 RISCV::V16_V17_V18_V19_V20_V21, RISCV::V17_V18_V19_V20_V21_V22,
95 RISCV::V18_V19_V20_V21_V22_V23};
97 RISCV::V8_V9_V10_V11_V12_V13_V14, RISCV::V9_V10_V11_V12_V13_V14_V15,
98 RISCV::V10_V11_V12_V13_V14_V15_V16, RISCV::V11_V12_V13_V14_V15_V16_V17,
99 RISCV::V12_V13_V14_V15_V16_V17_V18, RISCV::V13_V14_V15_V16_V17_V18_V19,
100 RISCV::V14_V15_V16_V17_V18_V19_V20, RISCV::V15_V16_V17_V18_V19_V20_V21,
101 RISCV::V16_V17_V18_V19_V20_V21_V22, RISCV::V17_V18_V19_V20_V21_V22_V23};
103 RISCV::V9_V10_V11_V12_V13_V14_V15_V16,
104 RISCV::V10_V11_V12_V13_V14_V15_V16_V17,
105 RISCV::V11_V12_V13_V14_V15_V16_V17_V18,
106 RISCV::V12_V13_V14_V15_V16_V17_V18_V19,
107 RISCV::V13_V14_V15_V16_V17_V18_V19_V20,
108 RISCV::V14_V15_V16_V17_V18_V19_V20_V21,
109 RISCV::V15_V16_V17_V18_V19_V20_V21_V22,
110 RISCV::V16_V17_V18_V19_V20_V21_V22_V23};
112 RISCV::V12M2_V14M2, RISCV::V14M2_V16M2,
113 RISCV::V16M2_V18M2, RISCV::V18M2_V20M2,
116 RISCV::V8M2_V10M2_V12M2, RISCV::V10M2_V12M2_V14M2,
117 RISCV::V12M2_V14M2_V16M2, RISCV::V14M2_V16M2_V18M2,
118 RISCV::V16M2_V18M2_V20M2, RISCV::V18M2_V20M2_V22M2};
120 RISCV::V8M2_V10M2_V12M2_V14M2, RISCV::V10M2_V12M2_V14M2_V16M2,
121 RISCV::V12M2_V14M2_V16M2_V18M2, RISCV::V14M2_V16M2_V18M2_V20M2,
122 RISCV::V16M2_V18M2_V20M2_V22M2};
127// The GPRs used for passing arguments in the ILP32* and LP64* ABIs, except 129staticconstMCPhysReg ArgIGPRs[] = {RISCV::X10, RISCV::X11, RISCV::X12,
130 RISCV::X13, RISCV::X14, RISCV::X15,
131 RISCV::X16, RISCV::X17};
132// The GPRs used for passing arguments in the ILP32E/LP64E ABI. 133staticconstMCPhysReg ArgEGPRs[] = {RISCV::X10, RISCV::X11, RISCV::X12,
134 RISCV::X13, RISCV::X14, RISCV::X15};
143// The GPRs used for passing arguments in the ILP32* and LP64* ABIs, except 145staticconstMCPhysReg ArgIGPRs[] = {RISCV::X10_H, RISCV::X11_H, RISCV::X12_H,
146 RISCV::X13_H, RISCV::X14_H, RISCV::X15_H,
147 RISCV::X16_H, RISCV::X17_H};
148// The GPRs used for passing arguments in the ILP32E/LP64E ABI. 149staticconstMCPhysReg ArgEGPRs[] = {RISCV::X10_H, RISCV::X11_H,
150 RISCV::X12_H, RISCV::X13_H,
151 RISCV::X14_H, RISCV::X15_H};
160// The GPRs used for passing arguments in the ILP32* and LP64* ABIs, except 162staticconstMCPhysReg ArgIGPRs[] = {RISCV::X10_W, RISCV::X11_W, RISCV::X12_W,
163 RISCV::X13_W, RISCV::X14_W, RISCV::X15_W,
164 RISCV::X16_W, RISCV::X17_W};
165// The GPRs used for passing arguments in the ILP32E/LP64E ABI. 166staticconstMCPhysReg ArgEGPRs[] = {RISCV::X10_W, RISCV::X11_W,
167 RISCV::X12_W, RISCV::X13_W,
168 RISCV::X14_W, RISCV::X15_W};
177// The GPRs used for passing arguments in the FastCC, X5 and X6 might be used 178// for save-restore libcall, so we don't use them. 179// Don't use X7 for fastcc, since Zicfilp uses X7 as the label register. 181 RISCV::X10, RISCV::X11, RISCV::X12, RISCV::X13, RISCV::X14, RISCV::X15,
182 RISCV::X16, RISCV::X17, RISCV::X28, RISCV::X29, RISCV::X30, RISCV::X31};
184// The GPRs used for passing arguments in the FastCC when using ILP32E/LP64E. 185staticconstMCPhysReg FastCCEGPRs[] = {RISCV::X10, RISCV::X11, RISCV::X12,
186 RISCV::X13, RISCV::X14, RISCV::X15};
195// The GPRs used for passing arguments in the FastCC, X5 and X6 might be used 196// for save-restore libcall, so we don't use them. 197// Don't use X7 for fastcc, since Zicfilp uses X7 as the label register. 199 RISCV::X10_H, RISCV::X11_H, RISCV::X12_H, RISCV::X13_H,
200 RISCV::X14_H, RISCV::X15_H, RISCV::X16_H, RISCV::X17_H,
201 RISCV::X28_H, RISCV::X29_H, RISCV::X30_H, RISCV::X31_H};
203// The GPRs used for passing arguments in the FastCC when using ILP32E/LP64E. 204staticconstMCPhysReg FastCCEGPRs[] = {RISCV::X10_H, RISCV::X11_H,
205 RISCV::X12_H, RISCV::X13_H,
206 RISCV::X14_H, RISCV::X15_H};
215// The GPRs used for passing arguments in the FastCC, X5 and X6 might be used 216// for save-restore libcall, so we don't use them. 217// Don't use X7 for fastcc, since Zicfilp uses X7 as the label register. 219 RISCV::X10_W, RISCV::X11_W, RISCV::X12_W, RISCV::X13_W,
220 RISCV::X14_W, RISCV::X15_W, RISCV::X16_W, RISCV::X17_W,
221 RISCV::X28_W, RISCV::X29_W, RISCV::X30_W, RISCV::X31_W};
223// The GPRs used for passing arguments in the FastCC when using ILP32E/LP64E. 224staticconstMCPhysReg FastCCEGPRs[] = {RISCV::X10_W, RISCV::X11_W,
225 RISCV::X12_W, RISCV::X13_W,
226 RISCV::X14_W, RISCV::X15_W};
234// Pass a 2*XLEN argument that has been split into two XLEN values through 235// registers or the stack as necessary. 240unsigned XLenInBytes = XLen / 8;
246// At least one half can be passed via register. 250// Both halves must be passed on the stack, with proper alignment. 251// TODO: To be compatible with GCC's behaviors, we force them to have 4-byte 252// alignment. This behavior may be changed when RV32E/ILP32E is ratified. 253Align StackAlign(XLenInBytes);
254if (!
EABI || XLen != 32)
267// The second half can also be passed via register. 271// The second half is passed via the stack, without additional alignment. 283if (RC == &RISCV::VRRegClass) {
284// Assign the first mask argument to V0. 285// This is an interim calling convention and it may be changed in the 292if (RC == &RISCV::VRM2RegClass)
294if (RC == &RISCV::VRM4RegClass)
296if (RC == &RISCV::VRM8RegClass)
298if (RC == &RISCV::VRN2M1RegClass)
300if (RC == &RISCV::VRN3M1RegClass)
302if (RC == &RISCV::VRN4M1RegClass)
304if (RC == &RISCV::VRN5M1RegClass)
306if (RC == &RISCV::VRN6M1RegClass)
308if (RC == &RISCV::VRN7M1RegClass)
310if (RC == &RISCV::VRN8M1RegClass)
312if (RC == &RISCV::VRN2M2RegClass)
314if (RC == &RISCV::VRN3M2RegClass)
316if (RC == &RISCV::VRN4M2RegClass)
318if (RC == &RISCV::VRN2M4RegClass)
323// Implements the RISC-V calling convention. Returns true upon failure. 326CCState &State,
bool IsFixed,
bool IsRet,
Type *OrigTy) {
332unsigned XLen = Subtarget.
getXLen();
335// Static chain parameter must not be passed in normal argument registers, 336// so we assign t2 for it as done in GCC's __builtin_call_with_static_chain 344// Any return value split in to more than two values can't be returned 345// directly. Vectors are returned via the available vector registers. 346if (!LocVT.
isVector() && IsRet && ValNo > 1)
349// UseGPRForF16_F32 if targeting one of the soft-float ABIs, if passing a 350// variadic argument, or if no F16/F32 argument registers are available. 351bool UseGPRForF16_F32 =
true;
352// UseGPRForF64 if targeting soft-float ABIs or an FLEN=32 ABI, if passing a 353// variadic argument, or if no F64 argument registers are available. 354bool UseGPRForF64 =
true;
367 UseGPRForF16_F32 = !IsFixed;
371 UseGPRForF16_F32 = !IsFixed;
372 UseGPRForF64 = !IsFixed;
376if ((LocVT == MVT::f16 || LocVT == MVT::bf16) && !UseGPRForF16_F32) {
383if (LocVT == MVT::f32 && !UseGPRForF16_F32) {
390if (LocVT == MVT::f64 && !UseGPRForF64) {
397if ((ValVT == MVT::f16 && Subtarget.hasStdExtZhinxmin())) {
404if (ValVT == MVT::f32 && Subtarget.hasStdExtZfinx()) {
413// Zdinx use GPR without a bitcast when possible. 414if (LocVT == MVT::f64 && XLen == 64 && Subtarget.hasStdExtZdinx()) {
421// FP smaller than XLen, uses custom GPR. 422if (LocVT == MVT::f16 || LocVT == MVT::bf16 ||
423 (LocVT == MVT::f32 && XLen == 64)) {
432// Bitcast FP to GPR if we can use a GPR register. 433if ((XLen == 32 && LocVT == MVT::f32) || (XLen == 64 && LocVT == MVT::f64)) {
442// If this is a variadic argument, the RISC-V calling convention requires 443// that it is assigned an 'even' or 'aligned' register if it has 8-byte 444// alignment (RV32) or 16-byte alignment (RV64). An aligned register should 445// be used regardless of whether the original argument was split during 446// legalisation or not. The argument will not be passed by registers if the 447// original type is larger than 2*XLEN, so the register alignment rule does 449// TODO: To be compatible with GCC's behaviors, we don't align registers 450// currently if we are using ILP32E calling convention. This behavior may be 451// changed when RV32E/ILP32E is ratified. 452unsigned TwoXLenInBytes = (2 * XLen) / 8;
454DL.getTypeAllocSize(OrigTy) == TwoXLenInBytes &&
457// Skip 'odd' register if necessary. 458if (RegIdx != std::size(
ArgGPRs) && RegIdx % 2 == 1)
467"PendingLocs and PendingArgFlags out of sync");
469// Handle passing f64 on RV32D with a soft float ABI or when floating point 470// registers are exhausted. 471if (XLen == 32 && LocVT == MVT::f64) {
472assert(PendingLocs.
empty() &&
"Can't lower f64 if it is split");
473// Depending on available argument GPRS, f64 may be passed in a pair of 474// GPRs, split between a GPR and the stack, or passed completely on the 475// stack. LowerCall/LowerFormalArguments/LowerReturn must recognise these 498// Split arguments might be passed indirectly, so keep track of the pending 499// values. Split vectors are passed via a mix of registers and indirectly, so 500// treat them as we would any other argument. 512// If the split argument only had two elements, it should be passed directly 513// in registers or on the stack. 515 PendingLocs.
size() <= 2) {
516assert(PendingLocs.
size() == 2 &&
"Unexpected PendingLocs.size()");
517// Apply the normal calling convention rules to the first half of the 522 PendingArgFlags.
clear();
524 XLen, State, VA, AF, ValNo, ValVT, LocVT, ArgFlags,
528// Allocate to a register if possible, or else a stack slot. 530unsigned StoreSizeBytes = XLen / 8;
536// Fixed-length vectors are located in the corresponding scalable-vector 539 LocVT = TLI.getContainerForFixedLengthVector(LocVT);
545// For return values, the vector must be passed fully via registers or 547// FIXME: The proposed vector ABI only mandates v8-v15 for return values, 548// but we're using all of them. 551// Try using a GPR to pass the address 560// Align vectors to their element sizes, being careful for vXi1 572// If we reach this point and PendingLocs is non-empty, we must be at the 573// end of a split argument that must be passed indirectly. 574if (!PendingLocs.
empty()) {
576assert(PendingLocs.
size() > 2 &&
"Unexpected PendingLocs.size()");
578for (
auto &It : PendingLocs) {
580 It.convertToReg(Reg);
586 PendingArgFlags.
clear();
591 (TLI.getSubtarget().hasVInstructions() &&
593"Expected an XLenVT or vector types at this stage");
604// FastCC has less than 1% performance improvement for some particular 605// benchmark. But theoretically, it may have benefit for some cases. 609bool IsFixed,
bool IsRet,
Type *OrigTy) {
615if ((LocVT == MVT::f16 && Subtarget.hasStdExtZfhmin()) ||
616 (LocVT == MVT::bf16 && Subtarget.hasStdExtZfbfmin())) {
618 RISCV::F10_H, RISCV::F11_H, RISCV::F12_H, RISCV::F13_H, RISCV::F14_H,
619 RISCV::F15_H, RISCV::F16_H, RISCV::F17_H, RISCV::F0_H, RISCV::F1_H,
620 RISCV::F2_H, RISCV::F3_H, RISCV::F4_H, RISCV::F5_H, RISCV::F6_H,
621 RISCV::F7_H, RISCV::F28_H, RISCV::F29_H, RISCV::F30_H, RISCV::F31_H};
628if (LocVT == MVT::f32 && Subtarget.hasStdExtF()) {
630 RISCV::F10_F, RISCV::F11_F, RISCV::F12_F, RISCV::F13_F, RISCV::F14_F,
631 RISCV::F15_F, RISCV::F16_F, RISCV::F17_F, RISCV::F0_F, RISCV::F1_F,
632 RISCV::F2_F, RISCV::F3_F, RISCV::F4_F, RISCV::F5_F, RISCV::F6_F,
633 RISCV::F7_F, RISCV::F28_F, RISCV::F29_F, RISCV::F30_F, RISCV::F31_F};
640if (LocVT == MVT::f64 && Subtarget.hasStdExtD()) {
642 RISCV::F10_D, RISCV::F11_D, RISCV::F12_D, RISCV::F13_D, RISCV::F14_D,
643 RISCV::F15_D, RISCV::F16_D, RISCV::F17_D, RISCV::F0_D, RISCV::F1_D,
644 RISCV::F2_D, RISCV::F3_D, RISCV::F4_D, RISCV::F5_D, RISCV::F6_D,
645 RISCV::F7_D, RISCV::F28_D, RISCV::F29_D, RISCV::F30_D, RISCV::F31_D};
654// Check if there is an available GPRF16 before hitting the stack. 655if ((LocVT == MVT::f16 && Subtarget.hasStdExtZhinxmin())) {
662// Check if there is an available GPRF32 before hitting the stack. 663if (LocVT == MVT::f32 && Subtarget.hasStdExtZfinx()) {
670// Check if there is an available GPR before hitting the stack. 671if (LocVT == MVT::f64 && Subtarget.
is64Bit() && Subtarget.hasStdExtZdinx()) {
688// Fixed-length vectors are located in the corresponding scalable-vector 691 LocVT = TLI.getContainerForFixedLengthVector(LocVT);
700// Pass scalable vectors indirectly. Pass fixed vectors indirectly if we 709if (LocVT == XLenVT) {
716if (LocVT == XLenVT || LocVT == MVT::f16 || LocVT == MVT::bf16 ||
724returntrue;
// CC didn't match. 732"Attribute 'nest' is not supported in GHC calling convention");
736 RISCV::X9, RISCV::X18, RISCV::X19, RISCV::X20, RISCV::X21, RISCV::X22,
737 RISCV::X23, RISCV::X24, RISCV::X25, RISCV::X26, RISCV::X27};
739if (LocVT == MVT::i32 || LocVT == MVT::i64) {
740// Pass in STG registers: Base, Sp, Hp, R1, R2, R3, R4, R5, R6, R7, SpLim 741// s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 751if (LocVT == MVT::f32 && Subtarget.hasStdExtF()) {
752// Pass in STG registers: F1, ..., F6 754staticconstMCPhysReg FPR32List[] = {RISCV::F8_F, RISCV::F9_F,
755 RISCV::F18_F, RISCV::F19_F,
756 RISCV::F20_F, RISCV::F21_F};
763if (LocVT == MVT::f64 && Subtarget.hasStdExtD()) {
764// Pass in STG registers: D1, ..., D6 766staticconstMCPhysReg FPR64List[] = {RISCV::F22_D, RISCV::F23_D,
767 RISCV::F24_D, RISCV::F25_D,
768 RISCV::F26_D, RISCV::F27_D};
775if (LocVT == MVT::f32 && Subtarget.hasStdExtZfinx()) {
777 RISCV::X9_W, RISCV::X18_W, RISCV::X19_W, RISCV::X20_W,
778 RISCV::X21_W, RISCV::X22_W, RISCV::X23_W, RISCV::X24_W,
779 RISCV::X25_W, RISCV::X26_W, RISCV::X27_W};
786if (LocVT == MVT::f64 && Subtarget.hasStdExtZdinx() && Subtarget.
is64Bit()) {
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
const MCPhysReg ArgGPRs[]
static const MCPhysReg ArgFPR32s[]
static const MCPhysReg ArgVRs[]
static bool CC_RISCVAssign2XLen(unsigned XLen, CCState &State, CCValAssign VA1, ISD::ArgFlagsTy ArgFlags1, unsigned ValNo2, MVT ValVT2, MVT LocVT2, ISD::ArgFlagsTy ArgFlags2, bool EABI)
static const MCPhysReg ArgVRN2M2s[]
static const MCPhysReg ArgVRM2s[]
static MCRegister allocateRVVReg(MVT ValVT, unsigned ValNo, CCState &State, const RISCVTargetLowering &TLI)
static const MCPhysReg ArgVRN3M2s[]
static const MCPhysReg ArgVRN4M1s[]
static const MCPhysReg ArgVRN6M1s[]
static ArrayRef< MCPhysReg > getFastCCArgGPRF32s(const RISCVABI::ABI ABI)
static const MCPhysReg ArgVRN4M2s[]
static const MCPhysReg ArgFPR64s[]
static const MCPhysReg ArgVRN3M1s[]
static const MCPhysReg ArgVRN7M1s[]
static const MCPhysReg ArgVRN5M1s[]
static const MCPhysReg ArgVRN2M4s[]
static ArrayRef< MCPhysReg > getFastCCArgGPRF16s(const RISCVABI::ABI ABI)
static ArrayRef< MCPhysReg > getArgGPR32s(const RISCVABI::ABI ABI)
static const MCPhysReg ArgVRN2M1s[]
static const MCPhysReg ArgVRN8M1s[]
static ArrayRef< MCPhysReg > getArgGPR16s(const RISCVABI::ABI ABI)
static ArrayRef< MCPhysReg > getFastCCArgGPRs(const RISCVABI::ABI ABI)
static const MCPhysReg ArgVRM8s[]
static const MCPhysReg ArgVRM4s[]
static const MCPhysReg ArgFPR16s[]
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
CCState - This class holds information needed while lowering arguments and return values.
MachineFunction & getMachineFunction() const
unsigned getFirstUnallocated(ArrayRef< MCPhysReg > Regs) const
getFirstUnallocated - Return the index of the first unallocated register in the set,...
SmallVectorImpl< ISD::ArgFlagsTy > & getPendingArgFlags()
MCRegister AllocateReg(MCPhysReg Reg)
AllocateReg - Attempt to allocate one register.
int64_t AllocateStack(unsigned Size, Align Alignment)
AllocateStack - Allocate a chunk of stack space with the specified size and alignment.
SmallVectorImpl< CCValAssign > & getPendingLocs()
void addLoc(const CCValAssign &V)
CCValAssign - Represent assignment of one arg/retval to a location.
static CCValAssign getPending(unsigned ValNo, MVT ValVT, MVT LocVT, LocInfo HTP, unsigned ExtraInfo=0)
static CCValAssign getReg(unsigned ValNo, MVT ValVT, MCRegister Reg, MVT LocVT, LocInfo HTP, bool IsCustom=false)
static CCValAssign getCustomReg(unsigned ValNo, MVT ValVT, MCRegister Reg, MVT LocVT, LocInfo HTP)
static CCValAssign getMem(unsigned ValNo, MVT ValVT, int64_t Offset, MVT LocVT, LocInfo HTP, bool IsCustom=false)
unsigned getValNo() const
static CCValAssign getCustomMem(unsigned ValNo, MVT ValVT, int64_t Offset, MVT LocVT, LocInfo HTP)
A parsed version of the target data layout string in and methods for querying it.
Wrapper class representing physical registers. Should be passed by value.
bool isRISCVVectorTuple() const
Return true if this is a RISCV vector tuple type where the runtime length is machine dependent.
uint64_t getScalarSizeInBits() const
bool isVector() const
Return true if this is a vector value type.
bool isScalableVector() const
Return true if this is a vector value type where the runtime length is machine dependent.
TypeSize getSizeInBits() const
Returns the size of the specified MVT in bits.
bool isFixedLengthVector() const
TypeSize getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
bool isScalarInteger() const
Return true if this is an integer, not including vectors.
MVT getVectorElementType() const
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
RISCVABI::ABI getTargetABI() const
const RISCVTargetLowering * getTargetLowering() const override
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
StackOffset holds a fixed and a scalable offset in bytes.
virtual const TargetRegisterClass * getRegClassFor(MVT VT, bool isDivergent=false) const
Return the register class that should be used for the specified value type.
The instances of the Type class are immutable: once they are created, they are never changed.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
ArrayRef< MCPhysReg > getArgGPRs(const RISCVABI::ABI ABI)
This is an optimization pass for GlobalISel generic memory operations.
bool CC_RISCV_GHC(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
bool CC_RISCV_FastCC(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State, bool IsFixed, bool IsRet, Type *OrigTy)
bool CC_RISCV(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State, bool IsFixed, bool IsRet, Type *OrigTy)
This struct is a compact representation of a valid (non-zero power of two) alignment.
Align getNonZeroOrigAlign() const
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Align valueOrOne() const
For convenience, returns a valid alignment or 1 if undefined.