15 #ifndef LLVM_MACHINEOUTLINER_H 16 #define LLVM_MACHINEOUTLINER_H 40 unsigned StartIdx = 0;
56 unsigned CallOverhead = 0;
94 unsigned getEndIdx()
const {
return StartIdx + Len - 1; }
99 CallConstructionID = CID;
123 unsigned FunctionIdx,
unsigned Flags)
124 : StartIdx(StartIdx), Len(Len), FirstInst(FirstInst), LastInst(LastInst),
125 MBB(MBB), FunctionIdx(FunctionIdx), Flags(Flags) {}
140 "Candidate's Machine Function must track liveness");
155 UsedInSequence.
init(TRI);
174 unsigned SequenceSize = 0;
177 unsigned FrameOverhead = 0;
180 unsigned FrameConstructionID = 0;
188 unsigned CallOverhead = 0;
190 CallOverhead +=
C.getCallOverhead();
191 return CallOverhead + SequenceSize + FrameOverhead;
196 return getOccurrenceCount() * SequenceSize;
202 unsigned NotOutlinedCost = getNotOutlinedCost();
203 unsigned OutlinedCost = getOutliningCost();
204 return (NotOutlinedCost < OutlinedCost) ? 0
205 : NotOutlinedCost - OutlinedCost;
212 unsigned FrameOverhead,
unsigned FrameConstructionID)
213 : Candidates(Candidates), SequenceSize(SequenceSize),
214 FrameOverhead(FrameOverhead), FrameConstructionID(FrameConstructionID) {
215 const unsigned B = getBenefit();
This class represents lattice values for constants.
Candidate(unsigned StartIdx, unsigned Len, MachineBasicBlock::iterator &FirstInst, MachineBasicBlock::iterator &LastInst, MachineBasicBlock *MBB, unsigned FunctionIdx, unsigned Flags)
void initLRU(const TargetRegisterInfo &TRI)
Compute the registers that are live across this Candidate.
unsigned getStartIdx() const
Return the start index of this candidate.
LiveRegUnits LRU
Contains physical register liveness information for the MBB containing this Candidate.
unsigned const TargetRegisterInfo * TRI
An individual sequence of instructions to be replaced with a call to an outlined function.
std::vector< Candidate > Candidates
void addLiveOuts(const MachineBasicBlock &MBB)
Adds registers living out of block MBB.
unsigned getOccurrenceCount() const
Return the number of candidates for this OutlinedFunction.
MachineInstrBundleIterator< MachineInstr, true > reverse_iterator
unsigned getEndIdx() const
Return the end index of this candidate.
unsigned getLength() const
Return the number of instructions in this Candidate.
reverse_iterator rbegin()
MachineBasicBlock::iterator & back()
unsigned Flags
Target-specific flags for this Candidate's MBB.
void init(const TargetRegisterInfo &TRI)
Initialize and clear the set.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
bool LRUWasSet
True if initLRU has been called on this Candidate.
InstrType
Represents how an instruction should be mapped by the outliner.
LiveRegUnits UsedInSequence
Contains the accumulated register liveness information for the instructions in this Candidate...
unsigned CallConstructionID
Identifier denoting the instructions to emit to call an outlined function from this point...
The information necessary to create an outlined function for some class of candidate.
void setCallInfo(unsigned CID, unsigned CO)
Set the CallConstructionID and CallOverhead of this candidate to CID and CO respectively.
OutlinedFunction(std::vector< Candidate > &Candidates, unsigned SequenceSize, unsigned FrameOverhead, unsigned FrameConstructionID)
unsigned getCallOverhead() const
Returns the call overhead of this candidate if it is in the list.
void stepBackward(const MachineInstr &MI)
Updates liveness when stepping backwards over the instruction MI.
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...
MachineBasicBlock::iterator & front()
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
This file implements the LivePhysRegs utility for tracking liveness of physical registers.
unsigned Benefit
The number of instructions that would be saved by outlining every candidate of this type...
unsigned getNotOutlinedCost() const
Return the size in bytes of the unoutlined sequences.
void accumulate(const MachineInstr &MI)
Adds all register units used, defined or clobbered in MI.
unsigned getNumInstrs() const
Return the number of instructions in this sequence.
Representation of each machine instruction.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
bool tracksLiveness() const
tracksLiveness - Returns true when tracking register liveness accurately.
unsigned FunctionIdx
The index of this Candidate's OutlinedFunction in the list of OutlinedFunctions.
A set of register units used to track register liveness.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
unsigned getOutliningCost() const
Return the number of bytes it would take to outline this function.
unsigned getBenefit() const
Return the number of instructions that would be saved by outlining this function. ...
UnaryPredicate for_each(R &&Range, UnaryPredicate P)
Provide wrappers to std::for_each which take ranges instead of having to pass begin/end explicitly...
MachineFunction * getMF() const
MachineBasicBlock * getMBB() const