Pass plugins on to children when optimizing.
authorAndrew Lenharth <andrewl@lenharth.org>
Thu, 26 Jan 2006 18:37:21 +0000 (18:37 +0000)
committerAndrew Lenharth <andrewl@lenharth.org>
Thu, 26 Jan 2006 18:37:21 +0000 (18:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25650 91177308-0d34-0410-b5e6-96231b3b80d8

tools/bugpoint/OptimizerDriver.cpp

index bad68d1f0a89955548aba95b08fbbc294a298ef7..7cfc4fb49947168d2d8376c3da4c607f39a32b6c 100644 (file)
 #include "llvm/System/Path.h"
 #include "llvm/System/Program.h"
 #include "llvm/Config/alloca.h"
+
+#define DONT_GET_PLUGIN_LOADER_OPTION
+#include "llvm/Support/PluginLoader.h"
+
 #include <fstream>
 using namespace llvm;
 
@@ -149,13 +153,18 @@ bool BugDriver::runPasses(const std::vector<const PassInfo*> &Passes,
 
   // setup the child process' arguments
   const char** args = (const char**)
-    alloca(sizeof(const char*)*(Passes.size()+10));
+    alloca(sizeof(const char*) * 
+          (Passes.size()+10+2*PluginLoader::getNumPlugins()));
   int n = 0;
   args[n++] = ToolName.c_str();
   args[n++] = "-as-child";
   args[n++] = "-child-output";
   args[n++] = OutputFilename.c_str();
   std::vector<std::string> pass_args;
+  for (unsigned i = 0, e = PluginLoader::getNumPlugins(); i != e; ++i) {
+    pass_args.push_back( std::string("-load"));
+    pass_args.push_back( PluginLoader::getPlugin(i));
+  }
   for (std::vector<const PassInfo*>::const_iterator I = Passes.begin(),
        E = Passes.end(); I != E; ++I )
     pass_args.push_back( std::string("-") + (*I)->getPassArgument() );