LLVM  13.0.0git
Public Member Functions | Public Attributes | List of all members
llvm::CallLowering::ValueHandler Struct Referenceabstract

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...

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

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

Public Member Functions

 ValueHandler (bool IsIncoming, MachineIRBuilder &MIRBuilder, MachineRegisterInfo &MRI, CCAssignFn *AssignFn)
 
virtual ~ValueHandler ()=default
 
bool isIncomingArgumentHandler () const
 Returns true if the handler is dealing with incoming arguments, i.e. More...
 
virtual Register getStackAddress (uint64_t Size, int64_t Offset, MachinePointerInfo &MPO, ISD::ArgFlagsTy Flags)=0
 Materialize a VReg containing the address of the specified stack-based object. More...
 
virtual uint64_t getStackValueStoreSize (const CCValAssign &VA) const
 Return the in-memory size to write for the argument at VA. More...
 
virtual void assignValueToReg (Register ValVReg, Register PhysReg, CCValAssign &VA)=0
 The specified value has been assigned to a physical register, handle the appropriate COPY (either to or from) and mark any relevant uses/defines as needed. More...
 
virtual void assignValueToAddress (Register ValVReg, Register Addr, uint64_t Size, MachinePointerInfo &MPO, CCValAssign &VA)=0
 The specified value has been assigned to a stack location. More...
 
virtual void assignValueToAddress (const ArgInfo &Arg, unsigned ValRegIndex, Register Addr, uint64_t Size, MachinePointerInfo &MPO, CCValAssign &VA)
 An overload which takes an ArgInfo if additional information about the arg is needed. More...
 
virtual unsigned assignCustomValue (const ArgInfo &Arg, ArrayRef< CCValAssign > VAs)
 Handle custom values, which may be passed into one or more of VAs. More...
 
void copyArgumentMemory (const ArgInfo &Arg, Register DstPtr, Register SrcPtr, const MachinePointerInfo &DstPtrInfo, Align DstAlign, const MachinePointerInfo &SrcPtrInfo, Align SrcAlign, uint64_t MemSize, CCValAssign &VA) const
 Do a memory copy of MemSize bytes from SrcPtr to DstPtr. More...
 
Register extendRegister (Register ValReg, CCValAssign &VA, unsigned MaxSizeBits=0)
 Extend a register to the location type given in VA, capped at extending to at most MaxSize bits. More...
 
virtual bool assignArg (unsigned ValNo, EVT OrigVT, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, const ArgInfo &Info, ISD::ArgFlagsTy Flags, CCState &State)
 Wrap call to (typically tablegenerated CCAssignFn). More...
 

Public Attributes

MachineIRBuilderMIRBuilder
 
MachineRegisterInfoMRI
 
CCAssignFnAssignFn
 

Detailed Description

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.

However, once a decision has been made on where an argument should go, exactly what happens can vary slightly. This class abstracts the differences.

Definition at line 145 of file CallLowering.h.

Constructor & Destructor Documentation

◆ ValueHandler()

llvm::CallLowering::ValueHandler::ValueHandler ( bool  IsIncoming,
MachineIRBuilder MIRBuilder,
MachineRegisterInfo MRI,
CCAssignFn AssignFn 
)
inline

Definition at line 146 of file CallLowering.h.

◆ ~ValueHandler()

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

Member Function Documentation

◆ assignArg()

virtual bool llvm::CallLowering::ValueHandler::assignArg ( unsigned  ValNo,
EVT  OrigVT,
MVT  ValVT,
MVT  LocVT,
CCValAssign::LocInfo  LocInfo,
const ArgInfo Info,
ISD::ArgFlagsTy  Flags,
CCState State 
)
inlinevirtual

Wrap call to (typically tablegenerated CCAssignFn).

This may be overridden to track additional state information as arguments are assigned or apply target specific hacks around the legacy infrastructure.

Definition at line 226 of file CallLowering.h.

References AssignFn.

Referenced by llvm::CallLowering::handleAssignments().

◆ assignCustomValue()

virtual unsigned llvm::CallLowering::ValueHandler::assignCustomValue ( const ArgInfo Arg,
ArrayRef< CCValAssign VAs 
)
inlinevirtual

Handle custom values, which may be passed into one or more of VAs.

Returns
The number of VAs that have been assigned after the first one, and which should therefore be skipped from further processing.

Definition at line 202 of file CallLowering.h.

References llvm_unreachable.

Referenced by llvm::CallLowering::handleAssignments().

◆ assignValueToAddress() [1/2]

virtual void llvm::CallLowering::ValueHandler::assignValueToAddress ( const ArgInfo Arg,
unsigned  ValRegIndex,
Register  Addr,
uint64_t  Size,
MachinePointerInfo MPO,
CCValAssign VA 
)
inlinevirtual

An overload which takes an ArgInfo if additional information about the arg is needed.

ValRegIndex is the index in Arg.Regs for the value to store.

Definition at line 191 of file CallLowering.h.

References Addr, Arg, assignValueToAddress(), and llvm::Check::Size.

◆ assignValueToAddress() [2/2]

virtual void llvm::CallLowering::ValueHandler::assignValueToAddress ( Register  ValVReg,
Register  Addr,
uint64_t  Size,
MachinePointerInfo MPO,
CCValAssign VA 
)
pure virtual

The specified value has been assigned to a stack location.

Load or store it there, with appropriate extension if necessary.

Referenced by assignValueToAddress(), and llvm::CallLowering::handleAssignments().

◆ assignValueToReg()

virtual void llvm::CallLowering::ValueHandler::assignValueToReg ( Register  ValVReg,
Register  PhysReg,
CCValAssign VA 
)
pure virtual

The specified value has been assigned to a physical register, handle the appropriate COPY (either to or from) and mark any relevant uses/defines as needed.

Implemented in llvm::CallLowering::IncomingValueHandler.

Referenced by llvm::CallLowering::handleAssignments().

◆ copyArgumentMemory()

void CallLowering::ValueHandler::copyArgumentMemory ( const ArgInfo Arg,
Register  DstPtr,
Register  SrcPtr,
const MachinePointerInfo DstPtrInfo,
Align  DstAlign,
const MachinePointerInfo SrcPtrInfo,
Align  SrcAlign,
uint64_t  MemSize,
CCValAssign VA 
) const

◆ extendRegister()

Register CallLowering::ValueHandler::extendRegister ( Register  ValReg,
CCValAssign VA,
unsigned  MaxSizeBits = 0 
)

◆ getStackAddress()

virtual Register llvm::CallLowering::ValueHandler::getStackAddress ( uint64_t  Size,
int64_t  Offset,
MachinePointerInfo MPO,
ISD::ArgFlagsTy  Flags 
)
pure virtual

Materialize a VReg containing the address of the specified stack-based object.

This is either based on a FrameIndex or direct SP manipulation, depending on the context. MPO should be initialized to an appropriate description of the address created.

Referenced by llvm::CallLowering::handleAssignments().

◆ getStackValueStoreSize()

uint64_t CallLowering::ValueHandler::getStackValueStoreSize ( const CCValAssign VA) const
virtual

Return the in-memory size to write for the argument at VA.

This may be smaller than the allocated stack slot size.

This is overridable primarily for targets to maintain compatibility with hacks around the existing DAG call lowering infrastructure.

FIXME: We need to get the correct pointer address space.

Definition at line 1007 of file CallLowering.cpp.

References DL, llvm::MachineIRBuilder::getDataLayout(), llvm::EVT::getStoreSize(), llvm::CCValAssign::getValVT(), llvm::MVT::iPTR, and MIRBuilder.

Referenced by llvm::CallLowering::handleAssignments().

◆ isIncomingArgumentHandler()

bool llvm::CallLowering::ValueHandler::isIncomingArgumentHandler ( ) const
inline

Returns true if the handler is dealing with incoming arguments, i.e.

those that move values from some physical location to vregs.

Definition at line 155 of file CallLowering.h.

Referenced by llvm::CallLowering::handleAssignments().

Member Data Documentation

◆ AssignFn

CCAssignFn* llvm::CallLowering::ValueHandler::AssignFn

Definition at line 234 of file CallLowering.h.

Referenced by assignArg().

◆ MIRBuilder

MachineIRBuilder& llvm::CallLowering::ValueHandler::MIRBuilder

Definition at line 232 of file CallLowering.h.

Referenced by getStackValueStoreSize().

◆ MRI

MachineRegisterInfo& llvm::CallLowering::ValueHandler::MRI

Definition at line 233 of file CallLowering.h.


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