Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1 | //===-- llvm/CodeGen/VirtRegMap.cpp - Virtual Register Map ----------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 081ce94 | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // 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 |
| 15 | // code as necessary. |
| 16 | // |
| 17 | //===----------------------------------------------------------------------===// |
| 18 | |
Owen Anderson | 860d482 | 2009-03-11 22:31:21 +0000 | [diff] [blame] | 19 | #define DEBUG_TYPE "virtregmap" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 20 | #include "VirtRegMap.h" |
| 21 | #include "llvm/Function.h" |
Evan Cheng | 97c5f1f | 2009-05-03 18:32:42 +0000 | [diff] [blame] | 22 | #include "llvm/CodeGen/LiveIntervalAnalysis.h" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 23 | #include "llvm/CodeGen/MachineFrameInfo.h" |
| 24 | #include "llvm/CodeGen/MachineFunction.h" |
Evan Cheng | 7b88cbc | 2008-04-11 17:53:36 +0000 | [diff] [blame] | 25 | #include "llvm/CodeGen/MachineInstrBuilder.h" |
Chris Lattner | 1b98919 | 2007-12-31 04:13:23 +0000 | [diff] [blame] | 26 | #include "llvm/CodeGen/MachineRegisterInfo.h" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 27 | #include "llvm/Target/TargetMachine.h" |
| 28 | #include "llvm/Target/TargetInstrInfo.h" |
Evan Cheng | 5277da7 | 2009-05-04 03:30:11 +0000 | [diff] [blame] | 29 | #include "llvm/Target/TargetRegisterInfo.h" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 30 | #include "llvm/Support/CommandLine.h" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 31 | #include "llvm/Support/Compiler.h" |
Evan Cheng | fc201f3 | 2009-02-11 08:24:21 +0000 | [diff] [blame] | 32 | #include "llvm/Support/Debug.h" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 33 | #include "llvm/ADT/BitVector.h" |
Evan Cheng | 1376d86 | 2008-06-04 09:16:33 +0000 | [diff] [blame] | 34 | #include "llvm/ADT/DenseMap.h" |
Evan Cheng | fc201f3 | 2009-02-11 08:24:21 +0000 | [diff] [blame] | 35 | #include "llvm/ADT/DepthFirstIterator.h" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 36 | #include "llvm/ADT/Statistic.h" |
| 37 | #include "llvm/ADT/STLExtras.h" |
| 38 | #include "llvm/ADT/SmallSet.h" |
| 39 | #include <algorithm> |
| 40 | using namespace llvm; |
| 41 | |
Evan Cheng | 5ed91b5 | 2008-06-13 23:58:02 +0000 | [diff] [blame] | 42 | STATISTIC(NumSpills , "Number of register spills"); |
Dan Gohman | 089efff | 2008-05-13 00:00:25 +0000 | [diff] [blame] | 43 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 44 | //===----------------------------------------------------------------------===// |
| 45 | // VirtRegMap implementation |
| 46 | //===----------------------------------------------------------------------===// |
| 47 | |
Owen Anderson | dd56ab7 | 2009-03-13 05:55:11 +0000 | [diff] [blame] | 48 | char VirtRegMap::ID = 0; |
| 49 | |
| 50 | static RegisterPass<VirtRegMap> |
| 51 | X("virtregmap", "Virtual Register Map"); |
| 52 | |
| 53 | bool VirtRegMap::runOnMachineFunction(MachineFunction &mf) { |
| 54 | TII = mf.getTarget().getInstrInfo(); |
Evan Cheng | 5277da7 | 2009-05-04 03:30:11 +0000 | [diff] [blame] | 55 | TRI = mf.getTarget().getRegisterInfo(); |
Owen Anderson | dd56ab7 | 2009-03-13 05:55:11 +0000 | [diff] [blame] | 56 | MF = &mf; |
| 57 | |
| 58 | ReMatId = MAX_STACK_SLOT+1; |
| 59 | LowSpillSlot = HighSpillSlot = NO_STACK_SLOT; |
| 60 | |
| 61 | Virt2PhysMap.clear(); |
| 62 | Virt2StackSlotMap.clear(); |
| 63 | Virt2ReMatIdMap.clear(); |
| 64 | Virt2SplitMap.clear(); |
| 65 | Virt2SplitKillMap.clear(); |
| 66 | ReMatMap.clear(); |
| 67 | ImplicitDefed.clear(); |
| 68 | SpillSlotToUsesMap.clear(); |
| 69 | MI2VirtMap.clear(); |
| 70 | SpillPt2VirtMap.clear(); |
| 71 | RestorePt2VirtMap.clear(); |
| 72 | EmergencySpillMap.clear(); |
| 73 | EmergencySpillSlots.clear(); |
| 74 | |
Evan Cheng | da87253 | 2008-02-27 03:04:06 +0000 | [diff] [blame] | 75 | SpillSlotToUsesMap.resize(8); |
Owen Anderson | dd56ab7 | 2009-03-13 05:55:11 +0000 | [diff] [blame] | 76 | ImplicitDefed.resize(MF->getRegInfo().getLastVirtReg()+1- |
Evan Cheng | 7b88cbc | 2008-04-11 17:53:36 +0000 | [diff] [blame] | 77 | TargetRegisterInfo::FirstVirtualRegister); |
Evan Cheng | 5277da7 | 2009-05-04 03:30:11 +0000 | [diff] [blame] | 78 | |
| 79 | allocatableRCRegs.clear(); |
| 80 | for (TargetRegisterInfo::regclass_iterator I = TRI->regclass_begin(), |
| 81 | E = TRI->regclass_end(); I != E; ++I) |
| 82 | allocatableRCRegs.insert(std::make_pair(*I, |
| 83 | TRI->getAllocatableSet(mf, *I))); |
| 84 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 85 | grow(); |
Owen Anderson | dd56ab7 | 2009-03-13 05:55:11 +0000 | [diff] [blame] | 86 | |
| 87 | return false; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 88 | } |
| 89 | |
| 90 | void VirtRegMap::grow() { |
Owen Anderson | dd56ab7 | 2009-03-13 05:55:11 +0000 | [diff] [blame] | 91 | unsigned LastVirtReg = MF->getRegInfo().getLastVirtReg(); |
Evan Cheng | 1204d17 | 2007-08-13 23:45:17 +0000 | [diff] [blame] | 92 | Virt2PhysMap.grow(LastVirtReg); |
| 93 | Virt2StackSlotMap.grow(LastVirtReg); |
| 94 | Virt2ReMatIdMap.grow(LastVirtReg); |
Evan Cheng | cecc822 | 2007-11-17 00:40:40 +0000 | [diff] [blame] | 95 | Virt2SplitMap.grow(LastVirtReg); |
Evan Cheng | 6f52267 | 2007-12-05 09:51:10 +0000 | [diff] [blame] | 96 | Virt2SplitKillMap.grow(LastVirtReg); |
Evan Cheng | 1204d17 | 2007-08-13 23:45:17 +0000 | [diff] [blame] | 97 | ReMatMap.grow(LastVirtReg); |
Evan Cheng | 7b88cbc | 2008-04-11 17:53:36 +0000 | [diff] [blame] | 98 | ImplicitDefed.resize(LastVirtReg-TargetRegisterInfo::FirstVirtualRegister+1); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | int VirtRegMap::assignVirt2StackSlot(unsigned virtReg) { |
Dan Gohman | 1e57df3 | 2008-02-10 18:45:23 +0000 | [diff] [blame] | 102 | assert(TargetRegisterInfo::isVirtualRegister(virtReg)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 103 | assert(Virt2StackSlotMap[virtReg] == NO_STACK_SLOT && |
| 104 | "attempt to assign stack slot to already spilled register"); |
Owen Anderson | dd56ab7 | 2009-03-13 05:55:11 +0000 | [diff] [blame] | 105 | const TargetRegisterClass* RC = MF->getRegInfo().getRegClass(virtReg); |
| 106 | int SS = MF->getFrameInfo()->CreateStackObject(RC->getSize(), |
Evan Cheng | da87253 | 2008-02-27 03:04:06 +0000 | [diff] [blame] | 107 | RC->getAlignment()); |
| 108 | if (LowSpillSlot == NO_STACK_SLOT) |
| 109 | LowSpillSlot = SS; |
| 110 | if (HighSpillSlot == NO_STACK_SLOT || SS > HighSpillSlot) |
| 111 | HighSpillSlot = SS; |
| 112 | unsigned Idx = SS-LowSpillSlot; |
| 113 | while (Idx >= SpillSlotToUsesMap.size()) |
| 114 | SpillSlotToUsesMap.resize(SpillSlotToUsesMap.size()*2); |
| 115 | Virt2StackSlotMap[virtReg] = SS; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 116 | ++NumSpills; |
Evan Cheng | da87253 | 2008-02-27 03:04:06 +0000 | [diff] [blame] | 117 | return SS; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 118 | } |
| 119 | |
Evan Cheng | da87253 | 2008-02-27 03:04:06 +0000 | [diff] [blame] | 120 | void VirtRegMap::assignVirt2StackSlot(unsigned virtReg, int SS) { |
Dan Gohman | 1e57df3 | 2008-02-10 18:45:23 +0000 | [diff] [blame] | 121 | assert(TargetRegisterInfo::isVirtualRegister(virtReg)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 122 | assert(Virt2StackSlotMap[virtReg] == NO_STACK_SLOT && |
| 123 | "attempt to assign stack slot to already spilled register"); |
Evan Cheng | da87253 | 2008-02-27 03:04:06 +0000 | [diff] [blame] | 124 | assert((SS >= 0 || |
Owen Anderson | dd56ab7 | 2009-03-13 05:55:11 +0000 | [diff] [blame] | 125 | (SS >= MF->getFrameInfo()->getObjectIndexBegin())) && |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 126 | "illegal fixed frame index"); |
Evan Cheng | da87253 | 2008-02-27 03:04:06 +0000 | [diff] [blame] | 127 | Virt2StackSlotMap[virtReg] = SS; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 128 | } |
| 129 | |
| 130 | int VirtRegMap::assignVirtReMatId(unsigned virtReg) { |
Dan Gohman | 1e57df3 | 2008-02-10 18:45:23 +0000 | [diff] [blame] | 131 | assert(TargetRegisterInfo::isVirtualRegister(virtReg)); |
Evan Cheng | 1204d17 | 2007-08-13 23:45:17 +0000 | [diff] [blame] | 132 | assert(Virt2ReMatIdMap[virtReg] == NO_STACK_SLOT && |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 133 | "attempt to assign re-mat id to already spilled register"); |
Evan Cheng | 1204d17 | 2007-08-13 23:45:17 +0000 | [diff] [blame] | 134 | Virt2ReMatIdMap[virtReg] = ReMatId; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 135 | return ReMatId++; |
| 136 | } |
| 137 | |
Evan Cheng | 1204d17 | 2007-08-13 23:45:17 +0000 | [diff] [blame] | 138 | void VirtRegMap::assignVirtReMatId(unsigned virtReg, int id) { |
Dan Gohman | 1e57df3 | 2008-02-10 18:45:23 +0000 | [diff] [blame] | 139 | assert(TargetRegisterInfo::isVirtualRegister(virtReg)); |
Evan Cheng | 1204d17 | 2007-08-13 23:45:17 +0000 | [diff] [blame] | 140 | assert(Virt2ReMatIdMap[virtReg] == NO_STACK_SLOT && |
| 141 | "attempt to assign re-mat id to already spilled register"); |
| 142 | Virt2ReMatIdMap[virtReg] = id; |
| 143 | } |
| 144 | |
Evan Cheng | 14cc83f | 2008-03-11 07:19:34 +0000 | [diff] [blame] | 145 | int VirtRegMap::getEmergencySpillSlot(const TargetRegisterClass *RC) { |
| 146 | std::map<const TargetRegisterClass*, int>::iterator I = |
| 147 | EmergencySpillSlots.find(RC); |
| 148 | if (I != EmergencySpillSlots.end()) |
| 149 | return I->second; |
Owen Anderson | dd56ab7 | 2009-03-13 05:55:11 +0000 | [diff] [blame] | 150 | int SS = MF->getFrameInfo()->CreateStackObject(RC->getSize(), |
Evan Cheng | 14cc83f | 2008-03-11 07:19:34 +0000 | [diff] [blame] | 151 | RC->getAlignment()); |
| 152 | if (LowSpillSlot == NO_STACK_SLOT) |
| 153 | LowSpillSlot = SS; |
| 154 | if (HighSpillSlot == NO_STACK_SLOT || SS > HighSpillSlot) |
| 155 | HighSpillSlot = SS; |
Dan Gohman | ad077b8 | 2008-10-06 18:00:07 +0000 | [diff] [blame] | 156 | EmergencySpillSlots[RC] = SS; |
Evan Cheng | 14cc83f | 2008-03-11 07:19:34 +0000 | [diff] [blame] | 157 | return SS; |
| 158 | } |
| 159 | |
Evan Cheng | da87253 | 2008-02-27 03:04:06 +0000 | [diff] [blame] | 160 | void VirtRegMap::addSpillSlotUse(int FI, MachineInstr *MI) { |
Owen Anderson | dd56ab7 | 2009-03-13 05:55:11 +0000 | [diff] [blame] | 161 | if (!MF->getFrameInfo()->isFixedObjectIndex(FI)) { |
David Greene | 022e2b3 | 2008-05-22 21:12:21 +0000 | [diff] [blame] | 162 | // If FI < LowSpillSlot, this stack reference was produced by |
| 163 | // instruction selection and is not a spill |
| 164 | if (FI >= LowSpillSlot) { |
| 165 | assert(FI >= 0 && "Spill slot index should not be negative!"); |
Bill Wendling | 8c33368 | 2008-05-23 01:29:08 +0000 | [diff] [blame] | 166 | assert((unsigned)FI-LowSpillSlot < SpillSlotToUsesMap.size() |
David Greene | 022e2b3 | 2008-05-22 21:12:21 +0000 | [diff] [blame] | 167 | && "Invalid spill slot"); |
| 168 | SpillSlotToUsesMap[FI-LowSpillSlot].insert(MI); |
| 169 | } |
Evan Cheng | da87253 | 2008-02-27 03:04:06 +0000 | [diff] [blame] | 170 | } |
| 171 | } |
| 172 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 173 | void VirtRegMap::virtFolded(unsigned VirtReg, MachineInstr *OldMI, |
Evan Cheng | fd0bd3c | 2007-12-02 08:30:39 +0000 | [diff] [blame] | 174 | MachineInstr *NewMI, ModRef MRInfo) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 175 | // Move previous memory references folded to new instruction. |
| 176 | MI2VirtMapTy::iterator IP = MI2VirtMap.lower_bound(NewMI); |
| 177 | for (MI2VirtMapTy::iterator I = MI2VirtMap.lower_bound(OldMI), |
| 178 | E = MI2VirtMap.end(); I != E && I->first == OldMI; ) { |
| 179 | MI2VirtMap.insert(IP, std::make_pair(NewMI, I->second)); |
| 180 | MI2VirtMap.erase(I++); |
| 181 | } |
| 182 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 183 | // add new memory reference |
| 184 | MI2VirtMap.insert(IP, std::make_pair(NewMI, std::make_pair(VirtReg, MRInfo))); |
| 185 | } |
| 186 | |
Evan Cheng | f325584 | 2007-10-13 02:50:24 +0000 | [diff] [blame] | 187 | void VirtRegMap::virtFolded(unsigned VirtReg, MachineInstr *MI, ModRef MRInfo) { |
| 188 | MI2VirtMapTy::iterator IP = MI2VirtMap.lower_bound(MI); |
| 189 | MI2VirtMap.insert(IP, std::make_pair(MI, std::make_pair(VirtReg, MRInfo))); |
| 190 | } |
| 191 | |
Evan Cheng | da87253 | 2008-02-27 03:04:06 +0000 | [diff] [blame] | 192 | void VirtRegMap::RemoveMachineInstrFromMaps(MachineInstr *MI) { |
| 193 | for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { |
| 194 | MachineOperand &MO = MI->getOperand(i); |
Dan Gohman | b9f4fa7 | 2008-10-03 15:45:36 +0000 | [diff] [blame] | 195 | if (!MO.isFI()) |
Evan Cheng | da87253 | 2008-02-27 03:04:06 +0000 | [diff] [blame] | 196 | continue; |
| 197 | int FI = MO.getIndex(); |
Owen Anderson | dd56ab7 | 2009-03-13 05:55:11 +0000 | [diff] [blame] | 198 | if (MF->getFrameInfo()->isFixedObjectIndex(FI)) |
Evan Cheng | da87253 | 2008-02-27 03:04:06 +0000 | [diff] [blame] | 199 | continue; |
David Greene | 022e2b3 | 2008-05-22 21:12:21 +0000 | [diff] [blame] | 200 | // This stack reference was produced by instruction selection and |
Bill Wendling | fbdad53 | 2009-03-31 08:41:31 +0000 | [diff] [blame] | 201 | // is not a spill |
David Greene | 022e2b3 | 2008-05-22 21:12:21 +0000 | [diff] [blame] | 202 | if (FI < LowSpillSlot) |
| 203 | continue; |
Bill Wendling | 8c33368 | 2008-05-23 01:29:08 +0000 | [diff] [blame] | 204 | assert((unsigned)FI-LowSpillSlot < SpillSlotToUsesMap.size() |
David Greene | 022e2b3 | 2008-05-22 21:12:21 +0000 | [diff] [blame] | 205 | && "Invalid spill slot"); |
Evan Cheng | da87253 | 2008-02-27 03:04:06 +0000 | [diff] [blame] | 206 | SpillSlotToUsesMap[FI-LowSpillSlot].erase(MI); |
| 207 | } |
| 208 | MI2VirtMap.erase(MI); |
| 209 | SpillPt2VirtMap.erase(MI); |
| 210 | RestorePt2VirtMap.erase(MI); |
Evan Cheng | 14cc83f | 2008-03-11 07:19:34 +0000 | [diff] [blame] | 211 | EmergencySpillMap.erase(MI); |
Evan Cheng | da87253 | 2008-02-27 03:04:06 +0000 | [diff] [blame] | 212 | } |
| 213 | |
Evan Cheng | 97c5f1f | 2009-05-03 18:32:42 +0000 | [diff] [blame] | 214 | /// FindUnusedRegisters - Gather a list of allocatable registers that |
| 215 | /// have not been allocated to any virtual register. |
| 216 | bool VirtRegMap::FindUnusedRegisters(const TargetRegisterInfo *TRI, |
| 217 | LiveIntervals* LIs) { |
| 218 | unsigned NumRegs = TRI->getNumRegs(); |
| 219 | UnusedRegs.reset(); |
| 220 | UnusedRegs.resize(NumRegs); |
| 221 | |
| 222 | BitVector Used(NumRegs); |
| 223 | for (unsigned i = TargetRegisterInfo::FirstVirtualRegister, |
| 224 | e = MF->getRegInfo().getLastVirtReg(); i <= e; ++i) |
| 225 | if (Virt2PhysMap[i] != (unsigned)VirtRegMap::NO_PHYS_REG) |
| 226 | Used.set(Virt2PhysMap[i]); |
| 227 | |
| 228 | BitVector Allocatable = TRI->getAllocatableSet(*MF); |
| 229 | bool AnyUnused = false; |
| 230 | for (unsigned Reg = 1; Reg < NumRegs; ++Reg) { |
| 231 | if (Allocatable[Reg] && !Used[Reg] && !LIs->hasInterval(Reg)) { |
| 232 | bool ReallyUnused = true; |
| 233 | for (const unsigned *AS = TRI->getAliasSet(Reg); *AS; ++AS) { |
| 234 | if (Used[*AS] || LIs->hasInterval(*AS)) { |
| 235 | ReallyUnused = false; |
| 236 | break; |
| 237 | } |
| 238 | } |
| 239 | if (ReallyUnused) { |
| 240 | AnyUnused = true; |
| 241 | UnusedRegs.set(Reg); |
| 242 | } |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | return AnyUnused; |
| 247 | } |
| 248 | |
Owen Anderson | dd56ab7 | 2009-03-13 05:55:11 +0000 | [diff] [blame] | 249 | void VirtRegMap::print(std::ostream &OS, const Module* M) const { |
| 250 | const TargetRegisterInfo* TRI = MF->getTarget().getRegisterInfo(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 251 | |
| 252 | OS << "********** REGISTER MAP **********\n"; |
Dan Gohman | 1e57df3 | 2008-02-10 18:45:23 +0000 | [diff] [blame] | 253 | for (unsigned i = TargetRegisterInfo::FirstVirtualRegister, |
Owen Anderson | dd56ab7 | 2009-03-13 05:55:11 +0000 | [diff] [blame] | 254 | e = MF->getRegInfo().getLastVirtReg(); i <= e; ++i) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 255 | if (Virt2PhysMap[i] != (unsigned)VirtRegMap::NO_PHYS_REG) |
Bill Wendling | 9b0baeb | 2008-02-26 21:47:57 +0000 | [diff] [blame] | 256 | OS << "[reg" << i << " -> " << TRI->getName(Virt2PhysMap[i]) |
Bill Wendling | 8eeb979 | 2008-02-26 21:11:01 +0000 | [diff] [blame] | 257 | << "]\n"; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 258 | } |
| 259 | |
Dan Gohman | 1e57df3 | 2008-02-10 18:45:23 +0000 | [diff] [blame] | 260 | for (unsigned i = TargetRegisterInfo::FirstVirtualRegister, |
Owen Anderson | dd56ab7 | 2009-03-13 05:55:11 +0000 | [diff] [blame] | 261 | e = MF->getRegInfo().getLastVirtReg(); i <= e; ++i) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 262 | if (Virt2StackSlotMap[i] != VirtRegMap::NO_STACK_SLOT) |
| 263 | OS << "[reg" << i << " -> fi#" << Virt2StackSlotMap[i] << "]\n"; |
| 264 | OS << '\n'; |
| 265 | } |
| 266 | |
| 267 | void VirtRegMap::dump() const { |
Dan Gohman | ecb9ad5 | 2008-03-12 20:52:10 +0000 | [diff] [blame] | 268 | print(cerr); |
Daniel Dunbar | c863a61 | 2009-03-14 01:53:05 +0000 | [diff] [blame] | 269 | } |