[llvm-commits] CVS: llvm/tools/bugpoint/BugDriver.h CodeGeneratorBug.cpp ExecutionDriver.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Oct 14 17:00:08 PDT 2003


Changes in directory llvm/tools/bugpoint:

BugDriver.h updated: 1.15 -> 1.16
CodeGeneratorBug.cpp updated: 1.21 -> 1.22
ExecutionDriver.cpp updated: 1.23 -> 1.24

---
Log message:

Change the execute methods to take the shared object filename by const reference.
Other adjustments to work with the new ToolRunner interfaces


---
Diffs of the changes:  (+37 -27)

Index: llvm/tools/bugpoint/BugDriver.h
diff -u llvm/tools/bugpoint/BugDriver.h:1.15 llvm/tools/bugpoint/BugDriver.h:1.16
--- llvm/tools/bugpoint/BugDriver.h:1.15	Tue Oct 14 16:09:11 2003
+++ llvm/tools/bugpoint/BugDriver.h	Tue Oct 14 16:59:36 2003
@@ -165,21 +165,25 @@
   ///
   std::string executeProgram(std::string RequestedOutputFilename = "",
                              std::string Bytecode = "",
-                             std::string SharedObject = "",
+                             const std::string &SharedObjects = "",
                              AbstractInterpreter *AI = 0);
 
   /// executeProgramWithCBE - Used to create reference output with the C
   /// backend, if reference output is not provided.
-  std::string executeProgramWithCBE(std::string RequestedOutputFilename = "",
-                                    std::string Bytecode = "",
-                                    std::string SharedObject = "");
+  ///
+  std::string executeProgramWithCBE(std::string OutputFile = "",
+                                    std::string BytecodeFile = "",
+                                    const std::string &SharedObj = "") {
+    return executeProgram(OutputFile, BytecodeFile, SharedObj,
+                          (AbstractInterpreter*)cbe);
+  }
 
   /// diffProgram - This method executes the specified module and diffs the
   /// output against the file specified by ReferenceOutputFile.  If the output
   /// is different, true is returned.
   ///
   bool diffProgram(const std::string &BytecodeFile = "",
-                   const std::string &SharedObject = "",
+                   const std::string &SharedObj = "",
                    bool RemoveBytecode = false);
 };
 


Index: llvm/tools/bugpoint/CodeGeneratorBug.cpp
diff -u llvm/tools/bugpoint/CodeGeneratorBug.cpp:1.21 llvm/tools/bugpoint/CodeGeneratorBug.cpp:1.22
--- llvm/tools/bugpoint/CodeGeneratorBug.cpp:1.21	Tue Oct 14 16:09:11 2003
+++ llvm/tools/bugpoint/CodeGeneratorBug.cpp	Tue Oct 14 16:59:36 2003
@@ -48,8 +48,7 @@
 
 
 bool ReduceMisCodegenFunctions::TestFuncs(const std::vector<Function*> &Funcs,
-                                          bool KeepFiles)
-{
+                                          bool KeepFiles) {
   std::cout << "Testing functions: ";
   BD.PrintFunctionList(Funcs);
   std::cout << "\t";
@@ -225,7 +224,7 @@
   }
 
   // Make a shared library
-  std::string SharedObject = compileSharedObject(SafeModuleBC);
+  std::string SharedObject = BD.compileSharedObject(SafeModuleBC);
 
   delete SafeModule;
   delete TestModule;


Index: llvm/tools/bugpoint/ExecutionDriver.cpp
diff -u llvm/tools/bugpoint/ExecutionDriver.cpp:1.23 llvm/tools/bugpoint/ExecutionDriver.cpp:1.24
--- llvm/tools/bugpoint/ExecutionDriver.cpp:1.23	Tue Oct 14 16:09:11 2003
+++ llvm/tools/bugpoint/ExecutionDriver.cpp	Tue Oct 14 16:59:36 2003
@@ -67,10 +67,18 @@
   // the command line
   std::string Message;
   switch (InterpreterSel) {
-  case RunLLI: Interpreter = createLLItool(getToolName(), Message); break;
-  case RunLLC: Interpreter = createLLCtool(getToolName(), Message); break;
-  case RunJIT: Interpreter = createJITtool(getToolName(), Message); break;
-  case RunCBE: Interpreter = createCBEtool(getToolName(), Message); break;
+  case RunLLI:
+    Interpreter = AbstractInterpreter::createLLI(getToolName(), Message);
+    break;
+  case RunLLC:
+    Interpreter = AbstractInterpreter::createLLC(getToolName(), Message);
+    break;
+  case RunJIT:
+    Interpreter = AbstractInterpreter::createJIT(getToolName(), Message);
+    break;
+  case RunCBE:
+    Interpreter = AbstractInterpreter::createCBE(getToolName(), Message);
+    break;
   default:
     Message = "Sorry, this back-end is not supported by bugpoint right now!\n";
     break;
@@ -78,9 +86,9 @@
   std::cerr << Message;
 
   // Initialize auxiliary tools for debugging
-  cbe = createCBEtool(getToolName(), Message);
+  cbe = AbstractInterpreter::createCBE(getToolName(), Message);
   if (!cbe) { std::cout << Message << "\nExiting.\n"; exit(1); }
-  gcc = createGCCtool(getToolName(), Message);
+  gcc = GCC::create(getToolName(), Message);
   if (!gcc) { std::cout << Message << "\nExiting.\n"; exit(1); }
 
   // If there was an error creating the selected interpreter, quit with error.
@@ -94,9 +102,10 @@
 ///
 std::string BugDriver::executeProgram(std::string OutputFile,
                                       std::string BytecodeFile,
-                                      std::string SharedObject,
+                                      const std::string &SharedObj,
                                       AbstractInterpreter *AI) {
-  assert((Interpreter||AI) && "Interpreter should have been created already!");
+  if (AI == 0) AI = Interpreter;
+  assert(AI && "Interpreter should have been created already!");
   bool CreatedBytecode = false;
   if (BytecodeFile.empty()) {
     // Emit the program to a bytecode file...
@@ -115,12 +124,15 @@
   // Check to see if this is a valid output filename...
   OutputFile = getUniqueFilename(OutputFile);
 
+  // Figure out which shared objects to run, if any.
+  std::vector<std::string> SharedObjs;
+  if (!SharedObj.empty())
+    SharedObjs.push_back(SharedObj);
+
   // Actually execute the program!
-  int RetVal = (AI != 0) ?
-    AI->ExecuteProgram(BytecodeFile, InputArgv, InputFile, OutputFile,
-                       SharedObject) :
-    Interpreter->ExecuteProgram(BytecodeFile, InputArgv, 
-                                InputFile, OutputFile, SharedObject);
+  int RetVal = AI->ExecuteProgram(BytecodeFile, InputArgv, InputFile,
+                                  OutputFile, SharedObjs);
+
 
   // Remove the temporary bytecode file.
   if (CreatedBytecode) removeFile(BytecodeFile);
@@ -129,11 +141,6 @@
   return OutputFile;
 }
 
-std::string BugDriver::executeProgramWithCBE(std::string OutputFile,
-                                             std::string BytecodeFile,
-                                             std::string SharedObject) {
-  return executeProgram(OutputFile, BytecodeFile, SharedObject, cbe);
-}
 
 std::string BugDriver::compileSharedObject(const std::string &BytecodeFile) {
   assert(Interpreter && "Interpreter should have been created already!");
@@ -153,7 +160,7 @@
 #endif
 
   std::string SharedObjectFile;
-  if (gcc->MakeSharedObject(OutputCFile, CFile, SharedObject))
+  if (gcc->MakeSharedObject(OutputCFile, GCC::CFile, SharedObjectFile))
     exit(1);
 
   // Remove the intermediate C file





More information about the llvm-commits mailing list