blob: 6e0bde6364d163e669a5ca9fd0089ce2d14a5d41 [file] [log] [blame]
Gordon Henriksen5eca0752008-08-17 18:44:35 +00001//===-- GCStrategy.cpp - Garbage collection infrastructure -----------------===//
Gordon Henriksen364caf02007-09-29 02:13:43 +00002//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Gordon Henriksen364caf02007-09-29 02:13:43 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This file implements target- and collector-independent garbage collection
11// infrastructure.
12//
Gordon Henriksen5eca0752008-08-17 18:44:35 +000013// MachineCodeAnalysis identifies the GC safe points in the machine code. Roots
14// are identified in SelectionDAGISel.
15//
Gordon Henriksen364caf02007-09-29 02:13:43 +000016//===----------------------------------------------------------------------===//
17
Gordon Henriksen5a29c9e2008-08-17 12:56:54 +000018#include "llvm/CodeGen/GCStrategy.h"
Gordon Henriksenad93c4f2007-12-11 00:30:17 +000019#include "llvm/CodeGen/Passes.h"
Gordon Henriksen364caf02007-09-29 02:13:43 +000020#include "llvm/IntrinsicInst.h"
21#include "llvm/Module.h"
Gordon Henriksen364caf02007-09-29 02:13:43 +000022#include "llvm/CodeGen/MachineFrameInfo.h"
23#include "llvm/CodeGen/MachineFunctionPass.h"
24#include "llvm/CodeGen/MachineInstrBuilder.h"
Chris Lattner84bc5422007-12-31 04:13:23 +000025#include "llvm/CodeGen/MachineModuleInfo.h"
Gordon Henriksen364caf02007-09-29 02:13:43 +000026#include "llvm/Target/TargetFrameInfo.h"
27#include "llvm/Target/TargetInstrInfo.h"
28#include "llvm/Target/TargetMachine.h"
Gordon Henriksenfcbcfaa2008-08-19 17:06:35 +000029#include "llvm/Target/TargetRegisterInfo.h"
Torok Edwin7d696d82009-07-11 13:10:19 +000030#include "llvm/Support/ErrorHandling.h"
Chris Lattner45cfe542009-08-23 06:03:38 +000031#include "llvm/Support/raw_ostream.h"
Gordon Henriksen364caf02007-09-29 02:13:43 +000032
33using namespace llvm;
34
35namespace {
36
Gordon Henriksenad93c4f2007-12-11 00:30:17 +000037 /// LowerIntrinsics - This pass rewrites calls to the llvm.gcread or
38 /// llvm.gcwrite intrinsics, replacing them with simple loads and stores as
Gordon Henriksen5eca0752008-08-17 18:44:35 +000039 /// directed by the GCStrategy. It also performs automatic root initialization
Gordon Henriksenad93c4f2007-12-11 00:30:17 +000040 /// and custom intrinsic lowering.
Nick Lewycky6726b6d2009-10-25 06:33:48 +000041 class LowerIntrinsics : public FunctionPass {
Gordon Henriksen5eca0752008-08-17 18:44:35 +000042 static bool NeedsDefaultLoweringPass(const GCStrategy &C);
43 static bool NeedsCustomLoweringPass(const GCStrategy &C);
Gordon Henriksen364caf02007-09-29 02:13:43 +000044 static bool CouldBecomeSafePoint(Instruction *I);
Gordon Henriksen5eca0752008-08-17 18:44:35 +000045 bool PerformDefaultLowering(Function &F, GCStrategy &Coll);
Gordon Henriksenad93c4f2007-12-11 00:30:17 +000046 static bool InsertRootInitializers(Function &F,
Gordon Henriksen364caf02007-09-29 02:13:43 +000047 AllocaInst **Roots, unsigned Count);
48
49 public:
50 static char ID;
51
Gordon Henriksenad93c4f2007-12-11 00:30:17 +000052 LowerIntrinsics();
Gordon Henriksen364caf02007-09-29 02:13:43 +000053 const char *getPassName() const;
Gordon Henriksenad93c4f2007-12-11 00:30:17 +000054 void getAnalysisUsage(AnalysisUsage &AU) const;
Gordon Henriksen364caf02007-09-29 02:13:43 +000055
56 bool doInitialization(Module &M);
57 bool runOnFunction(Function &F);
58 };
59
60
Gordon Henriksenad93c4f2007-12-11 00:30:17 +000061 /// MachineCodeAnalysis - This is a target-independent pass over the machine
62 /// function representation to identify safe points for the garbage collector
63 /// in the machine code. It inserts labels at safe points and populates a
Gordon Henriksen5eca0752008-08-17 18:44:35 +000064 /// GCMetadata record for each function.
Nick Lewycky6726b6d2009-10-25 06:33:48 +000065 class MachineCodeAnalysis : public MachineFunctionPass {
Gordon Henriksenad93c4f2007-12-11 00:30:17 +000066 const TargetMachine *TM;
Gordon Henriksen5eca0752008-08-17 18:44:35 +000067 GCFunctionInfo *FI;
Gordon Henriksen364caf02007-09-29 02:13:43 +000068 MachineModuleInfo *MMI;
69 const TargetInstrInfo *TII;
Gordon Henriksen364caf02007-09-29 02:13:43 +000070
71 void FindSafePoints(MachineFunction &MF);
72 void VisitCallPoint(MachineBasicBlock::iterator MI);
73 unsigned InsertLabel(MachineBasicBlock &MBB,
Nicolas Geoffray22f35ac2009-09-08 07:39:27 +000074 MachineBasicBlock::iterator MI,
75 DebugLoc DL) const;
Gordon Henriksen364caf02007-09-29 02:13:43 +000076
77 void FindStackOffsets(MachineFunction &MF);
78
79 public:
80 static char ID;
81
Gordon Henriksenad93c4f2007-12-11 00:30:17 +000082 MachineCodeAnalysis();
Gordon Henriksen364caf02007-09-29 02:13:43 +000083 const char *getPassName() const;
84 void getAnalysisUsage(AnalysisUsage &AU) const;
85
86 bool runOnMachineFunction(MachineFunction &MF);
87 };
88
89}
90
91// -----------------------------------------------------------------------------
92
Gordon Henriksen5eca0752008-08-17 18:44:35 +000093GCStrategy::GCStrategy() :
Gordon Henriksen364caf02007-09-29 02:13:43 +000094 NeededSafePoints(0),
95 CustomReadBarriers(false),
96 CustomWriteBarriers(false),
97 CustomRoots(false),
Gordon Henriksenc317a602008-08-17 12:08:44 +000098 InitRoots(true),
99 UsesMetadata(false)
Gordon Henriksen364caf02007-09-29 02:13:43 +0000100{}
101
Gordon Henriksen5eca0752008-08-17 18:44:35 +0000102GCStrategy::~GCStrategy() {
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000103 for (iterator I = begin(), E = end(); I != E; ++I)
104 delete *I;
105
106 Functions.clear();
Gordon Henriksen364caf02007-09-29 02:13:43 +0000107}
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000108
Gordon Henriksen5eca0752008-08-17 18:44:35 +0000109bool GCStrategy::initializeCustomLowering(Module &M) { return false; }
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000110
Gordon Henriksen5eca0752008-08-17 18:44:35 +0000111bool GCStrategy::performCustomLowering(Function &F) {
Chris Lattner45cfe542009-08-23 06:03:38 +0000112 errs() << "gc " << getName() << " must override performCustomLowering.\n";
Torok Edwinc23197a2009-07-14 16:55:14 +0000113 llvm_unreachable(0);
Gordon Henriksen364caf02007-09-29 02:13:43 +0000114 return 0;
115}
Gordon Henriksen5eca0752008-08-17 18:44:35 +0000116
117GCFunctionInfo *GCStrategy::insertFunctionInfo(const Function &F) {
118 GCFunctionInfo *FI = new GCFunctionInfo(F, *this);
119 Functions.push_back(FI);
120 return FI;
121}
Gordon Henriksen364caf02007-09-29 02:13:43 +0000122
123// -----------------------------------------------------------------------------
124
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000125FunctionPass *llvm::createGCLoweringPass() {
126 return new LowerIntrinsics();
127}
128
Gordon Henriksen364caf02007-09-29 02:13:43 +0000129char LowerIntrinsics::ID = 0;
130
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000131LowerIntrinsics::LowerIntrinsics()
Dan Gohmanae73dc12008-09-04 17:05:41 +0000132 : FunctionPass(&ID) {}
Gordon Henriksen364caf02007-09-29 02:13:43 +0000133
134const char *LowerIntrinsics::getPassName() const {
135 return "Lower Garbage Collection Instructions";
136}
137
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000138void LowerIntrinsics::getAnalysisUsage(AnalysisUsage &AU) const {
139 FunctionPass::getAnalysisUsage(AU);
Gordon Henriksen5eca0752008-08-17 18:44:35 +0000140 AU.addRequired<GCModuleInfo>();
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000141}
142
143/// doInitialization - If this module uses the GC intrinsics, find them now.
Gordon Henriksen364caf02007-09-29 02:13:43 +0000144bool LowerIntrinsics::doInitialization(Module &M) {
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000145 // FIXME: This is rather antisocial in the context of a JIT since it performs
146 // work against the entire module. But this cannot be done at
147 // runFunction time (initializeCustomLowering likely needs to change
148 // the module).
Duncan Sands1465d612009-01-28 13:14:17 +0000149 GCModuleInfo *MI = getAnalysisIfAvailable<GCModuleInfo>();
Gordon Henriksen5eca0752008-08-17 18:44:35 +0000150 assert(MI && "LowerIntrinsics didn't require GCModuleInfo!?");
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000151 for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
Gordon Henriksen5eca0752008-08-17 18:44:35 +0000152 if (!I->isDeclaration() && I->hasGC())
153 MI->getFunctionInfo(*I); // Instantiate the GC strategy.
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000154
155 bool MadeChange = false;
Gordon Henriksen5eca0752008-08-17 18:44:35 +0000156 for (GCModuleInfo::iterator I = MI->begin(), E = MI->end(); I != E; ++I)
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000157 if (NeedsCustomLoweringPass(**I))
158 if ((*I)->initializeCustomLowering(M))
159 MadeChange = true;
160
161 return MadeChange;
Gordon Henriksen364caf02007-09-29 02:13:43 +0000162}
163
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000164bool LowerIntrinsics::InsertRootInitializers(Function &F, AllocaInst **Roots,
Gordon Henriksen364caf02007-09-29 02:13:43 +0000165 unsigned Count) {
166 // Scroll past alloca instructions.
167 BasicBlock::iterator IP = F.getEntryBlock().begin();
168 while (isa<AllocaInst>(IP)) ++IP;
169
170 // Search for initializers in the initial BB.
171 SmallPtrSet<AllocaInst*,16> InitedRoots;
172 for (; !CouldBecomeSafePoint(IP); ++IP)
173 if (StoreInst *SI = dyn_cast<StoreInst>(IP))
Anton Korobeynikovb04addd2008-05-06 22:52:30 +0000174 if (AllocaInst *AI =
Anton Korobeynikov0b12ecf2008-05-07 22:54:15 +0000175 dyn_cast<AllocaInst>(SI->getOperand(1)->stripPointerCasts()))
Gordon Henriksen364caf02007-09-29 02:13:43 +0000176 InitedRoots.insert(AI);
177
178 // Add root initializers.
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000179 bool MadeChange = false;
180
Gordon Henriksen364caf02007-09-29 02:13:43 +0000181 for (AllocaInst **I = Roots, **E = Roots + Count; I != E; ++I)
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000182 if (!InitedRoots.count(*I)) {
Gordon Henriksen364caf02007-09-29 02:13:43 +0000183 new StoreInst(ConstantPointerNull::get(cast<PointerType>(
184 cast<PointerType>((*I)->getType())->getElementType())),
185 *I, IP);
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000186 MadeChange = true;
187 }
188
189 return MadeChange;
190}
191
Gordon Henriksen5eca0752008-08-17 18:44:35 +0000192bool LowerIntrinsics::NeedsDefaultLoweringPass(const GCStrategy &C) {
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000193 // Default lowering is necessary only if read or write barriers have a default
194 // action. The default for roots is no action.
195 return !C.customWriteBarrier()
196 || !C.customReadBarrier()
197 || C.initializeRoots();
198}
199
Gordon Henriksen5eca0752008-08-17 18:44:35 +0000200bool LowerIntrinsics::NeedsCustomLoweringPass(const GCStrategy &C) {
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000201 // Custom lowering is only necessary if enabled for some action.
202 return C.customWriteBarrier()
203 || C.customReadBarrier()
204 || C.customRoots();
Gordon Henriksen364caf02007-09-29 02:13:43 +0000205}
206
207/// CouldBecomeSafePoint - Predicate to conservatively determine whether the
208/// instruction could introduce a safe point.
209bool LowerIntrinsics::CouldBecomeSafePoint(Instruction *I) {
210 // The natural definition of instructions which could introduce safe points
211 // are:
212 //
213 // - call, invoke (AfterCall, BeforeCall)
214 // - phis (Loops)
215 // - invoke, ret, unwind (Exit)
216 //
217 // However, instructions as seemingly inoccuous as arithmetic can become
218 // libcalls upon lowering (e.g., div i64 on a 32-bit platform), so instead
219 // it is necessary to take a conservative approach.
220
221 if (isa<AllocaInst>(I) || isa<GetElementPtrInst>(I) ||
222 isa<StoreInst>(I) || isa<LoadInst>(I))
223 return false;
224
225 // llvm.gcroot is safe because it doesn't do anything at runtime.
226 if (CallInst *CI = dyn_cast<CallInst>(I))
227 if (Function *F = CI->getCalledFunction())
228 if (unsigned IID = F->getIntrinsicID())
229 if (IID == Intrinsic::gcroot)
230 return false;
231
232 return true;
233}
234
235/// runOnFunction - Replace gcread/gcwrite intrinsics with loads and stores.
236/// Leave gcroot intrinsics; the code generator needs to see those.
237bool LowerIntrinsics::runOnFunction(Function &F) {
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000238 // Quick exit for functions that do not use GC.
Gordon Henriksen5eca0752008-08-17 18:44:35 +0000239 if (!F.hasGC())
240 return false;
Gordon Henriksen364caf02007-09-29 02:13:43 +0000241
Gordon Henriksen5eca0752008-08-17 18:44:35 +0000242 GCFunctionInfo &FI = getAnalysis<GCModuleInfo>().getFunctionInfo(F);
243 GCStrategy &S = FI.getStrategy();
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000244
245 bool MadeChange = false;
246
Gordon Henriksen5eca0752008-08-17 18:44:35 +0000247 if (NeedsDefaultLoweringPass(S))
248 MadeChange |= PerformDefaultLowering(F, S);
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000249
Gordon Henriksen5eca0752008-08-17 18:44:35 +0000250 if (NeedsCustomLoweringPass(S))
251 MadeChange |= S.performCustomLowering(F);
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000252
253 return MadeChange;
254}
255
Gordon Henriksen5eca0752008-08-17 18:44:35 +0000256bool LowerIntrinsics::PerformDefaultLowering(Function &F, GCStrategy &S) {
257 bool LowerWr = !S.customWriteBarrier();
258 bool LowerRd = !S.customReadBarrier();
259 bool InitRoots = S.initializeRoots();
Gordon Henriksen364caf02007-09-29 02:13:43 +0000260
261 SmallVector<AllocaInst*,32> Roots;
262
263 bool MadeChange = false;
264 for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) {
265 for (BasicBlock::iterator II = BB->begin(), E = BB->end(); II != E;) {
Gordon Henriksena6c99252007-12-22 17:27:01 +0000266 if (IntrinsicInst *CI = dyn_cast<IntrinsicInst>(II++)) {
Gordon Henriksen364caf02007-09-29 02:13:43 +0000267 Function *F = CI->getCalledFunction();
Gordon Henriksena6c99252007-12-22 17:27:01 +0000268 switch (F->getIntrinsicID()) {
269 case Intrinsic::gcwrite:
270 if (LowerWr) {
271 // Replace a write barrier with a simple store.
272 Value *St = new StoreInst(CI->getOperand(1), CI->getOperand(3), CI);
273 CI->replaceAllUsesWith(St);
274 CI->eraseFromParent();
275 }
276 break;
277 case Intrinsic::gcread:
278 if (LowerRd) {
279 // Replace a read barrier with a simple load.
280 Value *Ld = new LoadInst(CI->getOperand(2), "", CI);
281 Ld->takeName(CI);
282 CI->replaceAllUsesWith(Ld);
283 CI->eraseFromParent();
284 }
285 break;
286 case Intrinsic::gcroot:
287 if (InitRoots) {
288 // Initialize the GC root, but do not delete the intrinsic. The
289 // backend needs the intrinsic to flag the stack slot.
290 Roots.push_back(cast<AllocaInst>(
Anton Korobeynikov0b12ecf2008-05-07 22:54:15 +0000291 CI->getOperand(1)->stripPointerCasts()));
Gordon Henriksena6c99252007-12-22 17:27:01 +0000292 }
293 break;
294 default:
Gordon Henriksen364caf02007-09-29 02:13:43 +0000295 continue;
296 }
297
298 MadeChange = true;
299 }
300 }
301 }
302
303 if (Roots.size())
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000304 MadeChange |= InsertRootInitializers(F, Roots.begin(), Roots.size());
Gordon Henriksen364caf02007-09-29 02:13:43 +0000305
306 return MadeChange;
307}
308
309// -----------------------------------------------------------------------------
310
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000311FunctionPass *llvm::createGCMachineCodeAnalysisPass() {
312 return new MachineCodeAnalysis();
313}
314
Gordon Henriksen364caf02007-09-29 02:13:43 +0000315char MachineCodeAnalysis::ID = 0;
316
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000317MachineCodeAnalysis::MachineCodeAnalysis()
Dan Gohman865f0062009-02-18 05:09:16 +0000318 : MachineFunctionPass(&ID) {}
Gordon Henriksen364caf02007-09-29 02:13:43 +0000319
320const char *MachineCodeAnalysis::getPassName() const {
321 return "Analyze Machine Code For Garbage Collection";
322}
323
324void MachineCodeAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
325 MachineFunctionPass::getAnalysisUsage(AU);
326 AU.setPreservesAll();
327 AU.addRequired<MachineModuleInfo>();
Gordon Henriksen5eca0752008-08-17 18:44:35 +0000328 AU.addRequired<GCModuleInfo>();
Gordon Henriksen364caf02007-09-29 02:13:43 +0000329}
330
331unsigned MachineCodeAnalysis::InsertLabel(MachineBasicBlock &MBB,
Nicolas Geoffray22f35ac2009-09-08 07:39:27 +0000332 MachineBasicBlock::iterator MI,
333 DebugLoc DL) const {
Gordon Henriksen364caf02007-09-29 02:13:43 +0000334 unsigned Label = MMI->NextLabelID();
Nicolas Geoffray22f35ac2009-09-08 07:39:27 +0000335
336 BuildMI(MBB, MI, DL,
Bill Wendlingd62e06c2009-02-03 02:29:34 +0000337 TII->get(TargetInstrInfo::GC_LABEL)).addImm(Label);
Nicolas Geoffray22f35ac2009-09-08 07:39:27 +0000338
Gordon Henriksen364caf02007-09-29 02:13:43 +0000339 return Label;
340}
341
342void MachineCodeAnalysis::VisitCallPoint(MachineBasicBlock::iterator CI) {
343 // Find the return address (next instruction), too, so as to bracket the call
344 // instruction.
345 MachineBasicBlock::iterator RAI = CI;
346 ++RAI;
347
Gordon Henriksen5eca0752008-08-17 18:44:35 +0000348 if (FI->getStrategy().needsSafePoint(GC::PreCall))
Nicolas Geoffray22f35ac2009-09-08 07:39:27 +0000349 FI->addSafePoint(GC::PreCall, InsertLabel(*CI->getParent(), CI,
350 CI->getDebugLoc()));
Gordon Henriksen364caf02007-09-29 02:13:43 +0000351
Gordon Henriksen5eca0752008-08-17 18:44:35 +0000352 if (FI->getStrategy().needsSafePoint(GC::PostCall))
Nicolas Geoffray22f35ac2009-09-08 07:39:27 +0000353 FI->addSafePoint(GC::PostCall, InsertLabel(*CI->getParent(), RAI,
354 CI->getDebugLoc()));
Gordon Henriksen364caf02007-09-29 02:13:43 +0000355}
356
357void MachineCodeAnalysis::FindSafePoints(MachineFunction &MF) {
358 for (MachineFunction::iterator BBI = MF.begin(),
359 BBE = MF.end(); BBI != BBE; ++BBI)
360 for (MachineBasicBlock::iterator MI = BBI->begin(),
361 ME = BBI->end(); MI != ME; ++MI)
Chris Lattner749c6f62008-01-07 07:27:27 +0000362 if (MI->getDesc().isCall())
Dan Gohmanfd3ff032008-07-07 20:08:05 +0000363 VisitCallPoint(MI);
Gordon Henriksen364caf02007-09-29 02:13:43 +0000364}
365
366void MachineCodeAnalysis::FindStackOffsets(MachineFunction &MF) {
Gordon Henriksenfcbcfaa2008-08-19 17:06:35 +0000367 const TargetRegisterInfo *TRI = TM->getRegisterInfo();
368 assert(TRI && "TargetRegisterInfo not available!");
Gordon Henriksen364caf02007-09-29 02:13:43 +0000369
Gordon Henriksen5eca0752008-08-17 18:44:35 +0000370 for (GCFunctionInfo::roots_iterator RI = FI->roots_begin(),
371 RE = FI->roots_end(); RI != RE; ++RI)
Gordon Henriksenfcbcfaa2008-08-19 17:06:35 +0000372 RI->StackOffset = TRI->getFrameIndexOffset(MF, RI->Num);
Gordon Henriksen364caf02007-09-29 02:13:43 +0000373}
374
375bool MachineCodeAnalysis::runOnMachineFunction(MachineFunction &MF) {
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000376 // Quick exit for functions that do not use GC.
Gordon Henriksen5eca0752008-08-17 18:44:35 +0000377 if (!MF.getFunction()->hasGC())
378 return false;
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000379
Gordon Henriksen5eca0752008-08-17 18:44:35 +0000380 FI = &getAnalysis<GCModuleInfo>().getFunctionInfo(*MF.getFunction());
381 if (!FI->getStrategy().needsSafePoints())
Gordon Henriksen364caf02007-09-29 02:13:43 +0000382 return false;
383
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000384 TM = &MF.getTarget();
Gordon Henriksen364caf02007-09-29 02:13:43 +0000385 MMI = &getAnalysis<MachineModuleInfo>();
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000386 TII = TM->getInstrInfo();
Gordon Henriksen364caf02007-09-29 02:13:43 +0000387
388 // Find the size of the stack frame.
Gordon Henriksenfcbcfaa2008-08-19 17:06:35 +0000389 FI->setFrameSize(MF.getFrameInfo()->getStackSize());
Gordon Henriksen364caf02007-09-29 02:13:43 +0000390
391 // Find all safe points.
392 FindSafePoints(MF);
393
394 // Find the stack offsets for all roots.
395 FindStackOffsets(MF);
396
397 return false;
398}