#include "BugDriver.h"
#include "SystemUtils.h"
#include "Support/CommandLine.h"
+#include "Support/Statistic.h"
#include <fstream>
#include <iostream>
0
};
+ std::cout << "<lli>";
return RunProgramWithTimeout(LLIPath, Args,
InputFile, OutputFile, OutputFile);
}
//===----------------------------------------------------------------------===//
-// GCC Implementation of AbstractIntepreter interface
+// GCC abstraction
//
// This is not a *real* AbstractInterpreter as it does not accept bytecode
// files, but only input acceptable to GCC, i.e. C, C++, and assembly files
FileType fileType,
const std::string &OutputFile,
const std::string &SharedLib) {
- std::string OutputBinary = "bugpoint.gcc.exe";
+ std::string OutputBinary = getUniqueFilename("bugpoint.gcc.exe");
const char **GCCArgs;
const char *ArgsWithoutSO[] = {
};
const char *ArgsWithSO[] = {
GCCPath.c_str(),
+ SharedLib.c_str(), // Specify the shared library to link in...
"-x", (fileType == AsmFile) ? "assembler" : "c",
ProgramFile.c_str(), // Specify the input filename...
- SharedLib.c_str(), // Specify the shared library to link in...
"-o", OutputBinary.c_str(), // Output to the right filename...
"-lm", // Hard-code the math library...
"-O2", // Optimize the program a bit...
0
};
- std::cout << "<program>";
-
// Now that we have a binary, run it!
+ std::cout << "<program>";
int ProgramResult = RunProgramWithTimeout(OutputBinary, ProgramArgs,
InputFile, OutputFile, OutputFile);
std::cout << "\n";
int GCC::MakeSharedObject(const std::string &InputFile,
FileType fileType,
std::string &OutputFile) {
- OutputFile = "./bugpoint.so";
+ OutputFile = getUniqueFilename("./bugpoint.so");
// Compile the C/asm file into a shared object
const char* GCCArgs[] = {
GCCPath.c_str(),
int OutputAsm(const std::string &Bytecode,
std::string &OutputAsmFile);
-
};
int LLC::OutputAsm(const std::string &Bytecode,
int JIT::ExecuteProgram(const std::string &Bytecode,
const std::string &OutputFile,
const std::string &SharedLib) {
- if (SharedLib.empty()) {
- const char* Args[] = {
- LLIPath.c_str(),
- "-quiet",
- "-force-interpreter=false",
- Bytecode.c_str(),
- 0
- };
- return RunProgramWithTimeout(LLIPath, Args,
- InputFile, OutputFile, OutputFile);
- } else {
- const char* Args[] = {
- LLIPath.c_str(), "-quiet", "-force-interpreter=false",
- "-load", SharedLib.c_str(),
- Bytecode.c_str(),
- 0
- };
- return RunProgramWithTimeout(LLIPath, Args,
- InputFile, OutputFile, OutputFile);
- }
+ const char* ArgsWithoutSO[] = {
+ LLIPath.c_str(), "-quiet", "-force-interpreter=false",
+ Bytecode.c_str(),
+ 0
+ };
+
+ const char* ArgsWithSO[] = {
+ LLIPath.c_str(), "-quiet", "-force-interpreter=false",
+ "-load", SharedLib.c_str(),
+ Bytecode.c_str(),
+ 0
+ };
+
+ const char** JITArgs = SharedLib.empty() ? ArgsWithoutSO : ArgsWithSO;
+
+ std::cout << "<jit>";
+ DEBUG(std::cerr << "\nSending output to " << OutputFile << "\n");
+ return RunProgramWithTimeout(LLIPath, JITArgs,
+ InputFile, OutputFile, OutputFile);
}
//===----------------------------------------------------------------------===//
if (C1 != C2) { FilesDifferent = true; break; }
} while (C1 != EOF);
- removeFile(Output);
+ //removeFile(Output);
if (RemoveBytecode) removeFile(BytecodeFile);
return FilesDifferent;
}
+
+bool BugDriver::isExecutingJIT() {
+ return InterpreterSel == RunJIT;
+}