Chris Lattner | a3b8b5c | 2004-07-23 17:56:30 +0000 | [diff] [blame] | 1 | //===-- LiveIntervalAnalysis.h - Live Interval Analysis ---------*- C++ -*-===// |
Alkis Evlogimenos | ff0cbe1 | 2003-11-20 03:32:25 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by the LLVM research group and is distributed under |
| 6 | // the University of Illinois Open Source License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
Chris Lattner | 6b92906 | 2004-07-19 02:13:59 +0000 | [diff] [blame] | 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' abd 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). |
Alkis Evlogimenos | ff0cbe1 | 2003-11-20 03:32:25 +0000 | [diff] [blame] | 17 | // |
| 18 | //===----------------------------------------------------------------------===// |
| 19 | |
Chris Lattner | a3b8b5c | 2004-07-23 17:56:30 +0000 | [diff] [blame] | 20 | #ifndef LLVM_CODEGEN_LIVEINTERVAL_ANALYSIS_H |
| 21 | #define LLVM_CODEGEN_LIVEINTERVAL_ANALYSIS_H |
Alkis Evlogimenos | ff0cbe1 | 2003-11-20 03:32:25 +0000 | [diff] [blame] | 22 | |
| 23 | #include "llvm/CodeGen/MachineFunctionPass.h" |
Chris Lattner | 779a651 | 2005-09-21 04:18:25 +0000 | [diff] [blame] | 24 | #include "llvm/CodeGen/LiveInterval.h" |
Evan Cheng | 61de82d | 2007-02-15 05:59:24 +0000 | [diff] [blame] | 25 | #include "llvm/ADT/BitVector.h" |
Evan Cheng | 20b0abc | 2007-04-17 20:32:26 +0000 | [diff] [blame] | 26 | #include "llvm/ADT/DenseMap.h" |
Evan Cheng | 549f27d3 | 2007-08-13 23:45:17 +0000 | [diff] [blame] | 27 | #include "llvm/ADT/SmallPtrSet.h" |
| 28 | #include "llvm/ADT/SmallVector.h" |
Evan Cheng | f3bb2e6 | 2007-09-05 21:46:51 +0000 | [diff] [blame] | 29 | #include "llvm/Support/Allocator.h" |
Hartmut Kaiser | ffb15de | 2007-11-13 23:04:28 +0000 | [diff] [blame^] | 30 | #include <cmath> |
Alkis Evlogimenos | ff0cbe1 | 2003-11-20 03:32:25 +0000 | [diff] [blame] | 31 | |
| 32 | namespace llvm { |
| 33 | |
Alkis Evlogimenos | 1a8ea01 | 2004-08-04 09:46:26 +0000 | [diff] [blame] | 34 | class LiveVariables; |
| 35 | class MRegisterInfo; |
Evan Cheng | f2fbca6 | 2007-11-12 06:35:08 +0000 | [diff] [blame] | 36 | class SSARegMap; |
Chris Lattner | f768bba | 2005-03-09 23:05:19 +0000 | [diff] [blame] | 37 | class TargetInstrInfo; |
Evan Cheng | 20b0abc | 2007-04-17 20:32:26 +0000 | [diff] [blame] | 38 | class TargetRegisterClass; |
Alkis Evlogimenos | 1a8ea01 | 2004-08-04 09:46:26 +0000 | [diff] [blame] | 39 | class VirtRegMap; |
Evan Cheng | 4ca980e | 2007-10-17 02:10:22 +0000 | [diff] [blame] | 40 | typedef std::pair<unsigned, MachineBasicBlock*> IdxMBBPair; |
Alkis Evlogimenos | ff0cbe1 | 2003-11-20 03:32:25 +0000 | [diff] [blame] | 41 | |
Alkis Evlogimenos | 1a8ea01 | 2004-08-04 09:46:26 +0000 | [diff] [blame] | 42 | class LiveIntervals : public MachineFunctionPass { |
| 43 | MachineFunction* mf_; |
| 44 | const TargetMachine* tm_; |
| 45 | const MRegisterInfo* mri_; |
Chris Lattner | f768bba | 2005-03-09 23:05:19 +0000 | [diff] [blame] | 46 | const TargetInstrInfo* tii_; |
Alkis Evlogimenos | 1a8ea01 | 2004-08-04 09:46:26 +0000 | [diff] [blame] | 47 | LiveVariables* lv_; |
Alkis Evlogimenos | ff0cbe1 | 2003-11-20 03:32:25 +0000 | [diff] [blame] | 48 | |
Evan Cheng | f3bb2e6 | 2007-09-05 21:46:51 +0000 | [diff] [blame] | 49 | /// Special pool allocator for VNInfo's (LiveInterval val#). |
| 50 | /// |
| 51 | BumpPtrAllocator VNInfoAllocator; |
| 52 | |
Evan Cheng | 549f27d3 | 2007-08-13 23:45:17 +0000 | [diff] [blame] | 53 | /// MBB2IdxMap - The indexes of the first and last instructions in the |
| 54 | /// specified basic block. |
| 55 | std::vector<std::pair<unsigned, unsigned> > MBB2IdxMap; |
David Greene | 2513330 | 2007-06-08 17:18:56 +0000 | [diff] [blame] | 56 | |
Evan Cheng | 4ca980e | 2007-10-17 02:10:22 +0000 | [diff] [blame] | 57 | /// Idx2MBBMap - Sorted list of pairs of index of first instruction |
| 58 | /// and MBB id. |
| 59 | std::vector<IdxMBBPair> Idx2MBBMap; |
| 60 | |
Alkis Evlogimenos | 1a8ea01 | 2004-08-04 09:46:26 +0000 | [diff] [blame] | 61 | typedef std::map<MachineInstr*, unsigned> Mi2IndexMap; |
| 62 | Mi2IndexMap mi2iMap_; |
Alkis Evlogimenos | ff0cbe1 | 2003-11-20 03:32:25 +0000 | [diff] [blame] | 63 | |
Alkis Evlogimenos | 1a8ea01 | 2004-08-04 09:46:26 +0000 | [diff] [blame] | 64 | typedef std::vector<MachineInstr*> Index2MiMap; |
| 65 | Index2MiMap i2miMap_; |
Alkis Evlogimenos | 843b160 | 2004-02-15 10:24:21 +0000 | [diff] [blame] | 66 | |
Alkis Evlogimenos | 1a8ea01 | 2004-08-04 09:46:26 +0000 | [diff] [blame] | 67 | typedef std::map<unsigned, LiveInterval> Reg2IntervalMap; |
| 68 | Reg2IntervalMap r2iMap_; |
Alkis Evlogimenos | ff0cbe1 | 2003-11-20 03:32:25 +0000 | [diff] [blame] | 69 | |
Evan Cheng | 61de82d | 2007-02-15 05:59:24 +0000 | [diff] [blame] | 70 | BitVector allocatableRegs_; |
Evan Cheng | 88d1f58 | 2007-03-01 02:03:03 +0000 | [diff] [blame] | 71 | |
Evan Cheng | 549f27d3 | 2007-08-13 23:45:17 +0000 | [diff] [blame] | 72 | std::vector<MachineInstr*> ClonedMIs; |
| 73 | |
Alkis Evlogimenos | 1a8ea01 | 2004-08-04 09:46:26 +0000 | [diff] [blame] | 74 | public: |
Nick Lewycky | ecd94c8 | 2007-05-06 13:37:16 +0000 | [diff] [blame] | 75 | static char ID; // Pass identification, replacement for typeid |
Devang Patel | 794fd75 | 2007-05-01 21:15:47 +0000 | [diff] [blame] | 76 | LiveIntervals() : MachineFunctionPass((intptr_t)&ID) {} |
| 77 | |
Chris Lattner | f7da2c7 | 2006-08-24 22:43:55 +0000 | [diff] [blame] | 78 | struct InstrSlots { |
Alkis Evlogimenos | 1a8ea01 | 2004-08-04 09:46:26 +0000 | [diff] [blame] | 79 | enum { |
| 80 | LOAD = 0, |
| 81 | USE = 1, |
| 82 | DEF = 2, |
| 83 | STORE = 3, |
Chris Lattner | 410354f | 2006-02-22 16:23:43 +0000 | [diff] [blame] | 84 | NUM = 4 |
Alkis Evlogimenos | 1a8ea01 | 2004-08-04 09:46:26 +0000 | [diff] [blame] | 85 | }; |
Alkis Evlogimenos | ff0cbe1 | 2003-11-20 03:32:25 +0000 | [diff] [blame] | 86 | }; |
| 87 | |
Alkis Evlogimenos | 1a8ea01 | 2004-08-04 09:46:26 +0000 | [diff] [blame] | 88 | static unsigned getBaseIndex(unsigned index) { |
| 89 | return index - (index % InstrSlots::NUM); |
| 90 | } |
| 91 | static unsigned getBoundaryIndex(unsigned index) { |
| 92 | return getBaseIndex(index + InstrSlots::NUM - 1); |
| 93 | } |
| 94 | static unsigned getLoadIndex(unsigned index) { |
| 95 | return getBaseIndex(index) + InstrSlots::LOAD; |
| 96 | } |
| 97 | static unsigned getUseIndex(unsigned index) { |
| 98 | return getBaseIndex(index) + InstrSlots::USE; |
| 99 | } |
| 100 | static unsigned getDefIndex(unsigned index) { |
| 101 | return getBaseIndex(index) + InstrSlots::DEF; |
| 102 | } |
| 103 | static unsigned getStoreIndex(unsigned index) { |
| 104 | return getBaseIndex(index) + InstrSlots::STORE; |
| 105 | } |
| 106 | |
Evan Cheng | f2fbca6 | 2007-11-12 06:35:08 +0000 | [diff] [blame] | 107 | static float getSpillWeight(const MachineOperand &mop, unsigned loopDepth) { |
| 108 | return (mop.isUse()+mop.isDef()) * powf(10.0F, (float)loopDepth); |
| 109 | } |
| 110 | |
Alkis Evlogimenos | 1a8ea01 | 2004-08-04 09:46:26 +0000 | [diff] [blame] | 111 | typedef Reg2IntervalMap::iterator iterator; |
Chris Lattner | 70ca358 | 2004-09-30 15:59:17 +0000 | [diff] [blame] | 112 | typedef Reg2IntervalMap::const_iterator const_iterator; |
| 113 | const_iterator begin() const { return r2iMap_.begin(); } |
| 114 | const_iterator end() const { return r2iMap_.end(); } |
Alkis Evlogimenos | 1a8ea01 | 2004-08-04 09:46:26 +0000 | [diff] [blame] | 115 | iterator begin() { return r2iMap_.begin(); } |
| 116 | iterator end() { return r2iMap_.end(); } |
| 117 | unsigned getNumIntervals() const { return r2iMap_.size(); } |
| 118 | |
| 119 | LiveInterval &getInterval(unsigned reg) { |
| 120 | Reg2IntervalMap::iterator I = r2iMap_.find(reg); |
| 121 | assert(I != r2iMap_.end() && "Interval does not exist for register"); |
| 122 | return I->second; |
| 123 | } |
| 124 | |
| 125 | const LiveInterval &getInterval(unsigned reg) const { |
| 126 | Reg2IntervalMap::const_iterator I = r2iMap_.find(reg); |
| 127 | assert(I != r2iMap_.end() && "Interval does not exist for register"); |
| 128 | return I->second; |
| 129 | } |
| 130 | |
Evan Cheng | b371f45 | 2007-02-19 21:49:54 +0000 | [diff] [blame] | 131 | bool hasInterval(unsigned reg) const { |
Evan Cheng | 88d1f58 | 2007-03-01 02:03:03 +0000 | [diff] [blame] | 132 | return r2iMap_.count(reg); |
Evan Cheng | b371f45 | 2007-02-19 21:49:54 +0000 | [diff] [blame] | 133 | } |
| 134 | |
Chris Lattner | 428b92e | 2006-09-15 03:57:23 +0000 | [diff] [blame] | 135 | /// getMBBStartIdx - Return the base index of the first instruction in the |
| 136 | /// specified MachineBasicBlock. |
| 137 | unsigned getMBBStartIdx(MachineBasicBlock *MBB) const { |
| 138 | return getMBBStartIdx(MBB->getNumber()); |
| 139 | } |
Chris Lattner | 428b92e | 2006-09-15 03:57:23 +0000 | [diff] [blame] | 140 | unsigned getMBBStartIdx(unsigned MBBNo) const { |
| 141 | assert(MBBNo < MBB2IdxMap.size() && "Invalid MBB number!"); |
Evan Cheng | 549f27d3 | 2007-08-13 23:45:17 +0000 | [diff] [blame] | 142 | return MBB2IdxMap[MBBNo].first; |
| 143 | } |
| 144 | |
| 145 | /// getMBBEndIdx - Return the store index of the last instruction in the |
| 146 | /// specified MachineBasicBlock. |
| 147 | unsigned getMBBEndIdx(MachineBasicBlock *MBB) const { |
| 148 | return getMBBEndIdx(MBB->getNumber()); |
| 149 | } |
| 150 | unsigned getMBBEndIdx(unsigned MBBNo) const { |
| 151 | assert(MBBNo < MBB2IdxMap.size() && "Invalid MBB number!"); |
| 152 | return MBB2IdxMap[MBBNo].second; |
Chris Lattner | 428b92e | 2006-09-15 03:57:23 +0000 | [diff] [blame] | 153 | } |
| 154 | |
Alkis Evlogimenos | 1a8ea01 | 2004-08-04 09:46:26 +0000 | [diff] [blame] | 155 | /// getInstructionIndex - returns the base index of instr |
| 156 | unsigned getInstructionIndex(MachineInstr* instr) const { |
| 157 | Mi2IndexMap::const_iterator it = mi2iMap_.find(instr); |
| 158 | assert(it != mi2iMap_.end() && "Invalid instruction!"); |
| 159 | return it->second; |
| 160 | } |
| 161 | |
| 162 | /// getInstructionFromIndex - given an index in any slot of an |
| 163 | /// instruction return a pointer the instruction |
| 164 | MachineInstr* getInstructionFromIndex(unsigned index) const { |
| 165 | index /= InstrSlots::NUM; // convert index to vector index |
| 166 | assert(index < i2miMap_.size() && |
| 167 | "index does not correspond to an instruction"); |
| 168 | return i2miMap_[index]; |
| 169 | } |
David Greene | 2513330 | 2007-06-08 17:18:56 +0000 | [diff] [blame] | 170 | |
Evan Cheng | c92da38 | 2007-11-03 07:20:12 +0000 | [diff] [blame] | 171 | /// conflictsWithPhysRegDef - Returns true if the specified register |
| 172 | /// is defined during the duration of the specified interval. |
| 173 | bool conflictsWithPhysRegDef(const LiveInterval &li, VirtRegMap &vrm, |
| 174 | unsigned reg); |
| 175 | |
Evan Cheng | 4ca980e | 2007-10-17 02:10:22 +0000 | [diff] [blame] | 176 | /// findLiveInMBBs - Given a live range, if the value of the range |
| 177 | /// is live in any MBB returns true as well as the list of basic blocks |
| 178 | /// where the value is live in. |
| 179 | bool findLiveInMBBs(const LiveRange &LR, |
Evan Cheng | a5bfc97 | 2007-10-17 06:53:44 +0000 | [diff] [blame] | 180 | SmallVectorImpl<MachineBasicBlock*> &MBBs) const; |
Evan Cheng | 4ca980e | 2007-10-17 02:10:22 +0000 | [diff] [blame] | 181 | |
David Greene | 2513330 | 2007-06-08 17:18:56 +0000 | [diff] [blame] | 182 | // Interval creation |
| 183 | |
| 184 | LiveInterval &getOrCreateInterval(unsigned reg) { |
| 185 | Reg2IntervalMap::iterator I = r2iMap_.find(reg); |
| 186 | if (I == r2iMap_.end()) |
| 187 | I = r2iMap_.insert(I, std::make_pair(reg, createInterval(reg))); |
| 188 | return I->second; |
| 189 | } |
Alkis Evlogimenos | 1a8ea01 | 2004-08-04 09:46:26 +0000 | [diff] [blame] | 190 | |
David Greene | 2513330 | 2007-06-08 17:18:56 +0000 | [diff] [blame] | 191 | // Interval removal |
Alkis Evlogimenos | 1a8ea01 | 2004-08-04 09:46:26 +0000 | [diff] [blame] | 192 | |
David Greene | 2513330 | 2007-06-08 17:18:56 +0000 | [diff] [blame] | 193 | void removeInterval(unsigned Reg) { |
| 194 | r2iMap_.erase(Reg); |
Bill Wendling | 5c7e326 | 2006-12-17 05:15:13 +0000 | [diff] [blame] | 195 | } |
Chris Lattner | 70ca358 | 2004-09-30 15:59:17 +0000 | [diff] [blame] | 196 | |
Evan Cheng | 30cac02 | 2007-02-22 23:03:39 +0000 | [diff] [blame] | 197 | /// isRemoved - returns true if the specified machine instr has been |
| 198 | /// removed. |
| 199 | bool isRemoved(MachineInstr* instr) const { |
Evan Cheng | 7d35c0e | 2007-02-22 23:52:23 +0000 | [diff] [blame] | 200 | return !mi2iMap_.count(instr); |
Evan Cheng | 30cac02 | 2007-02-22 23:03:39 +0000 | [diff] [blame] | 201 | } |
| 202 | |
Chris Lattner | f7da2c7 | 2006-08-24 22:43:55 +0000 | [diff] [blame] | 203 | /// RemoveMachineInstrFromMaps - This marks the specified machine instr as |
| 204 | /// deleted. |
| 205 | void RemoveMachineInstrFromMaps(MachineInstr *MI) { |
| 206 | // remove index -> MachineInstr and |
| 207 | // MachineInstr -> index mappings |
| 208 | Mi2IndexMap::iterator mi2i = mi2iMap_.find(MI); |
| 209 | if (mi2i != mi2iMap_.end()) { |
| 210 | i2miMap_[mi2i->second/InstrSlots::NUM] = 0; |
| 211 | mi2iMap_.erase(mi2i); |
| 212 | } |
| 213 | } |
David Greene | 2513330 | 2007-06-08 17:18:56 +0000 | [diff] [blame] | 214 | |
Evan Cheng | f3bb2e6 | 2007-09-05 21:46:51 +0000 | [diff] [blame] | 215 | BumpPtrAllocator& getVNInfoAllocator() { return VNInfoAllocator; } |
| 216 | |
David Greene | 2513330 | 2007-06-08 17:18:56 +0000 | [diff] [blame] | 217 | virtual void getAnalysisUsage(AnalysisUsage &AU) const; |
| 218 | virtual void releaseMemory(); |
| 219 | |
| 220 | /// runOnMachineFunction - pass entry point |
| 221 | virtual bool runOnMachineFunction(MachineFunction&); |
| 222 | |
| 223 | /// print - Implement the dump method. |
| 224 | virtual void print(std::ostream &O, const Module* = 0) const; |
| 225 | void print(std::ostream *O, const Module* M = 0) const { |
| 226 | if (O) print(*O, M); |
| 227 | } |
| 228 | |
Evan Cheng | f2fbca6 | 2007-11-12 06:35:08 +0000 | [diff] [blame] | 229 | /// addIntervalsForSpills - Create new intervals for spilled defs / uses of |
| 230 | /// the given interval. |
| 231 | std::vector<LiveInterval*> |
| 232 | addIntervalsForSpills(const LiveInterval& i, VirtRegMap& vrm); |
| 233 | |
David Greene | 2513330 | 2007-06-08 17:18:56 +0000 | [diff] [blame] | 234 | private: |
Chris Lattner | 428b92e | 2006-09-15 03:57:23 +0000 | [diff] [blame] | 235 | /// computeIntervals - Compute live intervals. |
Chris Lattner | c7695eb | 2006-09-14 06:42:17 +0000 | [diff] [blame] | 236 | void computeIntervals(); |
Chris Lattner | 6bda49f | 2006-09-02 05:26:01 +0000 | [diff] [blame] | 237 | |
Alkis Evlogimenos | 1a8ea01 | 2004-08-04 09:46:26 +0000 | [diff] [blame] | 238 | /// handleRegisterDef - update intervals for a register def |
| 239 | /// (calls handlePhysicalRegisterDef and |
| 240 | /// handleVirtualRegisterDef) |
Chris Lattner | 6b128bd | 2006-09-03 08:07:11 +0000 | [diff] [blame] | 241 | void handleRegisterDef(MachineBasicBlock *MBB, |
| 242 | MachineBasicBlock::iterator MI, unsigned MIIdx, |
Chris Lattner | f38a05d | 2006-01-29 07:59:37 +0000 | [diff] [blame] | 243 | unsigned reg); |
Alkis Evlogimenos | 1a8ea01 | 2004-08-04 09:46:26 +0000 | [diff] [blame] | 244 | |
| 245 | /// handleVirtualRegisterDef - update intervals for a virtual |
| 246 | /// register def |
Chris Lattner | 6b128bd | 2006-09-03 08:07:11 +0000 | [diff] [blame] | 247 | void handleVirtualRegisterDef(MachineBasicBlock *MBB, |
| 248 | MachineBasicBlock::iterator MI, |
| 249 | unsigned MIIdx, |
Alkis Evlogimenos | 1a8ea01 | 2004-08-04 09:46:26 +0000 | [diff] [blame] | 250 | LiveInterval& interval); |
| 251 | |
Chris Lattner | f768bba | 2005-03-09 23:05:19 +0000 | [diff] [blame] | 252 | /// handlePhysicalRegisterDef - update intervals for a physical register |
Chris Lattner | f7da2c7 | 2006-08-24 22:43:55 +0000 | [diff] [blame] | 253 | /// def. |
Alkis Evlogimenos | 1a8ea01 | 2004-08-04 09:46:26 +0000 | [diff] [blame] | 254 | void handlePhysicalRegisterDef(MachineBasicBlock* mbb, |
| 255 | MachineBasicBlock::iterator mi, |
Chris Lattner | 6b128bd | 2006-09-03 08:07:11 +0000 | [diff] [blame] | 256 | unsigned MIIdx, |
Chris Lattner | 91725b7 | 2006-08-31 05:54:43 +0000 | [diff] [blame] | 257 | LiveInterval &interval, |
| 258 | unsigned SrcReg); |
Alkis Evlogimenos | 1a8ea01 | 2004-08-04 09:46:26 +0000 | [diff] [blame] | 259 | |
Evan Cheng | b371f45 | 2007-02-19 21:49:54 +0000 | [diff] [blame] | 260 | /// handleLiveInRegister - Create interval for a livein register. |
Jim Laskey | 9b25b8c | 2007-02-21 22:41:17 +0000 | [diff] [blame] | 261 | void handleLiveInRegister(MachineBasicBlock* mbb, |
| 262 | unsigned MIIdx, |
Evan Cheng | 24a3cc4 | 2007-04-25 07:30:23 +0000 | [diff] [blame] | 263 | LiveInterval &interval, bool isAlias = false); |
Evan Cheng | b371f45 | 2007-02-19 21:49:54 +0000 | [diff] [blame] | 264 | |
Evan Cheng | 549f27d3 | 2007-08-13 23:45:17 +0000 | [diff] [blame] | 265 | /// isReMaterializable - Returns true if the definition MI of the specified |
| 266 | /// val# of the specified interval is re-materializable. |
Evan Cheng | 7ecb38b | 2007-08-29 20:45:00 +0000 | [diff] [blame] | 267 | bool isReMaterializable(const LiveInterval &li, const VNInfo *ValNo, |
Evan Cheng | 549f27d3 | 2007-08-13 23:45:17 +0000 | [diff] [blame] | 268 | MachineInstr *MI); |
| 269 | |
Evan Cheng | 35b35c5 | 2007-08-30 05:52:20 +0000 | [diff] [blame] | 270 | /// tryFoldMemoryOperand - Attempts to fold either a spill / restore from |
| 271 | /// slot / to reg or any rematerialized load into ith operand of specified |
| 272 | /// MI. If it is successul, MI is updated with the newly created MI and |
| 273 | /// returns true. |
| 274 | bool tryFoldMemoryOperand(MachineInstr* &MI, VirtRegMap &vrm, |
Evan Cheng | 32dfbea | 2007-10-12 08:50:34 +0000 | [diff] [blame] | 275 | MachineInstr *DefMI, unsigned index, unsigned i, |
| 276 | bool isSS, int slot, unsigned reg); |
Evan Cheng | 549f27d3 | 2007-08-13 23:45:17 +0000 | [diff] [blame] | 277 | |
Evan Cheng | f2fbca6 | 2007-11-12 06:35:08 +0000 | [diff] [blame] | 278 | /// rewriteInstructionForSpills, rewriteInstructionsForSpills - Helper functions |
| 279 | /// for addIntervalsForSpills to rewrite uses / defs for the given live range. |
| 280 | void rewriteInstructionForSpills(const LiveInterval &li, |
| 281 | unsigned id, unsigned index, unsigned end, MachineInstr *MI, |
| 282 | MachineInstr *OrigDefMI, MachineInstr *DefMI, unsigned Slot, int LdSlot, |
| 283 | bool isLoad, bool isLoadSS, bool DefIsReMat, bool CanDelete, |
| 284 | VirtRegMap &vrm, SSARegMap *RegMap, const TargetRegisterClass* rc, |
| 285 | SmallVector<int, 4> &ReMatIds, |
| 286 | std::vector<LiveInterval*> &NewLIs); |
| 287 | void rewriteInstructionsForSpills(const LiveInterval &li, |
| 288 | LiveInterval::Ranges::const_iterator &I, |
| 289 | MachineInstr *OrigDefMI, MachineInstr *DefMI, unsigned Slot, int LdSlot, |
| 290 | bool isLoad, bool isLoadSS, bool DefIsReMat, bool CanDelete, |
| 291 | VirtRegMap &vrm, SSARegMap *RegMap, const TargetRegisterClass* rc, |
| 292 | SmallVector<int, 4> &ReMatIds, |
| 293 | std::vector<LiveInterval*> &NewLIs); |
| 294 | |
Alkis Evlogimenos | 1a8ea01 | 2004-08-04 09:46:26 +0000 | [diff] [blame] | 295 | static LiveInterval createInterval(unsigned Reg); |
| 296 | |
Alkis Evlogimenos | 1a8ea01 | 2004-08-04 09:46:26 +0000 | [diff] [blame] | 297 | void printRegName(unsigned reg) const; |
| 298 | }; |
| 299 | |
Alkis Evlogimenos | ff0cbe1 | 2003-11-20 03:32:25 +0000 | [diff] [blame] | 300 | } // End llvm namespace |
| 301 | |
| 302 | #endif |