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;
164 bool LooksLikeLoopIV =
false;
170 void calcLiveBlockInfo();
213 return getUseBlocks().size() - NumGapBlocks + getNumThroughBlocks();
233 bool shouldSplitSingleBlock(
const BlockInfo &BI,
bool SingleInstrs)
const;
308 unsigned OpenIdx = 0;
311 ComplementSpillMode SpillMode = SM_Partition;
322 RegAssignMap RegAssign;
350 return LICalc[SpillMode != SM_Partition && RegIdx != 0];
359 void addDeadDef(LiveInterval &LI, VNInfo *VNI,
bool Original);
369 VNInfo *defValue(
unsigned RegIdx,
const VNInfo *ParentVNI, SlotIndex
Idx,
376 void forceRecompute(
unsigned RegIdx,
const VNInfo &ParentVNI);
380 void forceRecomputeVNI(
const VNInfo &ParentVNI);
384 VNInfo *defFromParent(
unsigned RegIdx,
const VNInfo *ParentVNI,
385 SlotIndex UseIdx, MachineBasicBlock &
MBB,
386 MachineBasicBlock::iterator
I);
390 void removeBackCopies(SmallVectorImpl<VNInfo*> &
Copies);
394 MachineBasicBlock *findShallowDominator(MachineBasicBlock *
MBB,
395 MachineBasicBlock *DefMBB);
398 void computeRedundantBackCopies(DenseSet<unsigned> &NotToHoistSet,
399 SmallVectorImpl<VNInfo *> &BackCopies);
408 bool transferValues();
415 void extendPHIRange(MachineBasicBlock &
B, LiveIntervalCalc &LIC,
417 ArrayRef<SlotIndex> Undefs);
421 void extendPHIKillRanges();
424 void rewriteAssigned(
bool ExtendRanges);
427 void deleteRematVictims();
433 MachineBasicBlock &
MBB, MachineBasicBlock::iterator InsertBefore,
434 bool Late,
unsigned RegIdx);
437 MachineBasicBlock &MB,
438 MachineBasicBlock::iterator InsertBefore,
439 unsigned SubIdx, LiveInterval &DestLI,
440 bool Late, SlotIndex Def,
441 const MCInstrDesc &Desc);
446 SplitEditor(SplitAnalysis &SA, LiveIntervals &LIS, VirtRegMap &VRM,
447 MachineDominatorTree &MDT, MachineBlockFrequencyInfo &MBFI,
448 VirtRegAuxInfo &VRAI);
451 void reset(LiveRangeEdit&, ComplementSpillMode = SM_Partition);
462 void selectIntv(
unsigned Idx);
536 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.
bool looksLikeLoopIV() const
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.