minor cleanups. Add provisions for a new standard BLOCKINFO_BLOCK
[oota-llvm.git] / tools / bugpoint / BugDriver.cpp
index e499477630d53d5808ae78d41da70ebacd36e424..b2a8f030c5f4ebb5f4a1296aaa16879e649ea816 100644 (file)
@@ -21,6 +21,7 @@
 #include "llvm/Assembly/Parser.h"
 #include "llvm/Bytecode/Reader.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compressor.h"
 #include "llvm/Support/FileUtilities.h"
 #include <iostream>
 #include <memory>
@@ -63,10 +64,10 @@ std::string llvm::getPassesString(const std::vector<const PassInfo*> &Passes) {
 }
 
 BugDriver::BugDriver(const char *toolname, bool as_child, bool find_bugs,
-                     unsigned timeout)
+                     unsigned timeout, unsigned memlimit)
   : ToolName(toolname), ReferenceOutputFile(OutputFile),
     Program(0), Interpreter(0), cbe(0), gcc(0), run_as_child(as_child),
-    run_find_bugs(find_bugs), Timeout(timeout) {}
+    run_find_bugs(find_bugs), Timeout(timeout), MemoryLimit(memlimit) {}
 
 
 /// ParseInputFile - Given a bytecode or assembly input filename, parse and
@@ -74,7 +75,8 @@ BugDriver::BugDriver(const char *toolname, bool as_child, bool find_bugs,
 ///
 Module *llvm::ParseInputFile(const std::string &InputFilename) {
   ParseError Err;
-  Module *Result = ParseBytecodeFile(InputFilename);
+  Module *Result = ParseBytecodeFile(InputFilename,
+                                     Compressor::decompressToNewBuffer);
   if (!Result && !(Result = ParseAssemblyFile(InputFilename,&Err))) {
     std::cerr << "bugpoint: " << Err.getMessage() << "\n"; 
     Result = 0;
@@ -221,3 +223,13 @@ void llvm::PrintFunctionList(const std::vector<Function*> &Funcs) {
     std::cout << "... <" << Funcs.size() << " total>";
   std::cout << std::flush;
 }
+
+void llvm::PrintGlobalVariableList(const std::vector<GlobalVariable*> &GVs) {
+  unsigned NumPrint = GVs.size();
+  if (NumPrint > 10) NumPrint = 10;
+  for (unsigned i = 0; i != NumPrint; ++i)
+    std::cout << " " << GVs[i]->getName();
+  if (NumPrint < GVs.size())
+    std::cout << "... <" << GVs.size() << " total>";
+  std::cout << std::flush;
+}