LLVM  6.0.0svn
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  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, unsigned VReg) const
 This hook must be implemented to lower outgoing return values, described by Val, into the specified virtual register VReg. 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 TargetLoweringgetTLI () 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 OpNum, const DataLayout &DL, const FuncInfoTy &FuncInfo) const
 
bool handleAssignments (MachineIRBuilder &MIRBuilder, ArrayRef< ArgInfo > Args, ValueHandler &Callback) const
 Invoke Handler::assignArg on each of the given Args and then use Callback to move them to the assigned locations. More...
 

Detailed Description

Definition at line 40 of file CallLowering.h.

Constructor & Destructor Documentation

◆ CallLowering()

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

Definition at line 137 of file CallLowering.h.

References ~CallLowering().

◆ ~CallLowering()

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

Referenced by CallLowering().

Member Function Documentation

◆ getTLI() [1/2]

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

Getter for generic TargetLowering class.

Definition at line 115 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 121 of file CallLowering.h.

References Arg, llvm::AMDGPU::HSAMD::Kernel::Key::Args, handleAssignments(), and setArgFlags().

◆ handleAssignments()

bool CallLowering::handleAssignments ( MachineIRBuilder MIRBuilder,
ArrayRef< ArgInfo Args,
ValueHandler Callback 
) const
protected

◆ lowerCall() [1/2]

virtual bool llvm::CallLowering::lowerCall ( MachineIRBuilder MIRBuilder,
CallingConv::ID  CallConv,
const MachineOperand Callee,
const ArgInfo OrigRet,
ArrayRef< ArgInfo OrigArgs 
) const
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.

Returns
true if the lowering succeeded, false otherwise.

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

Definition at line 185 of file CallLowering.h.

References function.

Referenced by llvm::IRTranslator::getAnalysisUsage(), and lowerCall().

◆ lowerCall() [2/2]

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.

Returns
true if the lowering succeeded, false otherwise.

Definition at line 26 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, isPodLike< T >::value >::push_back(), llvm::AttributeList::ReturnIndex, and setArgFlags().

◆ lowerFormalArguments()

virtual bool llvm::CallLowering::lowerFormalArguments ( MachineIRBuilder MIRBuilder,
const Function F,
ArrayRef< unsigned VRegs 
) const
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.

Returns
True if the lowering succeeded, false otherwise.

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

Definition at line 159 of file CallLowering.h.

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

◆ lowerReturn()

virtual bool llvm::CallLowering::lowerReturn ( MachineIRBuilder MIRBuilder,
const Value Val,
unsigned  VReg 
) const
inlinevirtual

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

This hook is used by GlobalISel.

Returns
True if the lowering succeeds, false otherwise.

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

Definition at line 145 of file CallLowering.h.

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

◆ setArgFlags()

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

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