15 #ifndef LLVM_CODEGEN_CALLINGCONVLOWER_H
16 #define LLVM_CODEGEN_CALLINGCONVLOWER_H
29 class TargetRegisterInfo;
65 unsigned isCustom : 1;
78 unsigned RegNo,
MVT LocVT,
92 unsigned RegNo,
MVT LocVT,
95 Ret =
getReg(ValNo, ValVT, RegNo, LocVT, HTP);
101 unsigned Offset,
MVT LocVT,
107 Ret.isCustom =
false;
115 unsigned Offset,
MVT LocVT,
118 Ret =
getMem(ValNo, ValVT, Offset, LocVT, HTP);
126 LocInfo HTP,
unsigned ExtraInfo = 0) {
127 return getReg(ValNo, ValVT, ExtraInfo, LocVT, HTP);
167 : VReg(VReg), PReg(PReg), VT(VT) {}
203 unsigned StackOffset;
237 ByValInfo(
unsigned B,
unsigned E,
bool IsWaste =
false) :
238 Begin(B), End(E), Waste(IsWaste) {}
255 unsigned InRegsParamsProcessed;
278 return UsedRegs[Reg/32] & (1 << (Reg&31));
320 for (
unsigned i = 0; i < Regs.
size(); ++i)
339 MarkAllocated(ShadowReg);
348 if (FirstUnalloc == Regs.
size())
352 unsigned Reg = Regs[FirstUnalloc];
361 if (RegsRequired > Regs.
size())
364 for (
unsigned StartIdx = 0; StartIdx <= Regs.
size() - RegsRequired;
366 bool BlockAvailable =
true;
368 for (
unsigned BlockIdx = 0; BlockIdx < RegsRequired; ++BlockIdx) {
370 BlockAvailable =
false;
374 if (BlockAvailable) {
376 for (
unsigned BlockIdx = 0; BlockIdx < RegsRequired; ++BlockIdx) {
377 MarkAllocated(Regs[StartIdx + BlockIdx]);
379 return Regs[StartIdx];
389 if (FirstUnalloc == Regs.
size())
393 unsigned Reg = Regs[FirstUnalloc], ShadowReg = ShadowRegs[FirstUnalloc];
395 MarkAllocated(ShadowReg);
402 assert(Align && ((Align - 1) & Align) == 0);
403 StackOffset = ((StackOffset + Align - 1) & ~(Align - 1));
404 unsigned Result = StackOffset;
412 MarkAllocated(ShadowReg);
420 for (
unsigned i = 0; i < ShadowRegs.
size(); ++i)
421 MarkAllocated(ShadowRegs[i]);
442 unsigned& BeginReg,
unsigned& EndReg)
const {
443 assert(InRegsParamRecordIndex < ByValRegs.
size() &&
444 "Wrong ByVal parameter index");
446 const ByValInfo&
info = ByValRegs[InRegsParamRecordIndex];
447 BeginReg = info.Begin;
453 ByValRegs.
push_back(ByValInfo(RegBegin, RegEnd));
460 unsigned e = ByValRegs.
size();
461 if (InRegsParamsProcessed < e)
462 ++InRegsParamsProcessed;
463 return InRegsParamsProcessed < e;
468 InRegsParamsProcessed = 0;
474 InRegsParamsProcessed = 0;
499 void MarkAllocated(
unsigned Reg);
void AnalyzeCallResult(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
AnalyzeCallResult - Analyze the return values of a call, incorporating info about the passed values i...
void push_back(const T &Elt)
static CCValAssign getPending(unsigned ValNo, MVT ValVT, MVT LocVT, LocInfo HTP, unsigned ExtraInfo=0)
static CCValAssign getCustomReg(unsigned ValNo, MVT ValVT, unsigned RegNo, MVT LocVT, LocInfo HTP)
LocInfo getLocInfo() const
Describes a register that needs to be forwarded from the prologue to a musttail call.
void getInRegsParamInfo(unsigned InRegsParamRecordIndex, unsigned &BeginReg, unsigned &EndReg) const
void AnalyzeFormalArguments(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
AnalyzeFormalArguments - Analyze an array of argument values, incorporating info about the formals in...
CallingConv::ID getCallingConv() 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...
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
unsigned getInRegsParamsCount() const
bool CheckReturn(const SmallVectorImpl< ISD::OutputArg > &ArgsFlags, CCAssignFn Fn)
CheckReturn - Analyze the return values of a function, returning true if the return can be performed ...
unsigned getValNo() const
LLVMContext & getContext() const
void convertToMem(unsigned Offset)
unsigned AllocateReg(unsigned Reg, unsigned ShadowReg)
Version of AllocateReg with extra register to be shadowed.
bool CCCustomFn(unsigned &ValNo, MVT &ValVT, MVT &LocVT, CCValAssign::LocInfo &LocInfo, ISD::ArgFlagsTy &ArgFlags, CCState &State)
CCCustomFn - This function assigns a location for Val, possibly updating all args to reflect changes ...
ParmContext getCallOrPrologue() const
unsigned AllocateReg(ArrayRef< MCPhysReg > Regs)
AllocateReg - Attempt to allocate one of the specified registers.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void addLoc(const CCValAssign &V)
Reg
All possible values of the reg field in the ModR/M byte.
bool isUpperBitsInLoc() const
SmallVectorImpl< llvm::CCValAssign > & getPendingLocs()
MachineFunction & getMachineFunction() const
unsigned getLocReg() const
void addInRegsParamInfo(unsigned RegBegin, unsigned RegEnd)
size_t size() const
size - Get the array size.
unsigned AllocateRegBlock(ArrayRef< uint16_t > Regs, unsigned RegsRequired)
AllocateRegBlock - Attempt to allocate a block of RegsRequired consecutive registers.
static CCValAssign getReg(unsigned ValNo, MVT ValVT, unsigned RegNo, MVT LocVT, LocInfo HTP)
unsigned AllocateReg(ArrayRef< MCPhysReg > Regs, const MCPhysReg *ShadowRegs)
Version of AllocateReg with list of registers to be shadowed.
unsigned getFirstUnallocated(ArrayRef< MCPhysReg > Regs) const
getFirstUnallocated - Return the index of the first unallocated register in the set, or Regs.size() if they are all allocated.
ForwardedRegister(unsigned VReg, MCPhysReg PReg, MVT VT)
MVT - Machine Value Type.
ParmContext
ParmContext - This enum tracks whether calling convention lowering is in the context of prologue or c...
This is an important class for using LLVM in a threaded context.
unsigned getInRegsParamsProcessed() const
unsigned getNextStackOffset() const
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
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.
void getRemainingRegParmsForType(SmallVectorImpl< MCPhysReg > &Regs, MVT VT, CCAssignFn Fn)
Compute the remaining unused register parameters that would be used for the given value type...
unsigned getExtraInfo() const
CCState - This class holds information needed while lowering arguments and return values...
CCValAssign - Represent assignment of one arg/retval to a location.
MachineFrameInfo * getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
CCState(CallingConv::ID CC, bool isVarArg, MachineFunction &MF, SmallVectorImpl< CCValAssign > &locs, LLVMContext &C)
static cl::opt< AlignMode > Align(cl::desc("Load/store alignment support"), cl::Hidden, cl::init(NoStrictAlign), cl::values(clEnumValN(StrictAlign,"aarch64-strict-align","Disallow all unaligned memory accesses"), clEnumValN(NoStrictAlign,"aarch64-no-strict-align","Allow unaligned memory accesses"), clEnumValEnd))
unsigned AllocateStack(unsigned Size, unsigned Align, unsigned ShadowReg)
Version of AllocateStack with extra register to be shadowed.
void AnalyzeCallOperands(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeCallOperands - Analyze the outgoing arguments to a call, incorporating info about the passed v...
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...
uint64_t MinAlign(uint64_t A, uint64_t B)
MinAlign - A and B are either alignments or offsets.
void ensureMaxAlignment(unsigned Align)
Make sure the function is at least Align bytes aligned.
unsigned AllocateStack(unsigned Size, unsigned Align, ArrayRef< MCPhysReg > ShadowRegs)
Version of AllocateStack with list of extra registers to be shadowed.
static CCValAssign getCustomMem(unsigned ValNo, MVT ValVT, unsigned Offset, MVT LocVT, LocInfo HTP)
void AnalyzeReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeReturn - Analyze the returned values of a return, incorporating info about the result values i...
bool isAllocated(unsigned Reg) const
isAllocated - Return true if the specified register (or an alias) is allocated.
ParmContext CallOrPrologue
static CCValAssign getMem(unsigned ValNo, MVT ValVT, unsigned Offset, MVT LocVT, LocInfo HTP)
void clearByValRegsInfo()
void rewindByValRegsInfo()
unsigned getLocMemOffset() const
unsigned AllocateReg(unsigned Reg)
AllocateReg - Attempt to allocate one register.
unsigned AllocateStack(unsigned Size, unsigned Align)
AllocateStack - Allocate a chunk of stack space with the specified size and alignment.
void convertToReg(unsigned RegNo)