16 #ifndef LLVM_MACHINEOUTLINER_H 17 #define LLVM_MACHINEOUTLINER_H 57 unsigned CallOverhead;
95 unsigned getEndIdx()
const {
return StartIdx + Len - 1; }
100 CallConstructionID = CID;
124 unsigned FunctionIdx,
unsigned Flags)
125 : StartIdx(StartIdx), Len(Len), FirstInst(FirstInst), LastInst(LastInst),
126 MBB(MBB), FunctionIdx(FunctionIdx), Flags(Flags) {}
141 "Candidate's Machine Function must track liveness");
156 UsedInSequence.
init(TRI);
189 unsigned CallOverhead = 0;
191 CallOverhead +=
C.getCallOverhead();
192 return CallOverhead + SequenceSize + FrameOverhead;
197 return getOccurrenceCount() * SequenceSize;
203 unsigned NotOutlinedCost = getNotOutlinedCost();
204 unsigned OutlinedCost = getOutliningCost();
205 return (NotOutlinedCost < OutlinedCost) ? 0
206 : NotOutlinedCost - OutlinedCost;
213 unsigned FrameOverhead,
unsigned FrameConstructionID)
214 : Candidates(Candidates), SequenceSize(SequenceSize),
215 FrameOverhead(FrameOverhead), FrameConstructionID(FrameConstructionID) {
216 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 FrameOverhead
Target-defined overhead of constructing a frame for this function.
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 SequenceSize
Represents the size of a sequence in bytes.
unsigned FrameConstructionID
Target-defined identifier for constructing a frame for this function.
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