LLVM 20.0.0git
|
#include "llvm/CodeGen/GlobalISel/CallLowering.h"
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 TargetLowering * | getTLI () 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 |
Definition at line 44 of file CallLowering.h.
|
inline |
Definition at line 451 of file CallLowering.h.
|
virtualdefault |
|
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().
|
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().
bool CallLowering::checkReturn | ( | CCState & | CCInfo, |
SmallVectorImpl< BaseArgInfo > & | Outs, | ||
CCAssignFn * | Fn | ||
) | const |
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().
bool CallLowering::checkReturnTypeForCallConv | ( | MachineFunction & | MF | ) | const |
Toplevel function to check the return type based on the target calling convention.
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().
|
protected |
Invoke ValueAssigner::assignArg on each of the given Args
and then use Handler
to move them to the assigned locations.
Definition at line 649 of file CallLowering.cpp.
References determineAssignments(), F, llvm::MachineFunction::getFunction(), llvm::MachineIRBuilder::getMF(), and handleAssignments().
Referenced by llvm::AArch64CallLowering::lowerCall(), llvm::AMDGPUCallLowering::lowerCall(), llvm::ARMCallLowering::lowerCall(), llvm::M68kCallLowering::lowerCall(), llvm::RISCVCallLowering::lowerCall(), llvm::X86CallLowering::lowerCall(), llvm::ARMCallLowering::lowerFormalArguments(), llvm::M68kCallLowering::lowerFormalArguments(), llvm::PPCCallLowering::lowerFormalArguments(), llvm::X86CallLowering::lowerFormalArguments(), llvm::X86CallLowering::lowerReturn(), llvm::AArch64CallLowering::lowerReturn(), llvm::M68kCallLowering::lowerReturn(), and llvm::PPCCallLowering::lowerReturn().
|
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.
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().
|
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().
|
inlinevirtual |
Reimplemented in llvm::AArch64CallLowering.
Definition at line 540 of file CallLowering.h.
Referenced by llvm::IRTranslator::runOnMachineFunction().
|
protected |
ArgIdx-th
parameter of Call
. Definition at line 68 of file CallLowering.cpp.
References addFlagsUsingAttrFn().
Referenced by lowerCall().
|
protected |
Call
. Definition at line 78 of file CallLowering.cpp.
References addFlagsUsingAttrFn().
Referenced by lowerCall().
void CallLowering::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
.
Definition at line 1106 of file CallLowering.cpp.
References addArgFlagsFromAttributes(), llvm::ComputeValueVTs(), DL, llvm::SmallVectorImpl< T >::emplace_back(), llvm::TargetLoweringBase::getNumRegistersForCallingConv(), llvm::TargetLoweringBase::getRegisterTypeForCallingConv(), llvm::EVT::getTypeForEVT(), I, RetTy, and llvm::AttributeList::ReturnIndex.
Referenced by checkReturnTypeForCallConv(), and lowerCall().
|
inlineprotected |
Getter for generic TargetLowering class.
Definition at line 354 of file CallLowering.h.
Referenced by setArgFlags().
|
inlineprotected |
Getter for target specific TargetLowering class.
Definition at line 360 of file CallLowering.h.
|
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().
void CallLowering::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
.
This function should be called from the target specific lowerFormalArguments when F
requires the sret demotion.
Definition at line 1051 of file CallLowering.cpp.
References assert(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::ComputeValueVTs(), DL, F, llvm::CallLowering::BaseArgInfo::Flags, llvm::PointerType::get(), llvm::Type::getContext(), llvm::SmallVectorImpl< T >::insert(), MRI, llvm::CallLowering::ArgInfo::NoArgIndex, llvm::LLT::pointer(), llvm::AttributeList::ReturnIndex, setArgFlags(), and llvm::SmallVectorBase< Size_T >::size().
Referenced by llvm::AMDGPUCallLowering::lowerFormalArguments(), llvm::AArch64CallLowering::lowerFormalArguments(), and llvm::X86CallLowering::lowerFormalArguments().
void CallLowering::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
.
It uses the frame index FI
and the start offset from DemoteReg
. The loaded data size will be determined from RetTy
.
Definition at line 990 of file CallLowering.cpp.
References Addr, assert(), llvm::MachineIRBuilder::buildLoad(), llvm::commonAlignment(), llvm::ComputeValueVTs(), DL, llvm::PointerType::get(), llvm::MachineFunction::getDataLayout(), llvm::MachinePointerInfo::getFixedStack(), llvm::getLLTForType(), llvm::MachineFunction::getMachineMemOperand(), llvm::MachineIRBuilder::getMF(), llvm::MachineFunction::getRegInfo(), I, llvm::MachineIRBuilder::materializePtrAdd(), llvm::MachineMemOperand::MOLoad, MRI, RetTy, llvm::ArrayRef< T >::size(), and llvm::SmallVectorBase< Size_T >::size().
Referenced by llvm::AArch64CallLowering::lowerCall(), llvm::AMDGPUCallLowering::lowerCall(), and llvm::X86CallLowering::lowerCall().
void CallLowering::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
.
Definition at line 1073 of file CallLowering.cpp.
References llvm::MachineIRBuilder::buildFrameIndex(), llvm::MachineFrameInfo::CreateStackObject(), DL, llvm::CallLowering::BaseArgInfo::Flags, llvm::PointerType::get(), llvm::MachineIRBuilder::getDataLayout(), llvm::MachineFunction::getFrameInfo(), llvm::MachineIRBuilder::getMF(), llvm::MachineInstrBuilder::getReg(), llvm::Value::getType(), Info, llvm::CallLowering::ArgInfo::NoArgIndex, llvm::LLT::pointer(), RetTy, llvm::AttributeList::ReturnIndex, and setArgFlags().
Referenced by lowerCall().
void CallLowering::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
.
Definition at line 1021 of file CallLowering.cpp.
References Addr, assert(), llvm::MachineIRBuilder::buildStore(), llvm::commonAlignment(), llvm::ComputeValueVTs(), DL, llvm::MachineFunction::getDataLayout(), llvm::getLLTForType(), llvm::MachineFunction::getMachineMemOperand(), llvm::MachineIRBuilder::getMF(), llvm::MachineFunction::getRegInfo(), I, llvm::MachineIRBuilder::materializePtrAdd(), llvm::MachineMemOperand::MOStore, MRI, RetTy, llvm::ArrayRef< T >::size(), and llvm::SmallVectorBase< Size_T >::size().
Referenced by llvm::AMDGPUCallLowering::lowerReturn(), llvm::X86CallLowering::lowerReturn(), and llvm::AArch64CallLowering::lowerReturn().
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().
|
inlinevirtual |
This hook must be implemented to lower the given call instruction, including argument and return value marshalling.
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().
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.
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().
|
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.
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().
|
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.
|
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.
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().
|
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().
|
protected |
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().
|
protected |
Definition at line 220 of file CallLowering.cpp.
References addArgFlagsFromAttributes(), assert(), DL, llvm::AttributeList::FirstArgIndex, llvm::CallLowering::BaseArgInfo::Flags, llvm::Type::getPointerAddressSpace(), llvm::Type::getScalarType(), getTLI(), and llvm::CallLowering::BaseArgInfo::Ty.
Referenced by insertSRetIncomingArgument(), insertSRetOutgoingArgument(), lowerCall(), 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::AMDGPUCallLowering::lowerFormalArgumentsKernel(), llvm::MipsCallLowering::lowerReturn(), llvm::X86CallLowering::lowerReturn(), llvm::AArch64CallLowering::lowerReturn(), llvm::M68kCallLowering::lowerReturn(), and llvm::PPCCallLowering::lowerReturn().
|
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().
|
inlinevirtual |
Reimplemented in llvm::AArch64CallLowering.
Definition at line 457 of file CallLowering.h.
Referenced by lowerReturn().