20 #ifndef LLVM_CODEGEN_LIVEINTERVAL_ANALYSIS_H
21 #define LLVM_CODEGEN_LIVEINTERVAL_ANALYSIS_H
41 class MachineDominatorTree;
42 class MachineLoopInfo;
43 class TargetRegisterInfo;
44 class MachineRegisterInfo;
45 class TargetInstrInfo;
46 class TargetRegisterClass;
107 return *VirtRegIntervals[
Reg];
117 return VirtRegIntervals.inBounds(Reg) && VirtRegIntervals[
Reg];
122 assert(!
hasInterval(Reg) &&
"Interval already exists!");
123 VirtRegIntervals.grow(Reg);
124 VirtRegIntervals[
Reg] = createInterval(Reg);
125 return *VirtRegIntervals[
Reg];
130 computeVirtRegInterval(LI);
136 delete VirtRegIntervals[
Reg];
137 VirtRegIntervals[
Reg] = 0;
226 "Blocks must be added in order.");
227 RegMaskBlocks.
push_back(std::make_pair(RegMaskSlots.size(), 0));
294 bool UpdateFlags =
false);
330 std::pair<unsigned, unsigned>
P = RegMaskBlocks[MBBNum];
341 std::pair<unsigned, unsigned>
P = RegMaskBlocks[MBBNum];
371 RegUnitRanges[Unit] = LR =
new LiveRange();
372 computeRegUnitRange(*LR, Unit);
380 return RegUnitRanges[Unit];
384 return RegUnitRanges[Unit];
389 void computeVirtRegs();
392 void computeRegMasks();
397 void dumpInstrs()
const;
399 void computeLiveInRegUnits();
400 void computeRegUnitRange(
LiveRange&,
unsigned Unit);
static float getSpillWeight(bool isDef, bool isUse, BlockFrequency freq)
void push_back(const T &Elt)
ArrayRef< SlotIndex > getRegMaskSlots() const
The main container class for the LLVM Intermediate Representation.
SlotIndex getInstructionIndex(const MachineInstr *instr) const
Returns the base index of the given instruction.
MachineBasicBlock * getMBBFromIndex(SlotIndex index) const
SlotIndex getMBBEndIdx(const MachineBasicBlock *mbb) const
Return the last index in the given basic block.
bool isLiveOutOfMBB(const LiveRange &LR, const MachineBasicBlock *mbb) const
bool isLiveInToMBB(const LiveRange &LR, const MachineBasicBlock *mbb) const
virtual bool runOnMachineFunction(MachineFunction &)
runOnMachineFunction - pass entry point
bool checkRegMaskInterference(LiveInterval &LI, BitVector &UsableRegs)
void pruneValue(LiveInterval *LI, SlotIndex Kill, SmallVectorImpl< SlotIndex > *EndPoints)
LoopInfoBase< BlockT, LoopT > * LI
bool isNotInMIMap(const MachineInstr *Instr) const
MachineBasicBlock * intervalIsInOneMBB(const LiveInterval &LI) const
ArrayRef< SlotIndex > getRegMaskSlotsInBlock(unsigned MBBNum) const
ArrayRef< const uint32_t * > getRegMaskBits() const
VNInfo::Allocator & getVNInfoAllocator()
bool findLiveInMBBs(SlotIndex Start, SlotIndex End, SmallVectorImpl< MachineBasicBlock * > &MBBs) const
void InsertMachineInstrRangeInMaps(MachineBasicBlock::iterator B, MachineBasicBlock::iterator E)
void insertMBBInMaps(MachineBasicBlock *MBB)
bool shrinkToUses(LiveInterval *li, SmallVectorImpl< MachineInstr * > *dead=0)
LiveRange * getCachedRegUnit(unsigned Unit)
bool hasPHIKill(const LiveInterval &LI, const VNInfo *VNI) const
bundle_iterator< MachineInstr, instr_iterator > iterator
void RemoveMachineInstrFromMaps(MachineInstr *MI)
SlotIndexes * getSlotIndexes() const
void insertMBBInMaps(MachineBasicBlock *mbb)
Add the given MachineBasicBlock into the maps.
bool findLiveInMBBs(SlotIndex start, SlotIndex end, SmallVectorImpl< MachineBasicBlock * > &mbbs) const
void removeInterval(unsigned Reg)
const LiveRange * getCachedRegUnit(unsigned Unit) const
virtual void getAnalysisUsage(AnalysisUsage &AU) const
LiveInterval::Segment addSegmentToEndOfBlock(unsigned reg, MachineInstr *startInst)
virtual void releaseMemory()
void repairIntervalsInRange(MachineBasicBlock *MBB, MachineBasicBlock::iterator Begin, MachineBasicBlock::iterator End, ArrayRef< unsigned > OrigRegs)
void handleMove(MachineInstr *MI, bool UpdateFlags=false)
bool liveAt(SlotIndex index) const
SlotIndex getInstructionIndex(const MachineInstr *MI) const
Returns the base index for the given instruction.
MachineInstr * getInstructionFromIndex(SlotIndex index) const
virtual void print(raw_ostream &O, const Module *=0) const
print - Implement the dump method.
ArrayRef< const uint32_t * > getRegMaskBitsInBlock(unsigned MBBNum) const
bool hasIndex(const MachineInstr *instr) const
MachineBasicBlock * getMBBFromIndex(SlotIndex index) const
Returns the basic block which the given index falls in.
LiveInterval & getInterval(unsigned Reg)
SlotIndex InsertMachineInstrInMaps(MachineInstr *MI)
SlotIndex getMBBEndIdx(unsigned Num) const
Returns the last index in the given basic block number.
LiveInterval & createEmptyInterval(unsigned Reg)
void ReplaceMachineInstrInMaps(MachineInstr *MI, MachineInstr *NewMI)
void replaceMachineInstrInMaps(MachineInstr *mi, MachineInstr *newMI)
void addKillFlags(const VirtRegMap *)
void handleMoveIntoBundle(MachineInstr *MI, MachineInstr *BundleStart, bool UpdateFlags=false)
void removeMachineInstrFromMaps(MachineInstr *mi)
Remove the given machine instruction from the mapping.
SlotIndex getMBBStartIdx(unsigned Num) const
Returns the first index in the given basic block number.
bool hasInterval(unsigned Reg) const
AliasAnalysis * getAliasAnalysis() const
MachineInstr * getInstructionFromIndex(SlotIndex index) const
Returns the instruction associated with the given index.
SlotIndex getMBBStartIdx(const MachineBasicBlock *mbb) const
Return the first index in the given basic block.
const LiveInterval & getInterval(unsigned Reg) const
SlotIndex - An opaque wrapper around machine indexes.
SlotIndex insertMachineInstrInMaps(MachineInstr *mi, bool Late=false)
void extendToIndices(LiveRange &LR, ArrayRef< SlotIndex > Indices)
LiveRange & getRegUnit(unsigned Unit)
LiveInterval & createAndComputeVirtRegInterval(unsigned Reg)