blob: 4d7c826a89738310b3a56f21c3c924c097ed5741 [file] [log] [blame]
Alkis Evlogimenos34d9bc92004-02-23 23:08:11 +00001//===-- llvm/CodeGen/VirtRegMap.cpp - Virtual Register Map ----------------===//
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 Lattner8c4d88d2004-09-30 01:54:45 +000010// This file implements the VirtRegMap class.
11//
12// It also contains implementations of the the Spiller interface, which, given a
13// virtual register map and a machine function, eliminates all virtual
14// references by replacing them with physical register references - adding spill
Alkis Evlogimenos0d6c5b62004-02-24 08:58:30 +000015// code as necessary.
Alkis Evlogimenos34d9bc92004-02-23 23:08:11 +000016//
17//===----------------------------------------------------------------------===//
18
Chris Lattner8c4d88d2004-09-30 01:54:45 +000019#define DEBUG_TYPE "spiller"
Alkis Evlogimenos34d9bc92004-02-23 23:08:11 +000020#include "VirtRegMap.h"
Alkis Evlogimenos0d6c5b62004-02-24 08:58:30 +000021#include "llvm/Function.h"
Alkis Evlogimenos34d9bc92004-02-23 23:08:11 +000022#include "llvm/CodeGen/MachineFrameInfo.h"
Chris Lattner8c4d88d2004-09-30 01:54:45 +000023#include "llvm/CodeGen/MachineFunction.h"
24#include "llvm/CodeGen/SSARegMap.h"
Alkis Evlogimenos34d9bc92004-02-23 23:08:11 +000025#include "llvm/Target/TargetMachine.h"
Alkis Evlogimenos0d6c5b62004-02-24 08:58:30 +000026#include "llvm/Target/TargetInstrInfo.h"
Reid Spencer551ccae2004-09-01 22:55:40 +000027#include "llvm/Support/CommandLine.h"
28#include "llvm/Support/Debug.h"
Reid Spencer551ccae2004-09-01 22:55:40 +000029#include "llvm/ADT/Statistic.h"
30#include "llvm/ADT/STLExtras.h"
Alkis Evlogimenos34d9bc92004-02-23 23:08:11 +000031using namespace llvm;
32
33namespace {
Chris Lattner8c4d88d2004-09-30 01:54:45 +000034 Statistic<> NumSpills("spiller", "Number of register spills");
35 Statistic<> NumStores("spiller", "Number of stores added");
36 Statistic<> NumLoads ("spiller", "Number of loads added");
Alkis Evlogimenos0d6c5b62004-02-24 08:58:30 +000037
Chris Lattner8c4d88d2004-09-30 01:54:45 +000038 enum SpillerName { simple, local };
Alkis Evlogimenosdd420e02004-03-01 23:18:15 +000039
Chris Lattner8c4d88d2004-09-30 01:54:45 +000040 cl::opt<SpillerName>
41 SpillerOpt("spiller",
Chris Lattner5f7d2d42004-09-30 02:40:06 +000042 cl::desc("Spiller to use: (default: simple)"),
Chris Lattner8c4d88d2004-09-30 01:54:45 +000043 cl::Prefix,
44 cl::values(clEnumVal(simple, " simple spiller"),
45 clEnumVal(local, " local spiller"),
46 clEnumValEnd),
Chris Lattner5f7d2d42004-09-30 02:40:06 +000047 cl::init(simple));
Alkis Evlogimenos34d9bc92004-02-23 23:08:11 +000048}
49
Chris Lattner8c4d88d2004-09-30 01:54:45 +000050//===----------------------------------------------------------------------===//
51// VirtRegMap implementation
52//===----------------------------------------------------------------------===//
53
54void VirtRegMap::grow() {
Chris Lattner7f690e62004-09-30 02:15:18 +000055 Virt2PhysMap.grow(MF.getSSARegMap()->getLastVirtReg());
56 Virt2StackSlotMap.grow(MF.getSSARegMap()->getLastVirtReg());
Alkis Evlogimenos34d9bc92004-02-23 23:08:11 +000057}
58
Chris Lattner8c4d88d2004-09-30 01:54:45 +000059int VirtRegMap::assignVirt2StackSlot(unsigned virtReg) {
60 assert(MRegisterInfo::isVirtualRegister(virtReg));
Chris Lattner7f690e62004-09-30 02:15:18 +000061 assert(Virt2StackSlotMap[virtReg] == NO_STACK_SLOT &&
Chris Lattner8c4d88d2004-09-30 01:54:45 +000062 "attempt to assign stack slot to already spilled register");
Chris Lattner7f690e62004-09-30 02:15:18 +000063 const TargetRegisterClass* RC = MF.getSSARegMap()->getRegClass(virtReg);
64 int frameIndex = MF.getFrameInfo()->CreateStackObject(RC->getSize(),
65 RC->getAlignment());
66 Virt2StackSlotMap[virtReg] = frameIndex;
Chris Lattner8c4d88d2004-09-30 01:54:45 +000067 ++NumSpills;
68 return frameIndex;
69}
70
71void VirtRegMap::assignVirt2StackSlot(unsigned virtReg, int frameIndex) {
72 assert(MRegisterInfo::isVirtualRegister(virtReg));
Chris Lattner7f690e62004-09-30 02:15:18 +000073 assert(Virt2StackSlotMap[virtReg] == NO_STACK_SLOT &&
Chris Lattner8c4d88d2004-09-30 01:54:45 +000074 "attempt to assign stack slot to already spilled register");
Chris Lattner7f690e62004-09-30 02:15:18 +000075 Virt2StackSlotMap[virtReg] = frameIndex;
Alkis Evlogimenos38af59a2004-05-29 20:38:05 +000076}
77
Alkis Evlogimenos5f375022004-03-01 20:05:10 +000078void VirtRegMap::virtFolded(unsigned virtReg,
79 MachineInstr* oldMI,
Chris Lattner8c4d88d2004-09-30 01:54:45 +000080 MachineInstr* newMI) {
81 // move previous memory references folded to new instruction
Chris Lattner7f690e62004-09-30 02:15:18 +000082 MI2VirtMapTy::iterator i, e;
83 std::vector<MI2VirtMapTy::mapped_type> regs;
84 for (tie(i, e) = MI2VirtMap.equal_range(oldMI); i != e; ) {
Chris Lattner8c4d88d2004-09-30 01:54:45 +000085 regs.push_back(i->second);
Chris Lattner7f690e62004-09-30 02:15:18 +000086 MI2VirtMap.erase(i++);
Chris Lattner8c4d88d2004-09-30 01:54:45 +000087 }
88 for (unsigned i = 0, e = regs.size(); i != e; ++i)
Chris Lattner7f690e62004-09-30 02:15:18 +000089 MI2VirtMap.insert(std::make_pair(newMI, i));
Alkis Evlogimenos5f375022004-03-01 20:05:10 +000090
Chris Lattner8c4d88d2004-09-30 01:54:45 +000091 // add new memory reference
Chris Lattner7f690e62004-09-30 02:15:18 +000092 MI2VirtMap.insert(std::make_pair(newMI, virtReg));
Alkis Evlogimenos5f375022004-03-01 20:05:10 +000093}
94
Chris Lattner7f690e62004-09-30 02:15:18 +000095void VirtRegMap::print(std::ostream &OS) const {
96 const MRegisterInfo* MRI = MF.getTarget().getRegisterInfo();
Alkis Evlogimenos34d9bc92004-02-23 23:08:11 +000097
Chris Lattner7f690e62004-09-30 02:15:18 +000098 OS << "********** REGISTER MAP **********\n";
Chris Lattner8c4d88d2004-09-30 01:54:45 +000099 for (unsigned i = MRegisterInfo::FirstVirtualRegister,
Chris Lattner7f690e62004-09-30 02:15:18 +0000100 e = MF.getSSARegMap()->getLastVirtReg(); i <= e; ++i) {
101 if (Virt2PhysMap[i] != (unsigned)VirtRegMap::NO_PHYS_REG)
102 OS << "[reg" << i << " -> " << MRI->getName(Virt2PhysMap[i]) << "]\n";
103
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000104 }
105
106 for (unsigned i = MRegisterInfo::FirstVirtualRegister,
Chris Lattner7f690e62004-09-30 02:15:18 +0000107 e = MF.getSSARegMap()->getLastVirtReg(); i <= e; ++i)
108 if (Virt2StackSlotMap[i] != VirtRegMap::NO_STACK_SLOT)
109 OS << "[reg" << i << " -> fi#" << Virt2StackSlotMap[i] << "]\n";
110 OS << '\n';
Alkis Evlogimenos34d9bc92004-02-23 23:08:11 +0000111}
Alkis Evlogimenos0d6c5b62004-02-24 08:58:30 +0000112
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000113void VirtRegMap::dump() const { print(std::cerr); }
Alkis Evlogimenosdd420e02004-03-01 23:18:15 +0000114
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000115
116//===----------------------------------------------------------------------===//
117// Simple Spiller Implementation
118//===----------------------------------------------------------------------===//
119
120Spiller::~Spiller() {}
Alkis Evlogimenosdd420e02004-03-01 23:18:15 +0000121
Alkis Evlogimenos0d6c5b62004-02-24 08:58:30 +0000122namespace {
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000123 struct SimpleSpiller : public Spiller {
124 bool runOnMachineFunction(MachineFunction& mf, const VirtRegMap &VRM);
125 };
Alkis Evlogimenos0d6c5b62004-02-24 08:58:30 +0000126}
127
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000128bool SimpleSpiller::runOnMachineFunction(MachineFunction& MF,
129 const VirtRegMap& VRM) {
130 DEBUG(std::cerr << "********** REWRITE MACHINE CODE **********\n");
131 DEBUG(std::cerr << "********** Function: "
132 << MF.getFunction()->getName() << '\n');
133 const TargetMachine& TM = MF.getTarget();
Chris Lattner7f690e62004-09-30 02:15:18 +0000134 const MRegisterInfo& MRI = *TM.getRegisterInfo();
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000135
Chris Lattner4ea1b822004-09-30 02:33:48 +0000136 // LoadedRegs - Keep track of which vregs are loaded, so that we only load
137 // each vreg once (in the case where a spilled vreg is used by multiple
138 // operands). This is always smaller than the number of operands to the
139 // current machine instr, so it should be small.
140 std::vector<unsigned> LoadedRegs;
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000141
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000142 for (MachineFunction::iterator MBBI = MF.begin(), E = MF.end();
143 MBBI != E; ++MBBI) {
144 DEBUG(std::cerr << MBBI->getBasicBlock()->getName() << ":\n");
145 MachineBasicBlock &MBB = *MBBI;
146 for (MachineBasicBlock::iterator MII = MBB.begin(),
147 E = MBB.end(); MII != E; ++MII) {
148 MachineInstr &MI = *MII;
149 for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) {
150 MachineOperand &MOP = MI.getOperand(i);
151 if (MOP.isRegister() && MOP.getReg() &&
152 MRegisterInfo::isVirtualRegister(MOP.getReg())){
153 unsigned VirtReg = MOP.getReg();
154 unsigned PhysReg = VRM.getPhys(VirtReg);
155 if (VRM.hasStackSlot(VirtReg)) {
Chris Lattner477e4552004-09-30 16:10:45 +0000156 int StackSlot = VRM.getStackSlot(VirtReg);
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000157
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000158 if (MOP.isUse() &&
159 std::find(LoadedRegs.begin(), LoadedRegs.end(), VirtReg)
160 == LoadedRegs.end()) {
161 MRI.loadRegFromStackSlot(MBB, &MI, PhysReg, StackSlot);
162 LoadedRegs.push_back(VirtReg);
163 ++NumLoads;
Chris Lattner477e4552004-09-30 16:10:45 +0000164 DEBUG(std::cerr << '\t' << *prior(MII));
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000165 }
166
167 if (MOP.isDef()) {
168 MRI.storeRegToStackSlot(MBB, next(MII), PhysReg,
169 VRM.getStackSlot(VirtReg));
170 ++NumStores;
171 }
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000172 }
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000173 MI.SetMachineOperandReg(i, PhysReg);
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000174 }
175 }
Chris Lattner477e4552004-09-30 16:10:45 +0000176 DEBUG(std::cerr << '\t' << MI);
Chris Lattner4ea1b822004-09-30 02:33:48 +0000177 LoadedRegs.clear();
Alkis Evlogimenosdd420e02004-03-01 23:18:15 +0000178 }
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000179 }
180 return true;
181}
182
183//===----------------------------------------------------------------------===//
184// Local Spiller Implementation
185//===----------------------------------------------------------------------===//
186
187namespace {
188 class LocalSpiller : public Spiller {
189 typedef std::vector<unsigned> Phys2VirtMap;
190 typedef std::vector<bool> PhysFlag;
191 typedef DenseMap<MachineInstr*, VirtReg2IndexFunctor> Virt2MI;
192
193 MachineFunction *MF;
194 const TargetMachine *TM;
195 const TargetInstrInfo *TII;
196 const MRegisterInfo *MRI;
197 const VirtRegMap *VRM;
198 Phys2VirtMap p2vMap_;
199 PhysFlag dirty_;
200 Virt2MI lastDef_;
201
202 public:
203 bool runOnMachineFunction(MachineFunction &MF, const VirtRegMap &VRM);
204
205 private:
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000206 void vacateJustPhysReg(MachineBasicBlock& MBB,
207 MachineBasicBlock::iterator MII,
208 unsigned PhysReg);
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000209
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000210 void vacatePhysReg(MachineBasicBlock& MBB,
211 MachineBasicBlock::iterator MII,
212 unsigned PhysReg) {
213 vacateJustPhysReg(MBB, MII, PhysReg);
214 for (const unsigned* as = MRI->getAliasSet(PhysReg); *as; ++as)
215 vacateJustPhysReg(MBB, MII, *as);
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000216 }
217
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000218 void handleUse(MachineBasicBlock& MBB,
219 MachineBasicBlock::iterator MII,
220 unsigned VirtReg,
221 unsigned PhysReg) {
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000222 // check if we are replacing a previous mapping
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000223 if (p2vMap_[PhysReg] != VirtReg) {
224 vacatePhysReg(MBB, MII, PhysReg);
225 p2vMap_[PhysReg] = VirtReg;
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000226 // load if necessary
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000227 if (VRM->hasStackSlot(VirtReg)) {
228 MRI->loadRegFromStackSlot(MBB, MII, PhysReg,
229 VRM->getStackSlot(VirtReg));
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000230 ++NumLoads;
Chris Lattner477e4552004-09-30 16:10:45 +0000231 DEBUG(std::cerr << "added: " << *prior(MII));
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000232 lastDef_[VirtReg] = MII;
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000233 }
234 }
235 }
236
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000237 void handleDef(MachineBasicBlock& MBB,
238 MachineBasicBlock::iterator MII,
239 unsigned VirtReg,
240 unsigned PhysReg) {
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000241 // check if we are replacing a previous mapping
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000242 if (p2vMap_[PhysReg] != VirtReg)
243 vacatePhysReg(MBB, MII, PhysReg);
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000244
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000245 p2vMap_[PhysReg] = VirtReg;
246 dirty_[PhysReg] = true;
247 lastDef_[VirtReg] = MII;
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000248 }
249
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000250 void eliminateVirtRegsInMBB(MachineBasicBlock& MBB);
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000251 };
252}
253
254bool LocalSpiller::runOnMachineFunction(MachineFunction &mf,
255 const VirtRegMap &vrm) {
256 MF = &mf;
257 TM = &MF->getTarget();
258 TII = TM->getInstrInfo();
259 MRI = TM->getRegisterInfo();
260 VRM = &vrm;
261 p2vMap_.assign(MRI->getNumRegs(), 0);
262 dirty_.assign(MRI->getNumRegs(), false);
263
264 DEBUG(std::cerr << "********** REWRITE MACHINE CODE **********\n");
265 DEBUG(std::cerr << "********** Function: "
266 << MF->getFunction()->getName() << '\n');
267
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000268 for (MachineFunction::iterator MBB = MF->begin(), E = MF->end();
269 MBB != E; ++MBB) {
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000270 lastDef_.grow(MF->getSSARegMap()->getLastVirtReg());
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000271 DEBUG(std::cerr << MBB->getBasicBlock()->getName() << ":\n");
272 eliminateVirtRegsInMBB(*MBB);
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000273 // clear map, dirty flag and last ref
274 p2vMap_.assign(p2vMap_.size(), 0);
275 dirty_.assign(dirty_.size(), false);
276 lastDef_.clear();
277 }
278 return true;
279}
280
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000281void LocalSpiller::vacateJustPhysReg(MachineBasicBlock& MBB,
282 MachineBasicBlock::iterator MII,
283 unsigned PhysReg) {
284 unsigned VirtReg = p2vMap_[PhysReg];
285 if (dirty_[PhysReg] && VRM->hasStackSlot(VirtReg)) {
286 assert(lastDef_[VirtReg] && "virtual register is mapped "
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000287 "to a register and but was not defined!");
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000288 MachineBasicBlock::iterator lastDef = lastDef_[VirtReg];
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000289 MachineBasicBlock::iterator nextLastRef = next(lastDef);
290 MRI->storeRegToStackSlot(*lastDef->getParent(),
291 nextLastRef,
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000292 PhysReg,
293 VRM->getStackSlot(VirtReg));
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000294 ++NumStores;
Chris Lattner477e4552004-09-30 16:10:45 +0000295 DEBUG(std::cerr << "added: " << *prior(nextLastRef);
296 std::cerr << "after: " << *lastDef);
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000297 lastDef_[VirtReg] = 0;
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000298 }
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000299 p2vMap_[PhysReg] = 0;
300 dirty_[PhysReg] = false;
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000301}
302
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000303void LocalSpiller::eliminateVirtRegsInMBB(MachineBasicBlock &MBB) {
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000304 for (MachineBasicBlock::iterator MI = MBB.begin(), E = MBB.end();
305 MI != E; ++MI) {
306
307 // if we have references to memory operands make sure
308 // we clear all physical registers that may contain
309 // the value of the spilled virtual register
Chris Lattner7f690e62004-09-30 02:15:18 +0000310 VirtRegMap::MI2VirtMapTy::const_iterator i, e;
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000311 for (tie(i, e) = VRM->getFoldedVirts(MI); i != e; ++i) {
312 if (VRM->hasPhys(i->second))
313 vacateJustPhysReg(MBB, MI, VRM->getPhys(i->second));
314 }
315
316 // rewrite all used operands
317 for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
318 MachineOperand& op = MI->getOperand(i);
319 if (op.isRegister() && op.getReg() && op.isUse() &&
320 MRegisterInfo::isVirtualRegister(op.getReg())) {
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000321 unsigned VirtReg = op.getReg();
322 unsigned PhysReg = VRM->getPhys(VirtReg);
323 handleUse(MBB, MI, VirtReg, PhysReg);
324 MI->SetMachineOperandReg(i, PhysReg);
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000325 // mark as dirty if this is def&use
326 if (op.isDef()) {
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000327 dirty_[PhysReg] = true;
328 lastDef_[VirtReg] = MI;
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000329 }
330 }
331 }
332
333 // spill implicit physical register defs
334 const TargetInstrDescriptor& tid = TII->get(MI->getOpcode());
335 for (const unsigned* id = tid.ImplicitDefs; *id; ++id)
336 vacatePhysReg(MBB, MI, *id);
337
338 // spill explicit physical register defs
339 for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
340 MachineOperand& op = MI->getOperand(i);
341 if (op.isRegister() && op.getReg() && !op.isUse() &&
342 MRegisterInfo::isPhysicalRegister(op.getReg()))
343 vacatePhysReg(MBB, MI, op.getReg());
344 }
345
346 // rewrite def operands (def&use was handled with the
347 // uses so don't check for those here)
348 for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
349 MachineOperand& op = MI->getOperand(i);
350 if (op.isRegister() && op.getReg() && !op.isUse())
351 if (MRegisterInfo::isPhysicalRegister(op.getReg()))
352 vacatePhysReg(MBB, MI, op.getReg());
353 else {
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000354 unsigned PhysReg = VRM->getPhys(op.getReg());
355 handleDef(MBB, MI, op.getReg(), PhysReg);
356 MI->SetMachineOperandReg(i, PhysReg);
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000357 }
358 }
359
Chris Lattner477e4552004-09-30 16:10:45 +0000360 DEBUG(std::cerr << '\t' << *MI);
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000361 }
362
363 for (unsigned i = 1, e = p2vMap_.size(); i != e; ++i)
364 vacateJustPhysReg(MBB, MBB.getFirstTerminator(), i);
365}
366
367
368llvm::Spiller* llvm::createSpiller() {
369 switch (SpillerOpt) {
370 default: assert(0 && "Unreachable!");
371 case local:
372 return new LocalSpiller();
373 case simple:
374 return new SimpleSpiller();
375 }
Alkis Evlogimenos0d6c5b62004-02-24 08:58:30 +0000376}