class CCState

Declaration

class CCState { /* full declaration omitted */ };

Description

CCState - This class holds information needed while lowering arguments and return values. It captures which registers are already assigned and which stack slots are used. It provides accessors to allocate these values.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:189

Member Variables

private CallingConv::ID CallingConv
private bool IsVarArg
private bool AnalyzingMustTailForwardedRegs = false
private llvm::MachineFunction& MF
private const llvm::TargetRegisterInfo& TRI
private SmallVectorImpl<llvm::CCValAssign>& Locs
private llvm::LLVMContext& Context
private unsigned int StackOffset
private llvm::Align MaxStackArgAlign
private SmallVector<uint32_t, 16> UsedRegs
private SmallVector<llvm::CCValAssign, 4> PendingLocs
private SmallVector<ISD::ArgFlagsTy, 4> PendingArgFlags
private SmallVector<llvm::CCState::ByValInfo, 4> ByValRegs
private unsigned int InRegsParamsProcessed

Method Overview

Methods

llvm::MCRegister AllocateReg(
    ArrayRef<llvm::MCPhysReg> Regs,
    const llvm::MCPhysReg* ShadowRegs)

Description

Version of AllocateReg with list of registers to be shadowed.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:409

Parameters

ArrayRef<llvm::MCPhysReg> Regs
const llvm::MCPhysReg* ShadowRegs

llvm::MCPhysReg AllocateReg(
    ArrayRef<llvm::MCPhysReg> Regs)

Description

AllocateReg - Attempt to allocate one of the specified registers. If none are available, return zero. Otherwise, return the first one available, marking it and any aliases as allocated.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:368

Parameters

ArrayRef<llvm::MCPhysReg> Regs

llvm::MCRegister AllocateReg(
    llvm::MCPhysReg Reg,
    llvm::MCPhysReg ShadowReg)

Description

Version of AllocateReg with extra register to be shadowed.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:357

Parameters

llvm::MCPhysReg Reg
llvm::MCPhysReg ShadowReg

llvm::MCRegister AllocateReg(llvm::MCPhysReg Reg)

Description

AllocateReg - Attempt to allocate one register. If it is not available, return zero. Otherwise, return the register, marking it and any aliases as allocated.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:349

Parameters

llvm::MCPhysReg Reg

llvm::MCPhysReg AllocateRegBlock(
    ArrayRef<llvm::MCPhysReg> Regs,
    unsigned int RegsRequired)

Description

AllocateRegBlock - Attempt to allocate a block of RegsRequired consecutive registers. If this is not possible, return zero. Otherwise, return the first register of the block that were allocated, marking the entire block as allocated.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:382

Parameters

ArrayRef<llvm::MCPhysReg> Regs
unsigned int RegsRequired

unsigned int AllocateStack(
    unsigned int Size,
    llvm::Align Alignment,
    ArrayRef<llvm::MCPhysReg> ShadowRegs)

Description

Version of AllocateStack with list of extra registers to be shadowed. Note that, unlike AllocateReg, this shadows ALL of the shadow registers.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:436

Parameters

unsigned int Size
llvm::Align Alignment
ArrayRef<llvm::MCPhysReg> ShadowRegs

unsigned int AllocateStack(unsigned int Size,
                           llvm::Align Alignment)

Description

AllocateStack - Allocate a chunk of stack space with the specified size and alignment.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:423

Parameters

unsigned int Size
llvm::Align Alignment

void AnalyzeArguments(
    const SmallVectorImpl<ISD::OutputArg>& Outs,
    llvm::CCAssignFn* Fn)

Description

The function will invoke AnalyzeCallOperands.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:313

Parameters

const SmallVectorImpl<ISD::OutputArg>& Outs
llvm::CCAssignFn* Fn

void AnalyzeArguments(
    const SmallVectorImpl<ISD::InputArg>& Ins,
    llvm::CCAssignFn* Fn)

Description

The function will invoke AnalyzeFormalArguments.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:285

Parameters

const SmallVectorImpl<ISD::InputArg>& Ins
llvm::CCAssignFn* Fn

template <class T>
void AnalyzeArgumentsSecondPass(
    const SmallVectorImpl<T>& Args,
    llvm::CCAssignFn* Fn)

Description

The function runs an additional analysis pass over function arguments. It will mark each argument with the attribute flag SecArgPass. After running, it will sort the locs list.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:530

Templates

T

Parameters

const SmallVectorImpl<T>& Args
llvm::CCAssignFn* Fn

void AnalyzeCallOperands(
    const SmallVectorImpl<ISD::OutputArg>& Outs,
    llvm::CCAssignFn* Fn)

Description

AnalyzeCallOperands - Analyze the outgoing arguments to a call, incorporating info about the passed values into this state.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:303

Parameters

const SmallVectorImpl<ISD::OutputArg>& Outs
llvm::CCAssignFn* Fn

void AnalyzeCallOperands(
    SmallVectorImpl<llvm::MVT>& ArgVTs,
    SmallVectorImpl<ISD::ArgFlagsTy>& Flags,
    llvm::CCAssignFn* Fn)

Description

AnalyzeCallOperands - Same as above except it takes vectors of types and argument flags.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:308

Parameters

SmallVectorImpl<llvm::MVT>& ArgVTs
SmallVectorImpl<ISD::ArgFlagsTy>& Flags
llvm::CCAssignFn* Fn

void AnalyzeCallResult(llvm::MVT VT,
                       llvm::CCAssignFn* Fn)

Description

AnalyzeCallResult - Same as above except it's specialized for calls which produce a single value.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:330

Parameters

llvm::MVT VT
llvm::CCAssignFn* Fn

void AnalyzeCallResult(
    const SmallVectorImpl<ISD::InputArg>& Ins,
    llvm::CCAssignFn* Fn)

Description

AnalyzeCallResult - Analyze the return values of a call, incorporating info about the passed values into this state.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:320

Parameters

const SmallVectorImpl<ISD::InputArg>& Ins
llvm::CCAssignFn* Fn

void AnalyzeFormalArguments(
    const SmallVectorImpl<ISD::InputArg>& Ins,
    llvm::CCAssignFn* Fn)

Description

AnalyzeFormalArguments - Analyze an array of argument values, incorporating info about the formals into this state.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:281

Parameters

const SmallVectorImpl<ISD::InputArg>& Ins
llvm::CCAssignFn* Fn

void AnalyzeReturn(
    const SmallVectorImpl<ISD::OutputArg>& Outs,
    llvm::CCAssignFn* Fn)

Description

AnalyzeReturn - Analyze the returned values of a return, incorporating info about the result values into this state.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:292

Parameters

const SmallVectorImpl<ISD::OutputArg>& Outs
llvm::CCAssignFn* Fn

CCState(CallingConv::ID CC,
        bool isVarArg,
        llvm::MachineFunction& MF,
        SmallVectorImpl<llvm::CCValAssign>& locs,
        llvm::LLVMContext& C)

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:248

Parameters

CallingConv::ID CC
bool isVarArg
llvm::MachineFunction& MF
SmallVectorImpl<llvm::CCValAssign>& locs
llvm::LLVMContext& C

bool CheckReturn(
    const SmallVectorImpl<ISD::OutputArg>& Outs,
    llvm::CCAssignFn* Fn)

Description

CheckReturn - Analyze the return values of a function, returning true if the return can be performed without sret-demotion, and false otherwise.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:298

Parameters

const SmallVectorImpl<ISD::OutputArg>& Outs
llvm::CCAssignFn* Fn

void DeallocateReg(llvm::MCPhysReg Reg)

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:341

Parameters

llvm::MCPhysReg Reg

void HandleByVal(unsigned int ValNo,
                 llvm::MVT ValVT,
                 llvm::MVT LocVT,
                 CCValAssign::LocInfo LocInfo,
                 int MinSize,
                 llvm::Align MinAlign,
                 ISD::ArgFlagsTy ArgFlags)

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:446

Parameters

unsigned int ValNo
llvm::MVT ValVT
llvm::MVT LocVT
CCValAssign::LocInfo LocInfo
int MinSize
llvm::Align MinAlign
ISD::ArgFlagsTy ArgFlags

bool IsShadowAllocatedReg(
    llvm::MCRegister Reg) const

Description

A shadow allocated register is a register that was allocated but wasn't added to the location list (Locs).

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:326

Parameters

llvm::MCRegister Reg

Returns

true if the register was allocated as shadow or false otherwise.

void MarkAllocated(llvm::MCPhysReg Reg)

Description

MarkAllocated - Mark a register and all of its aliases as allocated.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:559

Parameters

llvm::MCPhysReg Reg

void MarkUnallocated(llvm::MCPhysReg Reg)

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:561

Parameters

llvm::MCPhysReg Reg

void addInRegsParamInfo(unsigned int RegBegin,
                        unsigned int RegEnd)

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:470

Parameters

unsigned int RegBegin
unsigned int RegEnd

void addLoc(const llvm::CCValAssign& V)

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:251

Parameters

const llvm::CCValAssign& V

void analyzeMustTailForwardedRegisters(
    SmallVectorImpl<llvm::ForwardedRegister>&
        Forwards,
    ArrayRef<llvm::MVT> RegParmTypes,
    llvm::CCAssignFn* Fn)

Description

Compute the set of registers that need to be preserved and forwarded to any musttail calls.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:514

Parameters

SmallVectorImpl<llvm::ForwardedRegister>& Forwards
ArrayRef<llvm::MVT> RegParmTypes
llvm::CCAssignFn* Fn

void clearByValRegsInfo()

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:485

void ensureMaxAlignment(llvm::Align Alignment)

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:432

Parameters

llvm::Align Alignment

unsigned int getAlignedCallFrameSize() const

Description

getAlignedCallFrameSize - Return the size of the call frame needed to be able to store all arguments and such that the alignment requirement of each of the arguments is satisfied.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:269

CallingConv::ID getCallingConv() const

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:257

llvm::LLVMContext& getContext() const

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:255

unsigned int getFirstUnallocated(
    ArrayRef<llvm::MCPhysReg> Regs) const

Description

getFirstUnallocated - Return the index of the first unallocated register in the set, or Regs.size() if they are all allocated.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:334

Parameters

ArrayRef<llvm::MCPhysReg> Regs

void getInRegsParamInfo(
    unsigned int InRegsParamRecordIndex,
    unsigned int& BeginReg,
    unsigned int& EndReg) const

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:459

Parameters

unsigned int InRegsParamRecordIndex
unsigned int& BeginReg
unsigned int& EndReg

unsigned int getInRegsParamsCount() const

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:452

unsigned int getInRegsParamsProcessed() const

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:455

llvm::MachineFunction& getMachineFunction() const

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:256

unsigned int getNextStackOffset() const

Description

getNextStackOffset - Return the next stack offset such that all stack slots satisfy their alignment requirements.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:262

SmallVectorImpl<ISD::ArgFlagsTy>&
getPendingArgFlags()

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:501

SmallVectorImpl<llvm::CCValAssign>&
getPendingLocs()

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:496

void getRemainingRegParmsForType(
    SmallVectorImpl<llvm::MCPhysReg>& Regs,
    llvm::MVT VT,
    llvm::CCAssignFn* Fn)

Description

Compute the remaining unused register parameters that would be used for the given value type. This is useful when varargs are passed in the registers that normal prototyped parameters would be passed in, or for implementing perfect forwarding.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:509

Parameters

SmallVectorImpl<llvm::MCPhysReg>& Regs
llvm::MVT VT
llvm::CCAssignFn* Fn

bool isAllocated(llvm::MCRegister Reg) const

Description

isAllocated - Return true if the specified register (or an alias) is allocated.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:275

Parameters

llvm::MCRegister Reg

bool isVarArg() const

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:258

bool nextInRegsParam()

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:477

static bool resultsCompatible(
    CallingConv::ID CalleeCC,
    CallingConv::ID CallerCC,
    llvm::MachineFunction& MF,
    llvm::LLVMContext& C,
    const SmallVectorImpl<ISD::InputArg>& Ins,
    llvm::CCAssignFn* CalleeFn,
    llvm::CCAssignFn* CallerFn)

Description

Returns true if the results of the two calling conventions are compatible. This is usually part of the check for tailcall eligibility.

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:520

Parameters

CallingConv::ID CalleeCC
CallingConv::ID CallerCC
llvm::MachineFunction& MF
llvm::LLVMContext& C
const SmallVectorImpl<ISD::InputArg>& Ins
llvm::CCAssignFn* CalleeFn
llvm::CCAssignFn* CallerFn

void rewindByValRegsInfo()

Declared at: llvm/include/llvm/CodeGen/CallingConvLower.h:491