summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBrian Gaeke <gaeke@uiuc.edu>2003-10-21 17:41:35 +0000
committerBrian Gaeke <gaeke@uiuc.edu>2003-10-21 17:41:35 +0000
commitb5ee509be2ce78badc11fd649dda90ec78394d1a (patch)
treeacc38c95da3aed52fcdd30f72bf5498d0b99a3e5 /tools
parent2765c41c98f8108f704977e73763f2f4d790a882 (diff)
downloadllvm-b5ee509be2ce78badc11fd649dda90ec78394d1a.tar.gz
llvm-b5ee509be2ce78badc11fd649dda90ec78394d1a.tar.bz2
llvm-b5ee509be2ce78badc11fd649dda90ec78394d1a.tar.xz
Fix the first FIXME in this file: automatically pick a "good"
interpreter by default, by picking the first one that works from a hard-coded list. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9337 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/bugpoint/ExecutionDriver.cpp30
1 files changed, 24 insertions, 6 deletions
diff --git a/tools/bugpoint/ExecutionDriver.cpp b/tools/bugpoint/ExecutionDriver.cpp
index 17f377c7e0..596aeb95a8 100644
--- a/tools/bugpoint/ExecutionDriver.cpp
+++ b/tools/bugpoint/ExecutionDriver.cpp
@@ -35,17 +35,18 @@ namespace {
// for miscompilation.
//
enum OutputType {
- RunLLI, RunJIT, RunLLC, RunCBE
+ AutoPick, RunLLI, RunJIT, RunLLC, RunCBE
};
cl::opt<OutputType>
InterpreterSel(cl::desc("Specify how LLVM code should be executed:"),
- cl::values(clEnumValN(RunLLI, "run-int", "Execute with the interpreter"),
+ cl::values(clEnumValN(AutoPick, "auto", "Use best guess"),
+ clEnumValN(RunLLI, "run-int", "Execute with the interpreter"),
clEnumValN(RunJIT, "run-jit", "Execute with JIT"),
clEnumValN(RunLLC, "run-llc", "Compile with LLC"),
clEnumValN(RunCBE, "run-cbe", "Compile with CBE"),
0),
- cl::init(RunCBE));
+ cl::init(AutoPick));
cl::opt<std::string>
InputFile("input", cl::init("/dev/null"),
@@ -73,13 +74,30 @@ InputArgv("args", cl::Positional, cl::desc("<program arguments>..."),
bool BugDriver::initializeExecutionEnvironment() {
std::cout << "Initializing execution environment: ";
- // FIXME: This should default to searching for the best interpreter to use on
- // this platform, which would be JIT, then LLC, then CBE, then LLI.
-
// Create an instance of the AbstractInterpreter interface as specified on
// the command line
std::string Message;
switch (InterpreterSel) {
+ case AutoPick:
+ InterpreterSel = RunCBE;
+ Interpreter = AbstractInterpreter::createCBE(getToolName(), Message);
+ if (!Interpreter) {
+ InterpreterSel = RunJIT;
+ Interpreter = AbstractInterpreter::createJIT(getToolName(), Message);
+ }
+ if (!Interpreter) {
+ InterpreterSel = RunLLC;
+ Interpreter = AbstractInterpreter::createLLC(getToolName(), Message);
+ }
+ if (!Interpreter) {
+ InterpreterSel = RunLLI;
+ Interpreter = AbstractInterpreter::createLLI(getToolName(), Message);
+ }
+ if (!Interpreter) {
+ InterpreterSel = AutoPick;
+ Message = "Sorry, I can't automatically select an interpreter!\n";
+ }
+ break;
case RunLLI:
Interpreter = AbstractInterpreter::createLLI(getToolName(), Message);
break;