1//===-- SystemZCallingConv.h - Calling conventions for SystemZ --*- C++ -*-===//
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#ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZCALLINGCONV_H
10#define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZCALLINGCONV_H
30}
// end namespace SystemZ
32// Handle i128 argument types. These need to be passed by implicit
33// reference. This could be as simple as the following .td line:
34// CCIfType<[i128], CCPassIndirect<i64>>,
35// except that i128 is not a legal type, and therefore gets split by
36// common code into a pair of i64 arguments.
44 // ArgFlags.isSplit() is true on the first part of a i128 argument;
45 // PendingMembers.empty() is false on all subsequent parts.
49 // Push a pending Indirect value location for each part.
57 // OK, we've collected all parts in the pending list. Allocate
58 // the location (register or stack slot) for the indirect pointer.
59 // (This duplicates the usual i64 calling convention rules.)
72 : State.AllocateStack(8,
Align(8));
74 // Use that same location for all the pending parts.
75 for (
auto &It : PendingMembers) {
83 PendingMembers.
clear();
88// A pointer in 64bit mode is always passed as 64bit.
92 if (LocVT != MVT::i64) {
102 if (LocVT == MVT::f32 || LocVT == MVT::f64) {
106 // Shadow next two GPRs, if available.
110 // Quad precision floating point needs to
111 // go inside pre-defined FPR pair.
112 if (LocVT == MVT::f128) {
126 // For any C or C++ program, this should always be
127 // false, since it is illegal to have a function
128 // where the first argument is variadic. Therefore
129 // the first fixed argument should already have
130 // allocated GPR1 either through shadowing it or
131 // using it for parameter passing.
132 State.AllocateReg(SystemZ::R1D);
134 bool AllocGPR2 = State.AllocateReg(SystemZ::R2D);
135 bool AllocGPR3 = State.AllocateReg(SystemZ::R3D);
137 // If GPR2 and GPR3 are available, then we may pass vararg in R2Q.
138 // If only GPR3 is available, we need to set custom handling to copy
139 // hi bits into GPR3.
140 // Either way, we allocate on the stack.
142 // For f128 and vector var arg case, set the bitcast flag to bitcast to
177}
// end namespace llvm
This file defines the SmallVector class.
CCState - This class holds information needed while lowering arguments and return values.
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 getCustomMem(unsigned ValNo, MVT ValVT, int64_t Offset, MVT LocVT, LocInfo HTP)
bool is128BitVector() const
Return true if this is a 128-bit vector type.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
bool isTargetXPLINK64() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
const MCPhysReg XPLINK64ArgFPRs[XPLINK64NumArgFPRs]
const MCPhysReg ELFArgFPRs[ELFNumArgFPRs]
const unsigned XPLINK64NumArgFPRs
const unsigned XPLINK64NumArgGPRs
const MCPhysReg ELFArgGPRs[ELFNumArgGPRs]
const unsigned ELFNumArgGPRs
const unsigned ELFNumArgFPRs
const MCPhysReg XPLINK64ArgGPRs[XPLINK64NumArgGPRs]
This is an optimization pass for GlobalISel generic memory operations.
bool CC_SystemZ_I128Indirect(unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
bool CC_XPLINK64_Pointer(unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
bool CC_XPLINK64_Allocate128BitVararg(unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
bool CC_SystemZ_GHC_Error(unsigned &, MVT &, MVT &, CCValAssign::LocInfo &, ISD::ArgFlagsTy &, CCState &)
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
bool RetCC_SystemZ_Error(unsigned &, MVT &, MVT &, CCValAssign::LocInfo &, ISD::ArgFlagsTy &, CCState &)
bool CC_SystemZ_Error(unsigned &, MVT &, MVT &, CCValAssign::LocInfo &, ISD::ArgFlagsTy &, CCState &)
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
bool CC_XPLINK64_Shadow_Reg(unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
This struct is a compact representation of a valid (non-zero power of two) alignment.