diff options
author | Bill Wendling <isanbard@gmail.com> | 2009-03-02 23:13:18 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2009-03-02 23:13:18 +0000 |
commit | 38efa38c864f6d29892d92102c0232b234b526ed (patch) | |
tree | d121f75ee3af7dcfdceb4695f4a3c1e8ac445909 /tools/bugpoint/ToolRunner.cpp | |
parent | 0b82f77e662790ab3c230932f5309c5105812c26 (diff) | |
download | external_llvm-38efa38c864f6d29892d92102c0232b234b526ed.zip external_llvm-38efa38c864f6d29892d92102c0232b234b526ed.tar.gz external_llvm-38efa38c864f6d29892d92102c0232b234b526ed.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65896 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint/ToolRunner.cpp')
-rw-r--r-- | tools/bugpoint/ToolRunner.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/tools/bugpoint/ToolRunner.cpp b/tools/bugpoint/ToolRunner.cpp index f6a151c..7c669ef 100644 --- a/tools/bugpoint/ToolRunner.cpp +++ b/tools/bugpoint/ToolRunner.cpp @@ -344,7 +344,8 @@ int LLC::ExecuteProgram(const std::string &Bitcode, FileRemover OutFileRemover(OutputAsmFile); std::vector<std::string> GCCArgs(ArgsForGCC); - GCCArgs.insert(GCCArgs.end(),SharedLibs.begin(),SharedLibs.end()); + GCCArgs.insert(GCCArgs.end(), SharedLibs.begin(), SharedLibs.end()); + GCCArgs.insert(GCCArgs.end(), gccArgs.begin(), gccArgs.end()); // Assuming LLC worked, compile the result with GCC and run it. return gcc->ExecuteProgram(OutputAsmFile.toString(), Args, GCC::AsmFile, @@ -356,7 +357,8 @@ int LLC::ExecuteProgram(const std::string &Bitcode, /// LLC *AbstractInterpreter::createLLC(const std::string &ProgramPath, std::string &Message, - const std::vector<std::string> *Args) { + const std::vector<std::string> *Args, + const std::vector<std::string> *GCCArgs) { std::string LLCPath = FindExecutable("llc", ProgramPath).toString(); if (LLCPath.empty()) { Message = "Cannot find `llc' in executable directory or PATH!\n"; @@ -364,12 +366,12 @@ LLC *AbstractInterpreter::createLLC(const std::string &ProgramPath, } Message = "Found llc: " + LLCPath + "\n"; - GCC *gcc = GCC::create(ProgramPath, Message); + GCC *gcc = GCC::create(ProgramPath, Message, GCCArgs); if (!gcc) { std::cerr << Message << "\n"; exit(1); } - return new LLC(LLCPath, gcc, Args); + return new LLC(LLCPath, gcc, Args, GCCArgs); } //===---------------------------------------------------------------------===// @@ -509,7 +511,8 @@ int CBE::ExecuteProgram(const std::string &Bitcode, FileRemover CFileRemove(OutputCFile); std::vector<std::string> GCCArgs(ArgsForGCC); - GCCArgs.insert(GCCArgs.end(),SharedLibs.begin(),SharedLibs.end()); + GCCArgs.insert(GCCArgs.end(), SharedLibs.begin(), SharedLibs.end()); + return gcc->ExecuteProgram(OutputCFile.toString(), Args, GCC::CFile, InputFile, OutputFile, GCCArgs, Timeout, MemoryLimit); @@ -519,7 +522,8 @@ int CBE::ExecuteProgram(const std::string &Bitcode, /// CBE *AbstractInterpreter::createCBE(const std::string &ProgramPath, std::string &Message, - const std::vector<std::string> *Args) { + const std::vector<std::string> *Args, + const std::vector<std::string> *GCCArgs) { sys::Path LLCPath = FindExecutable("llc", ProgramPath); if (LLCPath.isEmpty()) { Message = @@ -528,7 +532,7 @@ CBE *AbstractInterpreter::createCBE(const std::string &ProgramPath, } Message = "Found llc: " + LLCPath.toString() + "\n"; - GCC *gcc = GCC::create(ProgramPath, Message); + GCC *gcc = GCC::create(ProgramPath, Message, GCCArgs); if (!gcc) { std::cerr << Message << "\n"; exit(1); @@ -551,6 +555,10 @@ int GCC::ExecuteProgram(const std::string &ProgramFile, GCCArgs.push_back(GCCPath.c_str()); + for (std::vector<std::string>::const_iterator + I = gccArgs.begin(), E = gccArgs.end(); I != E; ++I) + GCCArgs.push_back(I->c_str()); + // Specify -x explicitly in case the extension is wonky GCCArgs.push_back("-x"); if (fileType == CFile) { @@ -725,7 +733,8 @@ int GCC::MakeSharedObject(const std::string &InputFile, FileType fileType, /// create - Try to find the `gcc' executable /// -GCC *GCC::create(const std::string &ProgramPath, std::string &Message) { +GCC *GCC::create(const std::string &ProgramPath, std::string &Message, + const std::vector<std::string> *Args) { sys::Path GCCPath = FindExecutable("gcc", ProgramPath); if (GCCPath.isEmpty()) { Message = "Cannot find `gcc' in executable directory or PATH!\n"; @@ -737,5 +746,5 @@ GCC *GCC::create(const std::string &ProgramPath, std::string &Message) { RemoteClientPath = FindExecutable(RemoteClient.c_str(), ProgramPath); Message = "Found gcc: " + GCCPath.toString() + "\n"; - return new GCC(GCCPath, RemoteClientPath); + return new GCC(GCCPath, RemoteClientPath, Args); } |