1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

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.

llvm-svn: 9337
This commit is contained in:
Brian Gaeke 2003-10-21 17:41:35 +00:00
parent 5f4ed13cb9
commit 4034694fef

View File

@ -35,17 +35,18 @@ namespace {
// for miscompilation. // for miscompilation.
// //
enum OutputType { enum OutputType {
RunLLI, RunJIT, RunLLC, RunCBE AutoPick, RunLLI, RunJIT, RunLLC, RunCBE
}; };
cl::opt<OutputType> cl::opt<OutputType>
InterpreterSel(cl::desc("Specify how LLVM code should be executed:"), 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(RunJIT, "run-jit", "Execute with JIT"),
clEnumValN(RunLLC, "run-llc", "Compile with LLC"), clEnumValN(RunLLC, "run-llc", "Compile with LLC"),
clEnumValN(RunCBE, "run-cbe", "Compile with CBE"), clEnumValN(RunCBE, "run-cbe", "Compile with CBE"),
0), 0),
cl::init(RunCBE)); cl::init(AutoPick));
cl::opt<std::string> cl::opt<std::string>
InputFile("input", cl::init("/dev/null"), InputFile("input", cl::init("/dev/null"),
@ -73,13 +74,30 @@ InputArgv("args", cl::Positional, cl::desc("<program arguments>..."),
bool BugDriver::initializeExecutionEnvironment() { bool BugDriver::initializeExecutionEnvironment() {
std::cout << "Initializing execution environment: "; 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 // Create an instance of the AbstractInterpreter interface as specified on
// the command line // the command line
std::string Message; std::string Message;
switch (InterpreterSel) { 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: case RunLLI:
Interpreter = AbstractInterpreter::createLLI(getToolName(), Message); Interpreter = AbstractInterpreter::createLLI(getToolName(), Message);
break; break;