Go to the documentation of this file.
15 #ifndef LLVM_CODEGEN_MACHINEOUTLINER_H
16 #define LLVM_CODEGEN_MACHINEOUTLINER_H
21 #include <initializer_list>
40 unsigned StartIdx = 0;
56 unsigned CallOverhead = 0;
72 bool FromEndOfBlockToStartOfSeqWasSet =
false;
75 bool InSeqWasSet =
false;
79 assert(
MBB->getParent()->getRegInfo().tracksLiveness() &&
80 "Candidate's Machine Function must track liveness");
82 if (FromEndOfBlockToStartOfSeqWasSet)
84 FromEndOfBlockToStartOfSeqWasSet =
true;
85 FromEndOfBlockToStartOfSeq.
init(
TRI);
96 assert(
MBB->getParent()->getRegInfo().tracksLiveness() &&
97 "Candidate's Machine Function must track liveness");
126 unsigned getEndIdx()
const {
return StartIdx + Len - 1; }
157 if (!FromEndOfBlockToStartOfSeqWasSet)
158 initFromEndOfBlockToStartOfSeq(
TRI);
166 if (!FromEndOfBlockToStartOfSeqWasSet)
167 initFromEndOfBlockToStartOfSeq(
TRI);
200 : StartIdx(StartIdx), Len(Len), FirstInst(FirstInst), LastInst(LastInst),
239 unsigned CallOverhead = 0;
241 CallOverhead +=
C.getCallOverhead();
255 return (NotOutlinedCost < OutlinedCost) ? 0
256 : NotOutlinedCost - OutlinedCost;
OutlinedFunction()=default
This is an optimization pass for GlobalISel generic memory operations.
unsigned getOutliningCost() const
Return the number of bytes it would take to outline this function.
bool isAnyUnavailableAcrossOrOutOfSeq(std::initializer_list< Register > Regs, const TargetRegisterInfo &TRI)
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Reg
All possible values of the reg field in the ModR/M byte.
unsigned FunctionIdx
The index of this Candidate's OutlinedFunction in the list of OutlinedFunctions.
bool available(MCPhysReg Reg) const
Returns true if no part of physical register Reg is live.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
InstrType
Represents how an instruction should be mapped by the outliner.
The information necessary to create an outlined function for some class of candidate.
unsigned const TargetRegisterInfo * TRI
unsigned FrameOverhead
Target-defined overhead of constructing a frame for this function.
void addLiveOuts(const MachineBasicBlock &MBB)
Adds registers living out of block MBB.
unsigned CallConstructionID
Identifier denoting the instructions to emit to call an outlined function from this point.
void accumulate(const MachineInstr &MI)
Adds all register units used, defined or clobbered in MI.
void setCallInfo(unsigned CID, unsigned CO)
Set the CallConstructionID and CallOverhead of this candidate to CID and CO respectively.
(vector float) vec_cmpeq(*A, *B) C
MachineFunction * getMF() const
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
A set of register units used to track register liveness.
unsigned getEndIdx() const
Return the end index of this candidate.
bool isAvailableAcrossAndOutOfSeq(Register Reg, const TargetRegisterInfo &TRI)
unsigned getOccurrenceCount() const
Return the number of candidates for this OutlinedFunction.
void stepBackward(const MachineInstr &MI)
Updates liveness when stepping backwards over the instruction MI.
An individual sequence of instructions to be replaced with a call to an outlined function.
unsigned getNotOutlinedCost() const
Return the size in bytes of the unoutlined sequences.
MachineBasicBlock::iterator & front()
MachineBasicBlock::iterator & back()
void init(const TargetRegisterInfo &TRI)
Initialize and clear the set.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
unsigned getBenefit() const
Return the number of instructions that would be saved by outlining this function.
unsigned SequenceSize
Represents the size of a sequence in bytes.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
Wrapper class representing virtual and physical registers.
unsigned Flags
Target-specific flags for this Candidate's MBB.
Candidate(unsigned StartIdx, unsigned Len, MachineBasicBlock::iterator &FirstInst, MachineBasicBlock::iterator &LastInst, MachineBasicBlock *MBB, unsigned FunctionIdx, unsigned Flags)
unsigned getLength() const
Return the number of instructions in this Candidate.
bool operator<(const Candidate &RHS) const
Used to ensure that Candidates are outlined in an order that preserves the start and end indices of o...
OutlinedFunction(std::vector< Candidate > &Candidates, unsigned SequenceSize, unsigned FrameOverhead, unsigned FrameConstructionID)
bool isAvailableInsideSeq(Register Reg, const TargetRegisterInfo &TRI)
unsigned getCallOverhead() const
Returns the call overhead of this candidate if it is in the list.
unsigned Benefit
The number of instructions that would be saved by outlining every candidate of this type.
MachineFunction * MF
The actual outlined function created.
MachineBasicBlock * getMBB() const
unsigned getStartIdx() const
Return the start index of this candidate.
unsigned getNumInstrs() const
Return the number of instructions in this sequence.
std::vector< Candidate > Candidates
unsigned FrameConstructionID
Target-defined identifier for constructing a frame for this function.