14 #ifndef LLVM_CODEGEN_GLOBALISEL_CALLLOWERING_H 15 #define LLVM_CODEGEN_GLOBALISEL_CALLLOWERING_H 33 class MachineIRBuilder;
35 struct MachinePointerInfo;
36 class MachineRegisterInfo;
44 virtual void anchor();
59 : Regs(Regs.
begin(), Regs.
end()), Ty(Ty),
60 Flags(Flags.
begin(), Flags.
end()), IsFixed(IsFixed) {
65 "only void types should have no register");
92 bool IsMustTailCall =
false;
96 bool IsTailCall =
false;
100 bool LoweredTailCall =
false;
103 bool IsVarArg =
false;
115 : MIRBuilder(MIRBuilder), MRI(MRI), AssignFn(AssignFn) {}
121 virtual bool isIncomingArgumentHandler()
const = 0;
160 return AssignFn(ValNo, ValVT, LocVT, LocInfo, Flags, State);
168 virtual void anchor();
178 template <
class XXXTargetLowering>
179 const XXXTargetLowering *
getTLI()
const {
180 return static_cast<const XXXTargetLowering *
>(TLI);
183 template <
typename FuncInfoTy>
185 const FuncInfoTy &FuncInfo)
const;
268 assert(SwiftErrorVReg == 0 &&
"attempt to use unsupported swifterror");
339 #endif // LLVM_CODEGEN_GLOBALISEL_CALLLOWERING_H A parsed version of the target data layout string in and methods for querying it. ...
const_iterator end(StringRef path)
Get end iterator over path.
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
ValueHandler(MachineIRBuilder &MIRBuilder, MachineRegisterInfo &MRI, CCAssignFn *AssignFn)
This class represents lattice values for constants.
ArgInfo(ArrayRef< Register > Regs, Type *Ty, ArrayRef< ISD::ArgFlagsTy > Flags=ArrayRef< ISD::ArgFlagsTy >(), bool IsFixed=true)
MachineRegisterInfo & MRI
void push_back(const T &Elt)
bool handleAssignments(MachineIRBuilder &MIRBuilder, SmallVectorImpl< ArgInfo > &Args, ValueHandler &Handler) const
Invoke Handler::assignArg on each of the given Args and then use Callback to move them to the assigne...
bool CCAssignFn(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
CCAssignFn - This function assigns a location for Val, updating State to reflect the change...
C - The default llvm calling convention, compatible with C.
virtual bool lowerReturn(MachineIRBuilder &MIRBuilder, const Value *Val, ArrayRef< Register > VRegs) const
This hook behaves as the extended lowerReturn function, but for targets that do not support swifterro...
virtual bool assignArg(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, const ArgInfo &Info, ISD::ArgFlagsTy Flags, CCState &State)
SmallVector< ISD::ArgFlagsTy, 4 > Flags
const TargetLowering * getTLI() const
Getter for generic TargetLowering class.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
virtual bool lowerCall(MachineIRBuilder &MIRBuilder, CallLoweringInfo &Info) const
This hook must be implemented to lower the given call instruction, including argument and return valu...
const XXXTargetLowering * getTLI() const
Getter for target specific TargetLowering class.
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
bool analyzeArgInfo(CCState &CCState, SmallVectorImpl< ArgInfo > &Args, CCAssignFn &AssignFnFixed, CCAssignFn &AssignFnVarArg) const
Analyze passed or returned values from a call, supplied in ArgInfo, incorporating info about the pass...
Analysis containing CSE Info
bool isVoidTy() const
Return true if this is 'void'.
virtual bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, const Function &F, ArrayRef< ArrayRef< Register >> VRegs) const
This hook must be implemented to lower the incoming (formal) arguments, described by VRegs...
virtual ~CallLowering()=default
unsigned const MachineRegisterInfo * MRI
The instances of the Type class are immutable: once they are created, they are never changed...
bool resultsCompatible(CallLoweringInfo &Info, MachineFunction &MF, SmallVectorImpl< ArgInfo > &InArgs, CCAssignFn &CalleeAssignFnFixed, CCAssignFn &CalleeAssignFnVarArg, CCAssignFn &CallerAssignFnFixed, CCAssignFn &CallerAssignFnVarArg) const
Helper class to build MachineInstr.
Register packRegs(ArrayRef< Register > SrcRegs, Type *PackedTy, MachineIRBuilder &MIRBuilder) const
Generate instructions for packing SrcRegs into one big register corresponding to the aggregate type P...
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
void setArgFlags(ArgInfo &Arg, unsigned OpIdx, const DataLayout &DL, const FuncInfoTy &FuncInfo) const
CallLowering(const TargetLowering *TLI)
Argument handling is mostly uniform between the four places that make these decisions: function forma...
This class contains a discriminated union of information about pointers in memory operands...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
virtual unsigned assignCustomValue(const ArgInfo &Arg, ArrayRef< CCValAssign > VAs)
Handle custom values, which may be passed into one or more of VAs.
SmallVector< ArgInfo, 8 > OrigArgs
List of descriptors of the arguments passed to the function.
void unpackRegs(ArrayRef< Register > DstRegs, Register SrcReg, Type *PackedTy, MachineIRBuilder &MIRBuilder) const
Generate instructions for unpacking SrcReg into the DstRegs corresponding to the aggregate type Packe...
CCState - This class holds information needed while lowering arguments and return values...
MachineOperand class - Representation of each machine instruction operand.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
CCValAssign - Represent assignment of one arg/retval to a location.
amdgpu Simplify well known AMD library false FunctionCallee Callee
SmallVector< Register, 2 > OrigRegs
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
LLVM_NODISCARD bool empty() const
Establish a view to a call site for examination.
static MachineOperand CreateImm(int64_t Val)
virtual bool supportSwiftError() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
print Print MemDeps of function
SmallVector< Register, 4 > Regs
virtual bool lowerReturn(MachineIRBuilder &MIRBuilder, const Value *Val, ArrayRef< Register > VRegs, Register SwiftErrorVReg) const
This hook must be implemented to lower outgoing return values, described by Val, into the specified v...
MachineIRBuilder & MIRBuilder
ArgInfo OrigRet
Descriptor for the return type of the function.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Wrapper class representing virtual and physical registers.
bool empty() const
empty - Check if the array is empty.