aboutsummaryrefslogtreecommitdiffstats
path: root/tools/bugpoint/ToolRunner.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-09-15 21:29:15 +0000
committerChris Lattner <sabre@nondot.org>2006-09-15 21:29:15 +0000
commitc600f3c337f18c62116ac58b701e4f7ae6d2fb1a (patch)
treec49a64394e4f4a1c963d585efc2b056ce8fb4c6b /tools/bugpoint/ToolRunner.cpp
parentcbce2f6c1b5b63b16b856f80e6fc026764b4eab4 (diff)
downloadexternal_llvm-c600f3c337f18c62116ac58b701e4f7ae6d2fb1a.zip
external_llvm-c600f3c337f18c62116ac58b701e4f7ae6d2fb1a.tar.gz
external_llvm-c600f3c337f18c62116ac58b701e4f7ae6d2fb1a.tar.bz2
Add a new -cbe-bug mode, which works just like -run-llc, except that it uses
LLC as the reference compiler to reduce testcases for bugs in GCC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30400 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint/ToolRunner.cpp')
-rw-r--r--tools/bugpoint/ToolRunner.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/tools/bugpoint/ToolRunner.cpp b/tools/bugpoint/ToolRunner.cpp
index 589f515..bcade20 100644
--- a/tools/bugpoint/ToolRunner.cpp
+++ b/tools/bugpoint/ToolRunner.cpp
@@ -37,6 +37,13 @@ static int RunProgramWithTimeout(const sys::Path &ProgramPath,
redirects[0] = &StdInFile;
redirects[1] = &StdOutFile;
redirects[2] = &StdErrFile;
+
+{
+ std::cerr << "RUN:";
+ for (unsigned i = 0; Args[i]; ++i)
+ std::cerr << " " << Args[i];
+ std::cerr << "\n";
+}
return
sys::Program::ExecuteAndWait(ProgramPath, Args, 0, redirects, NumSeconds);
@@ -155,7 +162,8 @@ AbstractInterpreter *AbstractInterpreter::createLLI(const std::string &ProgPath,
//===----------------------------------------------------------------------===//
// LLC Implementation of AbstractIntepreter interface
//
-void LLC::OutputAsm(const std::string &Bytecode, sys::Path &OutputAsmFile) {
+GCC::FileType LLC::OutputCode(const std::string &Bytecode,
+ sys::Path &OutputAsmFile) {
sys::Path uniqueFile(Bytecode+".llc.s");
std::string ErrMsg;
if (uniqueFile.makeUnique(true, &ErrMsg)) {
@@ -185,11 +193,13 @@ void LLC::OutputAsm(const std::string &Bytecode, sys::Path &OutputAsmFile) {
if (RunProgramWithTimeout(sys::Path(LLCPath), &LLCArgs[0],
sys::Path(), sys::Path(), sys::Path()))
ProcessFailure(sys::Path(LLCPath), &LLCArgs[0]);
+
+ return GCC::AsmFile;
}
void LLC::compileProgram(const std::string &Bytecode) {
sys::Path OutputAsmFile;
- OutputAsm(Bytecode, OutputAsmFile);
+ OutputCode(Bytecode, OutputAsmFile);
OutputAsmFile.eraseFromDisk();
}
@@ -202,7 +212,7 @@ int LLC::ExecuteProgram(const std::string &Bytecode,
unsigned Timeout) {
sys::Path OutputAsmFile;
- OutputAsm(Bytecode, OutputAsmFile);
+ OutputCode(Bytecode, OutputAsmFile);
FileRemover OutFileRemover(OutputAsmFile);
std::vector<std::string> GCCArgs(ArgsForGCC);
@@ -313,7 +323,8 @@ AbstractInterpreter *AbstractInterpreter::createJIT(const std::string &ProgPath,
return 0;
}
-void CBE::OutputC(const std::string &Bytecode, sys::Path& OutputCFile) {
+GCC::FileType CBE::OutputCode(const std::string &Bytecode,
+ sys::Path &OutputCFile) {
sys::Path uniqueFile(Bytecode+".cbe.c");
std::string ErrMsg;
if (uniqueFile.makeUnique(true, &ErrMsg)) {
@@ -344,11 +355,12 @@ void CBE::OutputC(const std::string &Bytecode, sys::Path& OutputCFile) {
if (RunProgramWithTimeout(LLCPath, &LLCArgs[0], sys::Path(), sys::Path(),
sys::Path()))
ProcessFailure(LLCPath, &LLCArgs[0]);
+ return GCC::CFile;
}
void CBE::compileProgram(const std::string &Bytecode) {
sys::Path OutputCFile;
- OutputC(Bytecode, OutputCFile);
+ OutputCode(Bytecode, OutputCFile);
OutputCFile.eraseFromDisk();
}
@@ -360,7 +372,7 @@ int CBE::ExecuteProgram(const std::string &Bytecode,
const std::vector<std::string> &SharedLibs,
unsigned Timeout) {
sys::Path OutputCFile;
- OutputC(Bytecode, OutputCFile);
+ OutputCode(Bytecode, OutputCFile);
FileRemover CFileRemove(OutputCFile);