+ // 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,
+ &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,
+ &SafeToolArgs,
+ &GCCToolArgv);
+ }
+ if (!SafeInterpreter &&
+ InterpreterSel != RunLLC &&
+ InterpreterSel != RunJIT) {
+ SafeInterpreterSel = RunLLC;
+ SafeToolArgs.push_back("--relocation-model=pic");
+ SafeInterpreter = AbstractInterpreter::createLLC(Path.c_str(), Message,
+ &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,
+ &SafeToolArgs,
+ &GCCToolArgv,
+ SafeInterpreterSel == RunLLCIA);
+ break;
+ case RunCBE:
+ SafeInterpreter = AbstractInterpreter::createCBE(Path.c_str(), Message,
+ &SafeToolArgs,
+ &GCCToolArgv);
+ break;
+ case Custom:
+ SafeInterpreter = AbstractInterpreter::createCustom(Message,
+ CustomExecCommand);
+ break;
+ default:
+ Message = "Sorry, this back-end is not supported by bugpoint as the "
+ "\"safe\" backend right now!\n";
+ break;
+ }
+ if (!SafeInterpreter) { outs() << Message << "\nExiting.\n"; exit(1); }
+
+ gcc = GCC::create(Message, &GCCToolArgv);
+ if (!gcc) { outs() << Message << "\nExiting.\n"; exit(1); }