LLVM 20.0.0git
Classes | Public Member Functions | Protected Member Functions | List of all members
llvm::CallLowering Class Reference

#include "llvm/CodeGen/GlobalISel/CallLowering.h"

Inheritance diagram for llvm::CallLowering:
Inheritance graph
[legend]

Classes

struct  ArgInfo
 
struct  BaseArgInfo
 
struct  CallLoweringInfo
 
struct  IncomingValueAssigner
 
struct  IncomingValueHandler
 Base class for ValueHandlers used for arguments coming into the current function, or for return values received from a call. More...
 
struct  OutgoingValueAssigner
 
struct  OutgoingValueHandler
 Base class for ValueHandlers used for arguments passed to a function call, or for return values. More...
 
struct  PtrAuthInfo
 
struct  ValueAssigner
 Argument handling is mostly uniform between the four places that make these decisions: function formal arguments, call instruction args, call instruction returns and function returns. More...
 
struct  ValueHandler
 

Public Member Functions

 CallLowering (const TargetLowering *TLI)
 
virtual ~CallLowering ()=default
 
virtual bool supportSwiftError () const
 
void insertSRetLoads (MachineIRBuilder &MIRBuilder, Type *RetTy, ArrayRef< Register > VRegs, Register DemoteReg, int FI) const
 Load the returned value from the stack into virtual registers in VRegs.
 
void insertSRetStores (MachineIRBuilder &MIRBuilder, Type *RetTy, ArrayRef< Register > VRegs, Register DemoteReg) const
 Store the return value given by VRegs into stack starting at the offset specified in DemoteReg.
 
void insertSRetIncomingArgument (const Function &F, SmallVectorImpl< ArgInfo > &SplitArgs, Register &DemoteReg, MachineRegisterInfo &MRI, const DataLayout &DL) const
 Insert the hidden sret ArgInfo to the beginning of SplitArgs.
 
void insertSRetOutgoingArgument (MachineIRBuilder &MIRBuilder, const CallBase &CB, CallLoweringInfo &Info) const
 For the call-base described by CB, insert the hidden sret ArgInfo to the OrigArgs field of Info.
 
bool checkReturn (CCState &CCInfo, SmallVectorImpl< BaseArgInfo > &Outs, CCAssignFn *Fn) const
 
void getReturnInfo (CallingConv::ID CallConv, Type *RetTy, AttributeList Attrs, SmallVectorImpl< BaseArgInfo > &Outs, const DataLayout &DL) const
 Get the type and the ArgFlags for the split components of RetTy as returned by ComputeValueVTs.
 
bool checkReturnTypeForCallConv (MachineFunction &MF) const
 Toplevel function to check the return type based on the target calling convention.
 
virtual bool canLowerReturn (MachineFunction &MF, CallingConv::ID CallConv, SmallVectorImpl< BaseArgInfo > &Outs, bool IsVarArg) const
 This hook must be implemented to check whether the return values described by Outs can fit into the return registers.
 
virtual bool lowerReturn (MachineIRBuilder &MIRBuilder, const Value *Val, ArrayRef< Register > VRegs, FunctionLoweringInfo &FLI, Register SwiftErrorVReg) const
 This hook must be implemented to lower outgoing return values, described by Val, into the specified virtual registers VRegs.
 
virtual bool lowerReturn (MachineIRBuilder &MIRBuilder, const Value *Val, ArrayRef< Register > VRegs, FunctionLoweringInfo &FLI) const
 This hook behaves as the extended lowerReturn function, but for targets that do not support swifterror value promotion.
 
virtual bool fallBackToDAGISel (const MachineFunction &MF) const
 
virtual bool lowerFormalArguments (MachineIRBuilder &MIRBuilder, const Function &F, ArrayRef< ArrayRef< Register > > VRegs, FunctionLoweringInfo &FLI) const
 This hook must be implemented to lower the incoming (formal) arguments, described by VRegs, for GlobalISel.
 
virtual bool lowerCall (MachineIRBuilder &MIRBuilder, CallLoweringInfo &Info) const
 This hook must be implemented to lower the given call instruction, including argument and return value marshalling.
 
bool lowerCall (MachineIRBuilder &MIRBuilder, const CallBase &Call, ArrayRef< Register > ResRegs, ArrayRef< ArrayRef< Register > > ArgRegs, Register SwiftErrorVReg, std::optional< PtrAuthInfo > PAI, Register ConvergenceCtrlToken, std::function< unsigned()> GetCalleeReg) const
 Lower the given call instruction, including argument and return value marshalling.
 
virtual bool enableBigEndian () const
 For targets which want to use big-endian can enable it with enableBigEndian() hook.
 
virtual bool isTypeIsValidForThisReturn (EVT Ty) const
 For targets which support the "returned" parameter attribute, returns true if the given type is a valid one to use with "returned".
 

Protected Member Functions

const TargetLoweringgetTLI () const
 Getter for generic TargetLowering class.
 
template<class XXXTargetLowering >
const XXXTargetLowering * getTLI () const
 Getter for target specific TargetLowering class.
 
ISD::ArgFlagsTy getAttributesForArgIdx (const CallBase &Call, unsigned ArgIdx) const
 
ISD::ArgFlagsTy getAttributesForReturn (const CallBase &Call) const
 
void addArgFlagsFromAttributes (ISD::ArgFlagsTy &Flags, const AttributeList &Attrs, unsigned OpIdx) const
 Adds flags to Flags based off of the attributes in Attrs.
 
template<typename FuncInfoTy >
void setArgFlags (ArgInfo &Arg, unsigned OpIdx, const DataLayout &DL, const FuncInfoTy &FuncInfo) const
 
void splitToValueTypes (const ArgInfo &OrigArgInfo, SmallVectorImpl< ArgInfo > &SplitArgs, const DataLayout &DL, CallingConv::ID CallConv, SmallVectorImpl< uint64_t > *Offsets=nullptr) const
 Break OrigArgInfo into one or more pieces the calling convention can process, returned in SplitArgs.
 
bool determineAssignments (ValueAssigner &Assigner, SmallVectorImpl< ArgInfo > &Args, CCState &CCInfo) const
 Analyze the argument list in Args, using Assigner to populate CCInfo.
 
bool determineAndHandleAssignments (ValueHandler &Handler, ValueAssigner &Assigner, SmallVectorImpl< ArgInfo > &Args, MachineIRBuilder &MIRBuilder, CallingConv::ID CallConv, bool IsVarArg, ArrayRef< Register > ThisReturnRegs=std::nullopt) const
 Invoke ValueAssigner::assignArg on each of the given Args and then use Handler to move them to the assigned locations.
 
bool handleAssignments (ValueHandler &Handler, SmallVectorImpl< ArgInfo > &Args, CCState &CCState, SmallVectorImpl< CCValAssign > &ArgLocs, MachineIRBuilder &MIRBuilder, ArrayRef< Register > ThisReturnRegs=std::nullopt) const
 Use Handler to insert code to handle the argument/return values represented by Args.
 
bool parametersInCSRMatch (const MachineRegisterInfo &MRI, const uint32_t *CallerPreservedMask, const SmallVectorImpl< CCValAssign > &ArgLocs, const SmallVectorImpl< ArgInfo > &OutVals) const
 Check whether parameters to a call that are passed in callee saved registers are the same as from the calling function.
 
bool resultsCompatible (CallLoweringInfo &Info, MachineFunction &MF, SmallVectorImpl< ArgInfo > &InArgs, ValueAssigner &CalleeAssigner, ValueAssigner &CallerAssigner) const
 

Detailed Description

Definition at line 44 of file CallLowering.h.

Constructor & Destructor Documentation

◆ CallLowering()

llvm::CallLowering::CallLowering ( const TargetLowering TLI)
inline

Definition at line 451 of file CallLowering.h.

◆ ~CallLowering()

virtual llvm::CallLowering::~CallLowering ( )
virtualdefault

Member Function Documentation

◆ addArgFlagsFromAttributes()

void CallLowering::addArgFlagsFromAttributes ( ISD::ArgFlagsTy Flags,
const AttributeList Attrs,
unsigned  OpIdx 
) const
protected

Adds flags to Flags based off of the attributes in Attrs.

OpIdx is the index in Attrs to add flags from.

Definition at line 86 of file CallLowering.cpp.

References addFlagsUsingAttrFn().

Referenced by getReturnInfo(), and setArgFlags().

◆ canLowerReturn()

virtual bool llvm::CallLowering::canLowerReturn ( MachineFunction MF,
CallingConv::ID  CallConv,
SmallVectorImpl< BaseArgInfo > &  Outs,
bool  IsVarArg 
) const
inlinevirtual

This hook must be implemented to check whether the return values described by Outs can fit into the return registers.

If false is returned, an sret-demotion is performed.

Reimplemented in llvm::AArch64CallLowering, and llvm::X86CallLowering.

Definition at line 506 of file CallLowering.h.

Referenced by checkReturnTypeForCallConv(), and lowerCall().

◆ checkReturn()

bool CallLowering::checkReturn ( CCState CCInfo,
SmallVectorImpl< BaseArgInfo > &  Outs,
CCAssignFn Fn 
) const
Returns
True if the return type described by Outs can be returned without performing sret demotion.

Definition at line 1095 of file CallLowering.cpp.

References llvm::CCValAssign::Full, llvm::MVT::getVT(), I, and llvm::SmallVectorBase< Size_T >::size().

Referenced by llvm::AArch64CallLowering::canLowerReturn(), and llvm::X86CallLowering::canLowerReturn().

◆ checkReturnTypeForCallConv()

bool CallLowering::checkReturnTypeForCallConv ( MachineFunction MF) const

Toplevel function to check the return type based on the target calling convention.

Returns
True if the return value of MF can be returned without performing sret demotion.

Definition at line 1129 of file CallLowering.cpp.

References canLowerReturn(), F, llvm::MachineFunction::getDataLayout(), llvm::MachineFunction::getFunction(), and getReturnInfo().

Referenced by llvm::IRTranslator::runOnMachineFunction().

◆ determineAndHandleAssignments()

bool CallLowering::determineAndHandleAssignments ( ValueHandler Handler,
ValueAssigner Assigner,
SmallVectorImpl< ArgInfo > &  Args,
MachineIRBuilder MIRBuilder,
CallingConv::ID  CallConv,
bool  IsVarArg,
ArrayRef< Register ThisReturnRegs = std::nullopt 
) const
protected

◆ determineAssignments()

bool CallLowering::determineAssignments ( ValueAssigner Assigner,
SmallVectorImpl< ArgInfo > &  Args,
CCState CCInfo 
) const
protected

Analyze the argument list in Args, using Assigner to populate CCInfo.

This will determine the types and locations to use for passed or returned values. This may resize fields in Args if the value is split across multiple registers or stack slots.

This is independent of the function state and can be used to determine how a call would pass arguments without needing to change the function. This can be used to check if arguments are suitable for tail call lowering.

Returns
True if everything has succeeded, false otherwise.

Definition at line 674 of file CallLowering.cpp.

References llvm::CallLowering::ValueAssigner::assignArg(), llvm::CCValAssign::Full, llvm::CCState::getCallingConv(), llvm::CCState::getContext(), llvm::EVT::getEVT(), llvm::TargetLoweringBase::getNumRegistersForCallingConv(), and llvm::TargetLoweringBase::getRegisterTypeForCallingConv().

Referenced by llvm::AMDGPUCallLowering::areCalleeOutgoingArgsTailCallable(), determineAndHandleAssignments(), llvm::AMDGPUCallLowering::lowerCall(), llvm::MipsCallLowering::lowerCall(), llvm::AMDGPUCallLowering::lowerFormalArguments(), llvm::AArch64CallLowering::lowerFormalArguments(), llvm::MipsCallLowering::lowerFormalArguments(), llvm::RISCVCallLowering::lowerFormalArguments(), llvm::MipsCallLowering::lowerReturn(), llvm::AMDGPUCallLowering::lowerTailCall(), and resultsCompatible().

◆ enableBigEndian()

virtual bool llvm::CallLowering::enableBigEndian ( ) const
inlinevirtual

For targets which want to use big-endian can enable it with enableBigEndian() hook.

Reimplemented in llvm::ARMCallLowering, and llvm::M68kCallLowering.

Definition at line 603 of file CallLowering.h.

Referenced by llvm::IRTranslator::runOnMachineFunction().

◆ fallBackToDAGISel()

virtual bool llvm::CallLowering::fallBackToDAGISel ( const MachineFunction MF) const
inlinevirtual

Reimplemented in llvm::AArch64CallLowering.

Definition at line 540 of file CallLowering.h.

Referenced by llvm::IRTranslator::runOnMachineFunction().

◆ getAttributesForArgIdx()

ISD::ArgFlagsTy CallLowering::getAttributesForArgIdx ( const CallBase Call,
unsigned  ArgIdx 
) const
protected
Returns
Flags corresponding to the attributes on the ArgIdx-th parameter of Call.

Definition at line 68 of file CallLowering.cpp.

References addFlagsUsingAttrFn().

Referenced by lowerCall().

◆ getAttributesForReturn()

ISD::ArgFlagsTy CallLowering::getAttributesForReturn ( const CallBase Call) const
protected
Returns
Flags corresponding to the attributes on the return from Call.

Definition at line 78 of file CallLowering.cpp.

References addFlagsUsingAttrFn().

Referenced by lowerCall().

◆ getReturnInfo()

void CallLowering::getReturnInfo ( CallingConv::ID  CallConv,
Type RetTy,
AttributeList  Attrs,
SmallVectorImpl< BaseArgInfo > &  Outs,
const DataLayout DL 
) const

◆ getTLI() [1/2]

const TargetLowering * llvm::CallLowering::getTLI ( ) const
inlineprotected

Getter for generic TargetLowering class.

Definition at line 354 of file CallLowering.h.

Referenced by setArgFlags().

◆ getTLI() [2/2]

template<class XXXTargetLowering >
const XXXTargetLowering * llvm::CallLowering::getTLI ( ) const
inlineprotected

Getter for target specific TargetLowering class.

Definition at line 360 of file CallLowering.h.

◆ handleAssignments()

bool CallLowering::handleAssignments ( ValueHandler Handler,
SmallVectorImpl< ArgInfo > &  Args,
CCState CCState,
SmallVectorImpl< CCValAssign > &  ArgLocs,
MachineIRBuilder MIRBuilder,
ArrayRef< Register ThisReturnRegs = std::nullopt 
) const
protected

Use Handler to insert code to handle the argument/return values represented by Args.

It's expected determineAssignments previously processed these arguments to populate CCState and ArgLocs.

Definition at line 735 of file CallLowering.cpp.

References assert(), llvm::CallLowering::ValueHandler::assignCustomValue(), llvm::CallLowering::ValueHandler::assignValueToAddress(), llvm::CallLowering::ValueHandler::assignValueToReg(), llvm::MachineIRBuilder::buildCopy(), buildCopyFromRegs(), buildCopyToRegs(), llvm::MachineIRBuilder::buildFrameIndex(), llvm::MachineIRBuilder::buildLoad(), llvm::MachineIRBuilder::buildStore(), llvm::CallLowering::ValueHandler::copyArgumentMemory(), llvm::MachineFrameInfo::CreateStackObject(), DL, llvm::ArrayRef< T >::empty(), extendOpFromFlags(), F, llvm::LLT::getAddressSpace(), llvm::DataLayout::getAllocaAddrSpace(), llvm::MachineFunction::getDataLayout(), llvm::EVT::getEVT(), llvm::MachinePointerInfo::getFixedStack(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getFunction(), llvm::getLLTForType(), llvm::CCValAssign::getLocInfo(), llvm::CCValAssign::getLocMemOffset(), llvm::CCValAssign::getLocReg(), llvm::CCValAssign::getLocVT(), llvm::MachineIRBuilder::getMF(), llvm::MachineInstrBuilder::getReg(), llvm::MachineFunction::getRegInfo(), llvm::LLT::getScalarSizeInBits(), llvm::LLT::getSizeInBytes(), llvm::CallLowering::ValueHandler::getStackAddress(), llvm::CallLowering::ValueHandler::getStackValueStoreType(), llvm::MachinePointerInfo::getUnknownStack(), llvm::CCValAssign::getValNo(), llvm::CCValAssign::getValVT(), llvm::TargetLoweringBase::hasBigEndianPartOrdering(), Idx, llvm::CCValAssign::Indirect, llvm::inferAlignFromPtrInfo(), llvm::CallLowering::ValueHandler::isIncomingArgumentHandler(), llvm::CCValAssign::isMemLoc(), isTypeIsValidForThisReturn(), MRI, llvm::CCValAssign::needsCustom(), llvm::Offset, llvm::LLT::pointer(), and llvm::SmallVectorBase< Size_T >::size().

Referenced by determineAndHandleAssignments(), llvm::AMDGPUCallLowering::lowerCall(), llvm::MipsCallLowering::lowerCall(), llvm::AMDGPUCallLowering::lowerFormalArguments(), llvm::AArch64CallLowering::lowerFormalArguments(), llvm::MipsCallLowering::lowerFormalArguments(), llvm::RISCVCallLowering::lowerFormalArguments(), llvm::MipsCallLowering::lowerReturn(), and llvm::AMDGPUCallLowering::lowerTailCall().

◆ insertSRetIncomingArgument()

void CallLowering::insertSRetIncomingArgument ( const Function F,
SmallVectorImpl< ArgInfo > &  SplitArgs,
Register DemoteReg,
MachineRegisterInfo MRI,
const DataLayout DL 
) const

◆ insertSRetLoads()

void CallLowering::insertSRetLoads ( MachineIRBuilder MIRBuilder,
Type RetTy,
ArrayRef< Register VRegs,
Register  DemoteReg,
int  FI 
) const

◆ insertSRetOutgoingArgument()

void CallLowering::insertSRetOutgoingArgument ( MachineIRBuilder MIRBuilder,
const CallBase CB,
CallLoweringInfo Info 
) const

◆ insertSRetStores()

void CallLowering::insertSRetStores ( MachineIRBuilder MIRBuilder,
Type RetTy,
ArrayRef< Register VRegs,
Register  DemoteReg 
) const

◆ isTypeIsValidForThisReturn()

virtual bool llvm::CallLowering::isTypeIsValidForThisReturn ( EVT  Ty) const
inlinevirtual

For targets which support the "returned" parameter attribute, returns true if the given type is a valid one to use with "returned".

Reimplemented in llvm::AArch64CallLowering.

Definition at line 607 of file CallLowering.h.

Referenced by handleAssignments().

◆ lowerCall() [1/2]

virtual bool llvm::CallLowering::lowerCall ( MachineIRBuilder MIRBuilder,
CallLoweringInfo Info 
) const
inlinevirtual

This hook must be implemented to lower the given call instruction, including argument and return value marshalling.

Returns
true if the lowering succeeded, false otherwise.

Reimplemented in llvm::AArch64CallLowering, llvm::AMDGPUCallLowering, llvm::ARMCallLowering, llvm::BPFCallLowering, llvm::M68kCallLowering, llvm::MipsCallLowering, llvm::PPCCallLowering, llvm::RISCVCallLowering, llvm::SPIRVCallLowering, and llvm::X86CallLowering.

Definition at line 566 of file CallLowering.h.

Referenced by lowerCall().

◆ lowerCall() [2/2]

bool CallLowering::lowerCall ( MachineIRBuilder MIRBuilder,
const CallBase Call,
ArrayRef< Register ResRegs,
ArrayRef< ArrayRef< Register > >  ArgRegs,
Register  SwiftErrorVReg,
std::optional< PtrAuthInfo PAI,
Register  ConvergenceCtrlToken,
std::function< unsigned()>  GetCalleeReg 
) const

Lower the given call instruction, including argument and return value marshalling.

CI is the call/invoke instruction.

ResRegs are the registers where the call's return value should be stored (or 0 if there is no return value). There will be one register for each non-aggregate type, as returned by computeValueLLTs.

ArgRegs is a list of lists of virtual registers containing each argument that needs to be passed (argument i should be placed in ArgRegs[i]). For each argument, there will be one register for each non-aggregate type, as returned by computeValueLLTs.

SwiftErrorVReg is non-zero if the call has a swifterror inout parameter, and contains the vreg that the swifterror should be copied into after the call.

GetCalleeReg is a callback to materialize a register for the callee if the target determines it cannot jump to the destination based purely on CI. This might be because CI is indirect, or because of the limited range of an immediate jump.

Returns
true if the lowering succeeded, false otherwise.

Definition at line 94 of file CallLowering.cpp.

References llvm::CallBase::args(), assert(), llvm::MachineIRBuilder::buildAssertAlign(), llvm::MachineIRBuilder::buildGlobalValue(), canLowerReturn(), llvm::CallBase::countOperandBundlesOfType(), llvm::MachineOperand::CreateGA(), llvm::MachineOperand::CreateReg(), DL, F, llvm::AttributeList::FirstArgIndex, llvm::CallBase::getAttributes(), getAttributesForArgIdx(), getAttributesForReturn(), llvm::CallBase::getCalledOperand(), llvm::CallBase::getCallingConv(), llvm::MachineIRBuilder::getDataLayout(), llvm::Function::getFnAttribute(), llvm::MachineFunction::getFunction(), llvm::CallBase::getFunctionType(), llvm::getLLTForType(), llvm::Instruction::getMetadata(), llvm::MachineIRBuilder::getMF(), llvm::FunctionType::getNumParams(), llvm::CallBase::getOperandBundle(), llvm::MachineInstrBuilder::getReg(), llvm::MachineFunction::getRegInfo(), llvm::CallBase::getRetAlign(), getReturnInfo(), llvm::MachineFunction::getTarget(), llvm::Value::getType(), llvm::Attribute::getValueAsString(), Info, insertSRetOutgoingArgument(), llvm::CallBase::isConvergent(), llvm::CallBase::isIndirectCall(), llvm::isInTailCallPosition(), llvm::CallBase::isMustTailCall(), llvm::CallBase::isTailCall(), llvm::FunctionType::isVarArg(), lowerCall(), MRI, NumFixedArgs, llvm::LLVMContext::OB_kcfi, llvm::LLVMContext::OB_ptrauth, RetTy, llvm::AttributeList::ReturnIndex, setArgFlags(), and llvm::Value::stripPointerCasts().

◆ lowerFormalArguments()

virtual bool llvm::CallLowering::lowerFormalArguments ( MachineIRBuilder MIRBuilder,
const Function F,
ArrayRef< ArrayRef< Register > >  VRegs,
FunctionLoweringInfo FLI 
) const
inlinevirtual

This hook must be implemented to lower the incoming (formal) arguments, described by VRegs, for GlobalISel.

Each argument must end up in the related virtual registers described by VRegs. In other words, the first argument should end up in VRegs[0], the second in VRegs[1], and so on. For each argument, there will be one register for each non-aggregate type, as returned by computeValueLLTs. MIRBuilder is set to the proper insertion for the argument lowering. FLI is required for sret demotion.

Returns
True if the lowering succeeded, false otherwise.

Reimplemented in llvm::AMDGPUCallLowering, llvm::AArch64CallLowering, llvm::ARMCallLowering, llvm::BPFCallLowering, llvm::M68kCallLowering, llvm::MipsCallLowering, llvm::PPCCallLowering, llvm::RISCVCallLowering, llvm::SPIRVCallLowering, and llvm::X86CallLowering.

Definition at line 554 of file CallLowering.h.

Referenced by llvm::IRTranslator::runOnMachineFunction().

◆ lowerReturn() [1/2]

virtual bool llvm::CallLowering::lowerReturn ( MachineIRBuilder MIRBuilder,
const Value Val,
ArrayRef< Register VRegs,
FunctionLoweringInfo FLI 
) const
inlinevirtual

This hook behaves as the extended lowerReturn function, but for targets that do not support swifterror value promotion.

Reimplemented in llvm::AMDGPUCallLowering, llvm::ARMCallLowering, llvm::MipsCallLowering, llvm::X86CallLowering, and llvm::RISCVCallLowering.

Definition at line 534 of file CallLowering.h.

◆ lowerReturn() [2/2]

virtual bool llvm::CallLowering::lowerReturn ( MachineIRBuilder MIRBuilder,
const Value Val,
ArrayRef< Register VRegs,
FunctionLoweringInfo FLI,
Register  SwiftErrorVReg 
) const
inlinevirtual

This hook must be implemented to lower outgoing return values, described by Val, into the specified virtual registers VRegs.

This hook is used by GlobalISel.

FLI is required for sret demotion.

SwiftErrorVReg is non-zero if the function has a swifterror parameter that needs to be implicitly returned.

Returns
True if the lowering succeeds, false otherwise.

Reimplemented in llvm::AArch64CallLowering, llvm::BPFCallLowering, llvm::M68kCallLowering, llvm::PPCCallLowering, and llvm::SPIRVCallLowering.

Definition at line 522 of file CallLowering.h.

References assert(), lowerReturn(), and supportSwiftError().

Referenced by lowerReturn().

◆ parametersInCSRMatch()

bool CallLowering::parametersInCSRMatch ( const MachineRegisterInfo MRI,
const uint32_t CallerPreservedMask,
const SmallVectorImpl< CCValAssign > &  ArgLocs,
const SmallVectorImpl< ArgInfo > &  OutVals 
) const
protected

Check whether parameters to a call that are passed in callee saved registers are the same as from the calling function.

This needs to be checked for tail call eligibility.

Definition at line 1140 of file CallLowering.cpp.

References llvm::MachineOperand::clobbersPhysReg(), llvm::dbgs(), llvm::getDefIgnoringCopies(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), LLVM_DEBUG, MRI, llvm::CallLowering::ArgInfo::Regs, and llvm::SmallVectorBase< Size_T >::size().

Referenced by llvm::AMDGPUCallLowering::areCalleeOutgoingArgsTailCallable().

◆ resultsCompatible()

bool CallLowering::resultsCompatible ( CallLoweringInfo Info,
MachineFunction MF,
SmallVectorImpl< ArgInfo > &  InArgs,
ValueAssigner CalleeAssigner,
ValueAssigner CallerAssigner 
) const
protected
Returns
True if the calling convention for a callee and its caller pass results in the same way. Typically used for tail call eligibility checks.

Info is the CallLoweringInfo for the call. MF is the MachineFunction for the caller. InArgs contains the results of the call. CalleeAssigner specifies the target's handling of the argument types for the callee. CallerAssigner specifies the target's handling of the argument types for the caller.

Definition at line 1192 of file CallLowering.cpp.

References determineAssignments(), F, llvm::MachineFunction::getFunction(), llvm::CCValAssign::getLocMemOffset(), llvm::CCValAssign::getLocReg(), Info, llvm::CCValAssign::isRegLoc(), and llvm::SmallVectorBase< Size_T >::size().

Referenced by llvm::AMDGPUCallLowering::doCallerAndCalleePassArgsTheSameWay().

◆ setArgFlags()

template<typename FuncInfoTy >
template void CallLowering::setArgFlags< CallBase > ( ArgInfo Arg,
unsigned  OpIdx,
const DataLayout DL,
const FuncInfoTy &  FuncInfo 
) const
protected

◆ splitToValueTypes()

void CallLowering::splitToValueTypes ( const ArgInfo OrigArgInfo,
SmallVectorImpl< ArgInfo > &  SplitArgs,
const DataLayout DL,
CallingConv::ID  CallConv,
SmallVectorImpl< uint64_t > *  Offsets = nullptr 
) const
protected

Break OrigArgInfo into one or more pieces the calling convention can process, returned in SplitArgs.

For example, this should break structs down into individual fields.

If Offsets is non-null, it points to a vector to be filled in with the in-memory offsets of each of the individual values.

Definition at line 287 of file CallLowering.cpp.

References assert(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::ComputeValueVTs(), DL, llvm::SmallVectorImpl< T >::emplace_back(), llvm::CallLowering::BaseArgInfo::Flags, llvm::TargetLowering::functionArgumentNeedsConsecutiveRegisters(), llvm::Type::getContext(), llvm::CallLowering::BaseArgInfo::IsFixed, llvm::CallLowering::ArgInfo::OrigArgIndex, llvm::CallLowering::ArgInfo::OrigValue, llvm::CallLowering::ArgInfo::Regs, llvm::SmallVectorBase< Size_T >::size(), and llvm::CallLowering::BaseArgInfo::Ty.

Referenced by llvm::AArch64CallLowering::lowerCall(), llvm::AMDGPUCallLowering::lowerCall(), llvm::ARMCallLowering::lowerCall(), llvm::M68kCallLowering::lowerCall(), llvm::MipsCallLowering::lowerCall(), llvm::RISCVCallLowering::lowerCall(), llvm::X86CallLowering::lowerCall(), llvm::AMDGPUCallLowering::lowerChainCall(), llvm::AMDGPUCallLowering::lowerFormalArguments(), llvm::AArch64CallLowering::lowerFormalArguments(), llvm::ARMCallLowering::lowerFormalArguments(), llvm::M68kCallLowering::lowerFormalArguments(), llvm::MipsCallLowering::lowerFormalArguments(), llvm::PPCCallLowering::lowerFormalArguments(), llvm::RISCVCallLowering::lowerFormalArguments(), llvm::X86CallLowering::lowerFormalArguments(), llvm::MipsCallLowering::lowerReturn(), llvm::X86CallLowering::lowerReturn(), llvm::AArch64CallLowering::lowerReturn(), llvm::M68kCallLowering::lowerReturn(), and llvm::PPCCallLowering::lowerReturn().

◆ supportSwiftError()

virtual bool llvm::CallLowering::supportSwiftError ( ) const
inlinevirtual
Returns
true if the target is capable of handling swifterror values that have been promoted to a specified register. The extended versions of lowerReturn and lowerCall should be implemented.

Reimplemented in llvm::AArch64CallLowering.

Definition at line 457 of file CallLowering.h.

Referenced by lowerReturn().


The documentation for this class was generated from the following files: