blob: 8fc6335c2a2897b4571f25bb401d50994e887f74 [file] [log] [blame]
Tobias Grosser75805372011-04-29 06:27:02 +00001//===----- ScopDetection.cpp - Detect Scops --------------------*- C++ -*-===//
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// Detect the maximal Scops of a function.
11//
12// A static control part (Scop) is a subgraph of the control flow graph (CFG)
13// that only has statically known control flow and can therefore be described
14// within the polyhedral model.
15//
16// Every Scop fullfills these restrictions:
17//
18// * It is a single entry single exit region
19//
20// * Only affine linear bounds in the loops
21//
22// Every natural loop in a Scop must have a number of loop iterations that can
23// be described as an affine linear function in surrounding loop iterators or
24// parameters. (A parameter is a scalar that does not change its value during
25// execution of the Scop).
26//
27// * Only comparisons of affine linear expressions in conditions
28//
29// * All loops and conditions perfectly nested
30//
31// The control flow needs to be structured such that it could be written using
32// just 'for' and 'if' statements, without the need for any 'goto', 'break' or
33// 'continue'.
34//
35// * Side effect free functions call
36//
37// Only function calls and intrinsics that do not have side effects are allowed
38// (readnone).
39//
40// The Scop detection finds the largest Scops by checking if the largest
41// region is a Scop. If this is not the case, its canonical subregions are
42// checked until a region is a Scop. It is now tried to extend this Scop by
43// creating a larger non canonical region.
44//
45//===----------------------------------------------------------------------===//
46
47#include "polly/ScopDetection.h"
48
49#include "polly/LinkAllPasses.h"
50#include "polly/Support/ScopHelper.h"
51#include "polly/Support/AffineSCEVIterator.h"
52
53#include "llvm/LLVMContext.h"
54#include "llvm/ADT/Statistic.h"
55#include "llvm/Analysis/AliasAnalysis.h"
56#include "llvm/Analysis/RegionIterator.h"
57#include "llvm/Support/CommandLine.h"
58#include "llvm/Assembly/Writer.h"
59
60#define DEBUG_TYPE "polly-detect"
61#include "llvm/Support/Debug.h"
62
63using namespace llvm;
64using namespace polly;
65
66//===----------------------------------------------------------------------===//
67// Statistics.
68
69STATISTIC(ValidRegion, "Number of regions that a valid part of Scop");
70
71#define BADSCOP_STAT(NAME, DESC) STATISTIC(Bad##NAME##ForScop, \
72 "Number of bad regions for Scop: "\
73 DESC)
74
75#define STATSCOP(NAME); assert(!Context.Verifying && #NAME); \
76 if (!Context.Verifying) ++Bad##NAME##ForScop;
77
Tobias Grosserc4a0bd12011-10-08 00:30:48 +000078#define INVALID(NAME, MESSAGE) \
79 do { \
80 DEBUG(dbgs() << MESSAGE); \
81 DEBUG(dbgs() << "\n"); \
82 STATSCOP(NAME); \
83 return false; \
84 } while (0);
85
86
Tobias Grosser75805372011-04-29 06:27:02 +000087BADSCOP_STAT(CFG, "CFG too complex");
88BADSCOP_STAT(IndVar, "Non canonical induction variable in loop");
89BADSCOP_STAT(LoopBound, "Loop bounds can not be computed");
90BADSCOP_STAT(FuncCall, "Function call with side effects appeared");
91BADSCOP_STAT(AffFunc, "Expression not affine");
92BADSCOP_STAT(Scalar, "Found scalar dependency");
93BADSCOP_STAT(Alias, "Found base address alias");
94BADSCOP_STAT(SimpleRegion, "Region not simple");
95BADSCOP_STAT(Other, "Others");
96
97//===----------------------------------------------------------------------===//
98// ScopDetection.
99
100bool ScopDetection::isMaxRegionInScop(const Region &R) const {
101 // The Region is valid only if it could be found in the set.
102 return ValidRegions.count(&R);
103}
104
105bool ScopDetection::isValidAffineFunction(const SCEV *S, Region &RefRegion,
106 Value **BasePtr) const {
107 assert(S && "S must not be null!");
108 bool isMemoryAccess = (BasePtr != 0);
109 if (isMemoryAccess) *BasePtr = 0;
110 DEBUG(dbgs() << "Checking " << *S << " ... ");
111
112 if (isa<SCEVCouldNotCompute>(S)) {
113 DEBUG(dbgs() << "Non Affine: SCEV could not be computed\n");
114 return false;
115 }
116
117 for (AffineSCEVIterator I = affine_begin(S, SE), E = affine_end(); I != E;
118 ++I) {
119 // The constant part must be a SCEVConstant.
120 // TODO: support sizeof in coefficient.
121 if (!isa<SCEVConstant>(I->second)) {
122 DEBUG(dbgs() << "Non Affine: Right hand side is not constant\n");
123 return false;
124 }
125
126 const SCEV *Var = I->first;
127
128 // A constant offset is affine.
129 if(isa<SCEVConstant>(Var))
130 continue;
131
132 // Memory accesses are allowed to have a base pointer.
133 if (Var->getType()->isPointerTy()) {
134 if (!isMemoryAccess) {
135 DEBUG(dbgs() << "Non Affine: Pointer in non memory access\n");
136 return false;
137 }
138
139 assert(I->second->isOne() && "Only one as pointer coefficient allowed.\n");
140 const SCEVUnknown *BaseAddr = dyn_cast<SCEVUnknown>(Var);
141
142 if (!BaseAddr || isa<UndefValue>(BaseAddr->getValue())){
143 DEBUG(dbgs() << "Cannot handle base: " << *Var << "\n");
144 return false;
145 }
146
147 // BaseAddr must be invariant in Scop.
148 if (!isParameter(BaseAddr, RefRegion, *LI, *SE)) {
149 DEBUG(dbgs() << "Non Affine: Base address not invariant in SCoP\n");
150 return false;
151 }
152
153 assert(*BasePtr == 0 && "Found second base pointer.\n");
154 *BasePtr = BaseAddr->getValue();
155 continue;
156 }
157
158 if (isParameter(Var, RefRegion, *LI, *SE)
159 || isIndVar(Var, RefRegion, *LI, *SE))
160 continue;
161
162 DEBUG(dbgs() << "Non Affine: " ;
163 Var->print(dbgs());
164 dbgs() << " is neither parameter nor induction variable\n");
165 return false;
166 }
167
168 DEBUG(dbgs() << " is affine.\n");
169 return !isMemoryAccess || (*BasePtr != 0);
170}
171
172bool ScopDetection::isValidCFG(BasicBlock &BB, DetectionContext &Context) const
173{
174 Region &RefRegion = Context.CurRegion;
175 TerminatorInst *TI = BB.getTerminator();
176
177 // Return instructions are only valid if the region is the top level region.
178 if (isa<ReturnInst>(TI) && !RefRegion.getExit() && TI->getNumOperands() == 0)
179 return true;
180
181 BranchInst *Br = dyn_cast<BranchInst>(TI);
182
Tobias Grosserc4a0bd12011-10-08 00:30:48 +0000183 if (!Br)
184 INVALID(CFG, "Non branch instruction terminates BB: " + BB.getNameStr());
Tobias Grosser75805372011-04-29 06:27:02 +0000185
186 if (Br->isUnconditional()) return true;
187
188 Value *Condition = Br->getCondition();
189
190 // UndefValue is not allowed as condition.
Tobias Grosserc4a0bd12011-10-08 00:30:48 +0000191 if (isa<UndefValue>(Condition))
192 INVALID(AffFunc, "Condition based on 'undef' value in BB: "
193 + BB.getNameStr());
Tobias Grosser75805372011-04-29 06:27:02 +0000194
195 // Only Constant and ICmpInst are allowed as condition.
Tobias Grosserc4a0bd12011-10-08 00:30:48 +0000196 if (!(isa<Constant>(Condition) || isa<ICmpInst>(Condition)))
197 INVALID(AffFunc, "Condition in BB '" + BB.getNameStr() + "' neither "
198 "constant nor an icmp instruction");
Tobias Grosser75805372011-04-29 06:27:02 +0000199
200 // Allow perfectly nested conditions.
201 assert(Br->getNumSuccessors() == 2 && "Unexpected number of successors");
202
203 if (ICmpInst *ICmp = dyn_cast<ICmpInst>(Condition)) {
204 // Unsigned comparisons are not allowed. They trigger overflow problems
205 // in the code generation.
206 //
207 // TODO: This is not sufficient and just hides bugs. However it does pretty
208 // well.
209 if(ICmp->isUnsigned())
210 return false;
211
212 // Are both operands of the ICmp affine?
213 if (isa<UndefValue>(ICmp->getOperand(0))
Tobias Grosserc4a0bd12011-10-08 00:30:48 +0000214 || isa<UndefValue>(ICmp->getOperand(1)))
215 INVALID(AffFunc, "undef operand in branch at BB: " + BB.getNameStr());
Tobias Grosser75805372011-04-29 06:27:02 +0000216
217 const SCEV *ScevLHS = SE->getSCEV(ICmp->getOperand(0));
218 const SCEV *ScevRHS = SE->getSCEV(ICmp->getOperand(1));
219
220 bool affineLHS = isValidAffineFunction(ScevLHS, RefRegion);
221 bool affineRHS = isValidAffineFunction(ScevRHS, RefRegion);
222
Tobias Grosserc4a0bd12011-10-08 00:30:48 +0000223 if (!affineLHS || !affineRHS)
224 INVALID(AffFunc, "Non affine branch in BB: " + BB.getNameStr());
Tobias Grosser75805372011-04-29 06:27:02 +0000225 }
226
227 // Allow loop exit conditions.
228 Loop *L = LI->getLoopFor(&BB);
229 if (L && L->getExitingBlock() == &BB)
230 return true;
231
232 // Allow perfectly nested conditions.
233 Region *R = RI->getRegionFor(&BB);
Tobias Grosserc4a0bd12011-10-08 00:30:48 +0000234 if (R->getEntry() != &BB)
235 INVALID(CFG, "Not well structured condition at BB: " + BB.getNameStr());
Tobias Grosser75805372011-04-29 06:27:02 +0000236
237 return true;
238}
239
240bool ScopDetection::isValidCallInst(CallInst &CI) {
241 if (CI.mayHaveSideEffects() || CI.doesNotReturn())
242 return false;
243
244 if (CI.doesNotAccessMemory())
245 return true;
246
247 Function *CalledFunction = CI.getCalledFunction();
248
249 // Indirect calls are not supported.
250 if (CalledFunction == 0)
251 return false;
252
253 // TODO: Intrinsics.
254 return false;
255}
256
257bool ScopDetection::isValidMemoryAccess(Instruction &Inst,
258 DetectionContext &Context) const {
259 Value *Ptr = getPointerOperand(Inst), *BasePtr;
260 const SCEV *AccessFunction = SE->getSCEV(Ptr);
261
Tobias Grosserc4a0bd12011-10-08 00:30:48 +0000262 if (!isValidAffineFunction(AccessFunction, Context.CurRegion, &BasePtr))
263 INVALID(AffFunc, "Bad memory address " << *AccessFunction);
Tobias Grosser75805372011-04-29 06:27:02 +0000264
265 // FIXME: Alias Analysis thinks IntToPtrInst aliases with alloca instructions
266 // created by IndependentBlocks Pass.
Tobias Grosserc4a0bd12011-10-08 00:30:48 +0000267 if (isa<IntToPtrInst>(BasePtr))
268 INVALID(Other, "Find bad intoptr prt: " << *BasePtr);
Tobias Grosser75805372011-04-29 06:27:02 +0000269
270 // Check if the base pointer of the memory access does alias with
271 // any other pointer. This cannot be handled at the moment.
272 AliasSet &AS =
273 Context.AST.getAliasSetForPointer(BasePtr, AliasAnalysis::UnknownSize,
274 Inst.getMetadata(LLVMContext::MD_tbaa));
275 if (!AS.isMustAlias()) {
276 DEBUG(dbgs() << "Bad pointer alias found:" << *BasePtr << "\nAS:\n" << AS);
277
278 // STATSCOP triggers an assertion if we are in verifying mode.
279 // This is generally good to check that we do not change the SCoP after we
280 // run the SCoP detection and consequently to ensure that we can still
281 // represent that SCoP. However, in case of aliasing this does not work.
282 // The independent blocks pass may create memory references which seem to
283 // alias, if -basicaa is not available. They actually do not. As we do not
284 // not know this and we would fail here if we verify it.
285 if (!Context.Verifying) {
286 STATSCOP(Alias);
287 }
288
289 return false;
290 }
291
292 return true;
293}
294
295
296bool ScopDetection::hasScalarDependency(Instruction &Inst,
297 Region &RefRegion) const {
298 for (Instruction::use_iterator UI = Inst.use_begin(), UE = Inst.use_end();
299 UI != UE; ++UI)
300 if (Instruction *Use = dyn_cast<Instruction>(*UI))
301 if (!RefRegion.contains(Use->getParent())) {
302 // DirtyHack 1: PHINode user outside the Scop is not allow, if this
303 // PHINode is induction variable, the scalar to array transform may
304 // break it and introduce a non-indvar PHINode, which is not allow in
305 // Scop.
306 // This can be fix by:
307 // Introduce a IndependentBlockPrepare pass, which translate all
308 // PHINodes not in Scop to array.
309 // The IndependentBlockPrepare pass can also split the entry block of
310 // the function to hold the alloca instruction created by scalar to
311 // array. and split the exit block of the Scop so the new create load
312 // instruction for escape users will not break other Scops.
313 if (isa<PHINode>(Use))
314 return true;
315 }
316
317 return false;
318}
319
320bool ScopDetection::isValidInstruction(Instruction &Inst,
321 DetectionContext &Context) const {
322 // Only canonical IVs are allowed.
323 if (PHINode *PN = dyn_cast<PHINode>(&Inst))
324 if (!isIndVar(PN, LI)) {
325 DEBUG(dbgs() << "Non canonical PHI node found: ";
326 WriteAsOperand(dbgs(), &Inst, false);
327 dbgs() << "\n");
328 return false;
329 }
330
331 // Scalar dependencies are not allowed.
Tobias Grosserc4a0bd12011-10-08 00:30:48 +0000332 if (hasScalarDependency(Inst, Context.CurRegion))
333 INVALID(Scalar, "Scalar dependency found: " << Inst);
Tobias Grosser75805372011-04-29 06:27:02 +0000334
335 // We only check the call instruction but not invoke instruction.
336 if (CallInst *CI = dyn_cast<CallInst>(&Inst)) {
337 if (isValidCallInst(*CI))
338 return true;
339
Tobias Grosserc4a0bd12011-10-08 00:30:48 +0000340 INVALID(FuncCall, "Call instruction not allowed: " << Inst);
Tobias Grosser75805372011-04-29 06:27:02 +0000341 }
342
343 if (!Inst.mayWriteToMemory() && !Inst.mayReadFromMemory()) {
344 // Handle cast instruction.
Tobias Grosserc4a0bd12011-10-08 00:30:48 +0000345 if (isa<IntToPtrInst>(Inst) || isa<BitCastInst>(Inst))
346 INVALID(Other, "Cast instruction not allowed: " << Inst);
Tobias Grosser75805372011-04-29 06:27:02 +0000347
Tobias Grosserc4a0bd12011-10-08 00:30:48 +0000348 if (isa<AllocaInst>(Inst))
349 INVALID(Other, "Alloca instruction not allowed: " << Inst);
Tobias Grosser75805372011-04-29 06:27:02 +0000350
351 return true;
352 }
353
354 // Check the access function.
355 if (isa<LoadInst>(Inst) || isa<StoreInst>(Inst))
356 return isValidMemoryAccess(Inst, Context);
357
358 // We do not know this instruction, therefore we assume it is invalid.
Tobias Grosserc4a0bd12011-10-08 00:30:48 +0000359 INVALID(Other, "Unknown instruction: " << Inst);
Tobias Grosser75805372011-04-29 06:27:02 +0000360}
361
362bool ScopDetection::isValidBasicBlock(BasicBlock &BB,
363 DetectionContext &Context) const {
364 if (!isValidCFG(BB, Context))
365 return false;
366
367 // Check all instructions, except the terminator instruction.
368 for (BasicBlock::iterator I = BB.begin(), E = --BB.end(); I != E; ++I)
369 if (!isValidInstruction(*I, Context))
370 return false;
371
372 Loop *L = LI->getLoopFor(&BB);
373 if (L && L->getHeader() == &BB && !isValidLoop(L, Context))
374 return false;
375
376 return true;
377}
378
379bool ScopDetection::isValidLoop(Loop *L, DetectionContext &Context) const {
380 PHINode *IndVar = L->getCanonicalInductionVariable();
381 // No canonical induction variable.
Tobias Grosserc4a0bd12011-10-08 00:30:48 +0000382 if (!IndVar)
383 INVALID(IndVar, "No single induction variable for loop: "
384 << L->getHeader()->getNameStr());
Tobias Grosser75805372011-04-29 06:27:02 +0000385
386 // Is the loop count affine?
387 const SCEV *LoopCount = SE->getBackedgeTakenCount(L);
Tobias Grosserc4a0bd12011-10-08 00:30:48 +0000388 if (!isValidAffineFunction(LoopCount, Context.CurRegion))
389 INVALID(LoopBound, "Non affine loop bound for loop: "
390 << L->getHeader()->getNameStr());
Tobias Grosser75805372011-04-29 06:27:02 +0000391
392 return true;
393}
394
395Region *ScopDetection::expandRegion(Region &R) {
396 Region *CurrentRegion = &R;
397 Region *TmpRegion = R.getExpandedRegion();
398
399 DEBUG(dbgs() << "\tExpanding " << R.getNameStr() << "\n");
400
401 while (TmpRegion) {
402 DetectionContext Context(*TmpRegion, *AA, false /*verifying*/);
403 DEBUG(dbgs() << "\t\tTrying " << TmpRegion->getNameStr() << "\n");
404
405 if (!allBlocksValid(Context))
406 break;
407
408 if (isValidExit(Context)) {
409 if (CurrentRegion != &R)
410 delete CurrentRegion;
411
412 CurrentRegion = TmpRegion;
413 }
414
415 Region *TmpRegion2 = TmpRegion->getExpandedRegion();
416
417 if (TmpRegion != &R && TmpRegion != CurrentRegion)
418 delete TmpRegion;
419
420 TmpRegion = TmpRegion2;
421 }
422
423 if (&R == CurrentRegion)
424 return NULL;
425
426 DEBUG(dbgs() << "\tto " << CurrentRegion->getNameStr() << "\n");
427
428 return CurrentRegion;
429}
430
431
432void ScopDetection::findScops(Region &R) {
433 DetectionContext Context(R, *AA, false /*verifying*/);
434
435 if (isValidRegion(Context)) {
436 ++ValidRegion;
437 ValidRegions.insert(&R);
438 return;
439 }
440
441 for (Region::iterator I = R.begin(), E = R.end(); I != E; ++I)
442 findScops(**I);
443
444 // Try to expand regions.
445 //
446 // As the region tree normally only contains canonical regions, non canonical
447 // regions that form a Scop are not found. Therefore, those non canonical
448 // regions are checked by expanding the canonical ones.
449
450 std::vector<Region*> ToExpand;
451
452 for (Region::iterator I = R.begin(), E = R.end(); I != E; ++I)
453 ToExpand.push_back(*I);
454
455 for (std::vector<Region*>::iterator RI = ToExpand.begin(),
456 RE = ToExpand.end(); RI != RE; ++RI) {
457 Region *CurrentRegion = *RI;
458
459 // Skip invalid regions. Regions may become invalid, if they are element of
460 // an already expanded region.
461 if (ValidRegions.find(CurrentRegion) == ValidRegions.end())
462 continue;
463
464 Region *ExpandedR = expandRegion(*CurrentRegion);
465
466 if (!ExpandedR)
467 continue;
468
469 R.addSubRegion(ExpandedR, true);
470 ValidRegions.insert(ExpandedR);
471 ValidRegions.erase(CurrentRegion);
472
473 for (Region::iterator I = ExpandedR->begin(), E = ExpandedR->end(); I != E;
474 ++I)
475 ValidRegions.erase(*I);
476 }
477}
478
479bool ScopDetection::allBlocksValid(DetectionContext &Context) const {
480 Region &R = Context.CurRegion;
481
482 for (Region::block_iterator I = R.block_begin(), E = R.block_end(); I != E;
483 ++I)
484 if (!isValidBasicBlock(*(I->getNodeAs<BasicBlock>()), Context))
485 return false;
486
487 return true;
488}
489
490bool ScopDetection::isValidExit(DetectionContext &Context) const {
491 Region &R = Context.CurRegion;
492
493 // PHI nodes are not allowed in the exit basic block.
494 if (BasicBlock *Exit = R.getExit()) {
495 BasicBlock::iterator I = Exit->begin();
Tobias Grosserc4a0bd12011-10-08 00:30:48 +0000496 if (I != Exit->end() && isa<PHINode> (*I))
497 INVALID(Other, "PHI node in exit BB");
Tobias Grosser75805372011-04-29 06:27:02 +0000498 }
499
500 return true;
501}
502
503bool ScopDetection::isValidRegion(DetectionContext &Context) const {
504 Region &R = Context.CurRegion;
505
506 DEBUG(dbgs() << "Checking region: " << R.getNameStr() << "\n\t");
507
508 // The toplevel region is no valid region.
509 if (!R.getParent()) {
510 DEBUG(dbgs() << "Top level region is invalid";
511 dbgs() << "\n");
512 return false;
513 }
514
515 // SCoP can not contains the entry block of the function, because we need
516 // to insert alloca instruction there when translate scalar to array.
Tobias Grosserc4a0bd12011-10-08 00:30:48 +0000517 if (R.getEntry() == &(R.getEntry()->getParent()->getEntryBlock()))
518 INVALID(Other, "Region containing entry block of function is invalid!");
Tobias Grosser75805372011-04-29 06:27:02 +0000519
520 // Only a simple region is allowed.
Tobias Grosserc4a0bd12011-10-08 00:30:48 +0000521 if (!R.isSimple())
522 INVALID(SimpleRegion, "Region not simple: " << R.getNameStr());
Tobias Grosser75805372011-04-29 06:27:02 +0000523
524 if (!allBlocksValid(Context))
525 return false;
526
527 if (!isValidExit(Context))
528 return false;
529
530 DEBUG(dbgs() << "OK\n");
531 return true;
532}
533
534bool ScopDetection::isValidFunction(llvm::Function &F) {
Hongbin Zheng94c5df12011-05-06 02:38:20 +0000535 return !InvalidFunctions.count(&F);
Tobias Grosser75805372011-04-29 06:27:02 +0000536}
537
538bool ScopDetection::runOnFunction(llvm::Function &F) {
539 AA = &getAnalysis<AliasAnalysis>();
540 SE = &getAnalysis<ScalarEvolution>();
541 LI = &getAnalysis<LoopInfo>();
542 RI = &getAnalysis<RegionInfo>();
543 Region *TopRegion = RI->getTopLevelRegion();
544
545 if(!isValidFunction(F))
546 return false;
547
548 findScops(*TopRegion);
549 return false;
550}
551
552
553void polly::ScopDetection::verifyRegion(const Region &R) const {
554 assert(isMaxRegionInScop(R) && "Expect R is a valid region.");
555 DetectionContext Context(const_cast<Region&>(R), *AA, true /*verifying*/);
556 isValidRegion(Context);
557}
558
559void polly::ScopDetection::verifyAnalysis() const {
560 for (RegionSet::const_iterator I = ValidRegions.begin(),
561 E = ValidRegions.end(); I != E; ++I)
562 verifyRegion(**I);
563}
564
565void ScopDetection::getAnalysisUsage(AnalysisUsage &AU) const {
566 AU.addRequired<DominatorTree>();
567 AU.addRequired<PostDominatorTree>();
568 AU.addRequired<LoopInfo>();
569 AU.addRequired<ScalarEvolution>();
570 // We also need AA and RegionInfo when we are verifying analysis.
571 AU.addRequiredTransitive<AliasAnalysis>();
572 AU.addRequiredTransitive<RegionInfo>();
573 AU.setPreservesAll();
574}
575
576void ScopDetection::print(raw_ostream &OS, const Module *) const {
577 for (RegionSet::const_iterator I = ValidRegions.begin(),
578 E = ValidRegions.end(); I != E; ++I)
579 OS << "Valid Region for Scop: " << (*I)->getNameStr() << '\n';
580
581 OS << "\n";
582}
583
584void ScopDetection::releaseMemory() {
585 ValidRegions.clear();
Hongbin Zheng94c5df12011-05-06 02:38:20 +0000586 // Do not clear the invalid function set.
Tobias Grosser75805372011-04-29 06:27:02 +0000587}
588
589char ScopDetection::ID = 0;
590
Tobias Grosser73600b82011-10-08 00:30:40 +0000591INITIALIZE_PASS_BEGIN(ScopDetection, "polly-detect",
592 "Polly - Detect static control parts (SCoPs)", false,
593 false)
594INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
595INITIALIZE_PASS_DEPENDENCY(DominatorTree)
596INITIALIZE_PASS_DEPENDENCY(LoopInfo)
597INITIALIZE_PASS_DEPENDENCY(PostDominatorTree)
598INITIALIZE_PASS_DEPENDENCY(RegionInfo)
599INITIALIZE_PASS_DEPENDENCY(ScalarEvolution)
600INITIALIZE_PASS_END(ScopDetection, "polly-detect",
601 "Polly - Detect static control parts (SCoPs)", false, false)
Tobias Grosser75805372011-04-29 06:27:02 +0000602
Tobias Grosser83f5c432011-08-23 22:35:08 +0000603Pass *polly::createScopDetectionPass() {
604 return new ScopDetection();
605}