LLVM  5.0.0
LiveIntervalAnalysis.h
Go to the documentation of this file.
1 //===- LiveIntervalAnalysis.h - Live Interval Analysis ----------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 /// \file This file implements the LiveInterval analysis pass. Given some
11 /// numbering of each the machine instructions (in this implemention depth-first
12 /// order) an interval [i, j) is said to be a live interval for register v if
13 /// there is no instruction with number j' > j such that v is live at j' and
14 /// there is no instruction with number i' < i such that v is live at i'. In
15 /// this implementation intervals can have holes, i.e. an interval might look
16 /// like [1,20), [50,65), [1000,1001).
17 //
18 //===----------------------------------------------------------------------===//
19 
20 #ifndef LLVM_CODEGEN_LIVEINTERVALANALYSIS_H
21 #define LLVM_CODEGEN_LIVEINTERVALANALYSIS_H
22 
23 #include "llvm/ADT/ArrayRef.h"
24 #include "llvm/ADT/IndexedMap.h"
25 #include "llvm/ADT/SmallVector.h"
31 #include "llvm/MC/LaneBitmask.h"
33 #include "llvm/Support/Compiler.h"
36 #include <cassert>
37 #include <cstdint>
38 #include <utility>
39 
40 namespace llvm {
41 
42 extern cl::opt<bool> UseSegmentSetForPhysRegs;
43 
44 class BitVector;
45 class LiveRangeCalc;
46 class MachineBlockFrequencyInfo;
47 class MachineDominatorTree;
48 class MachineFunction;
49 class MachineInstr;
50 class MachineRegisterInfo;
51 class raw_ostream;
52 class TargetInstrInfo;
53 class VirtRegMap;
54 
56  MachineFunction* MF;
58  const TargetRegisterInfo* TRI;
59  const TargetInstrInfo* TII;
60  AliasAnalysis *AA;
61  SlotIndexes* Indexes;
62  MachineDominatorTree *DomTree = nullptr;
63  LiveRangeCalc *LRCalc = nullptr;
64 
65  /// Special pool allocator for VNInfo's (LiveInterval val#).
66  VNInfo::Allocator VNInfoAllocator;
67 
68  /// Live interval pointers for all the virtual registers.
70 
71  /// Sorted list of instructions with register mask operands. Always use the
72  /// 'r' slot, RegMasks are normal clobbers, not early clobbers.
73  SmallVector<SlotIndex, 8> RegMaskSlots;
74 
75  /// This vector is parallel to RegMaskSlots, it holds a pointer to the
76  /// corresponding register mask. This pointer can be recomputed as:
77  ///
78  /// MI = Indexes->getInstructionFromIndex(RegMaskSlot[N]);
79  /// unsigned OpNum = findRegMaskOperand(MI);
80  /// RegMaskBits[N] = MI->getOperand(OpNum).getRegMask();
81  ///
82  /// This is kept in a separate vector partly because some standard
83  /// libraries don't support lower_bound() with mixed objects, partly to
84  /// improve locality when searching in RegMaskSlots.
85  /// Also see the comment in LiveInterval::find().
87 
88  /// For each basic block number, keep (begin, size) pairs indexing into the
89  /// RegMaskSlots and RegMaskBits arrays.
90  /// Note that basic block numbers may not be layout contiguous, that's why
91  /// we can't just keep track of the first register mask in each basic
92  /// block.
94 
95  /// Keeps a live range set for each register unit to track fixed physreg
96  /// interference.
97  SmallVector<LiveRange*, 0> RegUnitRanges;
98 
99  public:
100  static char ID;
101 
102  LiveIntervals();
103  ~LiveIntervals() override;
104 
105  /// Calculate the spill weight to assign to a single instruction.
106  static float getSpillWeight(bool isDef, bool isUse,
107  const MachineBlockFrequencyInfo *MBFI,
108  const MachineInstr &Instr);
109 
111  if (hasInterval(Reg))
112  return *VirtRegIntervals[Reg];
113  else
115  }
116 
117  const LiveInterval &getInterval(unsigned Reg) const {
118  return const_cast<LiveIntervals*>(this)->getInterval(Reg);
119  }
120 
121  bool hasInterval(unsigned Reg) const {
122  return VirtRegIntervals.inBounds(Reg) && VirtRegIntervals[Reg];
123  }
124 
125  /// Interval creation.
127  assert(!hasInterval(Reg) && "Interval already exists!");
128  VirtRegIntervals.grow(Reg);
129  VirtRegIntervals[Reg] = createInterval(Reg);
130  return *VirtRegIntervals[Reg];
131  }
132 
135  computeVirtRegInterval(LI);
136  return LI;
137  }
138 
139  /// Interval removal.
140  void removeInterval(unsigned Reg) {
141  delete VirtRegIntervals[Reg];
142  VirtRegIntervals[Reg] = nullptr;
143  }
144 
145  /// Given a register and an instruction, adds a live segment from that
146  /// instruction to the end of its MBB.
148  MachineInstr &startInst);
149 
150  /// After removing some uses of a register, shrink its live range to just
151  /// the remaining uses. This method does not compute reaching defs for new
152  /// uses, and it doesn't remove dead defs.
153  /// Dead PHIDef values are marked as unused. New dead machine instructions
154  /// are added to the dead vector. Returns true if the interval may have been
155  /// separated into multiple connected components.
156  bool shrinkToUses(LiveInterval *li,
157  SmallVectorImpl<MachineInstr*> *dead = nullptr);
158 
159  /// Specialized version of
160  /// shrinkToUses(LiveInterval *li, SmallVectorImpl<MachineInstr*> *dead)
161  /// that works on a subregister live range and only looks at uses matching
162  /// the lane mask of the subregister range.
163  /// This may leave the subrange empty which needs to be cleaned up with
164  /// LiveInterval::removeEmptySubranges() afterwards.
165  void shrinkToUses(LiveInterval::SubRange &SR, unsigned Reg);
166 
167  /// Extend the live range \p LR to reach all points in \p Indices. The
168  /// points in the \p Indices array must be jointly dominated by the union
169  /// of the existing defs in \p LR and points in \p Undefs.
170  ///
171  /// PHI-defs are added as needed to maintain SSA form.
172  ///
173  /// If a SlotIndex in \p Indices is the end index of a basic block, \p LR
174  /// will be extended to be live out of the basic block.
175  /// If a SlotIndex in \p Indices is jointy dominated only by points in
176  /// \p Undefs, the live range will not be extended to that point.
177  ///
178  /// See also LiveRangeCalc::extend().
180  ArrayRef<SlotIndex> Undefs);
181 
183  extendToIndices(LR, Indices, /*Undefs=*/{});
184  }
185 
186  /// If \p LR has a live value at \p Kill, prune its live range by removing
187  /// any liveness reachable from Kill. Add live range end points to
188  /// EndPoints such that extendToIndices(LI, EndPoints) will reconstruct the
189  /// value's live range.
190  ///
191  /// Calling pruneValue() and extendToIndices() can be used to reconstruct
192  /// SSA form after adding defs to a virtual register.
194  SmallVectorImpl<SlotIndex> *EndPoints);
195 
196  /// This function should not be used. Its intend is to tell you that
197  /// you are doing something wrong if you call pruveValue directly on a
198  /// LiveInterval. Indeed, you are supposed to call pruneValue on the main
199  /// LiveRange and all the LiveRange of the subranges if any.
203  "Use pruneValue on the main LiveRange and on each subrange");
204  }
205 
207  return Indexes;
208  }
209 
211  return AA;
212  }
213 
214  /// Returns true if the specified machine instr has been removed or was
215  /// never entered in the map.
216  bool isNotInMIMap(const MachineInstr &Instr) const {
217  return !Indexes->hasIndex(Instr);
218  }
219 
220  /// Returns the base index of the given instruction.
222  return Indexes->getInstructionIndex(Instr);
223  }
224 
225  /// Returns the instruction associated with the given index.
227  return Indexes->getInstructionFromIndex(index);
228  }
229 
230  /// Return the first index in the given basic block.
232  return Indexes->getMBBStartIdx(mbb);
233  }
234 
235  /// Return the last index in the given basic block.
237  return Indexes->getMBBEndIdx(mbb);
238  }
239 
240  bool isLiveInToMBB(const LiveRange &LR,
241  const MachineBasicBlock *mbb) const {
242  return LR.liveAt(getMBBStartIdx(mbb));
243  }
244 
245  bool isLiveOutOfMBB(const LiveRange &LR,
246  const MachineBasicBlock *mbb) const {
247  return LR.liveAt(getMBBEndIdx(mbb).getPrevSlot());
248  }
249 
251  return Indexes->getMBBFromIndex(index);
252  }
253 
255  Indexes->insertMBBInMaps(MBB);
256  assert(unsigned(MBB->getNumber()) == RegMaskBlocks.size() &&
257  "Blocks must be added in order.");
258  RegMaskBlocks.push_back(std::make_pair(RegMaskSlots.size(), 0));
259  }
260 
262  return Indexes->insertMachineInstrInMaps(MI);
263  }
264 
267  for (MachineBasicBlock::iterator I = B; I != E; ++I)
268  Indexes->insertMachineInstrInMaps(*I);
269  }
270 
272  Indexes->removeMachineInstrFromMaps(MI);
273  }
274 
276  return Indexes->replaceMachineInstrInMaps(MI, NewMI);
277  }
278 
279  VNInfo::Allocator& getVNInfoAllocator() { return VNInfoAllocator; }
280 
281  void getAnalysisUsage(AnalysisUsage &AU) const override;
282  void releaseMemory() override;
283 
284  /// Pass entry point; Calculates LiveIntervals.
285  bool runOnMachineFunction(MachineFunction&) override;
286 
287  /// Implement the dump method.
288  void print(raw_ostream &O, const Module* = nullptr) const override;
289 
290  /// If LI is confined to a single basic block, return a pointer to that
291  /// block. If LI is live in to or out of any block, return NULL.
293 
294  /// Returns true if VNI is killed by any PHI-def values in LI.
295  /// This may conservatively return true to avoid expensive computations.
296  bool hasPHIKill(const LiveInterval &LI, const VNInfo *VNI) const;
297 
298  /// Add kill flags to any instruction that kills a virtual register.
299  void addKillFlags(const VirtRegMap*);
300 
301  /// Call this method to notify LiveIntervals that instruction \p MI has been
302  /// moved within a basic block. This will update the live intervals for all
303  /// operands of \p MI. Moves between basic blocks are not supported.
304  ///
305  /// \param UpdateFlags Update live intervals for nonallocatable physregs.
306  void handleMove(MachineInstr &MI, bool UpdateFlags = false);
307 
308  /// Update intervals for operands of \p MI so that they begin/end on the
309  /// SlotIndex for \p BundleStart.
310  ///
311  /// \param UpdateFlags Update live intervals for nonallocatable physregs.
312  ///
313  /// Requires MI and BundleStart to have SlotIndexes, and assumes
314  /// existing liveness is accurate. BundleStart should be the first
315  /// instruction in the Bundle.
316  void handleMoveIntoBundle(MachineInstr &MI, MachineInstr &BundleStart,
317  bool UpdateFlags = false);
318 
319  /// Update live intervals for instructions in a range of iterators. It is
320  /// intended for use after target hooks that may insert or remove
321  /// instructions, and is only efficient for a small number of instructions.
322  ///
323  /// OrigRegs is a vector of registers that were originally used by the
324  /// instructions in the range between the two iterators.
325  ///
326  /// Currently, the only only changes that are supported are simple removal
327  /// and addition of uses.
331  ArrayRef<unsigned> OrigRegs);
332 
333  // Register mask functions.
334  //
335  // Machine instructions may use a register mask operand to indicate that a
336  // large number of registers are clobbered by the instruction. This is
337  // typically used for calls.
338  //
339  // For compile time performance reasons, these clobbers are not recorded in
340  // the live intervals for individual physical registers. Instead,
341  // LiveIntervalAnalysis maintains a sorted list of instructions with
342  // register mask operands.
343 
344  /// Returns a sorted array of slot indices of all instructions with
345  /// register mask operands.
346  ArrayRef<SlotIndex> getRegMaskSlots() const { return RegMaskSlots; }
347 
348  /// Returns a sorted array of slot indices of all instructions with register
349  /// mask operands in the basic block numbered \p MBBNum.
351  std::pair<unsigned, unsigned> P = RegMaskBlocks[MBBNum];
352  return getRegMaskSlots().slice(P.first, P.second);
353  }
354 
355  /// Returns an array of register mask pointers corresponding to
356  /// getRegMaskSlots().
357  ArrayRef<const uint32_t*> getRegMaskBits() const { return RegMaskBits; }
358 
359  /// Returns an array of mask pointers corresponding to
360  /// getRegMaskSlotsInBlock(MBBNum).
362  std::pair<unsigned, unsigned> P = RegMaskBlocks[MBBNum];
363  return getRegMaskBits().slice(P.first, P.second);
364  }
365 
366  /// Test if \p LI is live across any register mask instructions, and
367  /// compute a bit mask of physical registers that are not clobbered by any
368  /// of them.
369  ///
370  /// Returns false if \p LI doesn't cross any register mask instructions. In
371  /// that case, the bit vector is not filled in.
373  BitVector &UsableRegs);
374 
375  // Register unit functions.
376  //
377  // Fixed interference occurs when MachineInstrs use physregs directly
378  // instead of virtual registers. This typically happens when passing
379  // arguments to a function call, or when instructions require operands in
380  // fixed registers.
381  //
382  // Each physreg has one or more register units, see MCRegisterInfo. We
383  // track liveness per register unit to handle aliasing registers more
384  // efficiently.
385 
386  /// Return the live range for register unit \p Unit. It will be computed if
387  /// it doesn't exist.
388  LiveRange &getRegUnit(unsigned Unit) {
389  LiveRange *LR = RegUnitRanges[Unit];
390  if (!LR) {
391  // Compute missing ranges on demand.
392  // Use segment set to speed-up initial computation of the live range.
393  RegUnitRanges[Unit] = LR = new LiveRange(UseSegmentSetForPhysRegs);
394  computeRegUnitRange(*LR, Unit);
395  }
396  return *LR;
397  }
398 
399  /// Return the live range for register unit \p Unit if it has already been
400  /// computed, or nullptr if it hasn't been computed yet.
402  return RegUnitRanges[Unit];
403  }
404 
405  const LiveRange *getCachedRegUnit(unsigned Unit) const {
406  return RegUnitRanges[Unit];
407  }
408 
409  /// Remove computed live range for register unit \p Unit. Subsequent uses
410  /// should rely on on-demand recomputation.
411  void removeRegUnit(unsigned Unit) {
412  delete RegUnitRanges[Unit];
413  RegUnitRanges[Unit] = nullptr;
414  }
415 
416  /// Remove value numbers and related live segments starting at position
417  /// \p Pos that are part of any liverange of physical register \p Reg or one
418  /// of its subregisters.
419  void removePhysRegDefAt(unsigned Reg, SlotIndex Pos);
420 
421  /// Remove value number and related live segments of \p LI and its subranges
422  /// that start at position \p Pos.
423  void removeVRegDefAt(LiveInterval &LI, SlotIndex Pos);
424 
425  /// Split separate components in LiveInterval \p LI into separate intervals.
428 
429  /// For live interval \p LI with correct SubRanges construct matching
430  /// information for the main live range. Expects the main live range to not
431  /// have any segments or value numbers.
433 
434  private:
435  /// Compute live intervals for all virtual registers.
436  void computeVirtRegs();
437 
438  /// Compute RegMaskSlots and RegMaskBits.
439  void computeRegMasks();
440 
441  /// Walk the values in \p LI and check for dead values:
442  /// - Dead PHIDef values are marked as unused.
443  /// - Dead operands are marked as such.
444  /// - Completely dead machine instructions are added to the \p dead vector
445  /// if it is not nullptr.
446  /// Returns true if any PHI value numbers have been removed which may
447  /// have separated the interval into multiple connected components.
448  bool computeDeadValues(LiveInterval &LI,
450 
451  static LiveInterval* createInterval(unsigned Reg);
452 
453  void printInstrs(raw_ostream &O) const;
454  void dumpInstrs() const;
455 
456  void computeLiveInRegUnits();
457  void computeRegUnitRange(LiveRange&, unsigned Unit);
458  void computeVirtRegInterval(LiveInterval&);
459 
460 
461  /// Helper function for repairIntervalsInRange(), walks backwards and
462  /// creates/modifies live segments in \p LR to match the operands found.
463  /// Only full operands or operands with subregisters matching \p LaneMask
464  /// are considered.
465  void repairOldRegInRange(MachineBasicBlock::iterator Begin,
467  const SlotIndex endIdx, LiveRange &LR,
468  unsigned Reg,
469  LaneBitmask LaneMask = LaneBitmask::getAll());
470 
471  class HMEditor;
472  };
473 
474 } // end namespace llvm
475 
476 #endif // LLVM_CODEGEN_LIVEINTERVALANALYSIS_H
void push_back(const T &Elt)
Definition: SmallVector.h:211
A common definition of LaneBitmask for use in TableGen and CodeGen.
ArrayRef< SlotIndex > getRegMaskSlots() const
Returns a sorted array of slot indices of all instructions with register mask operands.
void extendToIndices(LiveRange &LR, ArrayRef< SlotIndex > Indices)
SlotIndex getInstructionIndex(const MachineInstr &MI) const
Returns the base index for the given instruction.
Definition: SlotIndexes.h:414
cl::opt< bool > UseSegmentSetForPhysRegs
void RemoveMachineInstrFromMaps(MachineInstr &MI)
void removePhysRegDefAt(unsigned Reg, SlotIndex Pos)
Remove value numbers and related live segments starting at position Pos that are part of any liverang...
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:63
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
bool runOnMachineFunction(MachineFunction &) override
Pass entry point; Calculates LiveIntervals.
static LaneBitmask getAll()
Definition: LaneBitmask.h:77
LiveInterval - This class represents the liveness of a register, or stack slot.
Definition: LiveInterval.h:638
void removeMachineInstrFromMaps(MachineInstr &MI)
Removes machine instruction (bundle) MI from the mapping.
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
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
SlotIndex getInstructionIndex(const MachineInstr &Instr) const
Returns the base index of the given instruction.
A live range for subregisters.
Definition: LiveInterval.h:645
This represents a simple continuous liveness interval for a value.
Definition: LiveInterval.h:162
void splitSeparateComponents(LiveInterval &LI, SmallVectorImpl< LiveInterval * > &SplitLIs)
Split separate components in LiveInterval LI into separate intervals.
VNInfo - Value Number Information.
Definition: LiveInterval.h:53
void print(raw_ostream &O, const Module *=nullptr) const override
Implement the dump method.
bool checkRegMaskInterference(LiveInterval &LI, BitVector &UsableRegs)
Test if LI is live across any register mask instructions, and compute a bit mask of physical register...
LiveInterval::Segment addSegmentToEndOfBlock(unsigned reg, MachineInstr &startInst)
Given a register and an instruction, adds a live segment from that instruction to the end of its MBB...
This class represents the liveness of a register, stack slot, etc.
Definition: LiveInterval.h:157
LLVM_ATTRIBUTE_UNUSED void pruneValue(LiveInterval &, SlotIndex, SmallVectorImpl< SlotIndex > *)
This function should not be used.
void pruneValue(LiveRange &LR, SlotIndex Kill, SmallVectorImpl< SlotIndex > *EndPoints)
If LR has a live value at Kill, prune its live range by removing any liveness reachable from Kill...
MachineBasicBlock * intervalIsInOneMBB(const LiveInterval &LI) const
If LI is confined to a single basic block, return a pointer to that block.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
ArrayRef< SlotIndex > getRegMaskSlotsInBlock(unsigned MBBNum) const
Returns a sorted array of slot indices of all instructions with register mask operands in the basic b...
ArrayRef< const uint32_t * > getRegMaskBits() const
Returns an array of register mask pointers corresponding to getRegMaskSlots().
bool hasIndex(const MachineInstr &instr) const
Returns true if the given machine instr is mapped to an index, otherwise returns false.
Definition: SlotIndexes.h:409
VNInfo::Allocator & getVNInfoAllocator()
Reg
All possible values of the reg field in the ModR/M byte.
void InsertMachineInstrRangeInMaps(MachineBasicBlock::iterator B, MachineBasicBlock::iterator E)
SlotIndex ReplaceMachineInstrInMaps(MachineInstr &MI, MachineInstr &NewMI)
void extendToIndices(LiveRange &LR, ArrayRef< SlotIndex > Indices, ArrayRef< SlotIndex > Undefs)
Extend the live range LR to reach all points in Indices.
void insertMBBInMaps(MachineBasicBlock *MBB)
SlotIndexes pass.
Definition: SlotIndexes.h:331
void constructMainRangeFromSubranges(LiveInterval &LI)
For live interval LI with correct SubRanges construct matching information for the main live range...
SlotIndex InsertMachineInstrInMaps(MachineInstr &MI)
bool shrinkToUses(LiveInterval *li, SmallVectorImpl< MachineInstr * > *dead=nullptr)
After removing some uses of a register, shrink its live range to just the remaining uses...
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
LiveRange * getCachedRegUnit(unsigned Unit)
Return the live range for register unit Unit if it has already been computed, or nullptr if it hasn't...
TargetInstrInfo - Interface to description of machine instruction set.
bool hasPHIKill(const LiveInterval &LI, const VNInfo *VNI) const
Returns true if VNI is killed by any PHI-def values in LI.
SlotIndex insertMachineInstrInMaps(MachineInstr &MI, bool Late=false)
Insert the given machine instruction into the mapping.
Definition: SlotIndexes.h:577
#define P(N)
SlotIndexes * getSlotIndexes() const
void insertMBBInMaps(MachineBasicBlock *mbb)
Add the given MachineBasicBlock into the maps.
Definition: SlotIndexes.h:645
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:138
void removeInterval(unsigned Reg)
Interval removal.
const LiveRange * getCachedRegUnit(unsigned Unit) const
Represent the analysis usage information of a pass.
#define LLVM_ATTRIBUTE_UNUSED
Definition: Compiler.h:144
static const unsigned End
void repairIntervalsInRange(MachineBasicBlock *MBB, MachineBasicBlock::iterator Begin, MachineBasicBlock::iterator End, ArrayRef< unsigned > OrigRegs)
Update live intervals for instructions in a range of iterators.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
bool liveAt(SlotIndex index) const
Definition: LiveInterval.h:389
MachineInstr * getInstructionFromIndex(SlotIndex index) const
Returns the instruction for the given index, or null if the given index has no instruction associated...
Definition: SlotIndexes.h:424
void removeRegUnit(unsigned Unit)
Remove computed live range for register unit Unit.
ArrayRef< const uint32_t * > getRegMaskBitsInBlock(unsigned MBBNum) const
Returns an array of mask pointers corresponding to getRegMaskSlotsInBlock(MBBNum).
#define E
Definition: LargeTest.cpp:27
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
#define B
Definition: LargeTest.cpp:24
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:861
MachineBasicBlock * getMBBFromIndex(SlotIndex index) const
Returns the basic block which the given index falls in.
Definition: SlotIndexes.h:533
LiveInterval & getInterval(unsigned Reg)
static float getSpillWeight(bool isDef, bool isUse, const MachineBlockFrequencyInfo *MBFI, const MachineInstr &Instr)
Calculate the spill weight to assign to a single instruction.
SlotIndex getMBBEndIdx(unsigned Num) const
Returns the last index in the given basic block number.
Definition: SlotIndexes.h:497
LiveInterval & createEmptyInterval(unsigned Reg)
Interval creation.
llvm_unreachable("Unknown RegBank!")
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
Representation of each machine instruction.
Definition: MachineInstr.h:59
void addKillFlags(const VirtRegMap *)
Add kill flags to any instruction that kills a virtual register.
#define I(x, y, z)
Definition: MD5.cpp:58
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
Definition: SmallVector.h:135
SlotIndex getMBBStartIdx(unsigned Num) const
Returns the first index in the given basic block number.
Definition: SlotIndexes.h:487
bool hasInterval(unsigned Reg) const
std::vector< uint8_t > Unit
Definition: FuzzerDefs.h:105
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
AliasAnalysis * getAliasAnalysis() const
MachineInstr * getInstructionFromIndex(SlotIndex index) const
Returns the instruction associated with the given index.
bool isNotInMIMap(const MachineInstr &Instr) const
Returns true if the specified machine instr has been removed or was never entered in the map...
void handleMoveIntoBundle(MachineInstr &MI, MachineInstr &BundleStart, bool UpdateFlags=false)
Update intervals for operands of MI so that they begin/end on the SlotIndex for BundleStart.
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:44
SlotIndex getMBBStartIdx(const MachineBasicBlock *mbb) const
Return the first index in the given basic block.
const LiveInterval & getInterval(unsigned Reg) const
IRTranslator LLVM IR MI
SlotIndex - An opaque wrapper around machine indexes.
Definition: SlotIndexes.h:84
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
LiveRange & getRegUnit(unsigned Unit)
Return the live range for register unit Unit.
void handleMove(MachineInstr &MI, bool UpdateFlags=false)
Call this method to notify LiveIntervals that instruction MI has been moved within a basic block...
LiveInterval & createAndComputeVirtRegInterval(unsigned Reg)
void removeVRegDefAt(LiveInterval &LI, SlotIndex Pos)
Remove value number and related live segments of LI and its subranges that start at position Pos...
SlotIndex replaceMachineInstrInMaps(MachineInstr &MI, MachineInstr &NewMI)
ReplaceMachineInstrInMaps - Replacing a machine instr with a new one in maps used by register allocat...
Definition: SlotIndexes.h:630