#define BUGDRIVER_H
#include "llvm/ADT/ValueMap.h"
-#include <vector>
+#include "llvm/Transforms/Utils/ValueMapper.h"
#include <string>
+#include <vector>
namespace llvm {
const char *ToolName; // argv[0] of bugpoint
std::string ReferenceOutputFile; // Name of `good' output file
Module *Program; // The raw program, linked together
- std::vector<const PassInfo*> PassesToRun;
+ std::vector<std::string> PassesToRun;
AbstractInterpreter *Interpreter; // How to run the program
AbstractInterpreter *SafeInterpreter; // To generate reference output, etc.
GCC *gcc;
- bool run_as_child;
bool run_find_bugs;
unsigned Timeout;
unsigned MemoryLimit;
friend class ReduceMisCodegenFunctions;
public:
- BugDriver(const char *toolname, bool as_child, bool find_bugs,
+ BugDriver(const char *toolname, bool find_bugs,
unsigned timeout, unsigned memlimit, bool use_valgrind,
LLVMContext& ctxt);
~BugDriver();
// command line arguments into instance variables of BugDriver.
//
bool addSources(const std::vector<std::string> &FileNames);
- template<class It>
- void addPasses(It I, It E) { PassesToRun.insert(PassesToRun.end(), I, E); }
- void setPassesToRun(const std::vector<const PassInfo*> &PTR) {
+ void addPass(std::string p) { PassesToRun.push_back(p); }
+ void setPassesToRun(const std::vector<std::string> &PTR) {
PassesToRun = PTR;
}
- const std::vector<const PassInfo*> &getPassesToRun() const {
+ const std::vector<std::string> &getPassesToRun() const {
return PassesToRun;
}
/// this function.
///
bool createReferenceFile(Module *M, const std::string &Filename
- = "bugpoint.reference.out");
+ = "bugpoint.reference.out-%%%%%%%");
/// diffProgram - This method executes the specified module and diffs the
/// output against the file specified by ReferenceOutputFile. If the output
/// series of cleanup passes (ADCE and SimplifyCFG) to eliminate any code
/// which depends on the value. The modified module is then returned.
///
- Module *deleteInstructionFromProgram(const Instruction *I, unsigned Simp)
- const;
+ Module *deleteInstructionFromProgram(const Instruction *I, unsigned Simp);
/// performFinalCleanups - This method clones the current Program and performs
/// a series of cleanups intended to get rid of extra cruft on the module. If
/// failure. If AutoDebugCrashes is set to true, then bugpoint will
/// automatically attempt to track down a crashing pass if one exists, and
/// this method will never return null.
- Module *runPassesOn(Module *M, const std::vector<const PassInfo*> &Passes,
+ Module *runPassesOn(Module *M, const std::vector<std::string> &Passes,
bool AutoDebugCrashes = false, unsigned NumExtraArgs = 0,
const char * const *ExtraArgs = NULL);
/// to pass to the child bugpoint instance.
///
bool runPasses(Module *Program,
- const std::vector<const PassInfo*> &PassesToRun,
+ const std::vector<std::string> &PassesToRun,
std::string &OutputFilename, bool DeleteOutput = false,
bool Quiet = false, unsigned NumExtraArgs = 0,
const char * const *ExtraArgs = NULL) const;
/// If the passes did not compile correctly, output the command required to
/// recreate the failure. This returns true if a compiler error is found.
///
- bool runManyPasses(const std::vector<const PassInfo*> &AllPasses,
+ bool runManyPasses(const std::vector<std::string> &AllPasses,
std::string &ErrMsg);
/// writeProgramToFile - This writes the current "Program" to the named
/// bitcode file. If an error occurs, true is returned.
///
bool writeProgramToFile(const std::string &Filename, const Module *M) const;
+ bool writeProgramToFile(const std::string &Filename, int FD,
+ const Module *M) const;
private:
/// runPasses - Just like the method above, but this just returns true or
/// input (true = crashed).
///
bool runPasses(Module *M,
- const std::vector<const PassInfo*> &PassesToRun,
+ const std::vector<std::string> &PassesToRun,
bool DeleteOutput = true) const {
std::string Filename;
return runPasses(M, PassesToRun, Filename, DeleteOutput);
}
- /// runAsChild - The actual "runPasses" guts that runs in a child process.
- int runPassesAsChild(const std::vector<const PassInfo*> &PassesToRun);
-
/// initializeExecutionEnvironment - This method is used to set up the
/// environment for executing LLVM programs.
///
/// 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);
+std::string getPassesString(const std::vector<std::string> &Passes);
/// PrintFunctionList - prints out list of problematic functions
///
/// module, split the functions OUT of the specified module, and place them in
/// the new module.
Module *SplitFunctionsOutOfModule(Module *M, const std::vector<Function*> &F,
- ValueMap<const Value*, Value*> &VMap);
+ ValueToValueMapTy &VMap);
} // End llvm namespace