Removed static qualifier from a few index related methods. These methods may require...
[oota-llvm.git] / include / llvm / CodeGen / LiveIntervalAnalysis.h
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 // This file implements the LiveInterval analysis pass.  Given some numbering of
11 // each the machine instructions (in this implemention depth-first order) an
12 // interval [i, j) is said to be a live interval for register v if there is no
13 // instruction with number j' > j such that v is live at j' and there is no
14 // instruction with number i' < i such that v is live at i'. In this
15 // implementation intervals can have holes, i.e. an interval might look like
16 // [1,20), [50,65), [1000,1001).
17 //
18 //===----------------------------------------------------------------------===//
19
20 #ifndef LLVM_CODEGEN_LIVEINTERVAL_ANALYSIS_H
21 #define LLVM_CODEGEN_LIVEINTERVAL_ANALYSIS_H
22
23 #include "llvm/CodeGen/MachineBasicBlock.h"
24 #include "llvm/CodeGen/MachineFunctionPass.h"
25 #include "llvm/CodeGen/LiveInterval.h"
26 #include "llvm/ADT/BitVector.h"
27 #include "llvm/ADT/DenseMap.h"
28 #include "llvm/ADT/SmallPtrSet.h"
29 #include "llvm/ADT/SmallVector.h"
30 #include "llvm/Support/Allocator.h"
31 #include <cmath>
32
33 namespace llvm {
34
35   class AliasAnalysis;
36   class LiveVariables;
37   class MachineLoopInfo;
38   class TargetRegisterInfo;
39   class MachineRegisterInfo;
40   class TargetInstrInfo;
41   class TargetRegisterClass;
42   class VirtRegMap;
43   typedef std::pair<MachineInstrIndex, MachineBasicBlock*> IdxMBBPair;
44
45   inline bool operator<(MachineInstrIndex V, const IdxMBBPair &IM) {
46     return V < IM.first;
47   }
48
49   inline bool operator<(const IdxMBBPair &IM, MachineInstrIndex V) {
50     return IM.first < V;
51   }
52
53   struct Idx2MBBCompare {
54     bool operator()(const IdxMBBPair &LHS, const IdxMBBPair &RHS) const {
55       return LHS.first < RHS.first;
56     }
57   };
58   
59   class LiveIntervals : public MachineFunctionPass {
60     MachineFunction* mf_;
61     MachineRegisterInfo* mri_;
62     const TargetMachine* tm_;
63     const TargetRegisterInfo* tri_;
64     const TargetInstrInfo* tii_;
65     AliasAnalysis *aa_;
66     LiveVariables* lv_;
67
68
69     
70
71     /// Special pool allocator for VNInfo's (LiveInterval val#).
72     ///
73     BumpPtrAllocator VNInfoAllocator;
74
75     /// MBB2IdxMap - The indexes of the first and last instructions in the
76     /// specified basic block.
77     std::vector<std::pair<MachineInstrIndex, MachineInstrIndex> > MBB2IdxMap;
78
79     /// Idx2MBBMap - Sorted list of pairs of index of first instruction
80     /// and MBB id.
81     std::vector<IdxMBBPair> Idx2MBBMap;
82
83     /// FunctionSize - The number of instructions present in the function
84     uint64_t FunctionSize;
85
86     typedef DenseMap<const MachineInstr*, MachineInstrIndex> Mi2IndexMap;
87     Mi2IndexMap mi2iMap_;
88
89     typedef std::vector<MachineInstr*> Index2MiMap;
90     Index2MiMap i2miMap_;
91
92     typedef DenseMap<unsigned, LiveInterval*> Reg2IntervalMap;
93     Reg2IntervalMap r2iMap_;
94
95     DenseMap<MachineBasicBlock*, MachineInstrIndex> terminatorGaps;
96
97     BitVector allocatableRegs_;
98
99     std::vector<MachineInstr*> ClonedMIs;
100
101     typedef LiveInterval::InstrSlots InstrSlots;
102
103   public:
104     static char ID; // Pass identification, replacement for typeid
105     LiveIntervals() : MachineFunctionPass(&ID) {}
106
107     MachineInstrIndex getBaseIndex(MachineInstrIndex index) {
108       return MachineInstrIndex(index, MachineInstrIndex::LOAD);
109     }
110     MachineInstrIndex getBoundaryIndex(MachineInstrIndex index) {
111       return MachineInstrIndex(index,
112         (MachineInstrIndex::Slot)(MachineInstrIndex::NUM - 1));
113     }
114     MachineInstrIndex getLoadIndex(MachineInstrIndex index) {
115       return MachineInstrIndex(index, MachineInstrIndex::LOAD);
116     }
117     MachineInstrIndex getUseIndex(MachineInstrIndex index) {
118       return MachineInstrIndex(index, MachineInstrIndex::USE);
119     }
120     MachineInstrIndex getDefIndex(MachineInstrIndex index) {
121       return MachineInstrIndex(index, MachineInstrIndex::DEF);
122     }
123     MachineInstrIndex getStoreIndex(MachineInstrIndex index) {
124       return MachineInstrIndex(index, MachineInstrIndex::STORE);
125     }
126
127     
128
129     MachineInstrIndex getNextSlot(MachineInstrIndex m) const {
130       return m.nextSlot();
131     }
132
133     MachineInstrIndex getNextIndex(MachineInstrIndex m) const {
134       return m.nextIndex();
135     }
136
137     MachineInstrIndex getPrevSlot(MachineInstrIndex m) const {
138       return m.prevSlot();
139     }
140
141     MachineInstrIndex getPrevIndex(MachineInstrIndex m) const {
142       return m.prevIndex();
143     }
144
145     static float getSpillWeight(bool isDef, bool isUse, unsigned loopDepth) {
146       return (isDef + isUse) * powf(10.0F, (float)loopDepth);
147     }
148
149     typedef Reg2IntervalMap::iterator iterator;
150     typedef Reg2IntervalMap::const_iterator const_iterator;
151     const_iterator begin() const { return r2iMap_.begin(); }
152     const_iterator end() const { return r2iMap_.end(); }
153     iterator begin() { return r2iMap_.begin(); }
154     iterator end() { return r2iMap_.end(); }
155     unsigned getNumIntervals() const { return (unsigned)r2iMap_.size(); }
156
157     LiveInterval &getInterval(unsigned reg) {
158       Reg2IntervalMap::iterator I = r2iMap_.find(reg);
159       assert(I != r2iMap_.end() && "Interval does not exist for register");
160       return *I->second;
161     }
162
163     const LiveInterval &getInterval(unsigned reg) const {
164       Reg2IntervalMap::const_iterator I = r2iMap_.find(reg);
165       assert(I != r2iMap_.end() && "Interval does not exist for register");
166       return *I->second;
167     }
168
169     bool hasInterval(unsigned reg) const {
170       return r2iMap_.count(reg);
171     }
172
173     /// getMBBStartIdx - Return the base index of the first instruction in the
174     /// specified MachineBasicBlock.
175     MachineInstrIndex getMBBStartIdx(MachineBasicBlock *MBB) const {
176       return getMBBStartIdx(MBB->getNumber());
177     }
178     MachineInstrIndex getMBBStartIdx(unsigned MBBNo) const {
179       assert(MBBNo < MBB2IdxMap.size() && "Invalid MBB number!");
180       return MBB2IdxMap[MBBNo].first;
181     }
182
183     /// getMBBEndIdx - Return the store index of the last instruction in the
184     /// specified MachineBasicBlock.
185     MachineInstrIndex getMBBEndIdx(MachineBasicBlock *MBB) const {
186       return getMBBEndIdx(MBB->getNumber());
187     }
188     MachineInstrIndex getMBBEndIdx(unsigned MBBNo) const {
189       assert(MBBNo < MBB2IdxMap.size() && "Invalid MBB number!");
190       return MBB2IdxMap[MBBNo].second;
191     }
192
193     /// getScaledIntervalSize - get the size of an interval in "units,"
194     /// where every function is composed of one thousand units.  This
195     /// measure scales properly with empty index slots in the function.
196     double getScaledIntervalSize(LiveInterval& I) {
197       return (1000.0 / InstrSlots::NUM * I.getSize()) / i2miMap_.size();
198     }
199     
200     /// getApproximateInstructionCount - computes an estimate of the number
201     /// of instructions in a given LiveInterval.
202     unsigned getApproximateInstructionCount(LiveInterval& I) {
203       double IntervalPercentage = getScaledIntervalSize(I) / 1000.0;
204       return (unsigned)(IntervalPercentage * FunctionSize);
205     }
206
207     /// getMBBFromIndex - given an index in any instruction of an
208     /// MBB return a pointer the MBB
209     MachineBasicBlock* getMBBFromIndex(MachineInstrIndex index) const {
210       std::vector<IdxMBBPair>::const_iterator I =
211         std::lower_bound(Idx2MBBMap.begin(), Idx2MBBMap.end(), index);
212       // Take the pair containing the index
213       std::vector<IdxMBBPair>::const_iterator J =
214         ((I != Idx2MBBMap.end() && I->first > index) ||
215          (I == Idx2MBBMap.end() && Idx2MBBMap.size()>0)) ? (I-1): I;
216
217       assert(J != Idx2MBBMap.end() && J->first <= index &&
218              index <= getMBBEndIdx(J->second) &&
219              "index does not correspond to an MBB");
220       return J->second;
221     }
222
223     /// getInstructionIndex - returns the base index of instr
224     MachineInstrIndex getInstructionIndex(const MachineInstr* instr) const {
225       Mi2IndexMap::const_iterator it = mi2iMap_.find(instr);
226       assert(it != mi2iMap_.end() && "Invalid instruction!");
227       return it->second;
228     }
229
230     /// getInstructionFromIndex - given an index in any slot of an
231     /// instruction return a pointer the instruction
232     MachineInstr* getInstructionFromIndex(MachineInstrIndex index) const {
233       // convert index to vector index
234       unsigned i = index.getVecIndex();
235       assert(i < i2miMap_.size() &&
236              "index does not correspond to an instruction");
237       return i2miMap_[i];
238     }
239
240     /// hasGapBeforeInstr - Return true if the previous instruction slot,
241     /// i.e. Index - InstrSlots::NUM, is not occupied.
242     bool hasGapBeforeInstr(MachineInstrIndex Index) {
243       Index = getBaseIndex(Index.prevIndex());
244       return getInstructionFromIndex(Index) == 0;
245     }
246
247     /// hasGapAfterInstr - Return true if the successive instruction slot,
248     /// i.e. Index + InstrSlots::Num, is not occupied.
249     bool hasGapAfterInstr(MachineInstrIndex Index) {
250       Index = getBaseIndex(Index.nextIndex());
251       return getInstructionFromIndex(Index) == 0;
252     }
253
254     /// findGapBeforeInstr - Find an empty instruction slot before the
255     /// specified index. If "Furthest" is true, find one that's furthest
256     /// away from the index (but before any index that's occupied).
257     MachineInstrIndex findGapBeforeInstr(MachineInstrIndex Index,
258                                          bool Furthest = false) {
259       Index = getBaseIndex(Index.prevIndex());
260       if (getInstructionFromIndex(Index))
261         return MachineInstrIndex();  // No gap!
262       if (!Furthest)
263         return Index;
264       MachineInstrIndex PrevIndex = getBaseIndex(Index.prevIndex());
265       while (getInstructionFromIndex(Index)) {
266         Index = PrevIndex;
267         PrevIndex = getBaseIndex(Index.prevIndex());
268       }
269       return Index;
270     }
271
272     /// InsertMachineInstrInMaps - Insert the specified machine instruction
273     /// into the instruction index map at the given index.
274     void InsertMachineInstrInMaps(MachineInstr *MI, MachineInstrIndex Index) {
275       i2miMap_[Index.index / MachineInstrIndex::NUM] = MI;
276       Mi2IndexMap::iterator it = mi2iMap_.find(MI);
277       assert(it == mi2iMap_.end() && "Already in map!");
278       mi2iMap_[MI] = Index;
279     }
280
281     /// conflictsWithPhysRegDef - Returns true if the specified register
282     /// is defined during the duration of the specified interval.
283     bool conflictsWithPhysRegDef(const LiveInterval &li, VirtRegMap &vrm,
284                                  unsigned reg);
285
286     /// conflictsWithPhysRegRef - Similar to conflictsWithPhysRegRef except
287     /// it can check use as well.
288     bool conflictsWithPhysRegRef(LiveInterval &li, unsigned Reg,
289                                  bool CheckUse,
290                                  SmallPtrSet<MachineInstr*,32> &JoinedCopies);
291
292     /// findLiveInMBBs - Given a live range, if the value of the range
293     /// is live in any MBB returns true as well as the list of basic blocks
294     /// in which the value is live.
295     bool findLiveInMBBs(MachineInstrIndex Start, MachineInstrIndex End,
296                         SmallVectorImpl<MachineBasicBlock*> &MBBs) const;
297
298     /// findReachableMBBs - Return a list MBB that can be reached via any
299     /// branch or fallthroughs. Return true if the list is not empty.
300     bool findReachableMBBs(MachineInstrIndex Start, MachineInstrIndex End,
301                         SmallVectorImpl<MachineBasicBlock*> &MBBs) const;
302
303     // Interval creation
304
305     LiveInterval &getOrCreateInterval(unsigned reg) {
306       Reg2IntervalMap::iterator I = r2iMap_.find(reg);
307       if (I == r2iMap_.end())
308         I = r2iMap_.insert(std::make_pair(reg, createInterval(reg))).first;
309       return *I->second;
310     }
311
312     /// dupInterval - Duplicate a live interval. The caller is responsible for
313     /// managing the allocated memory.
314     LiveInterval *dupInterval(LiveInterval *li);
315     
316     /// addLiveRangeToEndOfBlock - Given a register and an instruction,
317     /// adds a live range from that instruction to the end of its MBB.
318     LiveRange addLiveRangeToEndOfBlock(unsigned reg,
319                                        MachineInstr* startInst);
320
321     // Interval removal
322
323     void removeInterval(unsigned Reg) {
324       DenseMap<unsigned, LiveInterval*>::iterator I = r2iMap_.find(Reg);
325       delete I->second;
326       r2iMap_.erase(I);
327     }
328
329     /// isNotInMIMap - returns true if the specified machine instr has been
330     /// removed or was never entered in the map.
331     bool isNotInMIMap(MachineInstr* instr) const {
332       return !mi2iMap_.count(instr);
333     }
334
335     /// RemoveMachineInstrFromMaps - This marks the specified machine instr as
336     /// deleted.
337     void RemoveMachineInstrFromMaps(MachineInstr *MI) {
338       // remove index -> MachineInstr and
339       // MachineInstr -> index mappings
340       Mi2IndexMap::iterator mi2i = mi2iMap_.find(MI);
341       if (mi2i != mi2iMap_.end()) {
342         i2miMap_[mi2i->second.index/InstrSlots::NUM] = 0;
343         mi2iMap_.erase(mi2i);
344       }
345     }
346
347     /// ReplaceMachineInstrInMaps - Replacing a machine instr with a new one in
348     /// maps used by register allocator.
349     void ReplaceMachineInstrInMaps(MachineInstr *MI, MachineInstr *NewMI) {
350       Mi2IndexMap::iterator mi2i = mi2iMap_.find(MI);
351       if (mi2i == mi2iMap_.end())
352         return;
353       i2miMap_[mi2i->second.index/InstrSlots::NUM] = NewMI;
354       Mi2IndexMap::iterator it = mi2iMap_.find(MI);
355       assert(it != mi2iMap_.end() && "Invalid instruction!");
356       MachineInstrIndex Index = it->second;
357       mi2iMap_.erase(it);
358       mi2iMap_[NewMI] = Index;
359     }
360
361     BumpPtrAllocator& getVNInfoAllocator() { return VNInfoAllocator; }
362
363     /// getVNInfoSourceReg - Helper function that parses the specified VNInfo
364     /// copy field and returns the source register that defines it.
365     unsigned getVNInfoSourceReg(const VNInfo *VNI) const;
366
367     virtual void getAnalysisUsage(AnalysisUsage &AU) const;
368     virtual void releaseMemory();
369
370     /// runOnMachineFunction - pass entry point
371     virtual bool runOnMachineFunction(MachineFunction&);
372
373     /// print - Implement the dump method.
374     virtual void print(raw_ostream &O, const Module* = 0) const;
375
376     /// addIntervalsForSpills - Create new intervals for spilled defs / uses of
377     /// the given interval. FIXME: It also returns the weight of the spill slot
378     /// (if any is created) by reference. This is temporary.
379     std::vector<LiveInterval*>
380     addIntervalsForSpills(const LiveInterval& i,
381                           SmallVectorImpl<LiveInterval*> &SpillIs,
382                           const MachineLoopInfo *loopInfo, VirtRegMap& vrm);
383     
384     /// addIntervalsForSpillsFast - Quickly create new intervals for spilled
385     /// defs / uses without remat or splitting.
386     std::vector<LiveInterval*>
387     addIntervalsForSpillsFast(const LiveInterval &li,
388                               const MachineLoopInfo *loopInfo, VirtRegMap &vrm);
389
390     /// spillPhysRegAroundRegDefsUses - Spill the specified physical register
391     /// around all defs and uses of the specified interval. Return true if it
392     /// was able to cut its interval.
393     bool spillPhysRegAroundRegDefsUses(const LiveInterval &li,
394                                        unsigned PhysReg, VirtRegMap &vrm);
395
396     /// isReMaterializable - Returns true if every definition of MI of every
397     /// val# of the specified interval is re-materializable. Also returns true
398     /// by reference if all of the defs are load instructions.
399     bool isReMaterializable(const LiveInterval &li,
400                             SmallVectorImpl<LiveInterval*> &SpillIs,
401                             bool &isLoad);
402
403     /// isReMaterializable - Returns true if the definition MI of the specified
404     /// val# of the specified interval is re-materializable.
405     bool isReMaterializable(const LiveInterval &li, const VNInfo *ValNo,
406                             MachineInstr *MI);
407
408     /// getRepresentativeReg - Find the largest super register of the specified
409     /// physical register.
410     unsigned getRepresentativeReg(unsigned Reg) const;
411
412     /// getNumConflictsWithPhysReg - Return the number of uses and defs of the
413     /// specified interval that conflicts with the specified physical register.
414     unsigned getNumConflictsWithPhysReg(const LiveInterval &li,
415                                         unsigned PhysReg) const;
416
417     /// processImplicitDefs - Process IMPLICIT_DEF instructions. Add isUndef
418     /// marker to implicit_def defs and their uses.
419     void processImplicitDefs();
420
421     /// computeNumbering - Compute the index numbering.
422     void computeNumbering();
423
424     /// scaleNumbering - Rescale interval numbers to introduce gaps for new
425     /// instructions
426     void scaleNumbering(int factor);
427
428     /// intervalIsInOneMBB - Returns true if the specified interval is entirely
429     /// within a single basic block.
430     bool intervalIsInOneMBB(const LiveInterval &li) const;
431
432   private:      
433     /// computeIntervals - Compute live intervals.
434     void computeIntervals();
435     
436     /// handleRegisterDef - update intervals for a register def
437     /// (calls handlePhysicalRegisterDef and
438     /// handleVirtualRegisterDef)
439     void handleRegisterDef(MachineBasicBlock *MBB,
440                            MachineBasicBlock::iterator MI,
441                            MachineInstrIndex MIIdx,
442                            MachineOperand& MO, unsigned MOIdx);
443
444     /// handleVirtualRegisterDef - update intervals for a virtual
445     /// register def
446     void handleVirtualRegisterDef(MachineBasicBlock *MBB,
447                                   MachineBasicBlock::iterator MI,
448                                   MachineInstrIndex MIIdx, MachineOperand& MO,
449                                   unsigned MOIdx,
450                                   LiveInterval& interval);
451
452     /// handlePhysicalRegisterDef - update intervals for a physical register
453     /// def.
454     void handlePhysicalRegisterDef(MachineBasicBlock* mbb,
455                                    MachineBasicBlock::iterator mi,
456                                    MachineInstrIndex MIIdx, MachineOperand& MO,
457                                    LiveInterval &interval,
458                                    MachineInstr *CopyMI);
459
460     /// handleLiveInRegister - Create interval for a livein register.
461     void handleLiveInRegister(MachineBasicBlock* mbb,
462                               MachineInstrIndex MIIdx,
463                               LiveInterval &interval, bool isAlias = false);
464
465     /// getReMatImplicitUse - If the remat definition MI has one (for now, we
466     /// only allow one) virtual register operand, then its uses are implicitly
467     /// using the register. Returns the virtual register.
468     unsigned getReMatImplicitUse(const LiveInterval &li,
469                                  MachineInstr *MI) const;
470
471     /// isValNoAvailableAt - Return true if the val# of the specified interval
472     /// which reaches the given instruction also reaches the specified use
473     /// index.
474     bool isValNoAvailableAt(const LiveInterval &li, MachineInstr *MI,
475                             MachineInstrIndex UseIdx) const;
476
477     /// isReMaterializable - Returns true if the definition MI of the specified
478     /// val# of the specified interval is re-materializable. Also returns true
479     /// by reference if the def is a load.
480     bool isReMaterializable(const LiveInterval &li, const VNInfo *ValNo,
481                             MachineInstr *MI,
482                             SmallVectorImpl<LiveInterval*> &SpillIs,
483                             bool &isLoad);
484
485     /// tryFoldMemoryOperand - Attempts to fold either a spill / restore from
486     /// slot / to reg or any rematerialized load into ith operand of specified
487     /// MI. If it is successul, MI is updated with the newly created MI and
488     /// returns true.
489     bool tryFoldMemoryOperand(MachineInstr* &MI, VirtRegMap &vrm,
490                               MachineInstr *DefMI, MachineInstrIndex InstrIdx,
491                               SmallVector<unsigned, 2> &Ops,
492                               bool isSS, int FrameIndex, unsigned Reg);
493
494     /// canFoldMemoryOperand - Return true if the specified load / store
495     /// folding is possible.
496     bool canFoldMemoryOperand(MachineInstr *MI,
497                               SmallVector<unsigned, 2> &Ops,
498                               bool ReMatLoadSS) const;
499
500     /// anyKillInMBBAfterIdx - Returns true if there is a kill of the specified
501     /// VNInfo that's after the specified index but is within the basic block.
502     bool anyKillInMBBAfterIdx(const LiveInterval &li, const VNInfo *VNI,
503                               MachineBasicBlock *MBB,
504                               MachineInstrIndex Idx) const;
505
506     /// hasAllocatableSuperReg - Return true if the specified physical register
507     /// has any super register that's allocatable.
508     bool hasAllocatableSuperReg(unsigned Reg) const;
509
510     /// SRInfo - Spill / restore info.
511     struct SRInfo {
512       MachineInstrIndex index;
513       unsigned vreg;
514       bool canFold;
515       SRInfo(MachineInstrIndex i, unsigned vr, bool f)
516         : index(i), vreg(vr), canFold(f) {}
517     };
518
519     bool alsoFoldARestore(int Id, MachineInstrIndex index, unsigned vr,
520                           BitVector &RestoreMBBs,
521                           DenseMap<unsigned,std::vector<SRInfo> >&RestoreIdxes);
522     void eraseRestoreInfo(int Id, MachineInstrIndex index, unsigned vr,
523                           BitVector &RestoreMBBs,
524                           DenseMap<unsigned,std::vector<SRInfo> >&RestoreIdxes);
525
526     /// handleSpilledImpDefs - Remove IMPLICIT_DEF instructions which are being
527     /// spilled and create empty intervals for their uses.
528     void handleSpilledImpDefs(const LiveInterval &li, VirtRegMap &vrm,
529                               const TargetRegisterClass* rc,
530                               std::vector<LiveInterval*> &NewLIs);
531
532     /// rewriteImplicitOps - Rewrite implicit use operands of MI (i.e. uses of
533     /// interval on to-be re-materialized operands of MI) with new register.
534     void rewriteImplicitOps(const LiveInterval &li,
535                            MachineInstr *MI, unsigned NewVReg, VirtRegMap &vrm);
536
537     /// rewriteInstructionForSpills, rewriteInstructionsForSpills - Helper
538     /// functions for addIntervalsForSpills to rewrite uses / defs for the given
539     /// live range.
540     bool rewriteInstructionForSpills(const LiveInterval &li, const VNInfo *VNI,
541         bool TrySplit, MachineInstrIndex index, MachineInstrIndex end,
542         MachineInstr *MI, MachineInstr *OrigDefMI, MachineInstr *DefMI,
543         unsigned Slot, int LdSlot,
544         bool isLoad, bool isLoadSS, bool DefIsReMat, bool CanDelete,
545         VirtRegMap &vrm, const TargetRegisterClass* rc,
546         SmallVector<int, 4> &ReMatIds, const MachineLoopInfo *loopInfo,
547         unsigned &NewVReg, unsigned ImpUse, bool &HasDef, bool &HasUse,
548         DenseMap<unsigned,unsigned> &MBBVRegsMap,
549         std::vector<LiveInterval*> &NewLIs);
550     void rewriteInstructionsForSpills(const LiveInterval &li, bool TrySplit,
551         LiveInterval::Ranges::const_iterator &I,
552         MachineInstr *OrigDefMI, MachineInstr *DefMI, unsigned Slot, int LdSlot,
553         bool isLoad, bool isLoadSS, bool DefIsReMat, bool CanDelete,
554         VirtRegMap &vrm, const TargetRegisterClass* rc,
555         SmallVector<int, 4> &ReMatIds, const MachineLoopInfo *loopInfo,
556         BitVector &SpillMBBs,
557         DenseMap<unsigned,std::vector<SRInfo> > &SpillIdxes,
558         BitVector &RestoreMBBs,
559         DenseMap<unsigned,std::vector<SRInfo> > &RestoreIdxes,
560         DenseMap<unsigned,unsigned> &MBBVRegsMap,
561         std::vector<LiveInterval*> &NewLIs);
562
563     static LiveInterval* createInterval(unsigned Reg);
564
565     void printRegName(unsigned reg) const;
566   };
567 } // End llvm namespace
568
569 #endif