LLVM 20.0.0git
|
#include "Target/AArch64/GISel/AArch64CallLowering.h"
Public Member Functions | |
AArch64CallLowering (const AArch64TargetLowering &TLI) | |
bool | lowerReturn (MachineIRBuilder &MIRBuilder, const Value *Val, ArrayRef< Register > VRegs, FunctionLoweringInfo &FLI, Register SwiftErrorVReg) const override |
This hook must be implemented to lower outgoing return values, described by Val , into the specified virtual registers VRegs . | |
bool | canLowerReturn (MachineFunction &MF, CallingConv::ID CallConv, SmallVectorImpl< BaseArgInfo > &Outs, bool IsVarArg) const override |
This hook must be implemented to check whether the return values described by Outs can fit into the return registers. | |
bool | fallBackToDAGISel (const MachineFunction &MF) const override |
bool | lowerFormalArguments (MachineIRBuilder &MIRBuilder, const Function &F, ArrayRef< ArrayRef< Register > > VRegs, FunctionLoweringInfo &FLI) const override |
This hook must be implemented to lower the incoming (formal) arguments, described by VRegs , for GlobalISel. | |
bool | lowerCall (MachineIRBuilder &MIRBuilder, CallLoweringInfo &Info) const override |
This hook must be implemented to lower the given call instruction, including argument and return value marshalling. | |
bool | isEligibleForTailCallOptimization (MachineIRBuilder &MIRBuilder, CallLoweringInfo &Info, SmallVectorImpl< ArgInfo > &InArgs, SmallVectorImpl< ArgInfo > &OutArgs) const |
Returns true if the call can be lowered as a tail call. | |
bool | supportSwiftError () const override |
bool | isTypeIsValidForThisReturn (EVT Ty) const override |
For targets which support the "returned" parameter attribute, returns true if the given type is a valid one to use with "returned". | |
Public Member Functions inherited from llvm::CallLowering | |
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". | |
Additional Inherited Members | |
Protected Member Functions inherited from llvm::CallLowering | |
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 30 of file AArch64CallLowering.h.
AArch64CallLowering::AArch64CallLowering | ( | const AArch64TargetLowering & | TLI | ) |
Definition at line 58 of file AArch64CallLowering.cpp.
|
overridevirtual |
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 from llvm::CallLowering.
Definition at line 474 of file AArch64CallLowering.cpp.
References llvm::CallLowering::checkReturn(), llvm::Function::getContext(), and llvm::MachineFunction::getFunction().
|
overridevirtual |
Reimplemented from llvm::CallLowering.
Definition at line 529 of file AArch64CallLowering.cpp.
References A, llvm::any_of(), llvm::dbgs(), EnableSVEGISel, F, llvm::MachineFunction::getFunction(), llvm::MachineFunction::getSubtarget(), and LLVM_DEBUG.
bool AArch64CallLowering::isEligibleForTailCallOptimization | ( | MachineIRBuilder & | MIRBuilder, |
CallLoweringInfo & | Info, | ||
SmallVectorImpl< ArgInfo > & | InArgs, | ||
SmallVectorImpl< ArgInfo > & | OutArgs | ||
) | const |
Returns true if the call can be lowered as a tail call.
Definition at line 920 of file AArch64CallLowering.cpp.
References A, llvm::any_of(), llvm::Function::args(), assert(), llvm::CallingConv::C, canGuaranteeTCO(), llvm::dbgs(), llvm::Function::getCallingConv(), llvm::MachineFunction::getFunction(), llvm::MachineIRBuilder::getMF(), llvm::MachineFunction::getTarget(), llvm::TargetMachine::getTargetTriple(), llvm::TargetOptions::GuaranteedTailCallOpt, llvm::GlobalValue::hasExternalWeakLinkage(), Info, LLVM_DEBUG, mayTailCallThisCC(), and llvm::TargetMachine::Options.
Referenced by lowerCall().
For targets which support the "returned" parameter attribute, returns true if the given type is a valid one to use with "returned".
Reimplemented from llvm::CallLowering.
Definition at line 1469 of file AArch64CallLowering.cpp.
References llvm::EVT::getSizeInBits().
|
overridevirtual |
This hook must be implemented to lower the given call instruction, including argument and return value marshalling.
Reimplemented from llvm::CallLowering.
Definition at line 1259 of file AArch64CallLowering.cpp.
References llvm::DstOp::addDefToMIB(), llvm::MachineInstrBuilder::addImm(), llvm::alignTo(), llvm::CallingConv::ARM64EC_Thunk_Native, llvm::CallingConv::ARM64EC_Thunk_X64, assert(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::AArch64FunctionInfo::branchTargetEnforcement(), llvm::MachineIRBuilder::buildCopy(), llvm::MachineIRBuilder::buildInstr(), llvm::MachineIRBuilder::buildInstrNoInsert(), llvm::MachineIRBuilder::buildZExt(), llvm::AArch64TargetLowering::CCAssignFnForReturn(), llvm::constrainOperandRegClass(), llvm::MachineOperand::CreateReg(), llvm::dbgs(), llvm::CallLowering::determineAndHandleAssignments(), DL, doesCalleeRestoreStack(), llvm::SmallVectorBase< Size_T >::empty(), extractPtrauthBlendDiscriminators(), F, getAssignFnsForCC(), llvm::objcarc::getAttachedARCFunction(), getCallOpcode(), llvm::Function::getContext(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getInfo(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::AArch64Subtarget::getInstrInfo(), llvm::Type::getInt8Ty(), llvm::getLLTForType(), getMaskForArgs(), llvm::MachineIRBuilder::getMF(), llvm::MachineInstrBuilder::getReg(), llvm::TargetSubtargetInfo::getRegBankInfo(), llvm::AArch64Subtarget::getRegBankInfo(), llvm::MachineFunction::getRegInfo(), llvm::AArch64Subtarget::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), llvm::MachineFunction::getTarget(), llvm::TargetOptions::GuaranteedTailCallOpt, llvm::objcarc::hasAttachedCallOpBundle(), llvm::AArch64Subtarget::hasCustomCallingConv(), llvm::AArch64PACKey::IA, llvm::AArch64PACKey::IB, llvm::RegState::Implicit, Info, llvm::MachineIRBuilder::insertInstr(), llvm::CallLowering::insertSRetLoads(), isEligibleForTailCallOptimization(), llvm::AArch64Subtarget::isWindowsArm64EC(), LLVM_DEBUG, llvm::AArch64II::MO_GOT, MRI, llvm::TargetMachine::Options, llvm::CallLowering::ArgInfo::Regs, llvm::LLT::scalar(), llvm::CallLowering::splitToValueTypes(), TRI, and llvm::CallLowering::BaseArgInfo::Ty.
|
overridevirtual |
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 from llvm::CallLowering.
Definition at line 638 of file AArch64CallLowering.cpp.
References llvm::alignTo(), llvm::CallingConv::ARM64EC_Thunk_Native, llvm::CallingConv::ARM64EC_Thunk_X64, assert(), llvm::MachineBasicBlock::begin(), llvm::MachineIRBuilder::buildAssertZExt(), llvm::MachineIRBuilder::buildTrunc(), llvm::FunctionLoweringInfo::CanLowerReturn, llvm::AArch64TargetLowering::CCAssignFnForCall(), llvm::MachineFrameInfo::CreateFixedObject(), llvm::FunctionLoweringInfo::DemoteRegister, llvm::CallLowering::determineAssignments(), DL, doesCalleeRestoreStack(), llvm::SmallVectorBase< Size_T >::empty(), llvm::MachineBasicBlock::empty(), F, llvm::AttributeList::FirstArgIndex, llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getInfo(), llvm::MachineIRBuilder::getMBB(), llvm::MachineIRBuilder::getMF(), llvm::MachineInstrBuilder::getReg(), llvm::MachineFunction::getRegInfo(), llvm::MachineFunction::getSubtarget(), llvm::MachineFunction::getTarget(), llvm::TargetOptions::GuaranteedTailCallOpt, llvm::CallLowering::handleAssignments(), handleMustTailForwardedRegisters(), llvm::CallLowering::insertSRetIncomingArgument(), MBB, MRI, llvm::TargetMachine::Options, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::LLT::scalar(), llvm::CallLowering::setArgFlags(), llvm::AArch64FunctionInfo::setArgumentStackToRestore(), llvm::AArch64FunctionInfo::setBytesInStackArgArea(), llvm::MachineIRBuilder::setInstr(), llvm::MachineIRBuilder::setMBB(), llvm::AArch64FunctionInfo::setVarArgsStackIndex(), and llvm::CallLowering::splitToValueTypes().
|
overridevirtual |
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 from llvm::CallLowering.
Definition at line 357 of file AArch64CallLowering.cpp.
References assert(), llvm::MachineIRBuilder::buildCopy(), llvm::MachineIRBuilder::buildInstr(), llvm::MachineIRBuilder::buildInstrNoInsert(), llvm::MachineIRBuilder::buildPadVectorWithUndefElements(), llvm::MachineIRBuilder::buildZExt(), llvm::FunctionLoweringInfo::CanLowerReturn, CC, llvm::AArch64TargetLowering::CCAssignFnForReturn(), llvm::ComputeValueVTs(), llvm::dbgs(), llvm::FunctionLoweringInfo::DemoteRegister, llvm::CallLowering::determineAndHandleAssignments(), DL, llvm::ArrayRef< T >::empty(), F, llvm::CallLowering::BaseArgInfo::Flags, llvm::Type::getContext(), llvm::MachineFunction::getFunction(), llvm::getLLTForType(), llvm::MachineIRBuilder::getMF(), llvm::LLT::getNumElements(), llvm::AArch64TargetLowering::getNumRegistersForCallingConv(), getReg(), llvm::MachineInstrBuilder::getReg(), llvm::MachineFunction::getRegInfo(), llvm::AArch64TargetLowering::getRegisterTypeForCallingConv(), llvm::MachineFunction::getSubtarget(), llvm::Value::getType(), llvm::EVT::getTypeForEVT(), llvm::RegState::Implicit, llvm::MachineIRBuilder::insertInstr(), llvm::CallLowering::insertSRetStores(), llvm::LLT::isVector(), llvm::MVT::isVector(), LLVM_DEBUG, MRI, llvm::CallLowering::ArgInfo::Regs, llvm::AttributeList::ReturnIndex, llvm::LLT::scalar(), llvm::CallLowering::setArgFlags(), llvm::ArrayRef< T >::size(), llvm::SmallVectorBase< Size_T >::size(), llvm::CallLowering::splitToValueTypes(), Success, and llvm::CallLowering::BaseArgInfo::Ty.
|
inlineoverridevirtual |
Reimplemented from llvm::CallLowering.
Definition at line 58 of file AArch64CallLowering.h.