+
+ switch (InterpreterSel) {
+ case AutoPick:
+ InterpreterSel = RunCBE;
+ Interpreter =
+ AbstractInterpreter::createCBE(getToolName(), Message, GCCBinary,
+ &ToolArgv, &GCCToolArgv);
+ if (!Interpreter) {
+ InterpreterSel = RunJIT;
+ Interpreter = AbstractInterpreter::createJIT(getToolName(), Message,
+ &ToolArgv);
+ }
+ if (!Interpreter) {
+ InterpreterSel = RunLLC;
+ Interpreter = AbstractInterpreter::createLLC(getToolName(), Message,
+ GCCBinary, &ToolArgv,
+ &GCCToolArgv);
+ }
+ if (!Interpreter) {
+ InterpreterSel = RunLLI;
+ Interpreter = AbstractInterpreter::createLLI(getToolName(), Message,
+ &ToolArgv);
+ }
+ if (!Interpreter) {
+ InterpreterSel = AutoPick;
+ Message = "Sorry, I can't automatically select an interpreter!\n";
+ }
+ break;
+ case RunLLI:
+ Interpreter = AbstractInterpreter::createLLI(getToolName(), Message,
+ &ToolArgv);
+ break;
+ case RunLLC:
+ case RunLLCIA:
+ case LLC_Safe:
+ Interpreter = AbstractInterpreter::createLLC(getToolName(), Message,
+ GCCBinary, &ToolArgv,
+ &GCCToolArgv,
+ InterpreterSel == RunLLCIA);
+ break;
+ case RunJIT:
+ Interpreter = AbstractInterpreter::createJIT(getToolName(), Message,
+ &ToolArgv);
+ break;
+ case RunCBE:
+ case CBE_bug:
+ Interpreter = AbstractInterpreter::createCBE(getToolName(), Message,
+ GCCBinary, &ToolArgv,
+ &GCCToolArgv);
+ break;
+ case CompileCustom:
+ Interpreter =
+ AbstractInterpreter::createCustomCompiler(Message, CustomCompileCommand);
+ break;
+ case Custom:
+ Interpreter =
+ AbstractInterpreter::createCustomExecutor(Message, CustomExecCommand);
+ break;
+ default:
+ Message = "Sorry, this back-end is not supported by bugpoint right now!\n";
+ break;
+ }
+ if (!Interpreter)
+ errs() << Message;
+ else // Display informational messages on stdout instead of stderr
+ outs() << Message;
+
+ std::string Path = SafeInterpreterPath;
+ if (Path.empty())
+ Path = getToolName();
+ std::vector<std::string> SafeToolArgs = SafeToolArgv;
+ switch (SafeInterpreterSel) {
+ case AutoPick:
+ // In "cbe-bug" mode, default to using LLC as the "safe" backend.
+ if (!SafeInterpreter &&
+ InterpreterSel == CBE_bug) {
+ SafeInterpreterSel = RunLLC;
+ SafeToolArgs.push_back("--relocation-model=pic");
+ SafeInterpreter = AbstractInterpreter::createLLC(Path.c_str(), Message,
+ GCCBinary,
+ &SafeToolArgs,
+ &GCCToolArgv);
+ }
+
+ // In "llc-safe" mode, default to using LLC as the "safe" backend.
+ if (!SafeInterpreter &&
+ InterpreterSel == LLC_Safe) {
+ SafeInterpreterSel = RunLLC;
+ SafeToolArgs.push_back("--relocation-model=pic");
+ SafeInterpreter = AbstractInterpreter::createLLC(Path.c_str(), Message,
+ GCCBinary,
+ &SafeToolArgs,
+ &GCCToolArgv);
+ }
+
+ // Pick a backend that's different from the test backend. The JIT and
+ // LLC backends share a lot of code, so prefer to use the CBE as the
+ // safe back-end when testing them.
+ if (!SafeInterpreter &&
+ InterpreterSel != RunCBE) {
+ SafeInterpreterSel = RunCBE;
+ SafeInterpreter = AbstractInterpreter::createCBE(Path.c_str(), Message,
+ GCCBinary,
+ &SafeToolArgs,
+ &GCCToolArgv);
+ }
+ if (!SafeInterpreter &&
+ InterpreterSel != RunLLC &&
+ InterpreterSel != RunJIT) {
+ SafeInterpreterSel = RunLLC;
+ SafeToolArgs.push_back("--relocation-model=pic");
+ SafeInterpreter = AbstractInterpreter::createLLC(Path.c_str(), Message,
+ GCCBinary,
+ &SafeToolArgs,
+ &GCCToolArgv);
+ }
+ if (!SafeInterpreter) {
+ SafeInterpreterSel = AutoPick;
+ Message = "Sorry, I can't automatically select an interpreter!\n";
+ }
+ break;
+ case RunLLC:
+ case RunLLCIA:
+ SafeToolArgs.push_back("--relocation-model=pic");
+ SafeInterpreter = AbstractInterpreter::createLLC(Path.c_str(), Message,
+ GCCBinary, &SafeToolArgs,
+ &GCCToolArgv,
+ SafeInterpreterSel == RunLLCIA);
+ break;
+ case RunCBE:
+ SafeInterpreter = AbstractInterpreter::createCBE(Path.c_str(), Message,
+ GCCBinary, &SafeToolArgs,
+ &GCCToolArgv);
+ break;
+ case Custom:
+ SafeInterpreter =
+ AbstractInterpreter::createCustomExecutor(Message, CustomExecCommand);
+ break;
+ default:
+ Message = "Sorry, this back-end is not supported by bugpoint as the "
+ "\"safe\" backend right now!\n";
+ break;