blob: b687c57ae7aad3f465b774c6e385de9a6890c9e7 [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 std::vector<MI2VirtMapTy::mapped_type> regs;
Chris Lattnerdbea9732004-09-30 16:35:08 +000083 for (MI2VirtMapTy::iterator I = MI2VirtMap.lower_bound(oldMI),
84 E = MI2VirtMap.end(); I != E && I->first == oldMI; ) {
85 regs.push_back(I->second);
86 MI2VirtMap.erase(I++);
Chris Lattner8c4d88d2004-09-30 01:54:45 +000087 }
Chris Lattnerdbea9732004-09-30 16:35:08 +000088
89 MI2VirtMapTy::iterator IP = MI2VirtMap.lower_bound(newMI);
Chris Lattner8c4d88d2004-09-30 01:54:45 +000090 for (unsigned i = 0, e = regs.size(); i != e; ++i)
Chris Lattnerdbea9732004-09-30 16:35:08 +000091 MI2VirtMap.insert(IP, std::make_pair(newMI, regs[i]));
Alkis Evlogimenos5f375022004-03-01 20:05:10 +000092
Chris Lattner8c4d88d2004-09-30 01:54:45 +000093 // add new memory reference
Chris Lattnerdbea9732004-09-30 16:35:08 +000094 MI2VirtMap.insert(IP, std::make_pair(newMI, virtReg));
Alkis Evlogimenos5f375022004-03-01 20:05:10 +000095}
96
Chris Lattner7f690e62004-09-30 02:15:18 +000097void VirtRegMap::print(std::ostream &OS) const {
98 const MRegisterInfo* MRI = MF.getTarget().getRegisterInfo();
Alkis Evlogimenos34d9bc92004-02-23 23:08:11 +000099
Chris Lattner7f690e62004-09-30 02:15:18 +0000100 OS << "********** REGISTER MAP **********\n";
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000101 for (unsigned i = MRegisterInfo::FirstVirtualRegister,
Chris Lattner7f690e62004-09-30 02:15:18 +0000102 e = MF.getSSARegMap()->getLastVirtReg(); i <= e; ++i) {
103 if (Virt2PhysMap[i] != (unsigned)VirtRegMap::NO_PHYS_REG)
104 OS << "[reg" << i << " -> " << MRI->getName(Virt2PhysMap[i]) << "]\n";
105
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000106 }
107
108 for (unsigned i = MRegisterInfo::FirstVirtualRegister,
Chris Lattner7f690e62004-09-30 02:15:18 +0000109 e = MF.getSSARegMap()->getLastVirtReg(); i <= e; ++i)
110 if (Virt2StackSlotMap[i] != VirtRegMap::NO_STACK_SLOT)
111 OS << "[reg" << i << " -> fi#" << Virt2StackSlotMap[i] << "]\n";
112 OS << '\n';
Alkis Evlogimenos34d9bc92004-02-23 23:08:11 +0000113}
Alkis Evlogimenos0d6c5b62004-02-24 08:58:30 +0000114
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000115void VirtRegMap::dump() const { print(std::cerr); }
Alkis Evlogimenosdd420e02004-03-01 23:18:15 +0000116
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000117
118//===----------------------------------------------------------------------===//
119// Simple Spiller Implementation
120//===----------------------------------------------------------------------===//
121
122Spiller::~Spiller() {}
Alkis Evlogimenosdd420e02004-03-01 23:18:15 +0000123
Alkis Evlogimenos0d6c5b62004-02-24 08:58:30 +0000124namespace {
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000125 struct SimpleSpiller : public Spiller {
126 bool runOnMachineFunction(MachineFunction& mf, const VirtRegMap &VRM);
127 };
Alkis Evlogimenos0d6c5b62004-02-24 08:58:30 +0000128}
129
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000130bool SimpleSpiller::runOnMachineFunction(MachineFunction& MF,
131 const VirtRegMap& VRM) {
132 DEBUG(std::cerr << "********** REWRITE MACHINE CODE **********\n");
133 DEBUG(std::cerr << "********** Function: "
134 << MF.getFunction()->getName() << '\n');
135 const TargetMachine& TM = MF.getTarget();
Chris Lattner7f690e62004-09-30 02:15:18 +0000136 const MRegisterInfo& MRI = *TM.getRegisterInfo();
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000137
Chris Lattner4ea1b822004-09-30 02:33:48 +0000138 // LoadedRegs - Keep track of which vregs are loaded, so that we only load
139 // each vreg once (in the case where a spilled vreg is used by multiple
140 // operands). This is always smaller than the number of operands to the
141 // current machine instr, so it should be small.
142 std::vector<unsigned> LoadedRegs;
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000143
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000144 for (MachineFunction::iterator MBBI = MF.begin(), E = MF.end();
145 MBBI != E; ++MBBI) {
146 DEBUG(std::cerr << MBBI->getBasicBlock()->getName() << ":\n");
147 MachineBasicBlock &MBB = *MBBI;
148 for (MachineBasicBlock::iterator MII = MBB.begin(),
149 E = MBB.end(); MII != E; ++MII) {
150 MachineInstr &MI = *MII;
151 for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) {
152 MachineOperand &MOP = MI.getOperand(i);
153 if (MOP.isRegister() && MOP.getReg() &&
154 MRegisterInfo::isVirtualRegister(MOP.getReg())){
155 unsigned VirtReg = MOP.getReg();
156 unsigned PhysReg = VRM.getPhys(VirtReg);
157 if (VRM.hasStackSlot(VirtReg)) {
Chris Lattner477e4552004-09-30 16:10:45 +0000158 int StackSlot = VRM.getStackSlot(VirtReg);
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000159
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000160 if (MOP.isUse() &&
161 std::find(LoadedRegs.begin(), LoadedRegs.end(), VirtReg)
162 == LoadedRegs.end()) {
163 MRI.loadRegFromStackSlot(MBB, &MI, PhysReg, StackSlot);
164 LoadedRegs.push_back(VirtReg);
165 ++NumLoads;
Chris Lattner477e4552004-09-30 16:10:45 +0000166 DEBUG(std::cerr << '\t' << *prior(MII));
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000167 }
168
169 if (MOP.isDef()) {
170 MRI.storeRegToStackSlot(MBB, next(MII), PhysReg,
171 VRM.getStackSlot(VirtReg));
172 ++NumStores;
173 }
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000174 }
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000175 MI.SetMachineOperandReg(i, PhysReg);
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000176 }
177 }
Chris Lattner477e4552004-09-30 16:10:45 +0000178 DEBUG(std::cerr << '\t' << MI);
Chris Lattner4ea1b822004-09-30 02:33:48 +0000179 LoadedRegs.clear();
Alkis Evlogimenosdd420e02004-03-01 23:18:15 +0000180 }
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000181 }
182 return true;
183}
184
185//===----------------------------------------------------------------------===//
186// Local Spiller Implementation
187//===----------------------------------------------------------------------===//
188
189namespace {
190 class LocalSpiller : public Spiller {
191 typedef std::vector<unsigned> Phys2VirtMap;
192 typedef std::vector<bool> PhysFlag;
193 typedef DenseMap<MachineInstr*, VirtReg2IndexFunctor> Virt2MI;
194
195 MachineFunction *MF;
196 const TargetMachine *TM;
197 const TargetInstrInfo *TII;
198 const MRegisterInfo *MRI;
199 const VirtRegMap *VRM;
200 Phys2VirtMap p2vMap_;
201 PhysFlag dirty_;
202 Virt2MI lastDef_;
203
204 public:
205 bool runOnMachineFunction(MachineFunction &MF, const VirtRegMap &VRM);
206
207 private:
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000208 void vacateJustPhysReg(MachineBasicBlock& MBB,
209 MachineBasicBlock::iterator MII,
210 unsigned PhysReg);
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000211
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000212 void vacatePhysReg(MachineBasicBlock& MBB,
213 MachineBasicBlock::iterator MII,
214 unsigned PhysReg) {
215 vacateJustPhysReg(MBB, MII, PhysReg);
216 for (const unsigned* as = MRI->getAliasSet(PhysReg); *as; ++as)
217 vacateJustPhysReg(MBB, MII, *as);
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000218 }
219
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000220 void handleUse(MachineBasicBlock& MBB,
221 MachineBasicBlock::iterator MII,
222 unsigned VirtReg,
223 unsigned PhysReg) {
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000224 // check if we are replacing a previous mapping
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000225 if (p2vMap_[PhysReg] != VirtReg) {
226 vacatePhysReg(MBB, MII, PhysReg);
227 p2vMap_[PhysReg] = VirtReg;
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000228 // load if necessary
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000229 if (VRM->hasStackSlot(VirtReg)) {
230 MRI->loadRegFromStackSlot(MBB, MII, PhysReg,
231 VRM->getStackSlot(VirtReg));
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000232 ++NumLoads;
Chris Lattner477e4552004-09-30 16:10:45 +0000233 DEBUG(std::cerr << "added: " << *prior(MII));
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000234 lastDef_[VirtReg] = MII;
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000235 }
236 }
237 }
238
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000239 void handleDef(MachineBasicBlock& MBB,
240 MachineBasicBlock::iterator MII,
241 unsigned VirtReg,
242 unsigned PhysReg) {
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000243 // check if we are replacing a previous mapping
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000244 if (p2vMap_[PhysReg] != VirtReg)
245 vacatePhysReg(MBB, MII, PhysReg);
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000246
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000247 p2vMap_[PhysReg] = VirtReg;
248 dirty_[PhysReg] = true;
249 lastDef_[VirtReg] = MII;
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000250 }
251
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000252 void eliminateVirtRegsInMBB(MachineBasicBlock& MBB);
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000253 };
254}
255
256bool LocalSpiller::runOnMachineFunction(MachineFunction &mf,
257 const VirtRegMap &vrm) {
258 MF = &mf;
259 TM = &MF->getTarget();
260 TII = TM->getInstrInfo();
261 MRI = TM->getRegisterInfo();
262 VRM = &vrm;
263 p2vMap_.assign(MRI->getNumRegs(), 0);
264 dirty_.assign(MRI->getNumRegs(), false);
265
266 DEBUG(std::cerr << "********** REWRITE MACHINE CODE **********\n");
267 DEBUG(std::cerr << "********** Function: "
268 << MF->getFunction()->getName() << '\n');
269
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000270 for (MachineFunction::iterator MBB = MF->begin(), E = MF->end();
271 MBB != E; ++MBB) {
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000272 lastDef_.grow(MF->getSSARegMap()->getLastVirtReg());
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000273 DEBUG(std::cerr << MBB->getBasicBlock()->getName() << ":\n");
274 eliminateVirtRegsInMBB(*MBB);
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000275 // clear map, dirty flag and last ref
276 p2vMap_.assign(p2vMap_.size(), 0);
277 dirty_.assign(dirty_.size(), false);
278 lastDef_.clear();
279 }
280 return true;
281}
282
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000283void LocalSpiller::vacateJustPhysReg(MachineBasicBlock& MBB,
284 MachineBasicBlock::iterator MII,
285 unsigned PhysReg) {
286 unsigned VirtReg = p2vMap_[PhysReg];
287 if (dirty_[PhysReg] && VRM->hasStackSlot(VirtReg)) {
288 assert(lastDef_[VirtReg] && "virtual register is mapped "
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000289 "to a register and but was not defined!");
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000290 MachineBasicBlock::iterator lastDef = lastDef_[VirtReg];
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000291 MachineBasicBlock::iterator nextLastRef = next(lastDef);
292 MRI->storeRegToStackSlot(*lastDef->getParent(),
293 nextLastRef,
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000294 PhysReg,
295 VRM->getStackSlot(VirtReg));
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000296 ++NumStores;
Chris Lattner477e4552004-09-30 16:10:45 +0000297 DEBUG(std::cerr << "added: " << *prior(nextLastRef);
298 std::cerr << "after: " << *lastDef);
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000299 lastDef_[VirtReg] = 0;
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000300 }
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000301 p2vMap_[PhysReg] = 0;
302 dirty_[PhysReg] = false;
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000303}
304
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000305void LocalSpiller::eliminateVirtRegsInMBB(MachineBasicBlock &MBB) {
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000306 for (MachineBasicBlock::iterator MI = MBB.begin(), E = MBB.end();
307 MI != E; ++MI) {
308
309 // if we have references to memory operands make sure
310 // we clear all physical registers that may contain
311 // the value of the spilled virtual register
Chris Lattner7f690e62004-09-30 02:15:18 +0000312 VirtRegMap::MI2VirtMapTy::const_iterator i, e;
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000313 for (tie(i, e) = VRM->getFoldedVirts(MI); i != e; ++i) {
314 if (VRM->hasPhys(i->second))
315 vacateJustPhysReg(MBB, MI, VRM->getPhys(i->second));
316 }
317
318 // rewrite all used operands
319 for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
320 MachineOperand& op = MI->getOperand(i);
321 if (op.isRegister() && op.getReg() && op.isUse() &&
322 MRegisterInfo::isVirtualRegister(op.getReg())) {
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000323 unsigned VirtReg = op.getReg();
324 unsigned PhysReg = VRM->getPhys(VirtReg);
325 handleUse(MBB, MI, VirtReg, PhysReg);
326 MI->SetMachineOperandReg(i, PhysReg);
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000327 // mark as dirty if this is def&use
328 if (op.isDef()) {
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000329 dirty_[PhysReg] = true;
330 lastDef_[VirtReg] = MI;
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000331 }
332 }
333 }
334
335 // spill implicit physical register defs
336 const TargetInstrDescriptor& tid = TII->get(MI->getOpcode());
337 for (const unsigned* id = tid.ImplicitDefs; *id; ++id)
338 vacatePhysReg(MBB, MI, *id);
339
340 // spill explicit physical register defs
341 for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
342 MachineOperand& op = MI->getOperand(i);
343 if (op.isRegister() && op.getReg() && !op.isUse() &&
344 MRegisterInfo::isPhysicalRegister(op.getReg()))
345 vacatePhysReg(MBB, MI, op.getReg());
346 }
347
348 // rewrite def operands (def&use was handled with the
349 // uses so don't check for those here)
350 for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
351 MachineOperand& op = MI->getOperand(i);
352 if (op.isRegister() && op.getReg() && !op.isUse())
353 if (MRegisterInfo::isPhysicalRegister(op.getReg()))
354 vacatePhysReg(MBB, MI, op.getReg());
355 else {
Chris Lattner0fc27cc2004-09-30 02:59:33 +0000356 unsigned PhysReg = VRM->getPhys(op.getReg());
357 handleDef(MBB, MI, op.getReg(), PhysReg);
358 MI->SetMachineOperandReg(i, PhysReg);
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000359 }
360 }
361
Chris Lattner477e4552004-09-30 16:10:45 +0000362 DEBUG(std::cerr << '\t' << *MI);
Chris Lattner8c4d88d2004-09-30 01:54:45 +0000363 }
364
365 for (unsigned i = 1, e = p2vMap_.size(); i != e; ++i)
366 vacateJustPhysReg(MBB, MBB.getFirstTerminator(), i);
367}
368
369
370llvm::Spiller* llvm::createSpiller() {
371 switch (SpillerOpt) {
372 default: assert(0 && "Unreachable!");
373 case local:
374 return new LocalSpiller();
375 case simple:
376 return new SimpleSpiller();
377 }
Alkis Evlogimenos0d6c5b62004-02-24 08:58:30 +0000378}