47 #define DEBUG_TYPE "aarch64-call-lowering" 58 :
ValueHandler(MIRBuilder, MRI, AssignFn), StackUsed(0) {}
67 StackUsed =
std::max(StackUsed, Size + Offset);
73 markPhysRegUsed(PhysReg);
78 case CCValAssign::LocInfo::SExt:
79 case CCValAssign::LocInfo::ZExt:
80 case CCValAssign::LocInfo::AExt: {
94 MIRBuilder.
buildLoad(ValVReg, Addr, *MMO);
100 virtual void markPhysRegUsed(
unsigned PhysReg) = 0;
102 bool isIncomingArgumentHandler()
const override {
return true; }
107 struct FormalArgHandler :
public IncomingArgHandler {
110 : IncomingArgHandler(MIRBuilder, MRI, AssignFn) {}
112 void markPhysRegUsed(
unsigned PhysReg)
override {
118 struct CallReturnHandler :
public IncomingArgHandler {
121 : IncomingArgHandler(MIRBuilder, MRI, AssignFn), MIB(MIB) {}
123 void markPhysRegUsed(
unsigned PhysReg)
override {
133 CCAssignFn *AssignFnVarArg,
bool IsTailCall =
false,
136 AssignFnVarArg(AssignFnVarArg), IsTailCall(IsTailCall), FPDiff(FPDiff),
139 bool isIncomingArgumentHandler()
const override {
return false; }
172 Register ExtReg = extendRegister(ValVReg, VA);
178 if (VA.
getLocInfo() == CCValAssign::LocInfo::AExt) {
189 bool assignArg(
unsigned ValNo,
MVT ValVT,
MVT LocVT,
196 Res = AssignFn(ValNo, ValVT, LocVT, LocInfo, Flags, State);
198 Res = AssignFnVarArg(ValNo, ValVT, LocVT, LocInfo, Flags, State);
219 void AArch64CallLowering::splitToValueTypes(
225 if (OrigArg.Ty->isVoidTy())
232 if (SplitVTs.
size() == 1) {
235 SplitArgs.
emplace_back(OrigArg.Regs[0], SplitVTs[0].getTypeForEVT(Ctx),
236 OrigArg.Flags[0], OrigArg.IsFixed);
241 assert(OrigArg.Regs.size() == SplitVTs.
size() &&
"Regs / types mismatch");
244 OrigArg.Ty, CallConv,
false);
245 for (
unsigned i = 0,
e = SplitVTs.
size(); i <
e; ++i) {
246 Type *SplitTy = SplitVTs[i].getTypeForEVT(Ctx);
247 SplitArgs.
emplace_back(OrigArg.Regs[i], SplitTy, OrigArg.Flags[0],
250 SplitArgs.
back().Flags[0].setInConsecutiveRegs();
253 SplitArgs.
back().Flags[0].setInConsecutiveRegsLast();
262 "Return value without a vreg");
265 if (!VRegs.
empty()) {
278 "For each split Type there should be exactly one VReg.");
283 for (
unsigned i = 0; i < SplitEVTs.
size(); ++i) {
285 LLVM_DEBUG(
dbgs() <<
"Can't handle extended arg types which need split");
290 ArgInfo CurArgInfo =
ArgInfo{CurVReg, SplitEVTs[i].getTypeForEVT(Ctx)};
300 if (
EVT(NewVT) != SplitEVTs[i]) {
301 unsigned ExtendOp = TargetOpcode::G_ANYEXT;
304 ExtendOp = TargetOpcode::G_SEXT;
307 ExtendOp = TargetOpcode::G_ZEXT;
329 CurVReg = MIRBuilder.
buildInstr(ExtendOp, {NewLLT}, {CurVReg})
352 if (CurVReg != CurArgInfo.
Regs[0]) {
353 CurArgInfo.
Regs[0] = CurVReg;
357 splitToValueTypes(CurArgInfo, SplitArgs, DL, MRI, CC);
360 OutgoingArgHandler Handler(MIRBuilder, MRI, MIB, AssignFn, AssignFn);
364 if (SwiftErrorVReg) {
366 MIRBuilder.
buildCopy(AArch64::X21, SwiftErrorVReg);
387 assert(F.isVarArg() &&
"Expected F to be vararg?");
391 CCState CCInfo(F.getCallingConv(),
true, MF, ArgLocs,
400 CCInfo.analyzeMustTailForwardedRegisters(Forwards, RegParmTypes, AssignFn);
404 if (!CCInfo.isAllocated(AArch64::X8)) {
405 unsigned X8VReg = MF.
addLiveIn(AArch64::X8, &AArch64::GPR64RegClass);
410 for (
const auto &F : Forwards) {
433 splitToValueTypes(OrigArg, SplitArgs, DL, MRI, F.
getCallingConv());
444 FormalArgHandler Handler(MIRBuilder, MRI, AssignFn);
452 if (!Subtarget.isTargetDarwin()) {
459 StackOffset =
alignTo(Handler.StackUsed, Subtarget.isTargetILP32() ? 4 : 8);
469 StackOffset =
alignTo(StackOffset, 16);
486 if (Subtarget.hasCustomCallingConv())
516 static std::pair<CCAssignFn *, CCAssignFn *>
521 bool AArch64CallLowering::doCallerAndCalleePassArgsTheSameWay(
529 if (CalleeCC == CallerCC)
536 std::tie(CalleeAssignFnFixed, CalleeAssignFnVarArg) =
541 std::tie(CallerAssignFnFixed, CallerAssignFnVarArg) =
545 *CalleeAssignFnVarArg, *CallerAssignFnFixed,
546 *CallerAssignFnVarArg))
551 const uint32_t *CallerPreserved =
TRI->getCallPreservedMask(MF, CallerCC);
552 const uint32_t *CalleePreserved =
TRI->getCallPreservedMask(MF, CalleeCC);
554 TRI->UpdateCustomCallPreservedMask(MF, &CallerPreserved);
555 TRI->UpdateCustomCallPreservedMask(MF, &CalleePreserved);
558 return TRI->regmaskSubsetEqual(CallerPreserved, CalleePreserved);
561 bool AArch64CallLowering::areCalleeOutgoingArgsTailCallable(
581 if (!
analyzeArgInfo(OutInfo, OutArgs, *AssignFnFixed, *AssignFnVarArg)) {
589 LLVM_DEBUG(
dbgs() <<
"... Cannot fit call operands on caller's stack.\n");
597 const uint32_t *CallerPreservedMask =
TRI->getCallPreservedMask(MF, CallerCC);
600 for (
unsigned i = 0; i < OutLocs.
size(); ++i) {
601 auto &ArgLoc = OutLocs[i];
603 if (!ArgLoc.isRegLoc()) {
612 <<
"... Cannot tail call vararg function with stack arguments\n");
626 <<
"... Call has an argument passed in a callee-saved register.\n");
629 ArgInfo &OutInfo = OutArgs[i];
631 if (OutInfo.Regs.size() > 1) {
633 dbgs() <<
"... Cannot handle arguments in multiple registers.\n");
641 if (!RegDef || RegDef->
getOpcode() != TargetOpcode::COPY) {
644 <<
"... Parameter was not copied into a VReg, cannot tail call.\n");
650 if (CopyRHS != Reg) {
651 LLVM_DEBUG(
dbgs() <<
"... Callee-saved register was not copied into " 652 "VReg, cannot tail call.\n");
680 LLVM_DEBUG(
dbgs() <<
"... Cannot handle tail calls with swifterror yet.\n");
685 LLVM_DEBUG(
dbgs() <<
"... Calling convention cannot be tail called.\n");
707 return A.hasByValAttr() || A.hasInRegAttr() || A.hasSwiftErrorAttr();
709 LLVM_DEBUG(
dbgs() <<
"... Cannot tail call from callers with byval, " 710 "inreg, or swifterror arguments\n");
727 LLVM_DEBUG(
dbgs() <<
"... Cannot tail call externally-defined function " 728 "with weak linkage for this OS.\n");
743 "Unexpected variadic calling convention");
747 if (!doCallerAndCalleePassArgsTheSameWay(Info, MF, InArgs)) {
750 <<
"... Caller and callee have incompatible calling conventions.\n");
754 if (!areCalleeOutgoingArgsTailCallable(Info, MF, OutArgs))
758 dbgs() <<
"... Call is eligible for tail call optimization.\n");
768 return AArch64::TCRETURNdi;
773 return AArch64::TCRETURNriBTI;
775 return AArch64::TCRETURNri;
778 bool AArch64CallLowering::lowerTailCall(
794 dbgs() <<
"Cannot lower indirect tail calls with BTI enabled yet.\n");
806 CallSeqStart = MIRBuilder.
buildInstr(AArch64::ADJCALLSTACKDOWN);
820 TRI->UpdateCustomCallPreservedMask(MF, &Mask);
821 MIB.addRegMask(Mask);
823 if (
TRI->isAnyArgRegReserved(MF))
824 TRI->emitReservedArgRegCallError(MF);
836 unsigned NumBytes = 0;
841 unsigned NumReusableBytes = FuncInfo->getBytesInStackArgArea();
844 analyzeArgInfo(OutInfo, OutArgs, *AssignFnFixed, *AssignFnVarArg);
848 NumBytes =
alignTo(OutInfo.getNextStackOffset(), 16);
853 FPDiff = NumReusableBytes - NumBytes;
860 assert(FPDiff % 16 == 0 &&
"unaligned stack on tail call");
863 const auto &Forwards = FuncInfo->getForwardedMustTailRegParms();
867 OutgoingArgHandler Handler(MIRBuilder, MRI, MIB, AssignFnFixed,
868 AssignFnVarArg,
true, FPDiff);
872 if (
Info.IsVarArg &&
Info.IsMustTailCall) {
876 for (
const auto &F : Forwards) {
883 return TRI->regsOverlap(
Use.getReg(), ForwardedReg);
910 if (
Info.Callee.isReg())
917 Info.LoweredTailCall =
true;
930 for (
auto &OrigArg : Info.
OrigArgs) {
931 splitToValueTypes(OrigArg, OutArgs, DL, MRI, Info.
CallConv);
933 if (OrigArg.Ty->isIntegerTy(1))
934 OutArgs.back().Flags[0].setZExt();
942 bool CanTailCallOpt =
950 LLVM_DEBUG(
dbgs() <<
"Failed to lower musttail call as tail call\n");
955 return lowerTailCall(MIRBuilder, Info, OutArgs);
960 std::tie(AssignFnFixed, AssignFnVarArg) =
964 CallSeqStart = MIRBuilder.
buildInstr(AArch64::ADJCALLSTACKDOWN);
977 TRI->UpdateCustomCallPreservedMask(MF, &Mask);
978 MIB.addRegMask(Mask);
980 if (
TRI->isAnyArgRegReserved(MF))
981 TRI->emitReservedArgRegCallError(MF);
985 OutgoingArgHandler Handler(MIRBuilder, MRI, MIB, AssignFnFixed,
986 AssignFnVarArg,
false);
1007 CallReturnHandler Handler(MIRBuilder, MRI, MIB, RetAssignFn);
1017 uint64_t CalleePopBytes =
1020 ?
alignTo(Handler.StackSize, 16)
1024 MIRBuilder.
buildInstr(AArch64::ADJCALLSTACKUP)
1025 .
addImm(Handler.StackSize)
bool isVarArg() const
isVarArg - Return true if this function takes a variable number of arguments.
static std::pair< CCAssignFn *, CCAssignFn * > getAssignFnsForCC(CallingConv::ID CC, const AArch64TargetLowering &TLI)
Returns a pair containing the fixed CCAssignFn and the vararg CCAssignFn for CC.
virtual MachineInstrBuilder buildConstant(const DstOp &Res, const ConstantInt &Val)
Build and insert Res = G_CONSTANT Val.
const MachineInstrBuilder & add(const MachineOperand &MO) const
A parsed version of the target data layout string in and methods for querying it. ...
reference emplace_back(ArgTypes &&... Args)
MachineOperand Callee
Destination of the call.
static LLT pointer(unsigned AddressSpace, unsigned SizeInBits)
Get a low-level pointer in the given address space.
AArch64FunctionInfo - This class is derived from MachineFunctionInfo and contains private AArch64-spe...
This class represents an incoming formal argument to a Function.
StackOffset is a wrapper around scalable and non-scalable offsets and is used in several functions su...
unsigned constrainOperandRegClass(const MachineFunction &MF, const TargetRegisterInfo &TRI, MachineRegisterInfo &MRI, const TargetInstrInfo &TII, const RegisterBankInfo &RBI, MachineInstr &InsertPt, const TargetRegisterClass &RegClass, const MachineOperand &RegMO, unsigned OpIdx)
Constrain the Register operand OpIdx, so that it is now constrained to the TargetRegisterClass passed...
This class represents lattice values for constants.
Describes a register that needs to be forwarded from the prologue to a musttail call.
bool hasCustomCallingConv() const
Register getReg(unsigned Idx) const
Get the register for the operand index.
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
bool isVector() const
Return true if this is a vector value type.
void addLiveIn(unsigned Reg, unsigned vreg=0)
addLiveIn - Add the specified register as a live-in.
void push_back(const T &Elt)
unsigned addLiveIn(unsigned PReg, const TargetRegisterClass *RC)
addLiveIn - Add the specified physical register as a live-in value and create a corresponding virtual...
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...
TypeSize getSizeInBits() const
Returns the size of the specified MVT in bits.
void setVarArgsStackIndex(int Index)
MachineInstrBuilder buildPtrAdd(const DstOp &Res, const SrcOp &Op0, const SrcOp &Op1)
Build and insert Res = G_PTR_ADD Op0, Op1.
bool IsMustTailCall
True if the call must be tail call optimized.
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...
LLT getType(unsigned Reg) const
Get the low-level type of Reg or LLT{} if Reg is not a generic (target independent) virtual register...
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
C - The default llvm calling convention, compatible with C.
virtual const RegisterBankInfo * getRegBankInfo() const
If the information for the register banks is available, return it.
unsigned const TargetRegisterInfo * TRI
bool hasExternalWeakLinkage() const
static bool doesCalleeRestoreStack(CallingConv::ID CallConv, bool TailCallOpt)
Register SwiftErrorVReg
Valid if the call has a swifterror inout parameter, and contains the vreg that the swifterror should ...
MachineInstr * getDefIgnoringCopies(Register Reg, const MachineRegisterInfo &MRI)
Find the def instruction for Reg, folding away any trivial copies.
bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, const Function &F, ArrayRef< ArrayRef< Register >> VRegs) const override
This hook must be implemented to lower the incoming (formal) arguments, described by VRegs...
bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return true if the attribute exists at the given index.
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
static unsigned getCallOpcode(const Function &CallerF, bool IsIndirect, bool IsTailCall)
MachineInstrBuilder buildAnyExt(const DstOp &Res, const SrcOp &Op)
Build and insert Res = G_ANYEXT Op0.
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
Type * getTypeForEVT(LLVMContext &Context) const
This method returns an LLVM type corresponding to the specified EVT.
virtual MVT getRegisterTypeForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const
Certain combinations of ABIs, Targets and features require that types are legal for some operations a...
A Use represents the edge between a Value definition and its users.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This file contains the simple types necessary to represent the attributes associated with functions a...
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, uint64_t s, unsigned base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
LocInfo getLocInfo() const
const MachineInstrBuilder & addDef(Register RegNo, unsigned Flags=0, unsigned SubReg=0) const
Add a virtual register definition operand.
void setArgumentStackToRestore(unsigned bytes)
unsigned getNextStackOffset() const
getNextStackOffset - Return the next stack offset such that all stack slots satisfy their alignment r...
Type * getType() const
All values are typed, get the type of this value.
TypeSize getTypeStoreSize(Type *Ty) const
Returns the maximum number of bytes that may be overwritten by storing the specified type...
const AArch64RegisterInfo * getRegisterInfo() const override
MachineInstrBuilder buildInstrNoInsert(unsigned Opcode)
Build but don't insert <empty> = Opcode <empty>.
MachineFunction & getMF()
Getter for the function we currently build.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
AttributeList getAttributes() const
Return the attribute list for this Function.
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...
void setReg(Register Reg)
Change the register this operand corresponds to.
virtual const TargetInstrInfo * getInstrInfo() const
static LLT scalar(unsigned SizeInBits)
Get a low-level scalar or aggregate "bag of bits".
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
bool functionArgumentNeedsConsecutiveRegisters(Type *Ty, CallingConv::ID CallConv, bool isVarArg) const override
For some targets, an LLVM struct type must be broken down into multiple simple types, but the calling convention specifies that the entire struct must be passed in a block of consecutive registers.
void ComputeValueVTs(const TargetLowering &TLI, const DataLayout &DL, Type *Ty, SmallVectorImpl< EVT > &ValueVTs, SmallVectorImpl< uint64_t > *Offsets=nullptr, uint64_t StartingOffset=0)
ComputeValueVTs - Given an LLVM IR type, compute a sequence of EVTs that represent all the individual...
Analysis containing CSE Info
void addLiveIn(MCRegister PhysReg, LaneBitmask LaneMask=LaneBitmask::getAll())
Adds the specified register as a live in.
static bool canGuaranteeTCO(CallingConv::ID CC)
Return true if the calling convention is one that we can guarantee TCO for.
MCContext & getContext() const
bool isOSWindows() const
Tests whether the OS is Windows.
bool isVoidTy() const
Return true if this is 'void'.
const MachineInstrBuilder & addUse(Register RegNo, unsigned Flags=0, unsigned SubReg=0) const
Add a virtual register use operand.
MachineRegisterInfo * getMRI()
Getter for MRI.
unsigned const MachineRegisterInfo * MRI
static bool mayTailCallThisCC(CallingConv::ID CC)
Return true if we might ever do TCO for calls with this calling convention.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
MachineInstrBuilder buildInstr(unsigned Opcode)
Build and insert <empty> = Opcode <empty>.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
MachineInstrBuilder buildZExt(const DstOp &Res, const SrcOp &Op)
Build and insert Res = G_ZEXT Op.
size_t size() const
size - Get the array size.
MachineInstrBuilder buildBuildVector(const DstOp &Res, ArrayRef< Register > Ops)
Build and insert Res = G_BUILD_VECTOR Op0, ...
static void handleMustTailForwardedRegisters(MachineIRBuilder &MIRBuilder, CCAssignFn *AssignFn)
Helper function to compute forwarded registers for musttail calls.
bool resultsCompatible(CallLoweringInfo &Info, MachineFunction &MF, SmallVectorImpl< ArgInfo > &InArgs, CCAssignFn &CalleeAssignFnFixed, CCAssignFn &CalleeAssignFnVarArg, CCAssignFn &CallerAssignFnFixed, CCAssignFn &CallerAssignFnVarArg) const
const GlobalValue * getGlobal() const
Helper class to build MachineInstr.
CCAssignFn * CCAssignFnForReturn(CallingConv::ID CC) const
Selects the correct CCAssignFn for a given CallingConvention value.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly...
void setInstr(MachineInstr &MI)
Set the insertion point to before MI.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
void setImm(int64_t immVal)
bool lowerReturn(MachineIRBuilder &MIRBuilder, const Value *Val, ArrayRef< Register > VRegs, Register SwiftErrorVReg) const override
This hook must be implemented to lower outgoing return values, described by Val, into the specified v...
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
unsigned GuaranteedTailCallOpt
GuaranteedTailCallOpt - This flag is enabled when -tailcallopt is specified on the commandline...
const Triple & getTargetTriple() const
static MVT getVT(Type *Ty, bool HandleUnknown=false)
Return the value type corresponding to the specified type.
SmallVectorImpl< ForwardedRegister > & getForwardedMustTailRegParms()
void setArgFlags(ArgInfo &Arg, unsigned OpIdx, const DataLayout &DL, const FuncInfoTy &FuncInfo) const
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
MachineInstrBuilder buildCopy(const DstOp &Res, const SrcOp &Op)
Build and insert Res = COPY Op.
MachineInstrBuilder buildTrunc(const DstOp &Res, const SrcOp &Op)
Build and insert Res = G_TRUNC Op.
bool lowerCall(MachineIRBuilder &MIRBuilder, CallLoweringInfo &Info) const override
This hook must be implemented to lower the given call instruction, including argument and return valu...
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...
Triple - Helper class for working with autoconf configuration names.
The memory access writes data.
SmallVector< ArgInfo, 8 > OrigArgs
List of descriptors of the arguments passed to the function.
bool IsVarArg
True if the call is to a vararg function.
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.
MachineInstrBuilder buildLoad(const DstOp &Res, const SrcOp &Addr, MachineMemOperand &MMO)
Build and insert Res = G_LOAD Addr, MMO.
virtual unsigned getNumRegistersForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const
Certain targets require unusual breakdowns of certain types.
CCState - This class holds information needed while lowering arguments and return values...
unsigned getBytesInStackArgArea() const
Align max(MaybeAlign Lhs, Align Rhs)
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
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.
MachineInstrBuilder buildFrameIndex(const DstOp &Res, int Idx)
Build and insert Res = G_FRAME_INDEX Idx.
unsigned getSizeInBits() const
Returns the total size of the type. Must only be called on sized types.
Promote Memory to Register
int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool IsImmutable, bool isAliased=false)
Create a new object at a fixed location on the stack.
bool hasMustTailInVarArgFunc() const
Returns true if the function is variadic and contains a musttail call.
const Function & getFunction() const
Return the LLVM function that this machine code represents.
This file declares the MachineIRBuilder class.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
static bool clobbersPhysReg(const uint32_t *RegMask, unsigned PhysReg)
clobbersPhysReg - Returns true if this RegMask clobbers PhysReg.
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
The memory access reads data.
static MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
CCAssignFn * CCAssignFnForCall(CallingConv::ID CC, bool IsVarArg) const
Selects the correct CCAssignFn for a given CallingConvention value.
Representation of each machine instruction.
void UpdateCustomCalleeSavedRegs(MachineFunction &MF) const
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
LLVM_NODISCARD bool empty() const
CallingConv::ID CallConv
Calling convention to be used for the call.
const MachineBasicBlock & getMBB() const
Getter for the basic block we currently build.
void setMBB(MachineBasicBlock &MBB)
Set the insertion point to the end of MBB.
The memory access always returns the same value (or traps).
MachineInstrBuilder buildStore(const SrcOp &Val, const SrcOp &Addr, MachineMemOperand &MMO)
Build and insert G_STORE Val, Addr, MMO.
This file describes how to lower LLVM calls to machine code calls.
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
bool isReg() const
isReg - Tests if this is a MO_Register operand.
void setBytesInStackArgArea(unsigned bytes)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool IsTailCall
True if the call passes all target-independent checks for tail call optimization. ...
MachineInstrBuilder insertInstr(MachineInstrBuilder MIB)
Insert an existing instruction at the insertion point.
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
Fast - This calling convention attempts to make calls as fast as possible (e.g.
uint16_t getNumElements() const
Returns the number of elements in a vector LLT.
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
MachineInstrBuilder buildMerge(const DstOp &Res, ArrayRef< Register > Ops)
Build and insert Res = G_MERGE_VALUES Op0, ...
AArch64CallLowering(const AArch64TargetLowering &TLI)
SmallVector< Register, 4 > Regs
static MachinePointerInfo getStack(MachineFunction &MF, int64_t Offset, uint8_t ID=0)
Stack pointer relative access.
MachineInstrBuilder buildUndef(const DstOp &Res)
Build and insert Res = IMPLICIT_DEF.
Register createGenericVirtualRegister(LLT Ty, StringRef Name="")
Create and return a new generic virtual register with low-level type Ty.
Register getReg() const
getReg - Returns the register number.
const MachineOperand & getOperand(unsigned i) const
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
ArgInfo OrigRet
Descriptor for the return type of the function.
iterator_range< arg_iterator > args()
Wrapper class representing virtual and physical registers.
bool empty() const
empty - Check if the array is empty.