Refactor and clean up a bunch more code.  No major functionality changes.
 * Make several methods of bugdriver global functions (ParseInputFile, PrintFunctionList)
 * Make PrintFunctionList truncate the output after 10 entries, like the crash debugger
   did.  This allows code sharing.
 * Add a couple of methods to BugDriver that allows us to eliminate some friends
 * Improve comments in ExtractFunction.cpp
 * Make classes that used to be friends up bugdriver now live in anon namespaces
 * Rip a bunch of functionality in the miscompilation tester into a new
   TestMergedProgram function for future code sharing.
 * Fix a bug in the miscompilation tester induced in my last checkin


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12393 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/bugpoint/BugDriver.h b/tools/bugpoint/BugDriver.h
index eb48eb7..a4428cf 100644
--- a/tools/bugpoint/BugDriver.h
+++ b/tools/bugpoint/BugDriver.h
@@ -28,8 +28,6 @@
 class Instruction;
 
 class DebugCrashes;
-class ReduceMiscompilingPasses;
-class ReduceMiscompilingFunctions;
 
 class CBE;
 class GCC;
@@ -47,8 +45,6 @@
 
   // FIXME: sort out public/private distinctions...
   friend class ReducePassList;
-  friend class ReduceMiscompilingPasses;
-  friend class ReduceMiscompilingFunctions;
   friend class ReduceMisCodegenFunctions;
 
 public:
@@ -65,6 +61,9 @@
   void setPassesToRun(const std::vector<const PassInfo*> &PTR) {
     PassesToRun = PTR;
   }
+  const std::vector<const PassInfo*> &getPassesToRun() const {
+    return PassesToRun;
+  }
 
   /// run - The top level method that is invoked after all of the instance
   /// variables are set up from command line arguments.
@@ -120,7 +119,15 @@
     return Result;
   }
 
-  const Module *getProgram() const { return Program; }
+  Module *getProgram() const { return Program; }
+
+  /// swapProgramIn - Set the current module to the specified module, returning
+  /// the old one.
+  Module *swapProgramIn(Module *M) {
+    Module *OldProgram = Program;
+    Program = M;
+    return OldProgram;
+  }
 
   /// setNewProgram - If we reduce or update the program somehow, call this
   /// method to update bugdriver with it.  This deletes the old module and sets
@@ -183,17 +190,6 @@
   /// program or if the loop extractor crashes.
   Module *ExtractLoop(Module *M);
 
-private:
-  /// ParseInputFile - Given a bytecode or assembly input filename, parse and
-  /// return it, or return null if not possible.
-  ///
-  Module *ParseInputFile(const std::string &InputFilename) const;
-
-  /// writeProgramToFile - This writes the current "Program" to the named
-  /// bytecode file.  If an error occurs, true is returned.
-  ///
-  bool writeProgramToFile(const std::string &Filename, Module *M = 0) const;
-
   /// runPasses - Run the specified passes on Program, outputting a bytecode
   /// file and writting the filename into OutputFile if successful.  If the
   /// optimizations fail for some reason (optimizer crashes), return true,
@@ -205,6 +201,11 @@
   bool runPasses(const std::vector<const PassInfo*> &PassesToRun,
                  std::string &OutputFilename, bool DeleteOutput = false,
 		 bool Quiet = false) const;
+private:
+  /// writeProgramToFile - This writes the current "Program" to the named
+  /// bytecode file.  If an error occurs, true is returned.
+  ///
+  bool writeProgramToFile(const std::string &Filename, Module *M = 0) const;
 
   /// runPasses - Just like the method above, but this just returns true or
   /// false indicating whether or not the optimizer crashed on the specified
@@ -216,21 +217,27 @@
     return runPasses(PassesToRun, Filename, DeleteOutput);
   }
 
-  /// PrintFunctionList - prints out list of problematic functions
-  ///
-  static void PrintFunctionList(const std::vector<Function*> &Funcs);
-
   /// initializeExecutionEnvironment - This method is used to set up the
   /// environment for executing LLVM programs.
   ///
   bool initializeExecutionEnvironment();
 };
 
+/// ParseInputFile - Given a bytecode or assembly input filename, parse and
+/// return it, or return null if not possible.
+///
+Module *ParseInputFile(const std::string &InputFilename);
+
+
 /// getPassesString - Turn a list of passes into a string which indicates the
 /// command line options that must be passed to add the passes.
 ///
 std::string getPassesString(const std::vector<const PassInfo*> &Passes);
 
+/// PrintFunctionList - prints out list of problematic functions
+///
+void PrintFunctionList(const std::vector<Function*> &Funcs);
+
 // DeleteFunctionBody - "Remove" the function by deleting all of it's basic
 // blocks, making it external.
 //