14#ifndef LLVM_CODEGEN_CALLINGCONVLOWER_H 
   15#define LLVM_CODEGEN_CALLINGCONVLOWER_H 
   63  std::variant<Register, int64_t, unsigned> 
Data;
 
   69  unsigned isCustom : 1;
 
   81      : ValNo(ValNo), isCustom(IsCustom), HTP(HTP), ValVT(ValVT), LocVT(LocVT) {
 
   86                            MVT LocVT, 
LocInfo HTP, 
bool IsCustom = 
false) {
 
   87    CCValAssign Ret(HTP, ValNo, ValVT, LocVT, IsCustom);
 
 
   94    return getReg(ValNo, ValVT, 
Reg, LocVT, HTP, 
true);
 
 
   98                            MVT LocVT, 
LocInfo HTP, 
bool IsCustom = 
false) {
 
   99    CCValAssign Ret(HTP, ValNo, ValVT, LocVT, IsCustom);
 
 
  110                                LocInfo HTP, 
unsigned ExtraInfo = 0) {
 
  111    CCValAssign Ret(HTP, ValNo, ValVT, LocVT, 
false);
 
  112    Ret.Data = ExtraInfo;
 
 
  123  bool isRegLoc()
 const { 
return std::holds_alternative<Register>(Data); }
 
  124  bool isMemLoc()
 const { 
return std::holds_alternative<int64_t>(Data); }
 
  125  bool isPendingLoc()
 const { 
return std::holds_alternative<unsigned>(Data); }
 
 
  175  bool AnalyzingMustTailForwardedRegs = 
false;
 
  181  bool NegativeOffsets;
 
  184  Align MaxStackArgAlign;
 
  217    ByValInfo(
unsigned B, 
unsigned E) : Begin(
B), End(
E) {}
 
  229  unsigned InRegsParamsProcessed;
 
  234                   bool NegativeOffsets = 
false);
 
  252    return alignTo(StackSize, MaxStackArgAlign);
 
 
  258    return UsedRegs[
Reg.id() / 32] & (1 << (
Reg.id() & 31));
 
 
  319    for (
unsigned i = 0; i < Regs.
size(); ++i)
 
 
  327    MarkUnallocated(
Reg);
 
 
  345    MarkAllocated(ShadowReg);
 
 
  354    if (FirstUnalloc == Regs.
size())
 
 
  367                                       unsigned RegsRequired) {
 
  368    if (RegsRequired > Regs.
size())
 
  371    for (
unsigned StartIdx = 0; StartIdx <= Regs.
size() - RegsRequired;
 
  373      bool BlockAvailable = 
true;
 
  375      for (
unsigned BlockIdx = 0; BlockIdx < RegsRequired; ++BlockIdx) {
 
  377          BlockAvailable = 
false;
 
  381      if (BlockAvailable) {
 
  383        for (
unsigned BlockIdx = 0; BlockIdx < RegsRequired; ++BlockIdx) {
 
  384          MarkAllocated(Regs[StartIdx + BlockIdx]);
 
  386        return Regs.
slice(StartIdx, RegsRequired);
 
 
  396    if (FirstUnalloc == Regs.
size())
 
  400    MCRegister Reg = Regs[FirstUnalloc], ShadowReg = ShadowRegs[FirstUnalloc];
 
  402    MarkAllocated(ShadowReg);
 
 
  410    if (NegativeOffsets) {
 
  417    MaxStackArgAlign = std::max(Alignment, MaxStackArgAlign);
 
 
  450                          unsigned& BeginReg, 
unsigned& EndReg)
 const {
 
  451    assert(InRegsParamRecordIndex < ByValRegs.size() &&
 
  452           "Wrong ByVal parameter index");
 
  454    const ByValInfo& 
info = ByValRegs[InRegsParamRecordIndex];
 
  455    BeginReg = 
info.Begin;
 
 
  461    ByValRegs.push_back(ByValInfo(RegBegin, RegEnd));
 
 
  468    unsigned e = ByValRegs.size();
 
  469    if (InRegsParamsProcessed < e)
 
  470      ++InRegsParamsProcessed;
 
  471    return InRegsParamsProcessed < e;
 
 
  476    InRegsParamsProcessed = 0;
 
 
  482    InRegsParamsProcessed = 0;
 
 
  492    return PendingArgFlags;
 
 
  522    unsigned NumFirstPassLocs = Locs.size();
 
  528    for (
auto Arg : Args) {
 
  529      Arg.Flags.setSecArgPass();
 
  538    TmpArgLocs.
swap(Locs);
 
  539    auto B = TmpArgLocs.
begin(), 
E = TmpArgLocs.
end();
 
  540    std::merge(
B, 
B + NumFirstPassLocs, 
B + NumFirstPassLocs, 
E,
 
  541               std::back_inserter(Locs),
 
  543                 return A.getValNo() < 
B.getValNo();
 
 
 
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
 
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
 
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
 
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
 
Promote Memory to Register
 
This file defines the SmallVector class.
 
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
 
size_t size() const
size - Get the array size.
 
ArrayRef< T > slice(size_t N, size_t M) const
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array.
 
CCState - This class holds information needed while lowering arguments and return values.
 
void getInRegsParamInfo(unsigned InRegsParamRecordIndex, unsigned &BeginReg, unsigned &EndReg) const
 
LLVM_ABI void HandleByVal(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, int MinSize, Align MinAlign, ISD::ArgFlagsTy ArgFlags)
Allocate space on the stack large enough to pass an argument by value.
 
MachineFunction & getMachineFunction() const
 
unsigned getFirstUnallocated(ArrayRef< MCPhysReg > Regs) const
getFirstUnallocated - Return the index of the first unallocated register in the set,...
 
void AnalyzeArguments(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
The function will invoke AnalyzeFormalArguments.
 
LLVM_ABI 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.
 
int64_t AllocateStack(unsigned Size, Align Alignment, ArrayRef< MCPhysReg > ShadowRegs)
Version of AllocateStack with list of extra registers to be shadowed.
 
void AnalyzeArgumentsSecondPass(const SmallVectorImpl< T > &Args, CCAssignFn Fn)
The function runs an additional analysis pass over function arguments.
 
static LLVM_ABI 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.
 
MCRegister AllocateReg(ArrayRef< MCPhysReg > Regs)
AllocateReg - Attempt to allocate one of the specified registers.
 
LLVM_ABI void AnalyzeCallResult(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
AnalyzeCallResult - Analyze the return values of a call, incorporating info about the passed values i...
 
LLVM_ABI void getRemainingRegParmsForType(SmallVectorImpl< MCRegister > &Regs, MVT VT, CCAssignFn Fn)
Compute the remaining unused register parameters that would be used for the given value type.
 
LLVM_ABI bool IsShadowAllocatedReg(MCRegister Reg) const
A shadow allocated register is a register that was allocated but wasn't added to the location list (L...
 
void AnalyzeArguments(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
The function will invoke AnalyzeCallOperands.
 
CallingConv::ID getCallingConv() const
 
SmallVectorImpl< ISD::ArgFlagsTy > & getPendingArgFlags()
 
MCRegister AllocateReg(MCPhysReg Reg)
AllocateReg - Attempt to allocate one register.
 
LLVM_ABI 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 ...
 
LLVM_ABI void AnalyzeReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeReturn - Analyze the returned values of a return, incorporating info about the result values i...
 
LLVMContext & getContext() const
 
ArrayRef< MCPhysReg > AllocateRegBlock(ArrayRef< MCPhysReg > Regs, unsigned RegsRequired)
Attempt to allocate a block of RegsRequired consecutive registers.
 
int64_t AllocateStack(unsigned Size, Align Alignment)
AllocateStack - Allocate a chunk of stack space with the specified size and alignment.
 
void rewindByValRegsInfo()
 
LLVM_ABI void AnalyzeCallOperands(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeCallOperands - Analyze the outgoing arguments to a call, incorporating info about the passed v...
 
unsigned getInRegsParamsProcessed() const
 
LLVM_ABI void ensureMaxAlignment(Align Alignment)
 
void DeallocateReg(MCPhysReg Reg)
 
LLVM_ABI CCState(CallingConv::ID CC, bool IsVarArg, MachineFunction &MF, SmallVectorImpl< CCValAssign > &Locs, LLVMContext &Context, bool NegativeOffsets=false)
 
uint64_t getStackSize() const
Returns the size of the currently allocated portion of the stack.
 
MCRegister AllocateReg(ArrayRef< MCPhysReg > Regs, const MCPhysReg *ShadowRegs)
Version of AllocateReg with list of registers to be shadowed.
 
SmallVectorImpl< CCValAssign > & getPendingLocs()
 
uint64_t getAlignedCallFrameSize() const
getAlignedCallFrameSize - Return the size of the call frame needed to be able to store all arguments ...
 
bool isAllocated(MCRegister Reg) const
isAllocated - Return true if the specified register (or an alias) is allocated.
 
void addInRegsParamInfo(unsigned RegBegin, unsigned RegEnd)
 
MCRegister AllocateReg(MCPhysReg Reg, MCPhysReg ShadowReg)
Version of AllocateReg with extra register to be shadowed.
 
LLVM_ABI void AnalyzeFormalArguments(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
AnalyzeFormalArguments - Analyze an array of argument values, incorporating info about the formals in...
 
void addLoc(const CCValAssign &V)
 
unsigned getInRegsParamsCount() const
 
void clearByValRegsInfo()
 
CCValAssign - Represent assignment of one arg/retval to a location.
 
void convertToReg(MCRegister Reg)
 
static CCValAssign getPending(unsigned ValNo, MVT ValVT, MVT LocVT, LocInfo HTP, unsigned ExtraInfo=0)
 
Register getLocReg() const
 
bool isPendingLoc() const
 
LocInfo getLocInfo() const
 
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)
 
bool isUpperBitsInLoc() const
 
static CCValAssign getMem(unsigned ValNo, MVT ValVT, int64_t Offset, MVT LocVT, LocInfo HTP, bool IsCustom=false)
 
unsigned getExtraInfo() const
 
int64_t getLocMemOffset() const
 
unsigned getValNo() const
 
static CCValAssign getCustomMem(unsigned ValNo, MVT ValVT, int64_t Offset, MVT LocVT, LocInfo HTP)
 
void convertToMem(int64_t Offset)
 
This is an important class for using LLVM in a threaded context.
 
Wrapper class representing physical registers. Should be passed by value.
 
Wrapper class representing virtual and physical registers.
 
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
 
void swap(SmallVectorImpl &RHS)
 
void push_back(const T &Elt)
 
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
 
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
 
The instances of the Type class are immutable: once they are created, they are never changed.
 
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
 
@ C
The default llvm calling convention, compatible with C.
 
This is an optimization pass for GlobalISel generic memory operations.
 
bool CCAssignFn(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
CCAssignFn - This function assigns a location for Val, updating State to reflect the change.
 
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 ...
 
constexpr T MinAlign(U A, V B)
A and B are either alignments or offsets.
 
FunctionAddr VTableAddr uintptr_t uintptr_t Data
 
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
 
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
 
This struct is a compact representation of a valid (non-zero power of two) alignment.
 
ForwardedRegister(Register VReg, MCPhysReg PReg, MVT VT)