From bf5d82719494cee10ee543d82c7fb28e4be07ccc Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Mon, 2 Mar 2009 23:13:18 +0000 Subject: Add a "-gcc-tool-args" option. This option acts like the "-tool-args" option, but passes the arguments to the "gcc" invocation instead of to the "llc" invocation. llvm-svn: 65896 --- llvm/tools/bugpoint/ExecutionDriver.cpp | 36 ++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'llvm/tools/bugpoint/ExecutionDriver.cpp') diff --git a/llvm/tools/bugpoint/ExecutionDriver.cpp b/llvm/tools/bugpoint/ExecutionDriver.cpp index b3c802032d5..640fe2829ae 100644 --- a/llvm/tools/bugpoint/ExecutionDriver.cpp +++ b/llvm/tools/bugpoint/ExecutionDriver.cpp @@ -111,6 +111,11 @@ namespace { SafeToolArgv("safe-tool-args", cl::Positional, cl::desc("..."), cl::ZeroOrMore, cl::PositionalEatsArgs); + + cl::list + GCCToolArgv("gcc-tool-args", cl::Positional, + cl::desc("..."), + cl::ZeroOrMore, cl::PositionalEatsArgs); } //===----------------------------------------------------------------------===// @@ -132,7 +137,8 @@ bool BugDriver::initializeExecutionEnvironment() { case AutoPick: InterpreterSel = RunCBE; Interpreter = - AbstractInterpreter::createCBE(getToolName(), Message, &ToolArgv); + AbstractInterpreter::createCBE(getToolName(), Message, &ToolArgv, + &GCCToolArgv); if (!Interpreter) { InterpreterSel = RunJIT; Interpreter = AbstractInterpreter::createJIT(getToolName(), Message, @@ -141,7 +147,7 @@ bool BugDriver::initializeExecutionEnvironment() { if (!Interpreter) { InterpreterSel = RunLLC; Interpreter = AbstractInterpreter::createLLC(getToolName(), Message, - &ToolArgv); + &ToolArgv, &GCCToolArgv); } if (!Interpreter) { InterpreterSel = RunLLI; @@ -160,7 +166,7 @@ bool BugDriver::initializeExecutionEnvironment() { case RunLLC: case LLC_Safe: Interpreter = AbstractInterpreter::createLLC(getToolName(), Message, - &ToolArgv); + &ToolArgv, &GCCToolArgv); break; case RunJIT: Interpreter = AbstractInterpreter::createJIT(getToolName(), Message, @@ -169,7 +175,7 @@ bool BugDriver::initializeExecutionEnvironment() { case RunCBE: case CBE_bug: Interpreter = AbstractInterpreter::createCBE(getToolName(), Message, - &ToolArgv); + &ToolArgv, &GCCToolArgv); break; case Custom: Interpreter = AbstractInterpreter::createCustom(getToolName(), Message, @@ -196,7 +202,8 @@ bool BugDriver::initializeExecutionEnvironment() { SafeInterpreterSel = RunLLC; SafeToolArgs.push_back("--relocation-model=pic"); SafeInterpreter = AbstractInterpreter::createLLC(Path, Message, - &SafeToolArgs); + &SafeToolArgs, + &GCCToolArgv); } // In "llc-safe" mode, default to using LLC as the "safe" backend. @@ -205,7 +212,8 @@ bool BugDriver::initializeExecutionEnvironment() { SafeInterpreterSel = RunLLC; SafeToolArgs.push_back("--relocation-model=pic"); SafeInterpreter = AbstractInterpreter::createLLC(Path, Message, - &SafeToolArgs); + &SafeToolArgs, + &GCCToolArgv); } // Pick a backend that's different from the test backend. The JIT and @@ -215,7 +223,8 @@ bool BugDriver::initializeExecutionEnvironment() { InterpreterSel != RunCBE) { SafeInterpreterSel = RunCBE; SafeInterpreter = AbstractInterpreter::createCBE(Path, Message, - &SafeToolArgs); + &SafeToolArgs, + &GCCToolArgv); } if (!SafeInterpreter && InterpreterSel != RunLLC && @@ -223,7 +232,8 @@ bool BugDriver::initializeExecutionEnvironment() { SafeInterpreterSel = RunLLC; SafeToolArgs.push_back("--relocation-model=pic"); SafeInterpreter = AbstractInterpreter::createLLC(Path, Message, - &SafeToolArgs); + &SafeToolArgs, + &GCCToolArgv); } if (!SafeInterpreter) { SafeInterpreterSel = AutoPick; @@ -233,11 +243,13 @@ bool BugDriver::initializeExecutionEnvironment() { case RunLLC: SafeToolArgs.push_back("--relocation-model=pic"); SafeInterpreter = AbstractInterpreter::createLLC(Path, Message, - &SafeToolArgs); + &SafeToolArgs, + &GCCToolArgv); break; case RunCBE: SafeInterpreter = AbstractInterpreter::createCBE(Path, Message, - &SafeToolArgs); + &SafeToolArgs, + &GCCToolArgv); break; case Custom: SafeInterpreter = AbstractInterpreter::createCustom(Path, Message, @@ -250,7 +262,7 @@ bool BugDriver::initializeExecutionEnvironment() { } if (!SafeInterpreter) { std::cout << Message << "\nExiting.\n"; exit(1); } - gcc = GCC::create(getToolName(), Message); + gcc = GCC::create(getToolName(), Message, &GCCToolArgv); if (!gcc) { std::cout << Message << "\nExiting.\n"; exit(1); } // If there was an error creating the selected interpreter, quit with error. @@ -406,7 +418,7 @@ bool BugDriver::createReferenceFile(Module *M, const std::string &Filename) { } try { ReferenceOutputFile = executeProgramSafely(Filename); - std::cout << "Reference output is: " << ReferenceOutputFile << "\n\n"; + std::cout << "\nReference output is: " << ReferenceOutputFile << "\n\n"; } catch (ToolExecutionError &TEE) { std::cerr << TEE.what(); if (Interpreter != SafeInterpreter) { -- cgit v1.2.3