summaryrefslogtreecommitdiff
path: root/tools/bugpoint/BugDriver.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-12-23 23:49:59 +0000
committerChris Lattner <sabre@nondot.org>2002-12-23 23:49:59 +0000
commit218e26ef3583cc3270f5f2a2b9cb1025e5b05ebe (patch)
treec580bd5dc8fa21a0244578e71e427ebd0c410825 /tools/bugpoint/BugDriver.h
parent18fda6d7c343afd5970bd26cfc4a80fa4503cc84 (diff)
downloadllvm-218e26ef3583cc3270f5f2a2b9cb1025e5b05ebe.tar.gz
llvm-218e26ef3583cc3270f5f2a2b9cb1025e5b05ebe.tar.bz2
llvm-218e26ef3583cc3270f5f2a2b9cb1025e5b05ebe.tar.xz
Implement the start of the miscompilation detection stuff
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5119 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint/BugDriver.h')
-rw-r--r--tools/bugpoint/BugDriver.h47
1 files changed, 39 insertions, 8 deletions
diff --git a/tools/bugpoint/BugDriver.h b/tools/bugpoint/BugDriver.h
index f419249afa..6398366d8c 100644
--- a/tools/bugpoint/BugDriver.h
+++ b/tools/bugpoint/BugDriver.h
@@ -14,13 +14,18 @@
class PassInfo;
class Module;
class Function;
+class AbstractInterpreter;
class BugDriver {
const std::string ToolName; // Name of bugpoint
Module *Program; // The raw program, linked together
std::vector<const PassInfo*> PassesToRun;
+ AbstractInterpreter *Interpreter; // How to run the program
public:
- BugDriver(const char *toolname) : ToolName(toolname), Program(0) {}
+ BugDriver(const char *toolname)
+ : ToolName(toolname), Program(0), Interpreter(0) {}
+
+ const std::string &getToolName() const { return ToolName; }
// Set up methods... these methods are used to copy information about the
// command line arguments into instance variables of BugDriver.
@@ -51,20 +56,25 @@ public:
/// input.
bool debugMiscompilation();
+ /// debugPassMiscompilation - This method is called when the specified pass
+ /// miscompiles Program as input. It tries to reduce the testcase to
+ /// something that smaller that still miscompiles the program.
+ /// ReferenceOutput contains the filename of the file containing the output we
+ /// are to match.
+ ///
+ bool debugPassMiscompilation(const PassInfo *ThePass,
+ const std::string &ReferenceOutput);
+
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;
- /// removeFile - Delete the specified file
- ///
- void removeFile(const std::string &Filename) 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) const;
+ bool writeProgramToFile(const std::string &Filename, Module *M = 0) const;
/// EmitProgressBytecode - This function is used to output the current Program
@@ -78,10 +88,11 @@ private:
/// otherwise return false. If DeleteOutput is set to true, the bytecode is
/// deleted on success, and the filename string is undefined. This prints to
/// cout a single line message indicating whether compilation was successful
- /// or failed.
+ /// or failed, unless Quiet is set.
///
bool runPasses(const std::vector<const PassInfo*> &PassesToRun,
- std::string &OutputFilename, bool DeleteOutput = false) const;
+ std::string &OutputFilename, bool DeleteOutput = false,
+ bool Quiet = false) const;
/// runPasses - Just like the method above, but this just returns true or
/// false indicating whether or not the optimizer crashed on the specified
@@ -94,6 +105,7 @@ private:
}
/// runPass - Run only the specified pass on the program.
+ ///
bool runPass(const PassInfo *P, bool DeleteOutput = true) const {
return runPasses(std::vector<const PassInfo*>(1, P), DeleteOutput);
}
@@ -102,8 +114,27 @@ private:
/// (non-external) function from the current program, slim down the module,
/// and then return it. This does not modify Program at all, it modifies a
/// copy, which it returns.
+ ///
Module *extractFunctionFromModule(Function *F) const;
+ /// initializeExecutionEnvironment - This method is used to set up the
+ /// environment for executing LLVM programs.
+ ///
+ bool initializeExecutionEnvironment();
+
+ /// executeProgram - This method runs "Program", capturing the output of the
+ /// program to a file, returning the filename of the file. A recommended
+ /// filename may be optionally specified.
+ ///
+ std::string executeProgram(std::string RequestedOutputFilename = "",
+ std::string Bytecode = "");
+
+ /// 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 &ReferenceOutputFile,
+ const std::string &BytecodeFile = "");
};
#endif