blob: 80a6da0f93b2c63586ac2c72d4decf1611c5420c [file] [log] [blame]
Jim Grosbacha030fa52010-08-14 00:15:52 +00001//===- LocalStackSlotAllocation.cpp - Pre-allocate locals to stack slots --===//
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// This pass assigns local frame indices to stack slots relative to one another
11// and allocates additional base registers to access them when the target
Bob Wilsond23b3d22011-01-07 04:58:58 +000012// estimates they are likely to be out of range of stack pointer and frame
Jim Grosbacha030fa52010-08-14 00:15:52 +000013// pointer relative addressing.
14//
15//===----------------------------------------------------------------------===//
16
17#define DEBUG_TYPE "localstackalloc"
Chandler Carruthed0881b2012-12-03 16:50:05 +000018#include "llvm/CodeGen/Passes.h"
19#include "llvm/ADT/STLExtras.h"
20#include "llvm/ADT/SmallSet.h"
21#include "llvm/ADT/Statistic.h"
22#include "llvm/CodeGen/MachineFrameInfo.h"
23#include "llvm/CodeGen/MachineFunction.h"
24#include "llvm/CodeGen/MachineFunctionPass.h"
25#include "llvm/CodeGen/MachineRegisterInfo.h"
Chandler Carruth9fb823b2013-01-02 11:36:10 +000026#include "llvm/IR/Constants.h"
27#include "llvm/IR/DerivedTypes.h"
28#include "llvm/IR/Instructions.h"
29#include "llvm/IR/Intrinsics.h"
30#include "llvm/IR/LLVMContext.h"
31#include "llvm/IR/Module.h"
Jim Grosbacha030fa52010-08-14 00:15:52 +000032#include "llvm/Pass.h"
Jim Grosbacha030fa52010-08-14 00:15:52 +000033#include "llvm/Support/Debug.h"
34#include "llvm/Support/ErrorHandling.h"
35#include "llvm/Support/raw_ostream.h"
Anton Korobeynikov2f931282011-01-10 12:39:04 +000036#include "llvm/Target/TargetFrameLowering.h"
Chandler Carruthed0881b2012-12-03 16:50:05 +000037#include "llvm/Target/TargetRegisterInfo.h"
Jim Grosbacha030fa52010-08-14 00:15:52 +000038
39using namespace llvm;
40
Jim Grosbachc252ee22010-08-17 18:13:53 +000041STATISTIC(NumAllocations, "Number of frame indices allocated into local block");
42STATISTIC(NumBaseRegisters, "Number of virtual frame base registers allocated");
43STATISTIC(NumReplacements, "Number of frame indices references replaced");
Jim Grosbacha030fa52010-08-14 00:15:52 +000044
45namespace {
Jim Grosbach365e9312010-08-31 17:58:19 +000046 class FrameRef {
47 MachineBasicBlock::iterator MI; // Instr referencing the frame
48 int64_t LocalOffset; // Local offset of the frame idx referenced
Hal Finkel71532512013-04-30 20:04:37 +000049 int FrameIdx; // The frame index
Jim Grosbach365e9312010-08-31 17:58:19 +000050 public:
Hal Finkel71532512013-04-30 20:04:37 +000051 FrameRef(MachineBasicBlock::iterator I, int64_t Offset, int Idx) :
52 MI(I), LocalOffset(Offset), FrameIdx(Idx) {}
Jim Grosbach365e9312010-08-31 17:58:19 +000053 bool operator<(const FrameRef &RHS) const {
54 return LocalOffset < RHS.LocalOffset;
55 }
Hal Finkel71532512013-04-30 20:04:37 +000056 MachineBasicBlock::iterator getMachineInstr() const { return MI; }
57 int64_t getLocalOffset() const { return LocalOffset; }
58 int getFrameIndex() const { return FrameIdx; }
Jim Grosbach365e9312010-08-31 17:58:19 +000059 };
60
Jim Grosbacha030fa52010-08-14 00:15:52 +000061 class LocalStackSlotPass: public MachineFunctionPass {
Jim Grosbachdbfc2ce2010-08-18 22:44:49 +000062 SmallVector<int64_t,16> LocalOffsets;
Jim Grosbachc252ee22010-08-17 18:13:53 +000063
Jim Grosbachdbfc2ce2010-08-18 22:44:49 +000064 void AdjustStackOffset(MachineFrameInfo *MFI, int FrameIdx, int64_t &Offset,
Jim Grosbach754f8e62010-08-23 20:40:38 +000065 bool StackGrowsDown, unsigned &MaxAlign);
Jim Grosbachdbfc2ce2010-08-18 22:44:49 +000066 void calculateFrameObjectOffsets(MachineFunction &Fn);
Jim Grosbach06006912010-08-20 16:48:30 +000067 bool insertFrameReferenceRegisters(MachineFunction &Fn);
Jim Grosbacha030fa52010-08-14 00:15:52 +000068 public:
69 static char ID; // Pass identification, replacement for typeid
70 explicit LocalStackSlotPass() : MachineFunctionPass(ID) { }
71 bool runOnMachineFunction(MachineFunction &MF);
72
73 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
74 AU.setPreservesCFG();
75 MachineFunctionPass::getAnalysisUsage(AU);
76 }
Jim Grosbacha030fa52010-08-14 00:15:52 +000077
78 private:
79 };
80} // end anonymous namespace
81
82char LocalStackSlotPass::ID = 0;
Andrew Trick1fa5bcb2012-02-08 21:23:13 +000083char &llvm::LocalStackSlotAllocationID = LocalStackSlotPass::ID;
84INITIALIZE_PASS(LocalStackSlotPass, "localstackalloc",
85 "Local Stack Slot Allocation", false, false)
Jim Grosbacha030fa52010-08-14 00:15:52 +000086
87bool LocalStackSlotPass::runOnMachineFunction(MachineFunction &MF) {
Jim Grosbachdbfc2ce2010-08-18 22:44:49 +000088 MachineFrameInfo *MFI = MF.getFrameInfo();
Jim Grosbachb77d67f2010-08-24 19:05:43 +000089 const TargetRegisterInfo *TRI = MF.getTarget().getRegisterInfo();
Jim Grosbachdbfc2ce2010-08-18 22:44:49 +000090 unsigned LocalObjectCount = MFI->getObjectIndexEnd();
91
Jim Grosbachb77d67f2010-08-24 19:05:43 +000092 // If the target doesn't want/need this pass, or if there are no locals
93 // to consider, early exit.
94 if (!TRI->requiresVirtualBaseRegisters(MF) || LocalObjectCount == 0)
Jim Grosbachdbfc2ce2010-08-18 22:44:49 +000095 return true;
96
97 // Make sure we have enough space to store the local offsets.
98 LocalOffsets.resize(MFI->getObjectIndexEnd());
99
Jim Grosbachc252ee22010-08-17 18:13:53 +0000100 // Lay out the local blob.
Jim Grosbacha030fa52010-08-14 00:15:52 +0000101 calculateFrameObjectOffsets(MF);
Jim Grosbachc252ee22010-08-17 18:13:53 +0000102
103 // Insert virtual base registers to resolve frame index references.
Jim Grosbach06006912010-08-20 16:48:30 +0000104 bool UsedBaseRegs = insertFrameReferenceRegisters(MF);
Jim Grosbachdbfc2ce2010-08-18 22:44:49 +0000105
Jim Grosbach743d7c82010-08-19 02:47:08 +0000106 // Tell MFI whether any base registers were allocated. PEI will only
107 // want to use the local block allocations from this pass if there were any.
108 // Otherwise, PEI can do a bit better job of getting the alignment right
109 // without a hole at the start since it knows the alignment of the stack
110 // at the start of local allocation, and this pass doesn't.
Jim Grosbach06006912010-08-20 16:48:30 +0000111 MFI->setUseLocalStackAllocationBlock(UsedBaseRegs);
Jim Grosbach743d7c82010-08-19 02:47:08 +0000112
Jim Grosbacha030fa52010-08-14 00:15:52 +0000113 return true;
114}
115
116/// AdjustStackOffset - Helper function used to adjust the stack frame offset.
Jim Grosbachdbfc2ce2010-08-18 22:44:49 +0000117void LocalStackSlotPass::AdjustStackOffset(MachineFrameInfo *MFI,
118 int FrameIdx, int64_t &Offset,
Jim Grosbach754f8e62010-08-23 20:40:38 +0000119 bool StackGrowsDown,
Jim Grosbachdbfc2ce2010-08-18 22:44:49 +0000120 unsigned &MaxAlign) {
Jim Grosbach754f8e62010-08-23 20:40:38 +0000121 // If the stack grows down, add the object size to find the lowest address.
122 if (StackGrowsDown)
123 Offset += MFI->getObjectSize(FrameIdx);
124
Jim Grosbacha030fa52010-08-14 00:15:52 +0000125 unsigned Align = MFI->getObjectAlignment(FrameIdx);
126
127 // If the alignment of this object is greater than that of the stack, then
128 // increase the stack alignment to match.
129 MaxAlign = std::max(MaxAlign, Align);
130
131 // Adjust to alignment boundary.
132 Offset = (Offset + Align - 1) / Align * Align;
133
Jim Grosbach754f8e62010-08-23 20:40:38 +0000134 int64_t LocalOffset = StackGrowsDown ? -Offset : Offset;
Jim Grosbacha030fa52010-08-14 00:15:52 +0000135 DEBUG(dbgs() << "Allocate FI(" << FrameIdx << ") to local offset "
Jim Grosbach754f8e62010-08-23 20:40:38 +0000136 << LocalOffset << "\n");
Jim Grosbachdbfc2ce2010-08-18 22:44:49 +0000137 // Keep the offset available for base register allocation
Jim Grosbach754f8e62010-08-23 20:40:38 +0000138 LocalOffsets[FrameIdx] = LocalOffset;
Jim Grosbachdbfc2ce2010-08-18 22:44:49 +0000139 // And tell MFI about it for PEI to use later
Jim Grosbach754f8e62010-08-23 20:40:38 +0000140 MFI->mapLocalFrameObject(FrameIdx, LocalOffset);
141
142 if (!StackGrowsDown)
143 Offset += MFI->getObjectSize(FrameIdx);
Jim Grosbacha030fa52010-08-14 00:15:52 +0000144
145 ++NumAllocations;
146}
147
148/// calculateFrameObjectOffsets - Calculate actual frame offsets for all of the
149/// abstract stack objects.
150///
151void LocalStackSlotPass::calculateFrameObjectOffsets(MachineFunction &Fn) {
Jim Grosbacha030fa52010-08-14 00:15:52 +0000152 // Loop over all of the stack objects, assigning sequential addresses...
153 MachineFrameInfo *MFI = Fn.getFrameInfo();
Anton Korobeynikov2f931282011-01-10 12:39:04 +0000154 const TargetFrameLowering &TFI = *Fn.getTarget().getFrameLowering();
Jim Grosbach754f8e62010-08-23 20:40:38 +0000155 bool StackGrowsDown =
Anton Korobeynikov2f931282011-01-10 12:39:04 +0000156 TFI.getStackGrowthDirection() == TargetFrameLowering::StackGrowsDown;
Jim Grosbacha030fa52010-08-14 00:15:52 +0000157 int64_t Offset = 0;
Jim Grosbach36d5ec32010-08-16 22:30:41 +0000158 unsigned MaxAlign = 0;
Jim Grosbacha030fa52010-08-14 00:15:52 +0000159
160 // Make sure that the stack protector comes before the local variables on the
161 // stack.
162 SmallSet<int, 16> LargeStackObjs;
163 if (MFI->getStackProtectorIndex() >= 0) {
Jim Grosbach754f8e62010-08-23 20:40:38 +0000164 AdjustStackOffset(MFI, MFI->getStackProtectorIndex(), Offset,
165 StackGrowsDown, MaxAlign);
Jim Grosbacha030fa52010-08-14 00:15:52 +0000166
167 // Assign large stack objects first.
168 for (unsigned i = 0, e = MFI->getObjectIndexEnd(); i != e; ++i) {
169 if (MFI->isDeadObjectIndex(i))
170 continue;
171 if (MFI->getStackProtectorIndex() == (int)i)
172 continue;
173 if (!MFI->MayNeedStackProtector(i))
174 continue;
175
Jim Grosbach754f8e62010-08-23 20:40:38 +0000176 AdjustStackOffset(MFI, i, Offset, StackGrowsDown, MaxAlign);
Jim Grosbacha030fa52010-08-14 00:15:52 +0000177 LargeStackObjs.insert(i);
178 }
179 }
180
181 // Then assign frame offsets to stack objects that are not used to spill
182 // callee saved registers.
183 for (unsigned i = 0, e = MFI->getObjectIndexEnd(); i != e; ++i) {
184 if (MFI->isDeadObjectIndex(i))
185 continue;
186 if (MFI->getStackProtectorIndex() == (int)i)
187 continue;
188 if (LargeStackObjs.count(i))
189 continue;
190
Jim Grosbach754f8e62010-08-23 20:40:38 +0000191 AdjustStackOffset(MFI, i, Offset, StackGrowsDown, MaxAlign);
Jim Grosbacha030fa52010-08-14 00:15:52 +0000192 }
193
Jim Grosbacha030fa52010-08-14 00:15:52 +0000194 // Remember how big this blob of stack space is
Jim Grosbach8be01962010-08-16 18:06:15 +0000195 MFI->setLocalFrameSize(Offset);
Jim Grosbach36d5ec32010-08-16 22:30:41 +0000196 MFI->setLocalFrameMaxAlign(MaxAlign);
Jim Grosbacha030fa52010-08-14 00:15:52 +0000197}
Jim Grosbachc252ee22010-08-17 18:13:53 +0000198
Jim Grosbache0e9b302010-08-18 17:57:37 +0000199static inline bool
Hal Finkel71532512013-04-30 20:04:37 +0000200lookupCandidateBaseReg(int64_t BaseOffset,
Jim Grosbach754f8e62010-08-23 20:40:38 +0000201 int64_t FrameSizeAdjust,
Jim Grosbachdbfc2ce2010-08-18 22:44:49 +0000202 int64_t LocalFrameOffset,
Jim Grosbache0e9b302010-08-18 17:57:37 +0000203 const MachineInstr *MI,
204 const TargetRegisterInfo *TRI) {
Hal Finkel71532512013-04-30 20:04:37 +0000205 // Check if the relative offset from the where the base register references
206 // to the target address is in range for the instruction.
207 int64_t Offset = FrameSizeAdjust + LocalFrameOffset - BaseOffset;
208 return TRI->isFrameOffsetLegal(MI, Offset);
Jim Grosbache0e9b302010-08-18 17:57:37 +0000209}
210
Jim Grosbach06006912010-08-20 16:48:30 +0000211bool LocalStackSlotPass::insertFrameReferenceRegisters(MachineFunction &Fn) {
Jim Grosbachc252ee22010-08-17 18:13:53 +0000212 // Scan the function's instructions looking for frame index references.
213 // For each, ask the target if it wants a virtual base register for it
214 // based on what we can tell it about where the local will end up in the
215 // stack frame. If it wants one, re-use a suitable one we've previously
216 // allocated, or if there isn't one that fits the bill, allocate a new one
217 // and ask the target to create a defining instruction for it.
Jim Grosbach06006912010-08-20 16:48:30 +0000218 bool UsedBaseReg = false;
Jim Grosbachc252ee22010-08-17 18:13:53 +0000219
220 MachineFrameInfo *MFI = Fn.getFrameInfo();
221 const TargetRegisterInfo *TRI = Fn.getTarget().getRegisterInfo();
Anton Korobeynikov2f931282011-01-10 12:39:04 +0000222 const TargetFrameLowering &TFI = *Fn.getTarget().getFrameLowering();
Jim Grosbach7648a212010-08-20 20:25:31 +0000223 bool StackGrowsDown =
Anton Korobeynikov2f931282011-01-10 12:39:04 +0000224 TFI.getStackGrowthDirection() == TargetFrameLowering::StackGrowsDown;
Jim Grosbachc252ee22010-08-17 18:13:53 +0000225
Jim Grosbach365e9312010-08-31 17:58:19 +0000226 // Collect all of the instructions in the block that reference
227 // a frame index. Also store the frame index referenced to ease later
228 // lookup. (For any insn that has more than one FI reference, we arbitrarily
229 // choose the first one).
230 SmallVector<FrameRef, 64> FrameReferenceInsns;
Jim Grosbachdbfc2ce2010-08-18 22:44:49 +0000231
Jim Grosbach365e9312010-08-31 17:58:19 +0000232 for (MachineFunction::iterator BB = Fn.begin(), E = Fn.end(); BB != E; ++BB) {
Jim Grosbachc252ee22010-08-17 18:13:53 +0000233 for (MachineBasicBlock::iterator I = BB->begin(); I != BB->end(); ++I) {
234 MachineInstr *MI = I;
Bill Wendling3fff1fd2010-12-17 23:09:14 +0000235
Lang Hames7468daa2013-11-29 06:35:30 +0000236 // Debug value, stackmap and patchpoint instructions can't be out of
237 // range, so they don't need any updates.
238 if (MI->isDebugValue() ||
239 MI->getOpcode() == TargetOpcode::STACKMAP ||
240 MI->getOpcode() == TargetOpcode::PATCHPOINT)
Jim Grosbach3cf08662010-08-17 22:41:55 +0000241 continue;
Bill Wendling3fff1fd2010-12-17 23:09:14 +0000242
Jim Grosbachc252ee22010-08-17 18:13:53 +0000243 // For now, allocate the base register(s) within the basic block
244 // where they're used, and don't try to keep them around outside
245 // of that. It may be beneficial to try sharing them more broadly
246 // than that, but the increased register pressure makes that a
247 // tricky thing to balance. Investigate if re-materializing these
248 // becomes an issue.
249 for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
250 // Consider replacing all frame index operands that reference
251 // an object allocated in the local block.
Jim Grosbach3cf08662010-08-17 22:41:55 +0000252 if (MI->getOperand(i).isFI()) {
Jim Grosbach3cf08662010-08-17 22:41:55 +0000253 // Don't try this with values not in the local block.
Jim Grosbach365e9312010-08-31 17:58:19 +0000254 if (!MFI->isObjectPreAllocated(MI->getOperand(i).getIndex()))
255 break;
Hal Finkel71532512013-04-30 20:04:37 +0000256 int Idx = MI->getOperand(i).getIndex();
257 int64_t LocalOffset = LocalOffsets[Idx];
258 if (!TRI->needsFrameBaseReg(MI, LocalOffset))
259 break;
Jim Grosbach365e9312010-08-31 17:58:19 +0000260 FrameReferenceInsns.
Hal Finkel71532512013-04-30 20:04:37 +0000261 push_back(FrameRef(MI, LocalOffset, Idx));
Jim Grosbach365e9312010-08-31 17:58:19 +0000262 break;
263 }
264 }
265 }
266 }
Bill Wendling3fff1fd2010-12-17 23:09:14 +0000267
Jim Grosbach365e9312010-08-31 17:58:19 +0000268 // Sort the frame references by local offset
269 array_pod_sort(FrameReferenceInsns.begin(), FrameReferenceInsns.end());
Jim Grosbach3cf08662010-08-17 22:41:55 +0000270
Bill Wendling3fff1fd2010-12-17 23:09:14 +0000271 MachineBasicBlock *Entry = Fn.begin();
Jim Grosbache0e9b302010-08-18 17:57:37 +0000272
Hal Finkel71532512013-04-30 20:04:37 +0000273 unsigned BaseReg = 0;
274 int64_t BaseOffset = 0;
275
Bill Wendling3fff1fd2010-12-17 23:09:14 +0000276 // Loop through the frame references and allocate for them as necessary.
Jim Grosbach365e9312010-08-31 17:58:19 +0000277 for (int ref = 0, e = FrameReferenceInsns.size(); ref < e ; ++ref) {
Hal Finkel71532512013-04-30 20:04:37 +0000278 FrameRef &FR = FrameReferenceInsns[ref];
279 MachineBasicBlock::iterator I = FR.getMachineInstr();
Jim Grosbach365e9312010-08-31 17:58:19 +0000280 MachineInstr *MI = I;
Hal Finkel71532512013-04-30 20:04:37 +0000281 int64_t LocalOffset = FR.getLocalOffset();
282 int FrameIdx = FR.getFrameIndex();
283 assert(MFI->isObjectPreAllocated(FrameIdx) &&
284 "Only pre-allocated locals expected!");
Jim Grosbachc252ee22010-08-17 18:13:53 +0000285
Hal Finkel71532512013-04-30 20:04:37 +0000286 DEBUG(dbgs() << "Considering: " << *MI);
Jim Grosbach3cf08662010-08-17 22:41:55 +0000287
Hal Finkel71532512013-04-30 20:04:37 +0000288 unsigned idx = 0;
289 for (unsigned f = MI->getNumOperands(); idx != f; ++idx) {
290 if (!MI->getOperand(idx).isFI())
291 continue;
Jim Grosbache0e9b302010-08-18 17:57:37 +0000292
Hal Finkel71532512013-04-30 20:04:37 +0000293 if (FrameIdx == I->getOperand(idx).getIndex())
294 break;
Jim Grosbachc252ee22010-08-17 18:13:53 +0000295 }
Hal Finkel71532512013-04-30 20:04:37 +0000296
297 assert(idx < MI->getNumOperands() && "Cannot find FI operand");
298
299 int64_t Offset = 0;
300 int64_t FrameSizeAdjust = StackGrowsDown ? MFI->getLocalFrameSize() : 0;
301
302 DEBUG(dbgs() << " Replacing FI in: " << *MI);
303
304 // If we have a suitable base register available, use it; otherwise
305 // create a new one. Note that any offset encoded in the
306 // instruction itself will be taken into account by the target,
307 // so we don't have to adjust for it here when reusing a base
308 // register.
309 if (UsedBaseReg && lookupCandidateBaseReg(BaseOffset, FrameSizeAdjust,
310 LocalOffset, MI, TRI)) {
311 DEBUG(dbgs() << " Reusing base register " << BaseReg << "\n");
312 // We found a register to reuse.
313 Offset = FrameSizeAdjust + LocalOffset - BaseOffset;
314 } else {
315 // No previously defined register was in range, so create a // new one.
316
317 int64_t InstrOffset = TRI->getFrameIndexInstrOffset(MI, idx);
318
319 int64_t PrevBaseOffset = BaseOffset;
320 BaseOffset = FrameSizeAdjust + LocalOffset + InstrOffset;
321
322 // We'd like to avoid creating single-use virtual base registers.
323 // Because the FrameRefs are in sorted order, and we've already
324 // processed all FrameRefs before this one, just check whether or not
325 // the next FrameRef will be able to reuse this new register. If not,
326 // then don't bother creating it.
327 bool CanReuse = false;
328 for (int refn = ref + 1; refn < e; ++refn) {
329 FrameRef &FRN = FrameReferenceInsns[refn];
330 MachineBasicBlock::iterator J = FRN.getMachineInstr();
331 MachineInstr *MIN = J;
332
333 CanReuse = lookupCandidateBaseReg(BaseOffset, FrameSizeAdjust,
334 FRN.getLocalOffset(), MIN, TRI);
335 break;
336 }
337
338 if (!CanReuse) {
339 BaseOffset = PrevBaseOffset;
340 continue;
341 }
342
343 const MachineFunction *MF = MI->getParent()->getParent();
344 const TargetRegisterClass *RC = TRI->getPointerRegClass(*MF);
345 BaseReg = Fn.getRegInfo().createVirtualRegister(RC);
346
347 DEBUG(dbgs() << " Materializing base register " << BaseReg <<
348 " at frame local offset " << LocalOffset + InstrOffset << "\n");
349
350 // Tell the target to insert the instruction to initialize
351 // the base register.
352 // MachineBasicBlock::iterator InsertionPt = Entry->begin();
353 TRI->materializeFrameBaseRegister(Entry, BaseReg, FrameIdx,
354 InstrOffset);
355
356 // The base register already includes any offset specified
357 // by the instruction, so account for that so it doesn't get
358 // applied twice.
359 Offset = -InstrOffset;
360
361 ++NumBaseRegisters;
362 UsedBaseReg = true;
363 }
364 assert(BaseReg != 0 && "Unable to allocate virtual base register!");
365
366 // Modify the instruction to use the new base register rather
367 // than the frame index operand.
368 TRI->resolveFrameIndex(I, BaseReg, Offset);
369 DEBUG(dbgs() << "Resolved: " << *MI);
370
371 ++NumReplacements;
Jim Grosbachc252ee22010-08-17 18:13:53 +0000372 }
Hal Finkel71532512013-04-30 20:04:37 +0000373
Jim Grosbach06006912010-08-20 16:48:30 +0000374 return UsedBaseReg;
Jim Grosbachc252ee22010-08-17 18:13:53 +0000375}