26 #ifndef LLVM_BUILD_GLOBAL_ISEL
27 #error "This shouldn't be built without GISel"
40 return VTSize == 8 || VTSize == 16 || VTSize == 32;
47 : ValueHandler(MIRBuilder, MRI), MIB(MIB) {}
49 unsigned getStackAddress(uint64_t Size, int64_t
Offset,
54 void assignValueToReg(
unsigned ValVReg,
unsigned PhysReg,
64 "ABI extensions not supported yet");
66 MIRBuilder.buildCopy(PhysReg, ValVReg);
70 void assignValueToAddress(
unsigned ValVReg,
unsigned Addr, uint64_t Size,
82 const Value *Val,
unsigned VReg,
88 auto &MF = MIRBuilder.
getMF();
89 const auto &
F = *MF.getFunction();
91 auto DL = MF.getDataLayout();
92 auto &TLI = *getTLI<ARMTargetLowering>();
97 TLI.CCAssignFnForReturn(
F.getCallingConv(),
F.isVarArg());
99 ArgInfo RetInfo(VReg, Val->
getType());
102 FuncReturnHandler RetHandler(MIRBuilder, MF.getRegInfo(),
Ret);
107 const Value *Val,
unsigned VReg)
const {
108 assert(!Val == !VReg &&
"Return value without a vreg");
112 if (!lowerReturnVal(MIRBuilder, Val, VReg, Ret))
122 : ValueHandler(MIRBuilder, MRI) {}
124 unsigned getStackAddress(uint64_t Size, int64_t
Offset,
126 assert(Size == 4 &&
"Unsupported size");
140 void assignValueToAddress(
unsigned ValVReg,
unsigned Addr, uint64_t Size,
142 assert(Size == 4 &&
"Unsupported size");
146 MIRBuilder.
buildLoad(ValVReg, Addr, *MMO);
149 void assignValueToReg(
unsigned ValVReg,
unsigned PhysReg,
174 auto &TLI = *getTLI<ARMTargetLowering>();
178 for (
auto &Arg : Args) {
185 if (ArgIdx > 4 && Arg.getType()->getIntegerBitWidth() != 32)
194 for (
auto &Arg : Args) {
195 ArgInfo AInfo(VRegs[Idx], Arg.getType());
201 FormalArgHandler ArgHandler(MIRBuilder, MIRBuilder.
getMF().
getRegInfo());
MachineBasicBlock & getMBB()
Getter for the basic block we currently build.
void push_back(const T &Elt)
A parsed version of the target data layout string in and methods for querying it. ...
LocInfo getLocInfo() const
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...
unsigned getSizeInBits() const
static const MCPhysReg VRegs[32]
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
bool isVector() const
isVector - Return true if this is a vector value type.
static const MachineInstrBuilder & AddDefaultPred(const MachineInstrBuilder &MIB)
bool lowerReturn(MachineIRBuilder &MIRBuiler, const Value *Val, unsigned VReg) const override
This hook must be implemented to lower outgoing return values, described by Val, into the specified v...
ARMCallLowering(const ARMTargetLowering &TLI)
bool isInteger() const
isInteger - Return true if this is an integer, or a vector integer type.
unsigned getLocReg() const
MachineInstrBuilder buildInstrNoInsert(unsigned Opcode)
Build but don't insert <empty> = Opcode <empty>.
MachineFunction & getMF()
Getter for the function we currently build.
EVT getValueType(const DataLayout &DL, Type *Ty, bool AllowUnknown=false) const
Return the EVT corresponding to this LLVM type.
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, const Function &F, ArrayRef< unsigned > VRegs) const override
This hook must be implemented to lower the incoming (formal) arguments, described by Args...
void addLiveIn(MCPhysReg PhysReg, LaneBitmask LaneMask=LaneBitmask::getAll())
Adds the specified register as a live in.
unsigned const MachineRegisterInfo * MRI
The instances of the Type class are immutable: once they are created, they are never changed...
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
Helper class to build MachineInstr.
int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool Immutable, bool isAliased=false)
Create a new object at a fixed location on the stack.
EVT - Extended Value Type.
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.
MachineInstrBuilder buildFrameIndex(unsigned Res, int Idx)
Build and insert Res<def> = G_FRAME_INDEX Idx.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Type * getType() const
All values are typed, get the type of this value.
MachineInstrBuilder buildCopy(unsigned Res, unsigned Op)
Build and insert Res<def> = COPY Op.
CCValAssign - Represent assignment of one arg/retval to a location.
unsigned getAddrSpace() const
Return the LLVM IR address space number that this pointer points into.
This file declares the MachineIRBuilder class.
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, uint64_t s, unsigned base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SynchronizationScope SynchScope=CrossThread, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
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.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
void setArgFlags(ArgInfo &Arg, unsigned OpNum, const DataLayout &DL, const FuncInfoTy &FuncInfo) const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isSimple() const
isSimple - Test if the given EVT is simple (as opposed to being extended).
MachineInstrBuilder insertInstr(MachineInstrBuilder MIB)
Insert an existing instruction at the insertion point.
LLVM Value Representation.
static LLT pointer(uint16_t AddressSpace, unsigned SizeInBits)
Get a low-level pointer in the given address space (defaulting to 0).
const ArgumentListType & getArgumentList() const
Get the underlying elements of the Function...
MachineInstrBuilder buildLoad(unsigned Res, unsigned Addr, MachineMemOperand &MMO)
Build and insert Res<def> = G_LOAD Addr, MMO.
static bool isSupportedType(const DataLayout DL, const ARMTargetLowering &TLI, Type *T)
This file describes how to lower LLVM calls to machine code calls.
bool handleAssignments(MachineIRBuilder &MIRBuilder, CCAssignFn *AssignFn, ArrayRef< ArgInfo > Args, ValueHandler &Callback) const
Invoke the AssignFn on each of the given Args and then use Callback to move them to the assigned loca...
bool isVarArg() const
isVarArg - Return true if this function takes a variable number of arguments.
MVT getSimpleVT() const
getSimpleVT - Return the SimpleValueType held in the specified simple EVT.