33 TRI(*MF.getSubtarget().getRegisterInfo()), Locs(locs),
Context(C) {
51 if (MinSize > (
int)Size)
53 if (MinAlign > (
int)Align)
63 void CCState::MarkAllocated(
unsigned Reg) {
65 UsedRegs[*AI/32] |= 1 << (*AI&31);
72 for (
auto const &ValAssign : Locs) {
73 if (ValAssign.isRegLoc()) {
89 unsigned NumArgs = Ins.
size();
91 for (
unsigned i = 0; i != NumArgs; ++i) {
92 MVT ArgVT = Ins[i].VT;
96 dbgs() <<
"Formal argument #" << i <<
" has unhandled type " 109 for (
unsigned i = 0, e = Outs.
size(); i != e; ++i) {
123 for (
unsigned i = 0, e = Outs.
size(); i != e; ++i) {
128 dbgs() <<
"Return operand #" << i <<
" has unhandled type " 140 unsigned NumOps = Outs.
size();
141 for (
unsigned i = 0; i != NumOps; ++i) {
142 MVT ArgVT = Outs[i].VT;
146 dbgs() <<
"Call operand #" << i <<
" has unhandled type " 158 unsigned NumOps = ArgVTs.
size();
159 for (
unsigned i = 0; i != NumOps; ++i) {
160 MVT ArgVT = ArgVTs[i];
164 dbgs() <<
"Call operand #" << i <<
" has unhandled type " 176 for (
unsigned i = 0, e = Ins.
size(); i != e; ++i) {
181 dbgs() <<
"Call result #" << i <<
" has unhandled type " 193 dbgs() <<
"Call result has unhandled type " 212 unsigned SavedStackOffset = StackOffset;
213 unsigned SavedMaxStackArgAlign = MaxStackArgAlign;
214 unsigned NumLocs = Locs.size();
223 bool HaveRegParm =
true;
224 while (HaveRegParm) {
228 <<
" while computing remaining regparms\n";
232 HaveRegParm = Locs.back().isRegLoc();
236 assert(NumLocs < Locs.size() &&
"CC assignment failed to add location");
237 for (
unsigned I = NumLocs,
E = Locs.size();
I !=
E; ++
I)
238 if (Locs[
I].isRegLoc())
244 StackOffset = SavedStackOffset;
245 MaxStackArgAlign = SavedMaxStackArgAlign;
246 Locs.resize(NumLocs);
258 for (
MVT RegVT : RegParmTypes) {
275 if (CalleeCC == CallerCC)
278 CCState CCInfo1(CalleeCC,
false, MF, RVLocs1, C);
282 CCState CCInfo2(CallerCC,
false, MF, RVLocs2, C);
285 if (RVLocs1.
size() != RVLocs2.
size())
287 for (
unsigned I = 0,
E = RVLocs1.
size();
I !=
E; ++
I) {
void AnalyzeCallResult(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
AnalyzeCallResult - Analyze the return values of a call, incorporating info about the passed values i...
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
bool isInteger() const
Return true if this is an integer or a vector integer type.
This class represents lattice values for constants.
Describes a register that needs to be forwarded from the prologue to a musttail call.
bool isVector() const
Return true if this is a vector value type.
bool isAllocated(unsigned Reg) const
isAllocated - Return true if the specified register (or an alias) is allocated.
void push_back(const T &Elt)
unsigned addLiveIn(unsigned PReg, const TargetRegisterClass *RC)
addLiveIn - Add the specified physical register as a live-in value and create a corresponding virtual...
void AnalyzeFormalArguments(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
AnalyzeFormalArguments - Analyze an array of argument values, incorporating info about the formals in...
virtual const TargetLowering * getTargetLowering() const
bool CCAssignFn(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
CCAssignFn - This function assigns a location for Val, updating State to reflect the change...
virtual void HandleByVal(CCState *, unsigned &, unsigned) const
Target-specific cleanup for formal ByVal parameters.
virtual const TargetRegisterClass * getRegClassFor(MVT VT) const
Return the register class that should be used for the specified value type.
unsigned const TargetRegisterInfo * TRI
uint64_t alignTo(uint64_t Value, uint64_t Align, uint64_t Skew=0)
Returns the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Alig...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void addLoc(const CCValAssign &V)
static bool isValueTypeInRegForCC(CallingConv::ID CC, MVT VT)
LocInfo getLocInfo() const
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
unsigned getByValSize() const
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
constexpr uint64_t MinAlign(uint64_t A, uint64_t B)
A and B are either alignments or offsets.
unsigned getNumRegs() const
Return the number of registers this target has (useful for sizing arrays holding per register informa...
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
This is an important class for using LLVM in a threaded context.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
MSVC calling convention that passes vectors and vector aggregates in SSE registers.
MCRegAliasIterator enumerates all registers aliasing Reg.
std::string getEVTString() const
This function returns value type as a string, e.g. "i32".
static bool resultsCompatible(CallingConv::ID CalleeCC, CallingConv::ID CallerCC, MachineFunction &MF, LLVMContext &C, const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn CalleeFn, CCAssignFn CallerFn)
Returns true if the results of the two calling conventions are compatible.
void HandleByVal(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, int MinSize, int MinAlign, ISD::ArgFlagsTy ArgFlags)
Allocate space on the stack large enough to pass an argument by value.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void getRemainingRegParmsForType(SmallVectorImpl< MCPhysReg > &Regs, MVT VT, CCAssignFn Fn)
Compute the remaining unused register parameters that would be used for the given value type...
CCState - This class holds information needed while lowering arguments and return values...
CCValAssign - Represent assignment of one arg/retval to a location.
CCState(CallingConv::ID CC, bool isVarArg, MachineFunction &MF, SmallVectorImpl< CCValAssign > &locs, LLVMContext &C)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
unsigned getByValAlign() const
X86_FastCall - 'fast' analog of X86_StdCall.
void AnalyzeCallOperands(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeCallOperands - Analyze the outgoing arguments to a call, incorporating info about the passed v...
A utility class that uses RAII to save and restore the value of a variable.
void analyzeMustTailForwardedRegisters(SmallVectorImpl< ForwardedRegister > &Forwards, ArrayRef< MVT > RegParmTypes, CCAssignFn Fn)
Compute the set of registers that need to be preserved and forwarded to any musttail calls...
bool CheckReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
CheckReturn - Analyze the return values of a function, returning true if the return can be performed ...
unsigned getLocMemOffset() const
void AnalyzeReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeReturn - Analyze the returned values of a return, incorporating info about the result values i...
static CCValAssign getMem(unsigned ValNo, MVT ValVT, unsigned Offset, MVT LocVT, LocInfo HTP)
void clearByValRegsInfo()
bool IsShadowAllocatedReg(unsigned Reg) const
A shadow allocated register is a register that was allocated but wasn't added to the location list (L...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file provides utility classes that use RAII to save and restore values.
unsigned getLocReg() const
unsigned AllocateStack(unsigned Size, unsigned Align)
AllocateStack - Allocate a chunk of stack space with the specified size and alignment.
This file describes how to lower LLVM code to machine code.
void ensureMaxAlignment(unsigned Align)