LLVM
8.0.1
|
#include "llvm/CodeGen/GlobalISel/CallLowering.h"
Classes | |
struct | ArgInfo |
struct | ValueHandler |
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... | |
Public Member Functions | |
CallLowering (const TargetLowering *TLI) | |
virtual | ~CallLowering ()=default |
virtual bool | lowerReturn (MachineIRBuilder &MIRBuilder, const Value *Val, ArrayRef< unsigned > VRegs) const |
This hook must be implemented to lower outgoing return values, described by Val , into the specified virtual registers VRegs . More... | |
virtual bool | lowerFormalArguments (MachineIRBuilder &MIRBuilder, const Function &F, ArrayRef< unsigned > VRegs) const |
This hook must be implemented to lower the incoming (formal) arguments, described by Args , for GlobalISel. More... | |
virtual bool | lowerCall (MachineIRBuilder &MIRBuilder, CallingConv::ID CallConv, const MachineOperand &Callee, const ArgInfo &OrigRet, ArrayRef< ArgInfo > OrigArgs) const |
This hook must be implemented to lower the given call instruction, including argument and return value marshalling. More... | |
bool | lowerCall (MachineIRBuilder &MIRBuilder, ImmutableCallSite CS, unsigned ResReg, ArrayRef< unsigned > ArgRegs, std::function< unsigned()> GetCalleeReg) const |
Lower the given call instruction, including argument and return value marshalling. More... | |
Protected Member Functions | |
const TargetLowering * | getTLI () const |
Getter for generic TargetLowering class. More... | |
template<class XXXTargetLowering > | |
const XXXTargetLowering * | getTLI () const |
Getter for target specific TargetLowering class. More... | |
template<typename FuncInfoTy > | |
void | setArgFlags (ArgInfo &Arg, unsigned OpIdx, const DataLayout &DL, const FuncInfoTy &FuncInfo) const |
bool | handleAssignments (MachineIRBuilder &MIRBuilder, ArrayRef< ArgInfo > Args, ValueHandler &Handler) const |
Invoke Handler::assignArg on each of the given Args and then use Callback to move them to the assigned locations. More... | |
Definition at line 40 of file CallLowering.h.
|
inline |
Definition at line 141 of file CallLowering.h.
References ~CallLowering().
|
virtualdefault |
Referenced by CallLowering().
|
inlineprotected |
Getter for generic TargetLowering class.
Definition at line 119 of file CallLowering.h.
Referenced by setArgFlags().
|
inlineprotected |
Getter for target specific TargetLowering class.
Definition at line 125 of file CallLowering.h.
References Arg, llvm::AMDGPU::HSAMD::Kernel::Key::Args, handleAssignments(), and setArgFlags().
|
protected |
Invoke Handler::assignArg on each of the given Args
and then use Callback
to move them to the assigned locations.
Definition at line 112 of file CallLowering.cpp.
References llvm::alignTo(), assert(), llvm::CallLowering::ValueHandler::assignArg(), llvm::CallLowering::ValueHandler::assignCustomValue(), llvm::CallLowering::ValueHandler::assignValueToAddress(), llvm::CallLowering::ValueHandler::assignValueToReg(), F(), llvm::CCValAssign::Full, llvm::Function::getCallingConv(), llvm::Function::getContext(), llvm::Module::getDataLayout(), llvm::MachineFunction::getFunction(), llvm::MachineIRBuilder::getMF(), llvm::GlobalValue::getParent(), llvm::DataLayout::getPointerSize(), llvm::CallLowering::ValueHandler::getStackAddress(), llvm::MVT::getVT(), llvm::MVT::iPTR, llvm::Function::isVarArg(), llvm::makeArrayRef(), Reg, Size, and llvm::ArrayRef< T >::size().
Referenced by getTLI(), isSupportedType(), llvm::X86CallLowering::lowerCall(), llvm::ARMCallLowering::lowerCall(), llvm::AArch64CallLowering::lowerCall(), llvm::X86CallLowering::lowerFormalArguments(), llvm::ARMCallLowering::lowerFormalArguments(), llvm::AArch64CallLowering::lowerFormalArguments(), llvm::X86CallLowering::lowerReturn(), and llvm::AArch64CallLowering::lowerReturn().
|
inlinevirtual |
This hook must be implemented to lower the given call instruction, including argument and return value marshalling.
CallConv
is the calling convention to be used for the call.
Callee
is the destination of the call. It should be either a register, globaladdress, or externalsymbol.
ResTy
is the type returned by the function
ResReg
is the generic virtual register that the returned value should be lowered into.
ArgTys
is a list of the types each member of ArgRegs
has; used by the target to decide which register/stack slot should be allocated.
ArgRegs
is a list of virtual registers containing each argument that needs to be passed.
Reimplemented in llvm::MipsCallLowering, llvm::AArch64CallLowering, llvm::ARMCallLowering, and llvm::X86CallLowering.
Definition at line 189 of file CallLowering.h.
References function.
Referenced by lowerCall().
bool CallLowering::lowerCall | ( | MachineIRBuilder & | MIRBuilder, |
ImmutableCallSite | CS, | ||
unsigned | ResReg, | ||
ArrayRef< unsigned > | ArgRegs, | ||
std::function< unsigned()> | GetCalleeReg | ||
) | const |
Lower the given call instruction, including argument and return value marshalling.
CI
is the call/invoke instruction.
ResReg
is a register where the call's return value should be stored (or 0 if there is no return value).
ArgRegs
is a list of virtual registers containing each argument that needs to be passed.
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 28 of file CallLowering.cpp.
References Arg, llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::args(), Callee, llvm::MachineOperand::CreateGA(), llvm::MachineOperand::CreateImm(), llvm::MachineOperand::CreateReg(), F(), llvm::AttributeList::FirstArgIndex, llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getCalledFunction(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getCallingConv(), llvm::Module::getDataLayout(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getFunctionType(), llvm::FunctionType::getNumParams(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getParent(), llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), llvm::Value::getType(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getType(), lowerCall(), NumFixedArgs, llvm::SmallVectorTemplateBase< T >::push_back(), llvm::AttributeList::ReturnIndex, and setArgFlags().
|
inlinevirtual |
This hook must be implemented to lower the incoming (formal) arguments, described by Args
, for GlobalISel.
Each argument must end up in the related virtual register described by VRegs. In other words, the first argument should end up in VRegs[0], the second in VRegs[1], and so on. MIRBuilder
is set to the proper insertion for the argument lowering.
Reimplemented in llvm::MipsCallLowering, llvm::AArch64CallLowering, llvm::ARMCallLowering, llvm::AMDGPUCallLowering, and llvm::X86CallLowering.
Definition at line 163 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.
Reimplemented in llvm::MipsCallLowering, llvm::AArch64CallLowering, llvm::AMDGPUCallLowering, llvm::ARMCallLowering, and llvm::X86CallLowering.
Definition at line 149 of file CallLowering.h.
|
protected |
Definition at line 64 of file CallLowering.cpp.
References Arg, llvm::AMDGPU::HSAMD::Kernel::Key::Attrs, llvm::Attribute::ByVal, llvm::CallLowering::ArgInfo::Flags, llvm::DataLayout::getABITypeAlignment(), llvm::TargetLoweringBase::getByValTypeAlignment(), getTLI(), llvm::DataLayout::getTypeAllocSize(), llvm::AttributeList::hasAttribute(), llvm::Attribute::InAlloca, llvm::Attribute::InReg, llvm::ISD::ArgFlagsTy::isByVal(), llvm::ISD::ArgFlagsTy::isInAlloca(), llvm::Attribute::Nest, llvm::ISD::ArgFlagsTy::setByVal(), llvm::ISD::ArgFlagsTy::setByValAlign(), llvm::ISD::ArgFlagsTy::setByValSize(), llvm::ISD::ArgFlagsTy::setInAlloca(), llvm::ISD::ArgFlagsTy::setInReg(), llvm::ISD::ArgFlagsTy::setNest(), llvm::ISD::ArgFlagsTy::setOrigAlign(), llvm::ISD::ArgFlagsTy::setSExt(), llvm::ISD::ArgFlagsTy::setSRet(), llvm::ISD::ArgFlagsTy::setSwiftError(), llvm::ISD::ArgFlagsTy::setSwiftSelf(), llvm::ISD::ArgFlagsTy::setZExt(), llvm::Attribute::SExt, llvm::Attribute::StructRet, llvm::Attribute::SwiftError, llvm::Attribute::SwiftSelf, llvm::CallLowering::ArgInfo::Ty, and llvm::Attribute::ZExt.
Referenced by getTLI(), isSupportedType(), lowerCall(), llvm::X86CallLowering::lowerFormalArguments(), llvm::AMDGPUCallLowering::lowerFormalArguments(), llvm::ARMCallLowering::lowerFormalArguments(), llvm::AArch64CallLowering::lowerFormalArguments(), llvm::MipsCallLowering::lowerFormalArguments(), llvm::X86CallLowering::lowerReturn(), llvm::AArch64CallLowering::lowerReturn(), and llvm::MipsCallLowering::lowerReturn().