From: Chris Lattner Date: Wed, 22 Jan 2003 23:24:11 +0000 (+0000) Subject: Allow creating of passes like levelraise which use a targetdata ctor X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f2bcccfbab53f31ccaceb6bd9b74e0219c572904;p=oota-llvm.git Allow creating of passes like levelraise which use a targetdata ctor git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5403 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp index aae5791935c..300ba950697 100644 --- a/tools/bugpoint/OptimizerDriver.cpp +++ b/tools/bugpoint/OptimizerDriver.cpp @@ -13,6 +13,7 @@ #include "llvm/PassManager.h" #include "llvm/Analysis/Verifier.h" #include "llvm/Bytecode/WriteBytecodePass.h" +#include "llvm/Target/TargetData.h" #include #include #include @@ -60,6 +61,8 @@ void BugDriver::EmitProgressBytecode(const PassInfo *Pass, std::cout << " " << Filename << " -" << Pass->getPassArgument() << "\n"; } +/// FIXME: This should be parameterizable!! +static TargetData TD("bugpoint target"); static void RunChild(Module *Program,const std::vector &Passes, const std::string &OutFilename) { @@ -73,6 +76,8 @@ static void RunChild(Module *Program,const std::vector &Passes, for (unsigned i = 0, e = Passes.size(); i != e; ++i) { if (Passes[i]->getNormalCtor()) PM.add(Passes[i]->getNormalCtor()()); + else if (Passes[i]->getDataCtor()) + PM.add(Passes[i]->getDataCtor()(TD)); // Provide dummy target data... else std::cerr << "Cannot create pass yet: " << Passes[i]->getPassName() << "\n";