blob: a6ba37610a0b9d4dfcd5e991cc030cf210981f57 [file] [log] [blame]
Andrew Trick14e8d712010-10-22 23:09:15 +00001//===-------- SplitKit.cpp - Toolkit for splitting live ranges --*- C++ -*-===//
Jakob Stoklund Olesen8ae02632010-07-20 15:41:07 +00002//
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
Jakob Stoklund Olesen8ae02632010-07-20 15:41:07 +000015#include "llvm/ADT/DenseMap.h"
Jakob Stoklund Olesen8d0963f2010-12-21 01:50:21 +000016#include "llvm/ADT/IntEqClasses.h"
17#include "llvm/ADT/SmallPtrSet.h"
Jakob Stoklund Olesenf0179002010-07-26 23:44:11 +000018#include "llvm/CodeGen/SlotIndexes.h"
Jakob Stoklund Olesen8ae02632010-07-20 15:41:07 +000019
Jakob Stoklund Olesen8d0963f2010-12-21 01:50:21 +000020#include <string>
21
Jakob Stoklund Olesen8ae02632010-07-20 15:41:07 +000022namespace llvm {
23
24class LiveInterval;
25class LiveIntervals;
Jakob Stoklund Olesena17768f2010-10-14 23:49:52 +000026class LiveRangeEdit;
Jakob Stoklund Olesen8ae02632010-07-20 15:41:07 +000027class MachineInstr;
Jakob Stoklund Olesen8ae02632010-07-20 15:41:07 +000028class MachineLoop;
29class MachineLoopInfo;
Jakob Stoklund Olesenf0179002010-07-26 23:44:11 +000030class MachineRegisterInfo;
Jakob Stoklund Olesen6a0dc072010-07-20 21:46:58 +000031class TargetInstrInfo;
Jakob Stoklund Olesencfa71342010-11-10 19:31:50 +000032class TargetRegisterInfo;
Jakob Stoklund Olesenf0179002010-07-26 23:44:11 +000033class VirtRegMap;
34class VNInfo;
Jakob Stoklund Olesen532de3d2010-10-22 20:28:21 +000035class raw_ostream;
Jakob Stoklund Olesen8ae02632010-07-20 15:41:07 +000036
Jakob Stoklund Olesene1dde7b2010-10-28 20:34:52 +000037/// At some point we should just include MachineDominators.h:
38class MachineDominatorTree;
39template <class NodeT> class DomTreeNodeBase;
40typedef DomTreeNodeBase<MachineBasicBlock> MachineDomTreeNode;
41
Jakob Stoklund Olesen8d0963f2010-12-21 01:50:21 +000042
43/// EdgeBundles - Group CFG edges into equivalence classes where registers must
44/// be allocated identically. This annotates the CFG to form a bipartite graph
45/// where each block is connected to an ingoing and an outgoing bundle.
46/// Edge bundles are simply numbered, there is no object representation.
47class EdgeBundles {
48 const MachineFunction *MF;
49
50 /// EC - Each edge bundle is an equivalence class. The keys are:
51 /// 2*BB->getNumber() -> Ingoing bundle.
52 /// 2*BB->getNumber()+1 -> Outgoing bundle.
53 IntEqClasses EC;
54
55public:
56 /// compute - Compute the edge bundles for MF. Bundles depend only on the CFG.
57 void compute(const MachineFunction *MF);
58
59 /// getBundle - Return the ingoing (Out = false) or outgoing (Out = true)
60 /// bundle number for basic block #N
61 unsigned getBundle(unsigned N, bool Out) const { return EC[2 * N + Out]; }
62
63 /// getMachineFunction - Return the last machine function computed.
64 const MachineFunction *getMachineFunction() const { return MF; }
65
66 /// view - Visualize the annotated bipartite CFG with Graphviz.
67 void view() const;
68};
69
70/// Specialize WriteGraph, the standard implementation won't work.
71raw_ostream &WriteGraph(raw_ostream &O, const EdgeBundles &G,
72 bool ShortNames = false,
73 const std::string &Title = "");
74
75
Jakob Stoklund Olesenf0179002010-07-26 23:44:11 +000076/// SplitAnalysis - Analyze a LiveInterval, looking for live range splitting
77/// opportunities.
Jakob Stoklund Olesen8ae02632010-07-20 15:41:07 +000078class SplitAnalysis {
Jakob Stoklund Olesen08e93b12010-08-10 17:07:22 +000079public:
Jakob Stoklund Olesen8ae02632010-07-20 15:41:07 +000080 const MachineFunction &mf_;
81 const LiveIntervals &lis_;
82 const MachineLoopInfo &loops_;
Jakob Stoklund Olesen6a0dc072010-07-20 21:46:58 +000083 const TargetInstrInfo &tii_;
Jakob Stoklund Olesen8ae02632010-07-20 15:41:07 +000084
Jakob Stoklund Olesen8ae02632010-07-20 15:41:07 +000085 // Instructions using the the current register.
86 typedef SmallPtrSet<const MachineInstr*, 16> InstrPtrSet;
87 InstrPtrSet usingInstrs_;
88
89 // The number of instructions using curli in each basic block.
90 typedef DenseMap<const MachineBasicBlock*, unsigned> BlockCountMap;
91 BlockCountMap usingBlocks_;
92
Jakob Stoklund Olesen2dee7a52010-08-12 23:02:55 +000093 // The number of basic block using curli in each loop.
94 typedef DenseMap<const MachineLoop*, unsigned> LoopCountMap;
95 LoopCountMap usingLoops_;
Jakob Stoklund Olesen8ae02632010-07-20 15:41:07 +000096
Jakob Stoklund Olesenf1b05f22010-08-12 17:07:14 +000097private:
98 // Current live interval.
99 const LiveInterval *curli_;
100
Jakob Stoklund Olesen8ae02632010-07-20 15:41:07 +0000101 // Sumarize statistics by counting instructions using curli_.
Jakob Stoklund Olesenabff2802010-07-20 16:12:37 +0000102 void analyzeUses();
Jakob Stoklund Olesen8ae02632010-07-20 15:41:07 +0000103
Jakob Stoklund Olesen6a0dc072010-07-20 21:46:58 +0000104 /// canAnalyzeBranch - Return true if MBB ends in a branch that can be
105 /// analyzed.
106 bool canAnalyzeBranch(const MachineBasicBlock *MBB);
107
Jakob Stoklund Olesen8ae02632010-07-20 15:41:07 +0000108public:
Jakob Stoklund Olesenf2c6e362010-07-20 23:50:15 +0000109 SplitAnalysis(const MachineFunction &mf, const LiveIntervals &lis,
110 const MachineLoopInfo &mli);
Jakob Stoklund Olesen8ae02632010-07-20 15:41:07 +0000111
112 /// analyze - set curli to the specified interval, and analyze how it may be
113 /// split.
114 void analyze(const LiveInterval *li);
115
116 /// clear - clear all data structures so SplitAnalysis is ready to analyze a
117 /// new interval.
118 void clear();
119
Jakob Stoklund Olesen6a0dc072010-07-20 21:46:58 +0000120 typedef SmallPtrSet<const MachineBasicBlock*, 16> BlockPtrSet;
Jakob Stoklund Olesen2dee7a52010-08-12 23:02:55 +0000121 typedef SmallPtrSet<const MachineLoop*, 16> LoopPtrSet;
Jakob Stoklund Olesen6a0dc072010-07-20 21:46:58 +0000122
Jakob Stoklund Olesen532de3d2010-10-22 20:28:21 +0000123 // Print a set of blocks with use counts.
124 void print(const BlockPtrSet&, raw_ostream&) const;
125
Jakob Stoklund Olesen6a0dc072010-07-20 21:46:58 +0000126 // Sets of basic blocks surrounding a machine loop.
127 struct LoopBlocks {
128 BlockPtrSet Loop; // Blocks in the loop.
129 BlockPtrSet Preds; // Loop predecessor blocks.
130 BlockPtrSet Exits; // Loop exit blocks.
131
132 void clear() {
133 Loop.clear();
134 Preds.clear();
135 Exits.clear();
136 }
137 };
138
Jakob Stoklund Olesen532de3d2010-10-22 20:28:21 +0000139 // Print loop blocks with use counts.
140 void print(const LoopBlocks&, raw_ostream&) const;
141
Jakob Stoklund Olesen6a0dc072010-07-20 21:46:58 +0000142 // Calculate the block sets surrounding the loop.
143 void getLoopBlocks(const MachineLoop *Loop, LoopBlocks &Blocks);
144
Jakob Stoklund Olesen8ae02632010-07-20 15:41:07 +0000145 /// LoopPeripheralUse - how is a variable used in and around a loop?
146 /// Peripheral blocks are the loop predecessors and exit blocks.
147 enum LoopPeripheralUse {
148 ContainedInLoop, // All uses are inside the loop.
149 SinglePeripheral, // At most one instruction per peripheral block.
150 MultiPeripheral, // Multiple instructions in some peripheral blocks.
151 OutsideLoop // Uses outside loop periphery.
152 };
153
154 /// analyzeLoopPeripheralUse - Return an enum describing how curli_ is used in
155 /// and around the Loop.
Jakob Stoklund Olesen6a0dc072010-07-20 21:46:58 +0000156 LoopPeripheralUse analyzeLoopPeripheralUse(const LoopBlocks&);
157
158 /// getCriticalExits - It may be necessary to partially break critical edges
159 /// leaving the loop if an exit block has phi uses of curli. Collect the exit
160 /// blocks that need special treatment into CriticalExits.
161 void getCriticalExits(const LoopBlocks &Blocks, BlockPtrSet &CriticalExits);
162
163 /// canSplitCriticalExits - Return true if it is possible to insert new exit
164 /// blocks before the blocks in CriticalExits.
165 bool canSplitCriticalExits(const LoopBlocks &Blocks,
166 BlockPtrSet &CriticalExits);
Jakob Stoklund Olesen8ae02632010-07-20 15:41:07 +0000167
Jakob Stoklund Olesen0960a652010-10-27 00:39:05 +0000168 /// getCriticalPreds - Get the set of loop predecessors with critical edges to
169 /// blocks outside the loop that have curli live in. We don't have to break
170 /// these edges, but they do require special treatment.
171 void getCriticalPreds(const LoopBlocks &Blocks, BlockPtrSet &CriticalPreds);
172
Jakob Stoklund Olesen521a4532010-12-15 17:41:19 +0000173 /// getSplitLoops - Get the set of loops that have curli uses and would be
174 /// profitable to split.
175 void getSplitLoops(LoopPtrSet&);
176
Jakob Stoklund Olesen8ae02632010-07-20 15:41:07 +0000177 /// getBestSplitLoop - Return the loop where curli may best be split to a
178 /// separate register, or NULL.
179 const MachineLoop *getBestSplitLoop();
Jakob Stoklund Olesenf1b05f22010-08-12 17:07:14 +0000180
Jakob Stoklund Olesen697483a2010-12-15 17:49:52 +0000181 /// isBypassLoop - Return true if curli is live through Loop and has no uses
182 /// inside the loop. Bypass loops are candidates for splitting because it can
183 /// prevent interference inside the loop.
184 bool isBypassLoop(const MachineLoop *Loop);
185
186 /// getBypassLoops - Get all the maximal bypass loops. These are the bypass
187 /// loops whose parent is not a bypass loop.
188 void getBypassLoops(LoopPtrSet&);
189
Jakob Stoklund Olesenf1b05f22010-08-12 17:07:14 +0000190 /// getMultiUseBlocks - Add basic blocks to Blocks that may benefit from
191 /// having curli split to a new live interval. Return true if Blocks can be
192 /// passed to SplitEditor::splitSingleBlocks.
193 bool getMultiUseBlocks(BlockPtrSet &Blocks);
Jakob Stoklund Olesenfc412d82010-08-13 21:18:48 +0000194
195 /// getBlockForInsideSplit - If curli is contained inside a single basic block,
196 /// and it wou pay to subdivide the interval inside that block, return it.
197 /// Otherwise return NULL. The returned block can be passed to
198 /// SplitEditor::splitInsideBlock.
199 const MachineBasicBlock *getBlockForInsideSplit();
Jakob Stoklund Olesen8ae02632010-07-20 15:41:07 +0000200};
201
Jakob Stoklund Olesen1407c842010-08-18 19:00:08 +0000202
203/// LiveIntervalMap - Map values from a large LiveInterval into a small
204/// interval that is a subset. Insert phi-def values as needed. This class is
205/// used by SplitEditor to create new smaller LiveIntervals.
206///
207/// parentli_ is the larger interval, li_ is the subset interval. Every value
208/// in li_ corresponds to exactly one value in parentli_, and the live range
209/// of the value is contained within the live range of the parentli_ value.
210/// Values in parentli_ may map to any number of openli_ values, including 0.
211class LiveIntervalMap {
212 LiveIntervals &lis_;
Jakob Stoklund Olesend68f4582010-10-28 20:34:50 +0000213 MachineDominatorTree &mdt_;
Jakob Stoklund Olesen1407c842010-08-18 19:00:08 +0000214
215 // The parent interval is never changed.
216 const LiveInterval &parentli_;
217
218 // The child interval's values are fully contained inside parentli_ values.
Jakob Stoklund Olesen9ca2aeb2010-09-13 23:29:09 +0000219 LiveInterval *li_;
Jakob Stoklund Olesen1407c842010-08-18 19:00:08 +0000220
221 typedef DenseMap<const VNInfo*, VNInfo*> ValueMap;
222
223 // Map parentli_ values to simple values in li_ that are defined at the same
224 // SlotIndex, or NULL for parentli_ values that have complex li_ defs.
225 // Note there is a difference between values mapping to NULL (complex), and
226 // values not present (unknown/unmapped).
227 ValueMap valueMap_;
228
Jakob Stoklund Olesene1dde7b2010-10-28 20:34:52 +0000229 typedef std::pair<VNInfo*, MachineDomTreeNode*> LiveOutPair;
230 typedef DenseMap<MachineBasicBlock*,LiveOutPair> LiveOutMap;
231
232 // liveOutCache_ - Map each basic block where li_ is live out to the live-out
233 // value and its defining block. One of these conditions shall be true:
234 //
235 // 1. !liveOutCache_.count(MBB)
236 // 2. liveOutCache_[MBB].second.getNode() == MBB
237 // 3. forall P in preds(MBB): liveOutCache_[P] == liveOutCache_[MBB]
238 //
239 // This is only a cache, the values can be computed as:
240 //
241 // VNI = li_->getVNInfoAt(lis_.getMBBEndIdx(MBB))
242 // Node = mbt_[lis_.getMBBFromIndex(VNI->def)]
243 //
244 // The cache is also used as a visiteed set by mapValue().
245 LiveOutMap liveOutCache_;
246
Jakob Stoklund Olesen1407c842010-08-18 19:00:08 +0000247public:
248 LiveIntervalMap(LiveIntervals &lis,
Jakob Stoklund Olesend68f4582010-10-28 20:34:50 +0000249 MachineDominatorTree &mdt,
Jakob Stoklund Olesen9ca2aeb2010-09-13 23:29:09 +0000250 const LiveInterval &parentli)
Jakob Stoklund Olesend68f4582010-10-28 20:34:50 +0000251 : lis_(lis), mdt_(mdt), parentli_(parentli), li_(0) {}
Jakob Stoklund Olesen9ca2aeb2010-09-13 23:29:09 +0000252
253 /// reset - clear all data structures and start a new live interval.
254 void reset(LiveInterval *);
255
256 /// getLI - return the current live interval.
257 LiveInterval *getLI() const { return li_; }
Jakob Stoklund Olesen1407c842010-08-18 19:00:08 +0000258
259 /// defValue - define a value in li_ from the parentli_ value VNI and Idx.
260 /// Idx does not have to be ParentVNI->def, but it must be contained within
261 /// ParentVNI's live range in parentli_.
262 /// Return the new li_ value.
263 VNInfo *defValue(const VNInfo *ParentVNI, SlotIndex Idx);
264
265 /// mapValue - map ParentVNI to the corresponding li_ value at Idx. It is
266 /// assumed that ParentVNI is live at Idx.
267 /// If ParentVNI has not been defined by defValue, it is assumed that
268 /// ParentVNI->def dominates Idx.
269 /// If ParentVNI has been defined by defValue one or more times, a value that
270 /// dominates Idx will be returned. This may require creating extra phi-def
271 /// values and adding live ranges to li_.
Jakob Stoklund Olesen5fa42a42010-09-21 22:32:21 +0000272 /// If simple is not NULL, *simple will indicate if ParentVNI is a simply
273 /// mapped value.
274 VNInfo *mapValue(const VNInfo *ParentVNI, SlotIndex Idx, bool *simple = 0);
275
Jakob Stoklund Olesenfc60d772010-10-05 20:36:25 +0000276 // extendTo - Find the last li_ value defined in MBB at or before Idx. The
277 // parentli is assumed to be live at Idx. Extend the live range to include
278 // Idx. Return the found VNInfo, or NULL.
Jakob Stoklund Olesenc95c1462010-10-27 00:39:07 +0000279 VNInfo *extendTo(const MachineBasicBlock *MBB, SlotIndex Idx);
Jakob Stoklund Olesenfc60d772010-10-05 20:36:25 +0000280
Jakob Stoklund Olesen5fa42a42010-09-21 22:32:21 +0000281 /// isMapped - Return true is ParentVNI is a known mapped value. It may be a
282 /// simple 1-1 mapping or a complex mapping to later defs.
283 bool isMapped(const VNInfo *ParentVNI) const {
284 return valueMap_.count(ParentVNI);
285 }
286
287 /// isComplexMapped - Return true if ParentVNI has received new definitions
288 /// with defValue.
289 bool isComplexMapped(const VNInfo *ParentVNI) const;
290
291 // addSimpleRange - Add a simple range from parentli_ to li_.
292 // ParentVNI must be live in the [Start;End) interval.
293 void addSimpleRange(SlotIndex Start, SlotIndex End, const VNInfo *ParentVNI);
Jakob Stoklund Olesen1407c842010-08-18 19:00:08 +0000294
295 /// addRange - Add live ranges to li_ where [Start;End) intersects parentli_.
296 /// All needed values whose def is not inside [Start;End) must be defined
297 /// beforehand so mapValue will work.
298 void addRange(SlotIndex Start, SlotIndex End);
299};
300
301
Jakob Stoklund Olesenf0179002010-07-26 23:44:11 +0000302/// SplitEditor - Edit machine code and LiveIntervals for live range
303/// splitting.
304///
Jakob Stoklund Olesen5eb308b2010-08-06 22:17:33 +0000305/// - Create a SplitEditor from a SplitAnalysis.
Jakob Stoklund Olesen7536f722010-08-04 22:08:39 +0000306/// - Start a new live interval with openIntv.
307/// - Mark the places where the new interval is entered using enterIntv*
308/// - Mark the ranges where the new interval is used with useIntv*
309/// - Mark the places where the interval is exited with exitIntv*.
310/// - Finish the current interval with closeIntv and repeat from 2.
Jakob Stoklund Olesen74669272010-10-08 23:42:21 +0000311/// - Rewrite instructions with finish().
Jakob Stoklund Olesenf0179002010-07-26 23:44:11 +0000312///
313class SplitEditor {
314 SplitAnalysis &sa_;
315 LiveIntervals &lis_;
316 VirtRegMap &vrm_;
317 MachineRegisterInfo &mri_;
318 const TargetInstrInfo &tii_;
Jakob Stoklund Olesencfa71342010-11-10 19:31:50 +0000319 const TargetRegisterInfo &tri_;
Jakob Stoklund Olesenf0179002010-07-26 23:44:11 +0000320
Jakob Stoklund Olesena17768f2010-10-14 23:49:52 +0000321 /// edit_ - The current parent register and new intervals created.
322 LiveRangeEdit &edit_;
323
Jakob Stoklund Olesen5eb308b2010-08-06 22:17:33 +0000324 /// dupli_ - Created as a copy of curli_, ranges are carved out as new
325 /// intervals get added through openIntv / closeIntv. This is used to avoid
326 /// editing curli_.
Jakob Stoklund Olesendd9f3fd2010-09-13 23:29:11 +0000327 LiveIntervalMap dupli_;
Jakob Stoklund Olesenf0179002010-07-26 23:44:11 +0000328
329 /// Currently open LiveInterval.
Jakob Stoklund Olesendd9f3fd2010-09-13 23:29:11 +0000330 LiveIntervalMap openli_;
Jakob Stoklund Olesenf0179002010-07-26 23:44:11 +0000331
Jakob Stoklund Olesencfa71342010-11-10 19:31:50 +0000332 /// defFromParent - Define Reg from ParentVNI at UseIdx using either
333 /// rematerialization or a COPY from parent. Return the new value.
334 VNInfo *defFromParent(LiveIntervalMap &Reg,
335 VNInfo *ParentVNI,
336 SlotIndex UseIdx,
337 MachineBasicBlock &MBB,
338 MachineBasicBlock::iterator I);
339
Jakob Stoklund Olesen5fa42a42010-09-21 22:32:21 +0000340 /// intervalsLiveAt - Return true if any member of intervals_ is live at Idx.
341 bool intervalsLiveAt(SlotIndex Idx) const;
342
343 /// Values in curli whose live range has been truncated when entering an open
344 /// li.
345 SmallPtrSet<const VNInfo*, 8> truncatedValues;
346
347 /// addTruncSimpleRange - Add the given simple range to dupli_ after
348 /// truncating any overlap with intervals_.
349 void addTruncSimpleRange(SlotIndex Start, SlotIndex End, VNInfo *VNI);
Jakob Stoklund Olesenf0179002010-07-26 23:44:11 +0000350
Jakob Stoklund Olesenc95c1462010-10-27 00:39:07 +0000351 /// criticalPreds_ - Set of basic blocks where both dupli and openli should be
352 /// live out because of a critical edge.
353 SplitAnalysis::BlockPtrSet criticalPreds_;
354
Jakob Stoklund Olesen74669272010-10-08 23:42:21 +0000355 /// computeRemainder - Compute the dupli liveness as the complement of all the
356 /// new intervals.
357 void computeRemainder();
358
359 /// rewrite - Rewrite all uses of reg to use the new registers.
360 void rewrite(unsigned reg);
361
Jakob Stoklund Olesenf0179002010-07-26 23:44:11 +0000362public:
363 /// Create a new SplitEditor for editing the LiveInterval analyzed by SA.
Jakob Stoklund Olesen7536f722010-08-04 22:08:39 +0000364 /// Newly created intervals will be appended to newIntervals.
Jakob Stoklund Olesend68f4582010-10-28 20:34:50 +0000365 SplitEditor(SplitAnalysis &SA, LiveIntervals&, VirtRegMap&,
366 MachineDominatorTree&, LiveRangeEdit&);
Jakob Stoklund Olesenf0179002010-07-26 23:44:11 +0000367
Jakob Stoklund Olesen5eb308b2010-08-06 22:17:33 +0000368 /// getAnalysis - Get the corresponding analysis.
369 SplitAnalysis &getAnalysis() { return sa_; }
Jakob Stoklund Olesenf0179002010-07-26 23:44:11 +0000370
Jakob Stoklund Olesen7536f722010-08-04 22:08:39 +0000371 /// Create a new virtual register and live interval.
372 void openIntv();
Jakob Stoklund Olesenf0179002010-07-26 23:44:11 +0000373
Jakob Stoklund Olesenf1b05f22010-08-12 17:07:14 +0000374 /// enterIntvBefore - Enter openli before the instruction at Idx. If curli is
375 /// not live before Idx, a COPY is not inserted.
376 void enterIntvBefore(SlotIndex Idx);
377
Jakob Stoklund Olesen7536f722010-08-04 22:08:39 +0000378 /// enterIntvAtEnd - Enter openli at the end of MBB.
Jakob Stoklund Olesenf6a129a2010-09-16 00:01:36 +0000379 void enterIntvAtEnd(MachineBasicBlock &MBB);
Jakob Stoklund Olesenf0179002010-07-26 23:44:11 +0000380
Jakob Stoklund Olesen7536f722010-08-04 22:08:39 +0000381 /// useIntv - indicate that all instructions in MBB should use openli.
382 void useIntv(const MachineBasicBlock &MBB);
Jakob Stoklund Olesenf0179002010-07-26 23:44:11 +0000383
Jakob Stoklund Olesen7536f722010-08-04 22:08:39 +0000384 /// useIntv - indicate that all instructions in range should use openli.
385 void useIntv(SlotIndex Start, SlotIndex End);
Jakob Stoklund Olesenf0179002010-07-26 23:44:11 +0000386
Jakob Stoklund Olesenf1b05f22010-08-12 17:07:14 +0000387 /// leaveIntvAfter - Leave openli after the instruction at Idx.
388 void leaveIntvAfter(SlotIndex Idx);
389
Jakob Stoklund Olesen7536f722010-08-04 22:08:39 +0000390 /// leaveIntvAtTop - Leave the interval at the top of MBB.
391 /// Currently, only one value can leave the interval.
392 void leaveIntvAtTop(MachineBasicBlock &MBB);
Jakob Stoklund Olesenf0179002010-07-26 23:44:11 +0000393
Jakob Stoklund Olesen7536f722010-08-04 22:08:39 +0000394 /// closeIntv - Indicate that we are done editing the currently open
Jakob Stoklund Olesenf0179002010-07-26 23:44:11 +0000395 /// LiveInterval, and ranges can be trimmed.
Jakob Stoklund Olesen7536f722010-08-04 22:08:39 +0000396 void closeIntv();
Jakob Stoklund Olesenf0179002010-07-26 23:44:11 +0000397
Jakob Stoklund Olesen74669272010-10-08 23:42:21 +0000398 /// finish - after all the new live ranges have been created, compute the
399 /// remaining live range, and rewrite instructions to use the new registers.
400 void finish();
Jakob Stoklund Olesenf0179002010-07-26 23:44:11 +0000401
402 // ===--- High level methods ---===
403
404 /// splitAroundLoop - Split curli into a separate live interval inside
Jakob Stoklund Olesen57d0f2d2010-10-05 22:19:33 +0000405 /// the loop.
406 void splitAroundLoop(const MachineLoop*);
Jakob Stoklund Olesenf0179002010-07-26 23:44:11 +0000407
Jakob Stoklund Olesenf1b05f22010-08-12 17:07:14 +0000408 /// splitSingleBlocks - Split curli into a separate live interval inside each
Jakob Stoklund Olesen57d0f2d2010-10-05 22:19:33 +0000409 /// basic block in Blocks.
410 void splitSingleBlocks(const SplitAnalysis::BlockPtrSet &Blocks);
Jakob Stoklund Olesenf0179002010-07-26 23:44:11 +0000411
Jakob Stoklund Olesen57d0f2d2010-10-05 22:19:33 +0000412 /// splitInsideBlock - Split curli into multiple intervals inside MBB.
413 void splitInsideBlock(const MachineBasicBlock *);
Jakob Stoklund Olesenfc412d82010-08-13 21:18:48 +0000414};
Jakob Stoklund Olesen8ae02632010-07-20 15:41:07 +0000415
416}