1 //===- LiveIntervals.h - Live Interval Analysis -----------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 /// \file This file implements the LiveInterval analysis pass. Given some 10 /// numbering of each the machine instructions (in this implemention depth-first 11 /// order) an interval [i, j) is said to be a live interval for register v if 12 /// there is no instruction with number j' > j such that v is live at j' and 13 /// there is no instruction with number i' < i such that v is live at i'. In 14 /// this implementation intervals can have holes, i.e. an interval might look 15 /// like [1,20), [50,65), [1000,1001). 16 // 17 //===----------------------------------------------------------------------===// 18 19 #ifndef LLVM_CODEGEN_LIVEINTERVALS_H 20 #define LLVM_CODEGEN_LIVEINTERVALS_H 21 22 #include "llvm/ADT/ArrayRef.h" 23 #include "llvm/ADT/IndexedMap.h" 24 #include "llvm/ADT/SmallVector.h" 25 #include "llvm/CodeGen/LiveInterval.h" 26 #include "llvm/CodeGen/LiveIntervalCalc.h" 27 #include "llvm/CodeGen/MachineBasicBlock.h" 28 #include "llvm/CodeGen/MachineFunctionPass.h" 29 #include "llvm/CodeGen/MachinePassManager.h" 30 #include "llvm/CodeGen/SlotIndexes.h" 31 #include "llvm/CodeGen/TargetRegisterInfo.h" 32 #include "llvm/MC/LaneBitmask.h" 33 #include "llvm/Support/CommandLine.h" 34 #include "llvm/Support/Compiler.h" 35 #include "llvm/Support/ErrorHandling.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 MachineBlockFrequencyInfo; 46 class MachineDominatorTree; 47 class MachineFunction; 48 class MachineInstr; 49 class MachineRegisterInfo; 50 class raw_ostream; 51 class TargetInstrInfo; 52 class VirtRegMap; 53 54 class LiveIntervals { 55 friend class LiveIntervalsAnalysis; 56 friend class LiveIntervalsWrapperPass; 57 58 MachineFunction *MF = nullptr; 59 MachineRegisterInfo *MRI = nullptr; 60 const TargetRegisterInfo *TRI = nullptr; 61 const TargetInstrInfo *TII = nullptr; 62 SlotIndexes *Indexes = nullptr; 63 MachineDominatorTree *DomTree = nullptr; 64 std::unique_ptr<LiveIntervalCalc> LICalc; 65 66 /// Special pool allocator for VNInfo's (LiveInterval val#). 67 VNInfo::Allocator VNInfoAllocator; 68 69 /// Live interval pointers for all the virtual registers. 70 IndexedMap<LiveInterval *, VirtReg2IndexFunctor> VirtRegIntervals; 71 72 /// Sorted list of instructions with register mask operands. Always use the 73 /// 'r' slot, RegMasks are normal clobbers, not early clobbers. 74 SmallVector<SlotIndex, 8> RegMaskSlots; 75 76 /// This vector is parallel to RegMaskSlots, it holds a pointer to the 77 /// corresponding register mask. This pointer can be recomputed as: 78 /// 79 /// MI = Indexes->getInstructionFromIndex(RegMaskSlot[N]); 80 /// unsigned OpNum = findRegMaskOperand(MI); 81 /// RegMaskBits[N] = MI->getOperand(OpNum).getRegMask(); 82 /// 83 /// This is kept in a separate vector partly because some standard 84 /// libraries don't support lower_bound() with mixed objects, partly to 85 /// improve locality when searching in RegMaskSlots. 86 /// Also see the comment in LiveInterval::find(). 87 SmallVector<const uint32_t *, 8> RegMaskBits; 88 89 /// For each basic block number, keep (begin, size) pairs indexing into the 90 /// RegMaskSlots and RegMaskBits arrays. 91 /// Note that basic block numbers may not be layout contiguous, that's why 92 /// we can't just keep track of the first register mask in each basic 93 /// block. 94 SmallVector<std::pair<unsigned, unsigned>, 8> RegMaskBlocks; 95 96 /// Keeps a live range set for each register unit to track fixed physreg 97 /// interference. 98 SmallVector<LiveRange *, 0> RegUnitRanges; 99 100 // Can only be created from pass manager. 101 LiveIntervals() = default; LiveIntervals(MachineFunction & MF,SlotIndexes & SI,MachineDominatorTree & DT)102 LiveIntervals(MachineFunction &MF, SlotIndexes &SI, MachineDominatorTree &DT) 103 : Indexes(&SI), DomTree(&DT) { 104 analyze(MF); 105 } 106 107 void analyze(MachineFunction &MF); 108 109 void clear(); 110 111 public: 112 LiveIntervals(LiveIntervals &&) = default; 113 ~LiveIntervals(); 114 115 /// Calculate the spill weight to assign to a single instruction. 116 static float getSpillWeight(bool isDef, bool isUse, 117 const MachineBlockFrequencyInfo *MBFI, 118 const MachineInstr &MI); 119 120 /// Calculate the spill weight to assign to a single instruction. 121 static float getSpillWeight(bool isDef, bool isUse, 122 const MachineBlockFrequencyInfo *MBFI, 123 const MachineBasicBlock *MBB); 124 getInterval(Register Reg)125 LiveInterval &getInterval(Register Reg) { 126 if (hasInterval(Reg)) 127 return *VirtRegIntervals[Reg.id()]; 128 129 return createAndComputeVirtRegInterval(Reg); 130 } 131 getInterval(Register Reg)132 const LiveInterval &getInterval(Register Reg) const { 133 return const_cast<LiveIntervals *>(this)->getInterval(Reg); 134 } 135 hasInterval(Register Reg)136 bool hasInterval(Register Reg) const { 137 return VirtRegIntervals.inBounds(Reg.id()) && VirtRegIntervals[Reg.id()]; 138 } 139 140 /// Interval creation. createEmptyInterval(Register Reg)141 LiveInterval &createEmptyInterval(Register Reg) { 142 assert(!hasInterval(Reg) && "Interval already exists!"); 143 VirtRegIntervals.grow(Reg.id()); 144 VirtRegIntervals[Reg.id()] = createInterval(Reg); 145 return *VirtRegIntervals[Reg.id()]; 146 } 147 createAndComputeVirtRegInterval(Register Reg)148 LiveInterval &createAndComputeVirtRegInterval(Register Reg) { 149 LiveInterval &LI = createEmptyInterval(Reg); 150 computeVirtRegInterval(LI); 151 return LI; 152 } 153 154 /// Return an existing interval for \p Reg. 155 /// If \p Reg has no interval then this creates a new empty one instead. 156 /// Note: does not trigger interval computation. getOrCreateEmptyInterval(Register Reg)157 LiveInterval &getOrCreateEmptyInterval(Register Reg) { 158 return hasInterval(Reg) ? getInterval(Reg) : createEmptyInterval(Reg); 159 } 160 161 /// Interval removal. removeInterval(Register Reg)162 void removeInterval(Register Reg) { 163 delete VirtRegIntervals[Reg]; 164 VirtRegIntervals[Reg] = nullptr; 165 } 166 167 /// Given a register and an instruction, adds a live segment from that 168 /// instruction to the end of its MBB. 169 LiveInterval::Segment addSegmentToEndOfBlock(Register Reg, 170 MachineInstr &startInst); 171 172 /// After removing some uses of a register, shrink its live range to just 173 /// the remaining uses. This method does not compute reaching defs for new 174 /// uses, and it doesn't remove dead defs. 175 /// Dead PHIDef values are marked as unused. New dead machine instructions 176 /// are added to the dead vector. Returns true if the interval may have been 177 /// separated into multiple connected components. 178 bool shrinkToUses(LiveInterval *li, 179 SmallVectorImpl<MachineInstr *> *dead = nullptr); 180 181 /// Specialized version of 182 /// shrinkToUses(LiveInterval *li, SmallVectorImpl<MachineInstr*> *dead) 183 /// that works on a subregister live range and only looks at uses matching 184 /// the lane mask of the subregister range. 185 /// This may leave the subrange empty which needs to be cleaned up with 186 /// LiveInterval::removeEmptySubranges() afterwards. 187 void shrinkToUses(LiveInterval::SubRange &SR, Register Reg); 188 189 /// Extend the live range \p LR to reach all points in \p Indices. The 190 /// points in the \p Indices array must be jointly dominated by the union 191 /// of the existing defs in \p LR and points in \p Undefs. 192 /// 193 /// PHI-defs are added as needed to maintain SSA form. 194 /// 195 /// If a SlotIndex in \p Indices is the end index of a basic block, \p LR 196 /// will be extended to be live out of the basic block. 197 /// If a SlotIndex in \p Indices is jointy dominated only by points in 198 /// \p Undefs, the live range will not be extended to that point. 199 /// 200 /// See also LiveRangeCalc::extend(). 201 void extendToIndices(LiveRange &LR, ArrayRef<SlotIndex> Indices, 202 ArrayRef<SlotIndex> Undefs); 203 extendToIndices(LiveRange & LR,ArrayRef<SlotIndex> Indices)204 void extendToIndices(LiveRange &LR, ArrayRef<SlotIndex> Indices) { 205 extendToIndices(LR, Indices, /*Undefs=*/{}); 206 } 207 208 /// If \p LR has a live value at \p Kill, prune its live range by removing 209 /// any liveness reachable from Kill. Add live range end points to 210 /// EndPoints such that extendToIndices(LI, EndPoints) will reconstruct the 211 /// value's live range. 212 /// 213 /// Calling pruneValue() and extendToIndices() can be used to reconstruct 214 /// SSA form after adding defs to a virtual register. 215 void pruneValue(LiveRange &LR, SlotIndex Kill, 216 SmallVectorImpl<SlotIndex> *EndPoints); 217 218 /// This function should not be used. Its intent is to tell you that you are 219 /// doing something wrong if you call pruneValue directly on a 220 /// LiveInterval. Indeed, you are supposed to call pruneValue on the main 221 /// LiveRange and all the LiveRanges of the subranges if any. pruneValue(LiveInterval &,SlotIndex,SmallVectorImpl<SlotIndex> *)222 LLVM_ATTRIBUTE_UNUSED void pruneValue(LiveInterval &, SlotIndex, 223 SmallVectorImpl<SlotIndex> *) { 224 llvm_unreachable( 225 "Use pruneValue on the main LiveRange and on each subrange"); 226 } 227 getSlotIndexes()228 SlotIndexes *getSlotIndexes() const { return Indexes; } 229 230 /// Returns true if the specified machine instr has been removed or was 231 /// never entered in the map. isNotInMIMap(const MachineInstr & Instr)232 bool isNotInMIMap(const MachineInstr &Instr) const { 233 return !Indexes->hasIndex(Instr); 234 } 235 236 /// Returns the base index of the given instruction. getInstructionIndex(const MachineInstr & Instr)237 SlotIndex getInstructionIndex(const MachineInstr &Instr) const { 238 return Indexes->getInstructionIndex(Instr); 239 } 240 241 /// Returns the instruction associated with the given index. getInstructionFromIndex(SlotIndex index)242 MachineInstr *getInstructionFromIndex(SlotIndex index) const { 243 return Indexes->getInstructionFromIndex(index); 244 } 245 246 /// Return the first index in the given basic block. getMBBStartIdx(const MachineBasicBlock * mbb)247 SlotIndex getMBBStartIdx(const MachineBasicBlock *mbb) const { 248 return Indexes->getMBBStartIdx(mbb); 249 } 250 251 /// Return the last index in the given basic block. getMBBEndIdx(const MachineBasicBlock * mbb)252 SlotIndex getMBBEndIdx(const MachineBasicBlock *mbb) const { 253 return Indexes->getMBBEndIdx(mbb); 254 } 255 isLiveInToMBB(const LiveRange & LR,const MachineBasicBlock * mbb)256 bool isLiveInToMBB(const LiveRange &LR, const MachineBasicBlock *mbb) const { 257 return LR.liveAt(getMBBStartIdx(mbb)); 258 } 259 isLiveOutOfMBB(const LiveRange & LR,const MachineBasicBlock * mbb)260 bool isLiveOutOfMBB(const LiveRange &LR, const MachineBasicBlock *mbb) const { 261 return LR.liveAt(getMBBEndIdx(mbb).getPrevSlot()); 262 } 263 getMBBFromIndex(SlotIndex index)264 MachineBasicBlock *getMBBFromIndex(SlotIndex index) const { 265 return Indexes->getMBBFromIndex(index); 266 } 267 insertMBBInMaps(MachineBasicBlock * MBB)268 void insertMBBInMaps(MachineBasicBlock *MBB) { 269 Indexes->insertMBBInMaps(MBB); 270 assert(unsigned(MBB->getNumber()) == RegMaskBlocks.size() && 271 "Blocks must be added in order."); 272 RegMaskBlocks.push_back(std::make_pair(RegMaskSlots.size(), 0)); 273 } 274 InsertMachineInstrInMaps(MachineInstr & MI)275 SlotIndex InsertMachineInstrInMaps(MachineInstr &MI) { 276 return Indexes->insertMachineInstrInMaps(MI); 277 } 278 InsertMachineInstrRangeInMaps(MachineBasicBlock::iterator B,MachineBasicBlock::iterator E)279 void InsertMachineInstrRangeInMaps(MachineBasicBlock::iterator B, 280 MachineBasicBlock::iterator E) { 281 for (MachineBasicBlock::iterator I = B; I != E; ++I) 282 Indexes->insertMachineInstrInMaps(*I); 283 } 284 RemoveMachineInstrFromMaps(MachineInstr & MI)285 void RemoveMachineInstrFromMaps(MachineInstr &MI) { 286 Indexes->removeMachineInstrFromMaps(MI); 287 } 288 ReplaceMachineInstrInMaps(MachineInstr & MI,MachineInstr & NewMI)289 SlotIndex ReplaceMachineInstrInMaps(MachineInstr &MI, MachineInstr &NewMI) { 290 return Indexes->replaceMachineInstrInMaps(MI, NewMI); 291 } 292 getVNInfoAllocator()293 VNInfo::Allocator &getVNInfoAllocator() { return VNInfoAllocator; } 294 295 /// Implement the dump method. 296 void print(raw_ostream &O) const; 297 void dump() const; 298 299 // For legacy pass to recompute liveness. reanalyze(MachineFunction & MF)300 void reanalyze(MachineFunction &MF) { 301 clear(); 302 analyze(MF); 303 } 304 getDomTree()305 MachineDominatorTree &getDomTree() { return *DomTree; } 306 307 /// If LI is confined to a single basic block, return a pointer to that 308 /// block. If LI is live in to or out of any block, return NULL. 309 MachineBasicBlock *intervalIsInOneMBB(const LiveInterval &LI) const; 310 311 /// Returns true if VNI is killed by any PHI-def values in LI. 312 /// This may conservatively return true to avoid expensive computations. 313 bool hasPHIKill(const LiveInterval &LI, const VNInfo *VNI) const; 314 315 /// Add kill flags to any instruction that kills a virtual register. 316 void addKillFlags(const VirtRegMap *); 317 318 /// Call this method to notify LiveIntervals that instruction \p MI has been 319 /// moved within a basic block. This will update the live intervals for all 320 /// operands of \p MI. Moves between basic blocks are not supported. 321 /// 322 /// \param UpdateFlags Update live intervals for nonallocatable physregs. 323 void handleMove(MachineInstr &MI, bool UpdateFlags = false); 324 325 /// Update intervals of operands of all instructions in the newly 326 /// created bundle specified by \p BundleStart. 327 /// 328 /// \param UpdateFlags Update live intervals for nonallocatable physregs. 329 /// 330 /// Assumes existing liveness is accurate. 331 /// \pre BundleStart should be the first instruction in the Bundle. 332 /// \pre BundleStart should not have a have SlotIndex as one will be assigned. 333 void handleMoveIntoNewBundle(MachineInstr &BundleStart, 334 bool UpdateFlags = false); 335 336 /// Update live intervals for instructions in a range of iterators. It is 337 /// intended for use after target hooks that may insert or remove 338 /// instructions, and is only efficient for a small number of instructions. 339 /// 340 /// OrigRegs is a vector of registers that were originally used by the 341 /// instructions in the range between the two iterators. 342 /// 343 /// Currently, the only changes that are supported are simple removal 344 /// and addition of uses. 345 void repairIntervalsInRange(MachineBasicBlock *MBB, 346 MachineBasicBlock::iterator Begin, 347 MachineBasicBlock::iterator End, 348 ArrayRef<Register> OrigRegs); 349 350 // Register mask functions. 351 // 352 // Machine instructions may use a register mask operand to indicate that a 353 // large number of registers are clobbered by the instruction. This is 354 // typically used for calls. 355 // 356 // For compile time performance reasons, these clobbers are not recorded in 357 // the live intervals for individual physical registers. Instead, 358 // LiveIntervalAnalysis maintains a sorted list of instructions with 359 // register mask operands. 360 361 /// Returns a sorted array of slot indices of all instructions with 362 /// register mask operands. getRegMaskSlots()363 ArrayRef<SlotIndex> getRegMaskSlots() const { return RegMaskSlots; } 364 365 /// Returns a sorted array of slot indices of all instructions with register 366 /// mask operands in the basic block numbered \p MBBNum. getRegMaskSlotsInBlock(unsigned MBBNum)367 ArrayRef<SlotIndex> getRegMaskSlotsInBlock(unsigned MBBNum) const { 368 std::pair<unsigned, unsigned> P = RegMaskBlocks[MBBNum]; 369 return getRegMaskSlots().slice(P.first, P.second); 370 } 371 372 /// Returns an array of register mask pointers corresponding to 373 /// getRegMaskSlots(). getRegMaskBits()374 ArrayRef<const uint32_t *> getRegMaskBits() const { return RegMaskBits; } 375 376 /// Returns an array of mask pointers corresponding to 377 /// getRegMaskSlotsInBlock(MBBNum). getRegMaskBitsInBlock(unsigned MBBNum)378 ArrayRef<const uint32_t *> getRegMaskBitsInBlock(unsigned MBBNum) const { 379 std::pair<unsigned, unsigned> P = RegMaskBlocks[MBBNum]; 380 return getRegMaskBits().slice(P.first, P.second); 381 } 382 383 /// Test if \p LI is live across any register mask instructions, and 384 /// compute a bit mask of physical registers that are not clobbered by any 385 /// of them. 386 /// 387 /// Returns false if \p LI doesn't cross any register mask instructions. In 388 /// that case, the bit vector is not filled in. 389 bool checkRegMaskInterference(const LiveInterval &LI, BitVector &UsableRegs); 390 391 // Register unit functions. 392 // 393 // Fixed interference occurs when MachineInstrs use physregs directly 394 // instead of virtual registers. This typically happens when passing 395 // arguments to a function call, or when instructions require operands in 396 // fixed registers. 397 // 398 // Each physreg has one or more register units, see MCRegisterInfo. We 399 // track liveness per register unit to handle aliasing registers more 400 // efficiently. 401 402 /// Return the live range for register unit \p Unit. It will be computed if 403 /// it doesn't exist. getRegUnit(unsigned Unit)404 LiveRange &getRegUnit(unsigned Unit) { 405 LiveRange *LR = RegUnitRanges[Unit]; 406 if (!LR) { 407 // Compute missing ranges on demand. 408 // Use segment set to speed-up initial computation of the live range. 409 RegUnitRanges[Unit] = LR = new LiveRange(UseSegmentSetForPhysRegs); 410 computeRegUnitRange(*LR, Unit); 411 } 412 return *LR; 413 } 414 415 /// Return the live range for register unit \p Unit if it has already been 416 /// computed, or nullptr if it hasn't been computed yet. getCachedRegUnit(unsigned Unit)417 LiveRange *getCachedRegUnit(unsigned Unit) { return RegUnitRanges[Unit]; } 418 getCachedRegUnit(unsigned Unit)419 const LiveRange *getCachedRegUnit(unsigned Unit) const { 420 return RegUnitRanges[Unit]; 421 } 422 423 /// Remove computed live range for register unit \p Unit. Subsequent uses 424 /// should rely on on-demand recomputation. removeRegUnit(unsigned Unit)425 void removeRegUnit(unsigned Unit) { 426 delete RegUnitRanges[Unit]; 427 RegUnitRanges[Unit] = nullptr; 428 } 429 430 /// Remove associated live ranges for the register units associated with \p 431 /// Reg. Subsequent uses should rely on on-demand recomputation. \note This 432 /// method can result in inconsistent liveness tracking if multiple phyical 433 /// registers share a regunit, and should be used cautiously. removeAllRegUnitsForPhysReg(MCRegister Reg)434 void removeAllRegUnitsForPhysReg(MCRegister Reg) { 435 for (MCRegUnit Unit : TRI->regunits(Reg)) 436 removeRegUnit(Unit); 437 } 438 439 /// Remove value numbers and related live segments starting at position 440 /// \p Pos that are part of any liverange of physical register \p Reg or one 441 /// of its subregisters. 442 void removePhysRegDefAt(MCRegister Reg, SlotIndex Pos); 443 444 /// Remove value number and related live segments of \p LI and its subranges 445 /// that start at position \p Pos. 446 void removeVRegDefAt(LiveInterval &LI, SlotIndex Pos); 447 448 /// Split separate components in LiveInterval \p LI into separate intervals. 449 void splitSeparateComponents(LiveInterval &LI, 450 SmallVectorImpl<LiveInterval *> &SplitLIs); 451 452 /// For live interval \p LI with correct SubRanges construct matching 453 /// information for the main live range. Expects the main live range to not 454 /// have any segments or value numbers. 455 void constructMainRangeFromSubranges(LiveInterval &LI); 456 457 private: 458 /// Compute live intervals for all virtual registers. 459 void computeVirtRegs(); 460 461 /// Compute RegMaskSlots and RegMaskBits. 462 void computeRegMasks(); 463 464 /// Walk the values in \p LI and check for dead values: 465 /// - Dead PHIDef values are marked as unused. 466 /// - Dead operands are marked as such. 467 /// - Completely dead machine instructions are added to the \p dead vector 468 /// if it is not nullptr. 469 /// Returns true if any PHI value numbers have been removed which may 470 /// have separated the interval into multiple connected components. 471 bool computeDeadValues(LiveInterval &LI, 472 SmallVectorImpl<MachineInstr *> *dead); 473 474 static LiveInterval *createInterval(Register Reg); 475 476 void printInstrs(raw_ostream &O) const; 477 void dumpInstrs() const; 478 479 void computeLiveInRegUnits(); 480 void computeRegUnitRange(LiveRange &, unsigned Unit); 481 bool computeVirtRegInterval(LiveInterval &); 482 483 using ShrinkToUsesWorkList = SmallVector<std::pair<SlotIndex, VNInfo *>, 16>; 484 void extendSegmentsToUses(LiveRange &Segments, ShrinkToUsesWorkList &WorkList, 485 Register Reg, LaneBitmask LaneMask); 486 487 /// Helper function for repairIntervalsInRange(), walks backwards and 488 /// creates/modifies live segments in \p LR to match the operands found. 489 /// Only full operands or operands with subregisters matching \p LaneMask 490 /// are considered. 491 void repairOldRegInRange(MachineBasicBlock::iterator Begin, 492 MachineBasicBlock::iterator End, 493 const SlotIndex endIdx, LiveRange &LR, Register Reg, 494 LaneBitmask LaneMask = LaneBitmask::getAll()); 495 496 class HMEditor; 497 }; 498 499 class LiveIntervalsAnalysis : public AnalysisInfoMixin<LiveIntervalsAnalysis> { 500 friend AnalysisInfoMixin<LiveIntervalsAnalysis>; 501 static AnalysisKey Key; 502 503 public: 504 using Result = LiveIntervals; 505 Result run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM); 506 }; 507 508 class LiveIntervalsPrinterPass 509 : public PassInfoMixin<LiveIntervalsPrinterPass> { 510 raw_ostream &OS; 511 512 public: LiveIntervalsPrinterPass(raw_ostream & OS)513 explicit LiveIntervalsPrinterPass(raw_ostream &OS) : OS(OS) {} 514 PreservedAnalyses run(MachineFunction &MF, 515 MachineFunctionAnalysisManager &MFAM); isRequired()516 static bool isRequired() { return true; } 517 }; 518 519 class LiveIntervalsWrapperPass : public MachineFunctionPass { 520 LiveIntervals LIS; 521 522 public: 523 static char ID; 524 525 LiveIntervalsWrapperPass(); 526 527 void getAnalysisUsage(AnalysisUsage &AU) const override; releaseMemory()528 void releaseMemory() override { LIS.clear(); } 529 530 /// Pass entry point; Calculates LiveIntervals. 531 bool runOnMachineFunction(MachineFunction &) override; 532 533 /// Implement the dump method. 534 void print(raw_ostream &O, const Module * = nullptr) const override { 535 LIS.print(O); 536 } 537 getLIS()538 LiveIntervals &getLIS() { return LIS; } 539 }; 540 541 } // end namespace llvm 542 543 #endif 544