Andrew Trick | 14e8d71 | 2010-10-22 23:09:15 +0000 | [diff] [blame^] | 1 | //===-------- SplitKit.cpp - Toolkit for splitting live ranges --*- C++ -*-===// |
Jakob Stoklund Olesen | 8ae0263 | 2010-07-20 15:41:07 +0000 | [diff] [blame] | 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 | // This file contains the SplitAnalysis class as well as mutator functions for |
| 11 | // live range splitting. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #include "llvm/ADT/SmallPtrSet.h" |
| 16 | #include "llvm/ADT/DenseMap.h" |
Jakob Stoklund Olesen | f017900 | 2010-07-26 23:44:11 +0000 | [diff] [blame] | 17 | #include "llvm/CodeGen/SlotIndexes.h" |
Jakob Stoklund Olesen | 8ae0263 | 2010-07-20 15:41:07 +0000 | [diff] [blame] | 18 | |
| 19 | namespace llvm { |
| 20 | |
| 21 | class LiveInterval; |
| 22 | class LiveIntervals; |
Jakob Stoklund Olesen | a17768f | 2010-10-14 23:49:52 +0000 | [diff] [blame] | 23 | class LiveRangeEdit; |
Jakob Stoklund Olesen | 8ae0263 | 2010-07-20 15:41:07 +0000 | [diff] [blame] | 24 | class MachineInstr; |
Jakob Stoklund Olesen | 8ae0263 | 2010-07-20 15:41:07 +0000 | [diff] [blame] | 25 | class MachineLoop; |
| 26 | class MachineLoopInfo; |
Jakob Stoklund Olesen | f017900 | 2010-07-26 23:44:11 +0000 | [diff] [blame] | 27 | class MachineRegisterInfo; |
Jakob Stoklund Olesen | 6a0dc07 | 2010-07-20 21:46:58 +0000 | [diff] [blame] | 28 | class TargetInstrInfo; |
Jakob Stoklund Olesen | f017900 | 2010-07-26 23:44:11 +0000 | [diff] [blame] | 29 | class VirtRegMap; |
| 30 | class VNInfo; |
Jakob Stoklund Olesen | 532de3d | 2010-10-22 20:28:21 +0000 | [diff] [blame] | 31 | class raw_ostream; |
Jakob Stoklund Olesen | 8ae0263 | 2010-07-20 15:41:07 +0000 | [diff] [blame] | 32 | |
Jakob Stoklund Olesen | f017900 | 2010-07-26 23:44:11 +0000 | [diff] [blame] | 33 | /// SplitAnalysis - Analyze a LiveInterval, looking for live range splitting |
| 34 | /// opportunities. |
Jakob Stoklund Olesen | 8ae0263 | 2010-07-20 15:41:07 +0000 | [diff] [blame] | 35 | class SplitAnalysis { |
Jakob Stoklund Olesen | 08e93b1 | 2010-08-10 17:07:22 +0000 | [diff] [blame] | 36 | public: |
Jakob Stoklund Olesen | 8ae0263 | 2010-07-20 15:41:07 +0000 | [diff] [blame] | 37 | const MachineFunction &mf_; |
| 38 | const LiveIntervals &lis_; |
| 39 | const MachineLoopInfo &loops_; |
Jakob Stoklund Olesen | 6a0dc07 | 2010-07-20 21:46:58 +0000 | [diff] [blame] | 40 | const TargetInstrInfo &tii_; |
Jakob Stoklund Olesen | 8ae0263 | 2010-07-20 15:41:07 +0000 | [diff] [blame] | 41 | |
Jakob Stoklund Olesen | 8ae0263 | 2010-07-20 15:41:07 +0000 | [diff] [blame] | 42 | // Instructions using the the current register. |
| 43 | typedef SmallPtrSet<const MachineInstr*, 16> InstrPtrSet; |
| 44 | InstrPtrSet usingInstrs_; |
| 45 | |
| 46 | // The number of instructions using curli in each basic block. |
| 47 | typedef DenseMap<const MachineBasicBlock*, unsigned> BlockCountMap; |
| 48 | BlockCountMap usingBlocks_; |
| 49 | |
Jakob Stoklund Olesen | 2dee7a5 | 2010-08-12 23:02:55 +0000 | [diff] [blame] | 50 | // The number of basic block using curli in each loop. |
| 51 | typedef DenseMap<const MachineLoop*, unsigned> LoopCountMap; |
| 52 | LoopCountMap usingLoops_; |
Jakob Stoklund Olesen | 8ae0263 | 2010-07-20 15:41:07 +0000 | [diff] [blame] | 53 | |
Jakob Stoklund Olesen | f1b05f2 | 2010-08-12 17:07:14 +0000 | [diff] [blame] | 54 | private: |
| 55 | // Current live interval. |
| 56 | const LiveInterval *curli_; |
| 57 | |
Jakob Stoklund Olesen | 8ae0263 | 2010-07-20 15:41:07 +0000 | [diff] [blame] | 58 | // Sumarize statistics by counting instructions using curli_. |
Jakob Stoklund Olesen | abff280 | 2010-07-20 16:12:37 +0000 | [diff] [blame] | 59 | void analyzeUses(); |
Jakob Stoklund Olesen | 8ae0263 | 2010-07-20 15:41:07 +0000 | [diff] [blame] | 60 | |
Jakob Stoklund Olesen | 6a0dc07 | 2010-07-20 21:46:58 +0000 | [diff] [blame] | 61 | /// canAnalyzeBranch - Return true if MBB ends in a branch that can be |
| 62 | /// analyzed. |
| 63 | bool canAnalyzeBranch(const MachineBasicBlock *MBB); |
| 64 | |
Jakob Stoklund Olesen | 8ae0263 | 2010-07-20 15:41:07 +0000 | [diff] [blame] | 65 | public: |
Jakob Stoklund Olesen | f2c6e36 | 2010-07-20 23:50:15 +0000 | [diff] [blame] | 66 | SplitAnalysis(const MachineFunction &mf, const LiveIntervals &lis, |
| 67 | const MachineLoopInfo &mli); |
Jakob Stoklund Olesen | 8ae0263 | 2010-07-20 15:41:07 +0000 | [diff] [blame] | 68 | |
| 69 | /// analyze - set curli to the specified interval, and analyze how it may be |
| 70 | /// split. |
| 71 | void analyze(const LiveInterval *li); |
| 72 | |
| 73 | /// clear - clear all data structures so SplitAnalysis is ready to analyze a |
| 74 | /// new interval. |
| 75 | void clear(); |
| 76 | |
Jakob Stoklund Olesen | 6a0dc07 | 2010-07-20 21:46:58 +0000 | [diff] [blame] | 77 | typedef SmallPtrSet<const MachineBasicBlock*, 16> BlockPtrSet; |
Jakob Stoklund Olesen | 2dee7a5 | 2010-08-12 23:02:55 +0000 | [diff] [blame] | 78 | typedef SmallPtrSet<const MachineLoop*, 16> LoopPtrSet; |
Jakob Stoklund Olesen | 6a0dc07 | 2010-07-20 21:46:58 +0000 | [diff] [blame] | 79 | |
Jakob Stoklund Olesen | 532de3d | 2010-10-22 20:28:21 +0000 | [diff] [blame] | 80 | // Print a set of blocks with use counts. |
| 81 | void print(const BlockPtrSet&, raw_ostream&) const; |
| 82 | |
Jakob Stoklund Olesen | 6a0dc07 | 2010-07-20 21:46:58 +0000 | [diff] [blame] | 83 | // Sets of basic blocks surrounding a machine loop. |
| 84 | struct LoopBlocks { |
| 85 | BlockPtrSet Loop; // Blocks in the loop. |
| 86 | BlockPtrSet Preds; // Loop predecessor blocks. |
| 87 | BlockPtrSet Exits; // Loop exit blocks. |
| 88 | |
| 89 | void clear() { |
| 90 | Loop.clear(); |
| 91 | Preds.clear(); |
| 92 | Exits.clear(); |
| 93 | } |
| 94 | }; |
| 95 | |
Jakob Stoklund Olesen | 532de3d | 2010-10-22 20:28:21 +0000 | [diff] [blame] | 96 | // Print loop blocks with use counts. |
| 97 | void print(const LoopBlocks&, raw_ostream&) const; |
| 98 | |
Jakob Stoklund Olesen | 6a0dc07 | 2010-07-20 21:46:58 +0000 | [diff] [blame] | 99 | // Calculate the block sets surrounding the loop. |
| 100 | void getLoopBlocks(const MachineLoop *Loop, LoopBlocks &Blocks); |
| 101 | |
Jakob Stoklund Olesen | 8ae0263 | 2010-07-20 15:41:07 +0000 | [diff] [blame] | 102 | /// LoopPeripheralUse - how is a variable used in and around a loop? |
| 103 | /// Peripheral blocks are the loop predecessors and exit blocks. |
| 104 | enum LoopPeripheralUse { |
| 105 | ContainedInLoop, // All uses are inside the loop. |
| 106 | SinglePeripheral, // At most one instruction per peripheral block. |
| 107 | MultiPeripheral, // Multiple instructions in some peripheral blocks. |
| 108 | OutsideLoop // Uses outside loop periphery. |
| 109 | }; |
| 110 | |
| 111 | /// analyzeLoopPeripheralUse - Return an enum describing how curli_ is used in |
| 112 | /// and around the Loop. |
Jakob Stoklund Olesen | 6a0dc07 | 2010-07-20 21:46:58 +0000 | [diff] [blame] | 113 | LoopPeripheralUse analyzeLoopPeripheralUse(const LoopBlocks&); |
| 114 | |
| 115 | /// getCriticalExits - It may be necessary to partially break critical edges |
| 116 | /// leaving the loop if an exit block has phi uses of curli. Collect the exit |
| 117 | /// blocks that need special treatment into CriticalExits. |
| 118 | void getCriticalExits(const LoopBlocks &Blocks, BlockPtrSet &CriticalExits); |
| 119 | |
| 120 | /// canSplitCriticalExits - Return true if it is possible to insert new exit |
| 121 | /// blocks before the blocks in CriticalExits. |
| 122 | bool canSplitCriticalExits(const LoopBlocks &Blocks, |
| 123 | BlockPtrSet &CriticalExits); |
Jakob Stoklund Olesen | 8ae0263 | 2010-07-20 15:41:07 +0000 | [diff] [blame] | 124 | |
| 125 | /// getBestSplitLoop - Return the loop where curli may best be split to a |
| 126 | /// separate register, or NULL. |
| 127 | const MachineLoop *getBestSplitLoop(); |
Jakob Stoklund Olesen | f1b05f2 | 2010-08-12 17:07:14 +0000 | [diff] [blame] | 128 | |
| 129 | /// getMultiUseBlocks - Add basic blocks to Blocks that may benefit from |
| 130 | /// having curli split to a new live interval. Return true if Blocks can be |
| 131 | /// passed to SplitEditor::splitSingleBlocks. |
| 132 | bool getMultiUseBlocks(BlockPtrSet &Blocks); |
Jakob Stoklund Olesen | fc412d8 | 2010-08-13 21:18:48 +0000 | [diff] [blame] | 133 | |
| 134 | /// getBlockForInsideSplit - If curli is contained inside a single basic block, |
| 135 | /// and it wou pay to subdivide the interval inside that block, return it. |
| 136 | /// Otherwise return NULL. The returned block can be passed to |
| 137 | /// SplitEditor::splitInsideBlock. |
| 138 | const MachineBasicBlock *getBlockForInsideSplit(); |
Jakob Stoklund Olesen | 8ae0263 | 2010-07-20 15:41:07 +0000 | [diff] [blame] | 139 | }; |
| 140 | |
Jakob Stoklund Olesen | 1407c84 | 2010-08-18 19:00:08 +0000 | [diff] [blame] | 141 | |
| 142 | /// LiveIntervalMap - Map values from a large LiveInterval into a small |
| 143 | /// interval that is a subset. Insert phi-def values as needed. This class is |
| 144 | /// used by SplitEditor to create new smaller LiveIntervals. |
| 145 | /// |
| 146 | /// parentli_ is the larger interval, li_ is the subset interval. Every value |
| 147 | /// in li_ corresponds to exactly one value in parentli_, and the live range |
| 148 | /// of the value is contained within the live range of the parentli_ value. |
| 149 | /// Values in parentli_ may map to any number of openli_ values, including 0. |
| 150 | class LiveIntervalMap { |
| 151 | LiveIntervals &lis_; |
Jakob Stoklund Olesen | 1407c84 | 2010-08-18 19:00:08 +0000 | [diff] [blame] | 152 | |
| 153 | // The parent interval is never changed. |
| 154 | const LiveInterval &parentli_; |
| 155 | |
| 156 | // The child interval's values are fully contained inside parentli_ values. |
Jakob Stoklund Olesen | 9ca2aeb | 2010-09-13 23:29:09 +0000 | [diff] [blame] | 157 | LiveInterval *li_; |
Jakob Stoklund Olesen | 1407c84 | 2010-08-18 19:00:08 +0000 | [diff] [blame] | 158 | |
| 159 | typedef DenseMap<const VNInfo*, VNInfo*> ValueMap; |
| 160 | |
| 161 | // Map parentli_ values to simple values in li_ that are defined at the same |
| 162 | // SlotIndex, or NULL for parentli_ values that have complex li_ defs. |
| 163 | // Note there is a difference between values mapping to NULL (complex), and |
| 164 | // values not present (unknown/unmapped). |
| 165 | ValueMap valueMap_; |
| 166 | |
Jakob Stoklund Olesen | 1407c84 | 2010-08-18 19:00:08 +0000 | [diff] [blame] | 167 | public: |
| 168 | LiveIntervalMap(LiveIntervals &lis, |
Jakob Stoklund Olesen | 9ca2aeb | 2010-09-13 23:29:09 +0000 | [diff] [blame] | 169 | const LiveInterval &parentli) |
| 170 | : lis_(lis), parentli_(parentli), li_(0) {} |
| 171 | |
| 172 | /// reset - clear all data structures and start a new live interval. |
| 173 | void reset(LiveInterval *); |
| 174 | |
| 175 | /// getLI - return the current live interval. |
| 176 | LiveInterval *getLI() const { return li_; } |
Jakob Stoklund Olesen | 1407c84 | 2010-08-18 19:00:08 +0000 | [diff] [blame] | 177 | |
| 178 | /// defValue - define a value in li_ from the parentli_ value VNI and Idx. |
| 179 | /// Idx does not have to be ParentVNI->def, but it must be contained within |
| 180 | /// ParentVNI's live range in parentli_. |
| 181 | /// Return the new li_ value. |
| 182 | VNInfo *defValue(const VNInfo *ParentVNI, SlotIndex Idx); |
| 183 | |
| 184 | /// mapValue - map ParentVNI to the corresponding li_ value at Idx. It is |
| 185 | /// assumed that ParentVNI is live at Idx. |
| 186 | /// If ParentVNI has not been defined by defValue, it is assumed that |
| 187 | /// ParentVNI->def dominates Idx. |
| 188 | /// If ParentVNI has been defined by defValue one or more times, a value that |
| 189 | /// dominates Idx will be returned. This may require creating extra phi-def |
| 190 | /// values and adding live ranges to li_. |
Jakob Stoklund Olesen | 5fa42a4 | 2010-09-21 22:32:21 +0000 | [diff] [blame] | 191 | /// If simple is not NULL, *simple will indicate if ParentVNI is a simply |
| 192 | /// mapped value. |
| 193 | VNInfo *mapValue(const VNInfo *ParentVNI, SlotIndex Idx, bool *simple = 0); |
| 194 | |
Jakob Stoklund Olesen | fc60d77 | 2010-10-05 20:36:25 +0000 | [diff] [blame] | 195 | // extendTo - Find the last li_ value defined in MBB at or before Idx. The |
| 196 | // parentli is assumed to be live at Idx. Extend the live range to include |
| 197 | // Idx. Return the found VNInfo, or NULL. |
| 198 | VNInfo *extendTo(MachineBasicBlock *MBB, SlotIndex Idx); |
| 199 | |
Jakob Stoklund Olesen | 5fa42a4 | 2010-09-21 22:32:21 +0000 | [diff] [blame] | 200 | /// isMapped - Return true is ParentVNI is a known mapped value. It may be a |
| 201 | /// simple 1-1 mapping or a complex mapping to later defs. |
| 202 | bool isMapped(const VNInfo *ParentVNI) const { |
| 203 | return valueMap_.count(ParentVNI); |
| 204 | } |
| 205 | |
| 206 | /// isComplexMapped - Return true if ParentVNI has received new definitions |
| 207 | /// with defValue. |
| 208 | bool isComplexMapped(const VNInfo *ParentVNI) const; |
| 209 | |
| 210 | // addSimpleRange - Add a simple range from parentli_ to li_. |
| 211 | // ParentVNI must be live in the [Start;End) interval. |
| 212 | void addSimpleRange(SlotIndex Start, SlotIndex End, const VNInfo *ParentVNI); |
Jakob Stoklund Olesen | 1407c84 | 2010-08-18 19:00:08 +0000 | [diff] [blame] | 213 | |
| 214 | /// addRange - Add live ranges to li_ where [Start;End) intersects parentli_. |
| 215 | /// All needed values whose def is not inside [Start;End) must be defined |
| 216 | /// beforehand so mapValue will work. |
| 217 | void addRange(SlotIndex Start, SlotIndex End); |
Jakob Stoklund Olesen | f6a129a | 2010-09-16 00:01:36 +0000 | [diff] [blame] | 218 | |
| 219 | /// defByCopyFrom - Insert a copy from Reg to li, assuming that Reg carries |
| 220 | /// ParentVNI. Add a minimal live range for the new value and return it. |
| 221 | VNInfo *defByCopyFrom(unsigned Reg, |
| 222 | const VNInfo *ParentVNI, |
| 223 | MachineBasicBlock &MBB, |
| 224 | MachineBasicBlock::iterator I); |
| 225 | |
Jakob Stoklund Olesen | 1407c84 | 2010-08-18 19:00:08 +0000 | [diff] [blame] | 226 | }; |
| 227 | |
| 228 | |
Jakob Stoklund Olesen | f017900 | 2010-07-26 23:44:11 +0000 | [diff] [blame] | 229 | /// SplitEditor - Edit machine code and LiveIntervals for live range |
| 230 | /// splitting. |
| 231 | /// |
Jakob Stoklund Olesen | 5eb308b | 2010-08-06 22:17:33 +0000 | [diff] [blame] | 232 | /// - Create a SplitEditor from a SplitAnalysis. |
Jakob Stoklund Olesen | 7536f72 | 2010-08-04 22:08:39 +0000 | [diff] [blame] | 233 | /// - Start a new live interval with openIntv. |
| 234 | /// - Mark the places where the new interval is entered using enterIntv* |
| 235 | /// - Mark the ranges where the new interval is used with useIntv* |
| 236 | /// - Mark the places where the interval is exited with exitIntv*. |
| 237 | /// - Finish the current interval with closeIntv and repeat from 2. |
Jakob Stoklund Olesen | 7466927 | 2010-10-08 23:42:21 +0000 | [diff] [blame] | 238 | /// - Rewrite instructions with finish(). |
Jakob Stoklund Olesen | f017900 | 2010-07-26 23:44:11 +0000 | [diff] [blame] | 239 | /// |
| 240 | class SplitEditor { |
| 241 | SplitAnalysis &sa_; |
| 242 | LiveIntervals &lis_; |
| 243 | VirtRegMap &vrm_; |
| 244 | MachineRegisterInfo &mri_; |
| 245 | const TargetInstrInfo &tii_; |
| 246 | |
Jakob Stoklund Olesen | a17768f | 2010-10-14 23:49:52 +0000 | [diff] [blame] | 247 | /// edit_ - The current parent register and new intervals created. |
| 248 | LiveRangeEdit &edit_; |
| 249 | |
Jakob Stoklund Olesen | 5eb308b | 2010-08-06 22:17:33 +0000 | [diff] [blame] | 250 | /// dupli_ - Created as a copy of curli_, ranges are carved out as new |
| 251 | /// intervals get added through openIntv / closeIntv. This is used to avoid |
| 252 | /// editing curli_. |
Jakob Stoklund Olesen | dd9f3fd | 2010-09-13 23:29:11 +0000 | [diff] [blame] | 253 | LiveIntervalMap dupli_; |
Jakob Stoklund Olesen | f017900 | 2010-07-26 23:44:11 +0000 | [diff] [blame] | 254 | |
| 255 | /// Currently open LiveInterval. |
Jakob Stoklund Olesen | dd9f3fd | 2010-09-13 23:29:11 +0000 | [diff] [blame] | 256 | LiveIntervalMap openli_; |
Jakob Stoklund Olesen | f017900 | 2010-07-26 23:44:11 +0000 | [diff] [blame] | 257 | |
Jakob Stoklund Olesen | 5fa42a4 | 2010-09-21 22:32:21 +0000 | [diff] [blame] | 258 | /// intervalsLiveAt - Return true if any member of intervals_ is live at Idx. |
| 259 | bool intervalsLiveAt(SlotIndex Idx) const; |
| 260 | |
| 261 | /// Values in curli whose live range has been truncated when entering an open |
| 262 | /// li. |
| 263 | SmallPtrSet<const VNInfo*, 8> truncatedValues; |
| 264 | |
| 265 | /// addTruncSimpleRange - Add the given simple range to dupli_ after |
| 266 | /// truncating any overlap with intervals_. |
| 267 | void addTruncSimpleRange(SlotIndex Start, SlotIndex End, VNInfo *VNI); |
Jakob Stoklund Olesen | f017900 | 2010-07-26 23:44:11 +0000 | [diff] [blame] | 268 | |
Jakob Stoklund Olesen | 7466927 | 2010-10-08 23:42:21 +0000 | [diff] [blame] | 269 | /// computeRemainder - Compute the dupli liveness as the complement of all the |
| 270 | /// new intervals. |
| 271 | void computeRemainder(); |
| 272 | |
| 273 | /// rewrite - Rewrite all uses of reg to use the new registers. |
| 274 | void rewrite(unsigned reg); |
| 275 | |
Jakob Stoklund Olesen | f017900 | 2010-07-26 23:44:11 +0000 | [diff] [blame] | 276 | public: |
| 277 | /// Create a new SplitEditor for editing the LiveInterval analyzed by SA. |
Jakob Stoklund Olesen | 7536f72 | 2010-08-04 22:08:39 +0000 | [diff] [blame] | 278 | /// Newly created intervals will be appended to newIntervals. |
Jakob Stoklund Olesen | a17768f | 2010-10-14 23:49:52 +0000 | [diff] [blame] | 279 | SplitEditor(SplitAnalysis &SA, LiveIntervals&, VirtRegMap&, LiveRangeEdit&); |
Jakob Stoklund Olesen | f017900 | 2010-07-26 23:44:11 +0000 | [diff] [blame] | 280 | |
Jakob Stoklund Olesen | 5eb308b | 2010-08-06 22:17:33 +0000 | [diff] [blame] | 281 | /// getAnalysis - Get the corresponding analysis. |
| 282 | SplitAnalysis &getAnalysis() { return sa_; } |
Jakob Stoklund Olesen | f017900 | 2010-07-26 23:44:11 +0000 | [diff] [blame] | 283 | |
Jakob Stoklund Olesen | 7536f72 | 2010-08-04 22:08:39 +0000 | [diff] [blame] | 284 | /// Create a new virtual register and live interval. |
| 285 | void openIntv(); |
Jakob Stoklund Olesen | f017900 | 2010-07-26 23:44:11 +0000 | [diff] [blame] | 286 | |
Jakob Stoklund Olesen | f1b05f2 | 2010-08-12 17:07:14 +0000 | [diff] [blame] | 287 | /// enterIntvBefore - Enter openli before the instruction at Idx. If curli is |
| 288 | /// not live before Idx, a COPY is not inserted. |
| 289 | void enterIntvBefore(SlotIndex Idx); |
| 290 | |
Jakob Stoklund Olesen | 7536f72 | 2010-08-04 22:08:39 +0000 | [diff] [blame] | 291 | /// enterIntvAtEnd - Enter openli at the end of MBB. |
Jakob Stoklund Olesen | f6a129a | 2010-09-16 00:01:36 +0000 | [diff] [blame] | 292 | void enterIntvAtEnd(MachineBasicBlock &MBB); |
Jakob Stoklund Olesen | f017900 | 2010-07-26 23:44:11 +0000 | [diff] [blame] | 293 | |
Jakob Stoklund Olesen | 7536f72 | 2010-08-04 22:08:39 +0000 | [diff] [blame] | 294 | /// useIntv - indicate that all instructions in MBB should use openli. |
| 295 | void useIntv(const MachineBasicBlock &MBB); |
Jakob Stoklund Olesen | f017900 | 2010-07-26 23:44:11 +0000 | [diff] [blame] | 296 | |
Jakob Stoklund Olesen | 7536f72 | 2010-08-04 22:08:39 +0000 | [diff] [blame] | 297 | /// useIntv - indicate that all instructions in range should use openli. |
| 298 | void useIntv(SlotIndex Start, SlotIndex End); |
Jakob Stoklund Olesen | f017900 | 2010-07-26 23:44:11 +0000 | [diff] [blame] | 299 | |
Jakob Stoklund Olesen | f1b05f2 | 2010-08-12 17:07:14 +0000 | [diff] [blame] | 300 | /// leaveIntvAfter - Leave openli after the instruction at Idx. |
| 301 | void leaveIntvAfter(SlotIndex Idx); |
| 302 | |
Jakob Stoklund Olesen | 7536f72 | 2010-08-04 22:08:39 +0000 | [diff] [blame] | 303 | /// leaveIntvAtTop - Leave the interval at the top of MBB. |
| 304 | /// Currently, only one value can leave the interval. |
| 305 | void leaveIntvAtTop(MachineBasicBlock &MBB); |
Jakob Stoklund Olesen | f017900 | 2010-07-26 23:44:11 +0000 | [diff] [blame] | 306 | |
Jakob Stoklund Olesen | 7536f72 | 2010-08-04 22:08:39 +0000 | [diff] [blame] | 307 | /// closeIntv - Indicate that we are done editing the currently open |
Jakob Stoklund Olesen | f017900 | 2010-07-26 23:44:11 +0000 | [diff] [blame] | 308 | /// LiveInterval, and ranges can be trimmed. |
Jakob Stoklund Olesen | 7536f72 | 2010-08-04 22:08:39 +0000 | [diff] [blame] | 309 | void closeIntv(); |
Jakob Stoklund Olesen | f017900 | 2010-07-26 23:44:11 +0000 | [diff] [blame] | 310 | |
Jakob Stoklund Olesen | 7466927 | 2010-10-08 23:42:21 +0000 | [diff] [blame] | 311 | /// finish - after all the new live ranges have been created, compute the |
| 312 | /// remaining live range, and rewrite instructions to use the new registers. |
| 313 | void finish(); |
Jakob Stoklund Olesen | f017900 | 2010-07-26 23:44:11 +0000 | [diff] [blame] | 314 | |
| 315 | // ===--- High level methods ---=== |
| 316 | |
| 317 | /// splitAroundLoop - Split curli into a separate live interval inside |
Jakob Stoklund Olesen | 57d0f2d | 2010-10-05 22:19:33 +0000 | [diff] [blame] | 318 | /// the loop. |
| 319 | void splitAroundLoop(const MachineLoop*); |
Jakob Stoklund Olesen | f017900 | 2010-07-26 23:44:11 +0000 | [diff] [blame] | 320 | |
Jakob Stoklund Olesen | f1b05f2 | 2010-08-12 17:07:14 +0000 | [diff] [blame] | 321 | /// splitSingleBlocks - Split curli into a separate live interval inside each |
Jakob Stoklund Olesen | 57d0f2d | 2010-10-05 22:19:33 +0000 | [diff] [blame] | 322 | /// basic block in Blocks. |
| 323 | void splitSingleBlocks(const SplitAnalysis::BlockPtrSet &Blocks); |
Jakob Stoklund Olesen | f017900 | 2010-07-26 23:44:11 +0000 | [diff] [blame] | 324 | |
Jakob Stoklund Olesen | 57d0f2d | 2010-10-05 22:19:33 +0000 | [diff] [blame] | 325 | /// splitInsideBlock - Split curli into multiple intervals inside MBB. |
| 326 | void splitInsideBlock(const MachineBasicBlock *); |
Jakob Stoklund Olesen | fc412d8 | 2010-08-13 21:18:48 +0000 | [diff] [blame] | 327 | }; |
Jakob Stoklund Olesen | 8ae0263 | 2010-07-20 15:41:07 +0000 | [diff] [blame] | 328 | |
| 329 | } |