Do not use typeinfo to identify pass in pass manager.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36632 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel
2007-05-01 21:15:47 +00:00
parent e50fb9ac17
commit 794fd75c67
154 changed files with 687 additions and 129 deletions
+12 -3
View File
@@ -34,9 +34,11 @@ namespace {
// Module passes to require FunctionPasses, so we can't get loop info if we're
// not a function pass.
struct VISIBILITY_HIDDEN LoopExtractor : public FunctionPass {
static const int ID; // Pass identifcation, replacement for typeid
unsigned NumLoops;
LoopExtractor(unsigned numLoops = ~0) : NumLoops(numLoops) {}
LoopExtractor(unsigned numLoops = ~0)
: FunctionPass((intptr_t)&ID), NumLoops(numLoops) {}
virtual bool runOnFunction(Function &F);
@@ -49,14 +51,17 @@ namespace {
}
};
const int LoopExtractor::ID = 0;
RegisterPass<LoopExtractor>
X("loop-extract", "Extract loops into new functions");
/// SingleLoopExtractor - For bugpoint.
struct SingleLoopExtractor : public LoopExtractor {
static const int ID; // Pass identifcation, replacement for typeid
SingleLoopExtractor() : LoopExtractor(1) {}
};
const int SingleLoopExtractor::ID = 0;
RegisterPass<SingleLoopExtractor>
Y("loop-extract-single", "Extract at most one loop into a new function");
} // End anonymous namespace
@@ -147,11 +152,15 @@ namespace {
class BlockExtractorPass : public ModulePass {
std::vector<BasicBlock*> BlocksToNotExtract;
public:
BlockExtractorPass(std::vector<BasicBlock*> &B) : BlocksToNotExtract(B) {}
BlockExtractorPass() {}
static const int ID; // Pass identifcation, replacement for typeid
BlockExtractorPass(std::vector<BasicBlock*> &B)
: ModulePass((intptr_t)&ID), BlocksToNotExtract(B) {}
BlockExtractorPass() : ModulePass((intptr_t)&ID) {}
bool runOnModule(Module &M);
};
const int BlockExtractorPass::ID = 0;
RegisterPass<BlockExtractorPass>
XX("extract-blocks", "Extract Basic Blocks From Module (for bugpoint use)");
}