14#ifndef LLVM_LIB_CODEGEN_SPLITKIT_H
15#define LLVM_LIB_CODEGEN_SPLITKIT_H
39class MachineBlockFrequencyInfo;
40class MachineDominatorTree;
42class MachineRegisterInfo;
44class TargetRegisterInfo;
69 unsigned Num =
MBB.getNumber();
71 if (LastInsertPoint[Num].first.isValid() &&
72 !LastInsertPoint[Num].second.isValid())
73 return LastInsertPoint[Num].first;
74 return computeLastInsertPoint(CurLI,
MBB);
132 return SlotIndex::isSameInstr(FirstInstr, LastInstr);
154 unsigned NumGapBlocks = 0u;
160 unsigned NumThroughBlocks = 0u;
166 void calcLiveBlockInfo();
209 return getUseBlocks().size() - NumGapBlocks + getNumThroughBlocks();
227 bool shouldSplitSingleBlock(
const BlockInfo &BI,
bool SingleInstrs)
const;
302 unsigned OpenIdx = 0;
305 ComplementSpillMode SpillMode = SM_Partition;
316 RegAssignMap RegAssign;
344 return LICalc[SpillMode != SM_Partition && RegIdx != 0];
353 void addDeadDef(LiveInterval &LI, VNInfo *VNI,
bool Original);
363 VNInfo *defValue(
unsigned RegIdx,
const VNInfo *ParentVNI, SlotIndex
Idx,
370 void forceRecompute(
unsigned RegIdx,
const VNInfo &ParentVNI);
374 void forceRecomputeVNI(
const VNInfo &ParentVNI);
378 VNInfo *defFromParent(
unsigned RegIdx,
const VNInfo *ParentVNI,
379 SlotIndex UseIdx, MachineBasicBlock &
MBB,
380 MachineBasicBlock::iterator
I);
384 void removeBackCopies(SmallVectorImpl<VNInfo*> &
Copies);
388 MachineBasicBlock *findShallowDominator(MachineBasicBlock *
MBB,
389 MachineBasicBlock *DefMBB);
392 void computeRedundantBackCopies(DenseSet<unsigned> &NotToHoistSet,
393 SmallVectorImpl<VNInfo *> &BackCopies);
402 bool transferValues();
409 void extendPHIRange(MachineBasicBlock &
B, LiveIntervalCalc &LIC,
411 ArrayRef<SlotIndex> Undefs);
415 void extendPHIKillRanges();
418 void rewriteAssigned(
bool ExtendRanges);
421 void deleteRematVictims();
427 MachineBasicBlock &
MBB, MachineBasicBlock::iterator InsertBefore,
428 bool Late,
unsigned RegIdx);
431 MachineBasicBlock &MB,
432 MachineBasicBlock::iterator InsertBefore,
433 unsigned SubIdx, LiveInterval &DestLI,
434 bool Late, SlotIndex Def,
435 const MCInstrDesc &Desc);
440 SplitEditor(SplitAnalysis &SA, LiveIntervals &LIS, VirtRegMap &VRM,
441 MachineDominatorTree &MDT, MachineBlockFrequencyInfo &MBFI,
442 VirtRegAuxInfo &VRAI);
445 void reset(LiveRangeEdit&, ComplementSpillMode = SM_Partition);
456 void selectIntv(
unsigned Idx);
530 void splitLiveThroughBlock(
unsigned MBBNum,
unsigned const MachineRegisterInfo * MRI
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
This file implements the BitVector class.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define LLVM_LIBRARY_VISIBILITY
static void clear(coro::Shape &Shape)
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
This file defines the DenseMap class.
This file defines the DenseSet and SmallDenseSet classes.
const HexagonInstrInfo * TII
This file implements a coalescing interval map for small objects.
unsigned const TargetRegisterInfo * TRI
Promote Memory to Register
This file defines the PointerIntPair class.
SI Optimize VGPR LiveRange
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
bool test(unsigned Idx) const
Determines the latest safe point in a block in which we can insert a split, spill or other instructio...
MachineBasicBlock::iterator getLastInsertPointIter(const LiveInterval &CurLI, MachineBasicBlock &MBB)
Returns the last insert point as an iterator for \pCurLI in \pMBB.
SlotIndex getLastInsertPoint(const LiveInterval &CurLI, const MachineBasicBlock &MBB)
Return the base index of the last valid insert point for \pCurLI in \pMBB.
SlotIndex getFirstInsertPoint(MachineBasicBlock &MBB)
Return the base index of the first insert point in \pMBB.
LiveInterval - This class represents the liveness of a register, or stack slot.
SlotIndex getMBBStartIdx(const MachineBasicBlock *mbb) const
Return the first index in the given basic block.
SlotIndex getInstructionIndex(const MachineInstr &Instr) const
Returns the base index of the given instruction.
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
MachineBasicBlock * getBlockNumbered(unsigned N) const
getBlockNumbered - MachineBasicBlocks are automatically numbered when they are inserted into the mach...
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
PointerIntPair - This class implements a pair of a pointer and small integer.
SlotIndex - An opaque wrapper around machine indexes.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
SplitAnalysis - Analyze a LiveInterval, looking for live range splitting opportunities.
const MachineFunction & MF
MachineBasicBlock::iterator getLastSplitPointIter(MachineBasicBlock *BB)
ArrayRef< BlockInfo > getUseBlocks() const
getUseBlocks - Return an array of BlockInfo objects for the basic blocks where CurLI has uses.
ArrayRef< SlotIndex > getUseSlots() const
getUseSlots - Return an array of SlotIndexes of instructions using CurLI.
unsigned getNumThroughBlocks() const
getNumThroughBlocks - Return the number of through blocks.
SlotIndex getLastSplitPoint(unsigned Num)
const LiveInterval & getParent() const
getParent - Return the last analyzed interval.
const LiveIntervals & LIS
const BitVector & getThroughBlocks() const
getThroughBlocks - Return the set of through blocks.
const MachineLoopInfo & Loops
const TargetInstrInfo & TII
unsigned getNumLiveBlocks() const
getNumLiveBlocks - Return the number of blocks where CurLI is live.
SlotIndex getLastSplitPoint(MachineBasicBlock *BB)
bool isThroughBlock(unsigned MBB) const
isThroughBlock - Return true if CurLI is live through MBB without uses.
SlotIndex getFirstSplitPoint(unsigned Num)
SplitEditor - Edit machine code and LiveIntervals for live range splitting.
unsigned currentIntv() const
currentIntv - Return the current interval index.
ComplementSpillMode
ComplementSpillMode - Select how the complement live range should be created.
@ SM_Partition
SM_Partition(Default) - Try to create the complement interval so it doesn't overlap any other interva...
@ SM_Size
SM_Size - Overlap intervals to minimize the number of inserted COPY instructions.
TargetInstrInfo - Interface to description of machine instruction set.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Calculate auxiliary information for a virtual register such as its spill weight and allocation hint.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
Additional information about basic blocks where the current variable is live.
SlotIndex FirstDef
First non-phi valno->def, or SlotIndex().
bool LiveOut
Current reg is live out.
bool LiveIn
Current reg is live in.
bool isOneInstr() const
isOneInstr - Returns true when this BlockInfo describes a single instruction.
SlotIndex LastInstr
Last instr accessing current reg.
SlotIndex FirstInstr
First instr accessing current reg.