Go to the documentation of this file.
27 #define DEBUG_TYPE "ppc-call-lowering"
36 : OutgoingValueHandler(MIRBuilder,
MRI), MIB(MIB) {}
50 void OutgoingArgHandler::assignValueToReg(
Register ValVReg,
Register PhysReg,
53 Register ExtReg = extendRegister(ValVReg, VA);
54 MIRBuilder.buildCopy(PhysReg, ExtReg);
82 auto &
DL =
F.getParent()->getDataLayout();
97 OutgoingArgHandler ArgHandler(MIRBuilder,
MRI, MIB);
101 MIRBuilder,
F.getCallingConv(),
119 const auto &
DL =
F.getParent()->getDataLayout();
120 auto &TLI = *getTLI<PPCTargetLowering>();
125 for (
const auto &
Arg :
F.args()) {
126 if (
DL.getTypeStoreSize(
Arg.getType()).isZero())
136 TLI.ccAssignFnForCall(
F.getCallingConv(),
false,
F.isVarArg());
140 MIRBuilder,
F.getCallingConv(),
144 void PPCIncomingValueHandler::assignValueToReg(
Register ValVReg,
147 markPhysRegUsed(PhysReg);
148 IncomingValueHandler::assignValueToReg(ValVReg, PhysReg, VA);
151 void PPCIncomingValueHandler::assignValueToAddress(
Register ValVReg,
171 const bool IsImmutable = !
Flags.isByVal();
172 int FI = MFI.CreateFixedObject(Size,
Offset, IsImmutable);
183 void FormalArgHandler::markPhysRegUsed(
unsigned PhysReg) {
void addLiveIn(MCRegister Reg, Register vreg=Register())
addLiveIn - Add the specified register as a live-in.
This is an optimization pass for GlobalISel generic memory operations.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
MachineRegisterInfo * getMRI()
Getter for MRI.
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, uint64_t s, Align 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.
bool lowerCall(MachineIRBuilder &MIRBuilder, CallLoweringInfo &Info) const override
This hook must be implemented to lower the given call instruction, including argument and return valu...
Base class for ValueHandlers used for arguments passed to a function call, or for return values.
void splitToValueTypes(const ArgInfo &OrigArgInfo, SmallVectorImpl< ArgInfo > &SplitArgs, const DataLayout &DL, CallingConv::ID CallConv, SmallVectorImpl< uint64_t > *Offsets=nullptr) const
Break OrigArgInfo into one or more pieces the calling convention can process, returned in SplitArgs.
Expected< ExpressionValue > max(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
MachineInstrBuilder buildInstrNoInsert(unsigned Opcode)
Build but don't insert <empty> = Opcode <empty>.
bool empty() const
empty - Check if the array is empty.
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
CCValAssign - Represent assignment of one arg/retval to a location.
MachineInstrBuilder buildLoad(const DstOp &Res, const SrcOp &Addr, MachineMemOperand &MMO)
Build and insert Res = G_LOAD Addr, MMO.
MachineFunction & getMF()
Getter for the function we currently build.
Analysis containing CSE Info
Register getReg(unsigned Idx) const
Get the register for the operand index.
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.
Helper class to build MachineInstr.
This class contains a discriminated union of information about pointers in memory operands,...
Align inferAlignFromPtrInfo(MachineFunction &MF, const MachinePointerInfo &MPO)
@ Implicit
Not emitted register (e.g. carry, or temporary result).
bool determineAndHandleAssignments(ValueHandler &Handler, ValueAssigner &Assigner, SmallVectorImpl< ArgInfo > &Args, MachineIRBuilder &MIRBuilder, CallingConv::ID CallConv, bool IsVarArg, ArrayRef< Register > ThisReturnRegs=std::nullopt) const
Invoke ValueAssigner::assignArg on each of the given Args and then use Handler to move them to the as...
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
const MachineBasicBlock & getMBB() const
Getter for the basic block we currently build.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
const MachineInstrBuilder & addUse(Register RegNo, unsigned Flags=0, unsigned SubReg=0) const
Add a virtual register use operand.
static constexpr LLT pointer(unsigned AddressSpace, unsigned SizeInBits)
Get a low-level pointer in the given address space.
bool RetCC_PPC(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
MachineInstrBuilder insertInstr(MachineInstrBuilder MIB)
Insert an existing instruction at the insertion point.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Type * getType() const
All values are typed, get the type of this value.
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
PPCCallLowering(const PPCTargetLowering &TLI)
@ MOLoad
The memory access reads data.
unsigned const MachineRegisterInfo * MRI
bool lowerReturn(MachineIRBuilder &MIRBuilder, const Value *Val, ArrayRef< Register > VRegs, FunctionLoweringInfo &FLI, Register SwiftErrorVReg) const override
This hook must be implemented to lower outgoing return values, described by Val, into the specified v...
Wrapper class representing virtual and physical registers.
void addLiveIn(MCRegister PhysReg, LaneBitmask LaneMask=LaneBitmask::getAll())
Adds the specified register as a live in.
MachineInstrBuilder buildFrameIndex(const DstOp &Res, int Idx)
Build and insert Res = G_FRAME_INDEX Idx.
bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, const Function &F, ArrayRef< ArrayRef< Register >> VRegs, FunctionLoweringInfo &FLI) const override
This hook must be implemented to lower the incoming (formal) arguments, described by VRegs,...
Function & getFunction()
Return the LLVM function that this machine code represents.
MachineIRBuilder & MIRBuilder
static MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
unsigned getPointerSizeInBits(unsigned AS=0) const
Layout pointer size, in bits FIXME: The defaults need to be removed once all of the backends/clients ...
LLVM Value Representation.
void setArgFlags(ArgInfo &Arg, unsigned OpIdx, const DataLayout &DL, const FuncInfoTy &FuncInfo) const