Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 1 | //===-- llvm/CodeGen/Spiller.cpp - Spiller -------------------------------===// |
| 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 | #define DEBUG_TYPE "spiller" |
| 11 | |
| 12 | #include "Spiller.h" |
| 13 | #include "VirtRegMap.h" |
| 14 | #include "llvm/CodeGen/LiveIntervalAnalysis.h" |
Jakob Stoklund Olesen | 2d17293 | 2010-10-26 00:11:33 +0000 | [diff] [blame] | 15 | #include "llvm/CodeGen/LiveStackAnalysis.h" |
Bill Wendling | c75e7d2 | 2009-08-22 20:54:03 +0000 | [diff] [blame] | 16 | #include "llvm/CodeGen/MachineFrameInfo.h" |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 17 | #include "llvm/CodeGen/MachineFunction.h" |
Jakob Stoklund Olesen | 1e1098c | 2010-07-10 22:42:59 +0000 | [diff] [blame] | 18 | #include "llvm/CodeGen/MachineInstrBuilder.h" |
Jakob Stoklund Olesen | f2c6e36 | 2010-07-20 23:50:15 +0000 | [diff] [blame] | 19 | #include "llvm/CodeGen/MachineLoopInfo.h" |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 20 | #include "llvm/CodeGen/MachineRegisterInfo.h" |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 21 | #include "llvm/Target/TargetMachine.h" |
| 22 | #include "llvm/Target/TargetInstrInfo.h" |
Lang Hames | 835ca07 | 2009-11-19 04:15:33 +0000 | [diff] [blame] | 23 | #include "llvm/Support/CommandLine.h" |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 24 | #include "llvm/Support/Debug.h" |
Jakob Stoklund Olesen | 15a5714 | 2010-06-25 22:53:05 +0000 | [diff] [blame] | 25 | #include "llvm/Support/ErrorHandling.h" |
Bill Wendling | c75e7d2 | 2009-08-22 20:54:03 +0000 | [diff] [blame] | 26 | #include "llvm/Support/raw_ostream.h" |
Lang Hames | 6194569 | 2009-12-09 05:39:12 +0000 | [diff] [blame] | 27 | #include <set> |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 28 | |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 29 | using namespace llvm; |
| 30 | |
Lang Hames | 835ca07 | 2009-11-19 04:15:33 +0000 | [diff] [blame] | 31 | namespace { |
Jakob Stoklund Olesen | a05f60b | 2010-11-11 00:52:44 +0000 | [diff] [blame] | 32 | enum SpillerName { trivial, standard, inline_ }; |
Lang Hames | 835ca07 | 2009-11-19 04:15:33 +0000 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | static cl::opt<SpillerName> |
| 36 | spillerOpt("spiller", |
| 37 | cl::desc("Spiller to use: (default: standard)"), |
| 38 | cl::Prefix, |
Lang Hames | 6194569 | 2009-12-09 05:39:12 +0000 | [diff] [blame] | 39 | cl::values(clEnumVal(trivial, "trivial spiller"), |
| 40 | clEnumVal(standard, "default spiller"), |
Jakob Stoklund Olesen | d5bd68e | 2010-06-30 00:24:51 +0000 | [diff] [blame] | 41 | clEnumValN(inline_, "inline", "inline spiller"), |
Lang Hames | 835ca07 | 2009-11-19 04:15:33 +0000 | [diff] [blame] | 42 | clEnumValEnd), |
| 43 | cl::init(standard)); |
| 44 | |
Lang Hames | 6194569 | 2009-12-09 05:39:12 +0000 | [diff] [blame] | 45 | // Spiller virtual destructor implementation. |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 46 | Spiller::~Spiller() {} |
| 47 | |
| 48 | namespace { |
| 49 | |
Lang Hames | f41538d | 2009-06-02 16:53:25 +0000 | [diff] [blame] | 50 | /// Utility class for spillers. |
| 51 | class SpillerBase : public Spiller { |
| 52 | protected: |
Jakob Stoklund Olesen | f2c6e36 | 2010-07-20 23:50:15 +0000 | [diff] [blame] | 53 | MachineFunctionPass *pass; |
Lang Hames | f41538d | 2009-06-02 16:53:25 +0000 | [diff] [blame] | 54 | MachineFunction *mf; |
Jakob Stoklund Olesen | f2c6e36 | 2010-07-20 23:50:15 +0000 | [diff] [blame] | 55 | VirtRegMap *vrm; |
Lang Hames | f41538d | 2009-06-02 16:53:25 +0000 | [diff] [blame] | 56 | LiveIntervals *lis; |
Lang Hames | f41538d | 2009-06-02 16:53:25 +0000 | [diff] [blame] | 57 | MachineFrameInfo *mfi; |
| 58 | MachineRegisterInfo *mri; |
| 59 | const TargetInstrInfo *tii; |
Evan Cheng | 746ad69 | 2010-05-06 19:06:44 +0000 | [diff] [blame] | 60 | const TargetRegisterInfo *tri; |
Eric Christopher | 894339e | 2010-07-06 18:35:20 +0000 | [diff] [blame] | 61 | |
| 62 | /// Construct a spiller base. |
Jakob Stoklund Olesen | f2c6e36 | 2010-07-20 23:50:15 +0000 | [diff] [blame] | 63 | SpillerBase(MachineFunctionPass &pass, MachineFunction &mf, VirtRegMap &vrm) |
| 64 | : pass(&pass), mf(&mf), vrm(&vrm) |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 65 | { |
Jakob Stoklund Olesen | f2c6e36 | 2010-07-20 23:50:15 +0000 | [diff] [blame] | 66 | lis = &pass.getAnalysis<LiveIntervals>(); |
| 67 | mfi = mf.getFrameInfo(); |
| 68 | mri = &mf.getRegInfo(); |
| 69 | tii = mf.getTarget().getInstrInfo(); |
| 70 | tri = mf.getTarget().getRegisterInfo(); |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 71 | } |
| 72 | |
Lang Hames | f41538d | 2009-06-02 16:53:25 +0000 | [diff] [blame] | 73 | /// Add spill ranges for every use/def of the live interval, inserting loads |
Lang Hames | 38283e2 | 2009-11-18 20:31:20 +0000 | [diff] [blame] | 74 | /// immediately before each use, and stores after each def. No folding or |
| 75 | /// remat is attempted. |
Jakob Stoklund Olesen | 67674e2 | 2010-06-24 20:54:29 +0000 | [diff] [blame] | 76 | void trivialSpillEverywhere(LiveInterval *li, |
Jakob Stoklund Olesen | 0a2b2a1 | 2010-08-13 22:56:53 +0000 | [diff] [blame] | 77 | SmallVectorImpl<LiveInterval*> &newIntervals) { |
David Greene | 65de504 | 2010-01-05 01:25:55 +0000 | [diff] [blame] | 78 | DEBUG(dbgs() << "Spilling everywhere " << *li << "\n"); |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 79 | |
| 80 | assert(li->weight != HUGE_VALF && |
| 81 | "Attempting to spill already spilled value."); |
| 82 | |
Jakob Stoklund Olesen | be97e90 | 2011-01-09 21:17:37 +0000 | [diff] [blame] | 83 | assert(!TargetRegisterInfo::isStackSlot(li->reg) && |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 84 | "Trying to spill a stack slot."); |
| 85 | |
David Greene | 65de504 | 2010-01-05 01:25:55 +0000 | [diff] [blame] | 86 | DEBUG(dbgs() << "Trivial spill everywhere of reg" << li->reg << "\n"); |
Lang Hames | 6bbc73d | 2009-06-24 20:46:24 +0000 | [diff] [blame] | 87 | |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 88 | const TargetRegisterClass *trc = mri->getRegClass(li->reg); |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 89 | unsigned ss = vrm->assignVirt2StackSlot(li->reg); |
| 90 | |
Lang Hames | 38283e2 | 2009-11-18 20:31:20 +0000 | [diff] [blame] | 91 | // Iterate over reg uses/defs. |
Lang Hames | f41538d | 2009-06-02 16:53:25 +0000 | [diff] [blame] | 92 | for (MachineRegisterInfo::reg_iterator |
| 93 | regItr = mri->reg_begin(li->reg); regItr != mri->reg_end();) { |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 94 | |
Lang Hames | 38283e2 | 2009-11-18 20:31:20 +0000 | [diff] [blame] | 95 | // Grab the use/def instr. |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 96 | MachineInstr *mi = &*regItr; |
Lang Hames | 6bbc73d | 2009-06-24 20:46:24 +0000 | [diff] [blame] | 97 | |
David Greene | 65de504 | 2010-01-05 01:25:55 +0000 | [diff] [blame] | 98 | DEBUG(dbgs() << " Processing " << *mi); |
Lang Hames | 6bbc73d | 2009-06-24 20:46:24 +0000 | [diff] [blame] | 99 | |
Lang Hames | 38283e2 | 2009-11-18 20:31:20 +0000 | [diff] [blame] | 100 | // Step regItr to the next use/def instr. |
Lang Hames | f41538d | 2009-06-02 16:53:25 +0000 | [diff] [blame] | 101 | do { |
| 102 | ++regItr; |
| 103 | } while (regItr != mri->reg_end() && (&*regItr == mi)); |
Eric Christopher | 894339e | 2010-07-06 18:35:20 +0000 | [diff] [blame] | 104 | |
Lang Hames | 38283e2 | 2009-11-18 20:31:20 +0000 | [diff] [blame] | 105 | // Collect uses & defs for this instr. |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 106 | SmallVector<unsigned, 2> indices; |
| 107 | bool hasUse = false; |
| 108 | bool hasDef = false; |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 109 | for (unsigned i = 0; i != mi->getNumOperands(); ++i) { |
| 110 | MachineOperand &op = mi->getOperand(i); |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 111 | if (!op.isReg() || op.getReg() != li->reg) |
| 112 | continue; |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 113 | hasUse |= mi->getOperand(i).isUse(); |
| 114 | hasDef |= mi->getOperand(i).isDef(); |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 115 | indices.push_back(i); |
| 116 | } |
| 117 | |
Lang Hames | 38283e2 | 2009-11-18 20:31:20 +0000 | [diff] [blame] | 118 | // Create a new vreg & interval for this instr. |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 119 | unsigned newVReg = mri->createVirtualRegister(trc); |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 120 | vrm->grow(); |
| 121 | vrm->assignVirt2StackSlot(newVReg, ss); |
Lang Hames | f41538d | 2009-06-02 16:53:25 +0000 | [diff] [blame] | 122 | LiveInterval *newLI = &lis->getOrCreateInterval(newVReg); |
| 123 | newLI->weight = HUGE_VALF; |
Eric Christopher | 894339e | 2010-07-06 18:35:20 +0000 | [diff] [blame] | 124 | |
Lang Hames | 38283e2 | 2009-11-18 20:31:20 +0000 | [diff] [blame] | 125 | // Update the reg operands & kill flags. |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 126 | for (unsigned i = 0; i < indices.size(); ++i) { |
Lang Hames | 38283e2 | 2009-11-18 20:31:20 +0000 | [diff] [blame] | 127 | unsigned mopIdx = indices[i]; |
| 128 | MachineOperand &mop = mi->getOperand(mopIdx); |
| 129 | mop.setReg(newVReg); |
| 130 | if (mop.isUse() && !mi->isRegTiedToDefOperand(mopIdx)) { |
| 131 | mop.setIsKill(true); |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 132 | } |
| 133 | } |
Lang Hames | f41538d | 2009-06-02 16:53:25 +0000 | [diff] [blame] | 134 | assert(hasUse || hasDef); |
| 135 | |
Lang Hames | 38283e2 | 2009-11-18 20:31:20 +0000 | [diff] [blame] | 136 | // Insert reload if necessary. |
| 137 | MachineBasicBlock::iterator miItr(mi); |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 138 | if (hasUse) { |
Evan Cheng | 746ad69 | 2010-05-06 19:06:44 +0000 | [diff] [blame] | 139 | tii->loadRegFromStackSlot(*mi->getParent(), miItr, newVReg, ss, trc, |
| 140 | tri); |
Lang Hames | 38283e2 | 2009-11-18 20:31:20 +0000 | [diff] [blame] | 141 | MachineInstr *loadInstr(prior(miItr)); |
| 142 | SlotIndex loadIndex = |
| 143 | lis->InsertMachineInstrInMaps(loadInstr).getDefIndex(); |
Jakob Stoklund Olesen | d540801 | 2010-06-30 18:41:20 +0000 | [diff] [blame] | 144 | vrm->addSpillSlotUse(ss, loadInstr); |
Lang Hames | 38283e2 | 2009-11-18 20:31:20 +0000 | [diff] [blame] | 145 | SlotIndex endIndex = loadIndex.getNextIndex(); |
| 146 | VNInfo *loadVNI = |
Lang Hames | 6e2968c | 2010-09-25 12:04:16 +0000 | [diff] [blame] | 147 | newLI->getNextValue(loadIndex, 0, lis->getVNInfoAllocator()); |
Lang Hames | 38283e2 | 2009-11-18 20:31:20 +0000 | [diff] [blame] | 148 | newLI->addRange(LiveRange(loadIndex, endIndex, loadVNI)); |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 149 | } |
| 150 | |
Lang Hames | 38283e2 | 2009-11-18 20:31:20 +0000 | [diff] [blame] | 151 | // Insert store if necessary. |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 152 | if (hasDef) { |
Evan Cheng | e9b3ac2 | 2010-05-06 16:33:12 +0000 | [diff] [blame] | 153 | tii->storeRegToStackSlot(*mi->getParent(), llvm::next(miItr), newVReg, |
Evan Cheng | 746ad69 | 2010-05-06 19:06:44 +0000 | [diff] [blame] | 154 | true, ss, trc, tri); |
Chris Lattner | 7896c9f | 2009-12-03 00:50:42 +0000 | [diff] [blame] | 155 | MachineInstr *storeInstr(llvm::next(miItr)); |
Lang Hames | 38283e2 | 2009-11-18 20:31:20 +0000 | [diff] [blame] | 156 | SlotIndex storeIndex = |
| 157 | lis->InsertMachineInstrInMaps(storeInstr).getDefIndex(); |
Jakob Stoklund Olesen | d540801 | 2010-06-30 18:41:20 +0000 | [diff] [blame] | 158 | vrm->addSpillSlotUse(ss, storeInstr); |
Lang Hames | 38283e2 | 2009-11-18 20:31:20 +0000 | [diff] [blame] | 159 | SlotIndex beginIndex = storeIndex.getPrevIndex(); |
| 160 | VNInfo *storeVNI = |
Lang Hames | 6e2968c | 2010-09-25 12:04:16 +0000 | [diff] [blame] | 161 | newLI->getNextValue(beginIndex, 0, lis->getVNInfoAllocator()); |
Lang Hames | 38283e2 | 2009-11-18 20:31:20 +0000 | [diff] [blame] | 162 | newLI->addRange(LiveRange(beginIndex, storeIndex, storeVNI)); |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 163 | } |
| 164 | |
Jakob Stoklund Olesen | 67674e2 | 2010-06-24 20:54:29 +0000 | [diff] [blame] | 165 | newIntervals.push_back(newLI); |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 166 | } |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 167 | } |
Lang Hames | f41538d | 2009-06-02 16:53:25 +0000 | [diff] [blame] | 168 | }; |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 169 | |
Chris Lattner | 1ca6531 | 2010-04-07 22:44:07 +0000 | [diff] [blame] | 170 | } // end anonymous namespace |
| 171 | |
| 172 | namespace { |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 173 | |
Lang Hames | f41538d | 2009-06-02 16:53:25 +0000 | [diff] [blame] | 174 | /// Spills any live range using the spill-everywhere method with no attempt at |
| 175 | /// folding. |
| 176 | class TrivialSpiller : public SpillerBase { |
| 177 | public: |
Lang Hames | 10382fb | 2009-06-19 02:17:53 +0000 | [diff] [blame] | 178 | |
Jakob Stoklund Olesen | f2c6e36 | 2010-07-20 23:50:15 +0000 | [diff] [blame] | 179 | TrivialSpiller(MachineFunctionPass &pass, MachineFunction &mf, |
| 180 | VirtRegMap &vrm) |
| 181 | : SpillerBase(pass, mf, vrm) {} |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 182 | |
Jakob Stoklund Olesen | 67674e2 | 2010-06-24 20:54:29 +0000 | [diff] [blame] | 183 | void spill(LiveInterval *li, |
Jakob Stoklund Olesen | 0a2b2a1 | 2010-08-13 22:56:53 +0000 | [diff] [blame] | 184 | SmallVectorImpl<LiveInterval*> &newIntervals, |
Andrew Trick | f4baeaf | 2010-11-10 19:18:47 +0000 | [diff] [blame] | 185 | const SmallVectorImpl<LiveInterval*> &) { |
Lang Hames | 835ca07 | 2009-11-19 04:15:33 +0000 | [diff] [blame] | 186 | // Ignore spillIs - we don't use it. |
Jakob Stoklund Olesen | 67674e2 | 2010-06-24 20:54:29 +0000 | [diff] [blame] | 187 | trivialSpillEverywhere(li, newIntervals); |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 188 | } |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 189 | }; |
| 190 | |
Chris Lattner | 1ca6531 | 2010-04-07 22:44:07 +0000 | [diff] [blame] | 191 | } // end anonymous namespace |
| 192 | |
| 193 | namespace { |
| 194 | |
Lang Hames | 835ca07 | 2009-11-19 04:15:33 +0000 | [diff] [blame] | 195 | /// Falls back on LiveIntervals::addIntervalsForSpills. |
| 196 | class StandardSpiller : public Spiller { |
Lang Hames | 6194569 | 2009-12-09 05:39:12 +0000 | [diff] [blame] | 197 | protected: |
Jakob Stoklund Olesen | 2d17293 | 2010-10-26 00:11:33 +0000 | [diff] [blame] | 198 | MachineFunction *mf; |
Lang Hames | 835ca07 | 2009-11-19 04:15:33 +0000 | [diff] [blame] | 199 | LiveIntervals *lis; |
Jakob Stoklund Olesen | 2d17293 | 2010-10-26 00:11:33 +0000 | [diff] [blame] | 200 | LiveStacks *lss; |
Jakob Stoklund Olesen | 9529a1c | 2010-07-19 18:41:20 +0000 | [diff] [blame] | 201 | MachineLoopInfo *loopInfo; |
Lang Hames | 835ca07 | 2009-11-19 04:15:33 +0000 | [diff] [blame] | 202 | VirtRegMap *vrm; |
| 203 | public: |
Jakob Stoklund Olesen | f2c6e36 | 2010-07-20 23:50:15 +0000 | [diff] [blame] | 204 | StandardSpiller(MachineFunctionPass &pass, MachineFunction &mf, |
| 205 | VirtRegMap &vrm) |
Jakob Stoklund Olesen | 2d17293 | 2010-10-26 00:11:33 +0000 | [diff] [blame] | 206 | : mf(&mf), |
| 207 | lis(&pass.getAnalysis<LiveIntervals>()), |
| 208 | lss(&pass.getAnalysis<LiveStacks>()), |
Jakob Stoklund Olesen | f2c6e36 | 2010-07-20 23:50:15 +0000 | [diff] [blame] | 209 | loopInfo(pass.getAnalysisIfAvailable<MachineLoopInfo>()), |
| 210 | vrm(&vrm) {} |
Lang Hames | 835ca07 | 2009-11-19 04:15:33 +0000 | [diff] [blame] | 211 | |
| 212 | /// Falls back on LiveIntervals::addIntervalsForSpills. |
Jakob Stoklund Olesen | 67674e2 | 2010-06-24 20:54:29 +0000 | [diff] [blame] | 213 | void spill(LiveInterval *li, |
Jakob Stoklund Olesen | 0a2b2a1 | 2010-08-13 22:56:53 +0000 | [diff] [blame] | 214 | SmallVectorImpl<LiveInterval*> &newIntervals, |
Andrew Trick | f4baeaf | 2010-11-10 19:18:47 +0000 | [diff] [blame] | 215 | const SmallVectorImpl<LiveInterval*> &spillIs) { |
Jakob Stoklund Olesen | 67674e2 | 2010-06-24 20:54:29 +0000 | [diff] [blame] | 216 | std::vector<LiveInterval*> added = |
| 217 | lis->addIntervalsForSpills(*li, spillIs, loopInfo, *vrm); |
| 218 | newIntervals.insert(newIntervals.end(), added.begin(), added.end()); |
Jakob Stoklund Olesen | 2d17293 | 2010-10-26 00:11:33 +0000 | [diff] [blame] | 219 | |
| 220 | // Update LiveStacks. |
| 221 | int SS = vrm->getStackSlot(li->reg); |
| 222 | if (SS == VirtRegMap::NO_STACK_SLOT) |
| 223 | return; |
| 224 | const TargetRegisterClass *RC = mf->getRegInfo().getRegClass(li->reg); |
| 225 | LiveInterval &SI = lss->getOrCreateInterval(SS, RC); |
| 226 | if (!SI.hasAtLeastOneValue()) |
| 227 | SI.getNextValue(SlotIndex(), 0, lss->getVNInfoAllocator()); |
| 228 | SI.MergeRangesInAsValue(*li, SI.getValNumInfo(0)); |
Lang Hames | 835ca07 | 2009-11-19 04:15:33 +0000 | [diff] [blame] | 229 | } |
Lang Hames | 835ca07 | 2009-11-19 04:15:33 +0000 | [diff] [blame] | 230 | }; |
| 231 | |
Chris Lattner | 1ca6531 | 2010-04-07 22:44:07 +0000 | [diff] [blame] | 232 | } // end anonymous namespace |
| 233 | |
Jakob Stoklund Olesen | f2c6e36 | 2010-07-20 23:50:15 +0000 | [diff] [blame] | 234 | llvm::Spiller* llvm::createSpiller(MachineFunctionPass &pass, |
| 235 | MachineFunction &mf, |
| 236 | VirtRegMap &vrm) { |
Lang Hames | 835ca07 | 2009-11-19 04:15:33 +0000 | [diff] [blame] | 237 | switch (spillerOpt) { |
Chris Lattner | 1ca6531 | 2010-04-07 22:44:07 +0000 | [diff] [blame] | 238 | default: assert(0 && "unknown spiller"); |
Jakob Stoklund Olesen | f2c6e36 | 2010-07-20 23:50:15 +0000 | [diff] [blame] | 239 | case trivial: return new TrivialSpiller(pass, mf, vrm); |
| 240 | case standard: return new StandardSpiller(pass, mf, vrm); |
Jakob Stoklund Olesen | f2c6e36 | 2010-07-20 23:50:15 +0000 | [diff] [blame] | 241 | case inline_: return createInlineSpiller(pass, mf, vrm); |
Lang Hames | 835ca07 | 2009-11-19 04:15:33 +0000 | [diff] [blame] | 242 | } |
Lang Hames | e2b201b | 2009-05-18 19:03:16 +0000 | [diff] [blame] | 243 | } |