Chris Lattner | f1b20d8 | 2006-06-06 22:30:59 +0000 | [diff] [blame] | 1 | //===-- tools/bugpoint/ToolRunner.h -----------------------------*- C++ -*-===// |
Misha Brukman | 63b3afa | 2005-04-21 20:48:15 +0000 | [diff] [blame] | 2 | // |
John Criswell | 6fbcc26 | 2003-10-20 20:19:47 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 21c62da | 2007-12-29 20:44:31 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Misha Brukman | 63b3afa | 2005-04-21 20:48:15 +0000 | [diff] [blame] | 7 | // |
John Criswell | 6fbcc26 | 2003-10-20 20:19:47 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
Chris Lattner | f474449 | 2003-09-30 18:28:53 +0000 | [diff] [blame] | 9 | // |
Chris Lattner | 7915a1e | 2003-10-14 21:34:11 +0000 | [diff] [blame] | 10 | // This file exposes an abstraction around a platform C compiler, used to |
| 11 | // compile C and assembly code. It also exposes an "AbstractIntepreter" |
| 12 | // interface, which is used to execute code using one of the LLVM execution |
| 13 | // engines. |
Chris Lattner | f474449 | 2003-09-30 18:28:53 +0000 | [diff] [blame] | 14 | // |
| 15 | //===----------------------------------------------------------------------===// |
| 16 | |
Chris Lattner | f1b20d8 | 2006-06-06 22:30:59 +0000 | [diff] [blame] | 17 | #ifndef BUGPOINT_TOOLRUNNER_H |
| 18 | #define BUGPOINT_TOOLRUNNER_H |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 19 | |
Daniel Dunbar | ca74096 | 2009-08-18 03:35:57 +0000 | [diff] [blame] | 20 | #include "llvm/ADT/Triple.h" |
Anton Korobeynikov | 86c006a | 2009-08-05 09:32:10 +0000 | [diff] [blame] | 21 | #include "llvm/Support/CommandLine.h" |
Nick Lewycky | 22ff748 | 2010-04-12 05:08:25 +0000 | [diff] [blame] | 22 | #include "llvm/Support/ErrorHandling.h" |
Reid Spencer | 551ccae | 2004-09-01 22:55:40 +0000 | [diff] [blame] | 23 | #include "llvm/Support/SystemUtils.h" |
Michael J. Spencer | 1f6efa3 | 2010-11-29 18:16:10 +0000 | [diff] [blame] | 24 | #include "llvm/Support/Path.h" |
Alkis Evlogimenos | 1d29a6d | 2004-02-19 07:39:26 +0000 | [diff] [blame] | 25 | #include <exception> |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 26 | #include <vector> |
| 27 | |
Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 28 | namespace llvm { |
| 29 | |
Anton Korobeynikov | 86c006a | 2009-08-05 09:32:10 +0000 | [diff] [blame] | 30 | extern cl::opt<bool> SaveTemps; |
Daniel Dunbar | ca74096 | 2009-08-18 03:35:57 +0000 | [diff] [blame] | 31 | extern Triple TargetTriple; |
Anton Korobeynikov | 86c006a | 2009-08-05 09:32:10 +0000 | [diff] [blame] | 32 | |
Chris Lattner | 7915a1e | 2003-10-14 21:34:11 +0000 | [diff] [blame] | 33 | class CBE; |
| 34 | class LLC; |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 35 | |
| 36 | //===---------------------------------------------------------------------===// |
| 37 | // GCC abstraction |
| 38 | // |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 39 | class GCC { |
Bill Wendling | 38efa38 | 2009-03-02 23:13:18 +0000 | [diff] [blame] | 40 | sys::Path GCCPath; // The path to the gcc executable. |
| 41 | sys::Path RemoteClientPath; // The path to the rsh / ssh executable. |
| 42 | std::vector<std::string> gccArgs; // GCC-specific arguments. |
| 43 | GCC(const sys::Path &gccPath, const sys::Path &RemotePath, |
| 44 | const std::vector<std::string> *GCCArgs) |
| 45 | : GCCPath(gccPath), RemoteClientPath(RemotePath) { |
| 46 | if (GCCArgs) gccArgs = *GCCArgs; |
| 47 | } |
Chris Lattner | 7915a1e | 2003-10-14 21:34:11 +0000 | [diff] [blame] | 48 | public: |
Chris Lattner | 5001042 | 2010-03-16 06:41:47 +0000 | [diff] [blame] | 49 | enum FileType { AsmFile, ObjectFile, CFile }; |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 50 | |
Dan Gohman | 197f728 | 2009-08-05 20:21:17 +0000 | [diff] [blame] | 51 | static GCC *create(std::string &Message, |
Kalle Raiskila | faa9576 | 2010-05-10 07:38:37 +0000 | [diff] [blame] | 52 | const std::string &GCCBinary, |
Bill Wendling | 38efa38 | 2009-03-02 23:13:18 +0000 | [diff] [blame] | 53 | const std::vector<std::string> *Args); |
Chris Lattner | 7915a1e | 2003-10-14 21:34:11 +0000 | [diff] [blame] | 54 | |
Chris Lattner | eeed983 | 2003-10-14 21:52:52 +0000 | [diff] [blame] | 55 | /// ExecuteProgram - Execute the program specified by "ProgramFile" (which is |
| 56 | /// either a .s file, or a .c file, specified by FileType), with the specified |
| 57 | /// arguments. Standard input is specified with InputFile, and standard |
| 58 | /// Output is captured to the specified OutputFile location. The SharedLibs |
| 59 | /// option specifies optional native shared objects that can be loaded into |
| 60 | /// the program for execution. |
| 61 | /// |
Chris Lattner | 7915a1e | 2003-10-14 21:34:11 +0000 | [diff] [blame] | 62 | int ExecuteProgram(const std::string &ProgramFile, |
| 63 | const std::vector<std::string> &Args, |
| 64 | FileType fileType, |
| 65 | const std::string &InputFile, |
| 66 | const std::string &OutputFile, |
Duncan Sands | 3472766 | 2010-07-12 08:16:59 +0000 | [diff] [blame] | 67 | std::string *Error = 0, |
Reid Spencer | 51ab5c8 | 2006-06-06 00:00:42 +0000 | [diff] [blame] | 68 | const std::vector<std::string> &GCCArgs = |
Andrew Trick | de86cbd | 2011-02-08 18:07:10 +0000 | [diff] [blame^] | 69 | std::vector<std::string>(), |
Anton Korobeynikov | 9ba8a76 | 2007-02-16 19:11:07 +0000 | [diff] [blame] | 70 | unsigned Timeout = 0, |
| 71 | unsigned MemoryLimit = 0); |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 72 | |
Chris Lattner | eeed983 | 2003-10-14 21:52:52 +0000 | [diff] [blame] | 73 | /// MakeSharedObject - This compiles the specified file (which is either a .c |
| 74 | /// file or a .s file) into a shared object. |
| 75 | /// |
| 76 | int MakeSharedObject(const std::string &InputFile, FileType fileType, |
Chris Lattner | 130e2a3 | 2006-06-27 20:35:36 +0000 | [diff] [blame] | 77 | std::string &OutputFile, |
Nick Lewycky | 22ff748 | 2010-04-12 05:08:25 +0000 | [diff] [blame] | 78 | const std::vector<std::string> &ArgsForGCC, |
| 79 | std::string &Error); |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 80 | }; |
| 81 | |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 82 | |
Chris Lattner | 7915a1e | 2003-10-14 21:34:11 +0000 | [diff] [blame] | 83 | //===---------------------------------------------------------------------===// |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 84 | /// AbstractInterpreter Class - Subclasses of this class are used to execute |
Gabor Greif | 8ff70c2 | 2007-07-04 21:55:50 +0000 | [diff] [blame] | 85 | /// LLVM bitcode in a variety of ways. This abstract interface hides this |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 86 | /// complexity behind a simple interface. |
| 87 | /// |
Jeff Cohen | 8388195 | 2005-01-22 16:30:58 +0000 | [diff] [blame] | 88 | class AbstractInterpreter { |
| 89 | public: |
Dan Gohman | 197f728 | 2009-08-05 20:21:17 +0000 | [diff] [blame] | 90 | static CBE *createCBE(const char *Argv0, std::string &Message, |
Kalle Raiskila | faa9576 | 2010-05-10 07:38:37 +0000 | [diff] [blame] | 91 | const std::string &GCCBinary, |
Bill Wendling | 38efa38 | 2009-03-02 23:13:18 +0000 | [diff] [blame] | 92 | const std::vector<std::string> *Args = 0, |
| 93 | const std::vector<std::string> *GCCArgs = 0); |
Dan Gohman | 197f728 | 2009-08-05 20:21:17 +0000 | [diff] [blame] | 94 | static LLC *createLLC(const char *Argv0, std::string &Message, |
Kalle Raiskila | faa9576 | 2010-05-10 07:38:37 +0000 | [diff] [blame] | 95 | const std::string &GCCBinary, |
Bill Wendling | 38efa38 | 2009-03-02 23:13:18 +0000 | [diff] [blame] | 96 | const std::vector<std::string> *Args = 0, |
Chris Lattner | 5001042 | 2010-03-16 06:41:47 +0000 | [diff] [blame] | 97 | const std::vector<std::string> *GCCArgs = 0, |
| 98 | bool UseIntegratedAssembler = false); |
Chris Lattner | 7915a1e | 2003-10-14 21:34:11 +0000 | [diff] [blame] | 99 | |
Dan Gohman | 197f728 | 2009-08-05 20:21:17 +0000 | [diff] [blame] | 100 | static AbstractInterpreter* createLLI(const char *Argv0, std::string &Message, |
Brian Gaeke | d11577b | 2004-05-04 21:09:01 +0000 | [diff] [blame] | 101 | const std::vector<std::string> *Args=0); |
Chris Lattner | 7915a1e | 2003-10-14 21:34:11 +0000 | [diff] [blame] | 102 | |
Dan Gohman | 197f728 | 2009-08-05 20:21:17 +0000 | [diff] [blame] | 103 | static AbstractInterpreter* createJIT(const char *Argv0, std::string &Message, |
Brian Gaeke | d11577b | 2004-05-04 21:09:01 +0000 | [diff] [blame] | 104 | const std::vector<std::string> *Args=0); |
Chris Lattner | 7915a1e | 2003-10-14 21:34:11 +0000 | [diff] [blame] | 105 | |
Dan Gohman | 197f728 | 2009-08-05 20:21:17 +0000 | [diff] [blame] | 106 | static AbstractInterpreter* createCustom(std::string &Message, |
Anton Korobeynikov | 9ef7425 | 2008-04-28 20:53:48 +0000 | [diff] [blame] | 107 | const std::string &ExecCommandLine); |
| 108 | |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 109 | |
| 110 | virtual ~AbstractInterpreter() {} |
| 111 | |
Gabor Greif | 8ff70c2 | 2007-07-04 21:55:50 +0000 | [diff] [blame] | 112 | /// compileProgram - Compile the specified program from bitcode to executable |
Chris Lattner | f03715c | 2004-02-18 23:24:29 +0000 | [diff] [blame] | 113 | /// code. This does not produce any output, it is only used when debugging |
Nick Lewycky | 22ff748 | 2010-04-12 05:08:25 +0000 | [diff] [blame] | 114 | /// the code generator. It returns false if the code generator fails. |
Duncan Sands | 4139630 | 2010-05-24 07:49:55 +0000 | [diff] [blame] | 115 | virtual void compileProgram(const std::string &Bitcode, std::string *Error, |
| 116 | unsigned Timeout = 0, unsigned MemoryLimit = 0) {} |
Chris Lattner | f03715c | 2004-02-18 23:24:29 +0000 | [diff] [blame] | 117 | |
Gabor Greif | 8ff70c2 | 2007-07-04 21:55:50 +0000 | [diff] [blame] | 118 | /// OutputCode - Compile the specified program from bitcode to code |
Chris Lattner | c600f3c | 2006-09-15 21:29:15 +0000 | [diff] [blame] | 119 | /// understood by the GCC driver (either C or asm). If the code generator |
Nick Lewycky | 22ff748 | 2010-04-12 05:08:25 +0000 | [diff] [blame] | 120 | /// fails, it sets Error, otherwise, this function returns the type of code |
| 121 | /// emitted. |
Gabor Greif | 8ff70c2 | 2007-07-04 21:55:50 +0000 | [diff] [blame] | 122 | virtual GCC::FileType OutputCode(const std::string &Bitcode, |
Duncan Sands | 4139630 | 2010-05-24 07:49:55 +0000 | [diff] [blame] | 123 | sys::Path &OutFile, std::string &Error, |
| 124 | unsigned Timeout = 0, |
| 125 | unsigned MemoryLimit = 0) { |
Nick Lewycky | 22ff748 | 2010-04-12 05:08:25 +0000 | [diff] [blame] | 126 | Error = "OutputCode not supported by this AbstractInterpreter!"; |
| 127 | return GCC::AsmFile; |
Chris Lattner | c600f3c | 2006-09-15 21:29:15 +0000 | [diff] [blame] | 128 | } |
Nick Lewycky | 22ff748 | 2010-04-12 05:08:25 +0000 | [diff] [blame] | 129 | |
Gabor Greif | 8ff70c2 | 2007-07-04 21:55:50 +0000 | [diff] [blame] | 130 | /// ExecuteProgram - Run the specified bitcode file, emitting output to the |
Nick Lewycky | 22ff748 | 2010-04-12 05:08:25 +0000 | [diff] [blame] | 131 | /// specified filename. This sets RetVal to the exit code of the program or |
| 132 | /// returns false if a problem was encountered that prevented execution of |
| 133 | /// the program. |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 134 | /// |
Gabor Greif | 8ff70c2 | 2007-07-04 21:55:50 +0000 | [diff] [blame] | 135 | virtual int ExecuteProgram(const std::string &Bitcode, |
Chris Lattner | 7915a1e | 2003-10-14 21:34:11 +0000 | [diff] [blame] | 136 | const std::vector<std::string> &Args, |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 137 | const std::string &InputFile, |
| 138 | const std::string &OutputFile, |
Nick Lewycky | 22ff748 | 2010-04-12 05:08:25 +0000 | [diff] [blame] | 139 | std::string *Error, |
Reid Spencer | 51ab5c8 | 2006-06-06 00:00:42 +0000 | [diff] [blame] | 140 | const std::vector<std::string> &GCCArgs = |
| 141 | std::vector<std::string>(), |
Misha Brukman | 63b3afa | 2005-04-21 20:48:15 +0000 | [diff] [blame] | 142 | const std::vector<std::string> &SharedLibs = |
Chris Lattner | 62c91fc | 2004-07-24 07:48:50 +0000 | [diff] [blame] | 143 | std::vector<std::string>(), |
Anton Korobeynikov | 9ba8a76 | 2007-02-16 19:11:07 +0000 | [diff] [blame] | 144 | unsigned Timeout = 0, |
| 145 | unsigned MemoryLimit = 0) = 0; |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 146 | }; |
| 147 | |
| 148 | //===---------------------------------------------------------------------===// |
| 149 | // CBE Implementation of AbstractIntepreter interface |
| 150 | // |
| 151 | class CBE : public AbstractInterpreter { |
Bill Wendling | 38efa38 | 2009-03-02 23:13:18 +0000 | [diff] [blame] | 152 | sys::Path LLCPath; // The path to the `llc' executable. |
| 153 | std::vector<std::string> ToolArgs; // Extra args to pass to LLC. |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 154 | GCC *gcc; |
| 155 | public: |
Reid Spencer | 2418bf9 | 2004-12-19 17:59:45 +0000 | [diff] [blame] | 156 | CBE(const sys::Path &llcPath, GCC *Gcc, |
Bill Wendling | 38efa38 | 2009-03-02 23:13:18 +0000 | [diff] [blame] | 157 | const std::vector<std::string> *Args) |
| 158 | : LLCPath(llcPath), gcc(Gcc) { |
Brian Gaeke | d11577b | 2004-05-04 21:09:01 +0000 | [diff] [blame] | 159 | ToolArgs.clear (); |
Bill Wendling | 38efa38 | 2009-03-02 23:13:18 +0000 | [diff] [blame] | 160 | if (Args) ToolArgs = *Args; |
Brian Gaeke | d11577b | 2004-05-04 21:09:01 +0000 | [diff] [blame] | 161 | } |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 162 | ~CBE() { delete gcc; } |
| 163 | |
Gabor Greif | 8ff70c2 | 2007-07-04 21:55:50 +0000 | [diff] [blame] | 164 | /// compileProgram - Compile the specified program from bitcode to executable |
Chris Lattner | f03715c | 2004-02-18 23:24:29 +0000 | [diff] [blame] | 165 | /// code. This does not produce any output, it is only used when debugging |
Nick Lewycky | 22ff748 | 2010-04-12 05:08:25 +0000 | [diff] [blame] | 166 | /// the code generator. Returns false if the code generator fails. |
Duncan Sands | 4139630 | 2010-05-24 07:49:55 +0000 | [diff] [blame] | 167 | virtual void compileProgram(const std::string &Bitcode, std::string *Error, |
| 168 | unsigned Timeout = 0, unsigned MemoryLimit = 0); |
Chris Lattner | f03715c | 2004-02-18 23:24:29 +0000 | [diff] [blame] | 169 | |
Gabor Greif | 8ff70c2 | 2007-07-04 21:55:50 +0000 | [diff] [blame] | 170 | virtual int ExecuteProgram(const std::string &Bitcode, |
Chris Lattner | 7915a1e | 2003-10-14 21:34:11 +0000 | [diff] [blame] | 171 | const std::vector<std::string> &Args, |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 172 | const std::string &InputFile, |
| 173 | const std::string &OutputFile, |
Nick Lewycky | 22ff748 | 2010-04-12 05:08:25 +0000 | [diff] [blame] | 174 | std::string *Error, |
Reid Spencer | 51ab5c8 | 2006-06-06 00:00:42 +0000 | [diff] [blame] | 175 | const std::vector<std::string> &GCCArgs = |
| 176 | std::vector<std::string>(), |
Misha Brukman | 63b3afa | 2005-04-21 20:48:15 +0000 | [diff] [blame] | 177 | const std::vector<std::string> &SharedLibs = |
Chris Lattner | 62c91fc | 2004-07-24 07:48:50 +0000 | [diff] [blame] | 178 | std::vector<std::string>(), |
Anton Korobeynikov | 9ba8a76 | 2007-02-16 19:11:07 +0000 | [diff] [blame] | 179 | unsigned Timeout = 0, |
| 180 | unsigned MemoryLimit = 0); |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 181 | |
Gabor Greif | 8ff70c2 | 2007-07-04 21:55:50 +0000 | [diff] [blame] | 182 | /// OutputCode - Compile the specified program from bitcode to code |
Chris Lattner | c600f3c | 2006-09-15 21:29:15 +0000 | [diff] [blame] | 183 | /// understood by the GCC driver (either C or asm). If the code generator |
Nick Lewycky | 22ff748 | 2010-04-12 05:08:25 +0000 | [diff] [blame] | 184 | /// fails, it sets Error, otherwise, this function returns the type of code |
| 185 | /// emitted. |
Gabor Greif | 8ff70c2 | 2007-07-04 21:55:50 +0000 | [diff] [blame] | 186 | virtual GCC::FileType OutputCode(const std::string &Bitcode, |
Duncan Sands | 4139630 | 2010-05-24 07:49:55 +0000 | [diff] [blame] | 187 | sys::Path &OutFile, std::string &Error, |
| 188 | unsigned Timeout = 0, |
| 189 | unsigned MemoryLimit = 0); |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 190 | }; |
| 191 | |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 192 | |
| 193 | //===---------------------------------------------------------------------===// |
| 194 | // LLC Implementation of AbstractIntepreter interface |
| 195 | // |
| 196 | class LLC : public AbstractInterpreter { |
Bill Wendling | 38efa38 | 2009-03-02 23:13:18 +0000 | [diff] [blame] | 197 | std::string LLCPath; // The path to the LLC executable. |
| 198 | std::vector<std::string> ToolArgs; // Extra args to pass to LLC. |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 199 | GCC *gcc; |
Chris Lattner | 5001042 | 2010-03-16 06:41:47 +0000 | [diff] [blame] | 200 | bool UseIntegratedAssembler; |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 201 | public: |
Brian Gaeke | d11577b | 2004-05-04 21:09:01 +0000 | [diff] [blame] | 202 | LLC(const std::string &llcPath, GCC *Gcc, |
Bill Wendling | 38efa38 | 2009-03-02 23:13:18 +0000 | [diff] [blame] | 203 | const std::vector<std::string> *Args, |
Chris Lattner | 5001042 | 2010-03-16 06:41:47 +0000 | [diff] [blame] | 204 | bool useIntegratedAssembler) |
| 205 | : LLCPath(llcPath), gcc(Gcc), |
| 206 | UseIntegratedAssembler(useIntegratedAssembler) { |
Bill Wendling | 38efa38 | 2009-03-02 23:13:18 +0000 | [diff] [blame] | 207 | ToolArgs.clear(); |
| 208 | if (Args) ToolArgs = *Args; |
Brian Gaeke | d11577b | 2004-05-04 21:09:01 +0000 | [diff] [blame] | 209 | } |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 210 | ~LLC() { delete gcc; } |
| 211 | |
Gabor Greif | 8ff70c2 | 2007-07-04 21:55:50 +0000 | [diff] [blame] | 212 | /// compileProgram - Compile the specified program from bitcode to executable |
Chris Lattner | f03715c | 2004-02-18 23:24:29 +0000 | [diff] [blame] | 213 | /// code. This does not produce any output, it is only used when debugging |
Nick Lewycky | 22ff748 | 2010-04-12 05:08:25 +0000 | [diff] [blame] | 214 | /// the code generator. Returns false if the code generator fails. |
Duncan Sands | 4139630 | 2010-05-24 07:49:55 +0000 | [diff] [blame] | 215 | virtual void compileProgram(const std::string &Bitcode, std::string *Error, |
| 216 | unsigned Timeout = 0, unsigned MemoryLimit = 0); |
Chris Lattner | f03715c | 2004-02-18 23:24:29 +0000 | [diff] [blame] | 217 | |
Gabor Greif | 8ff70c2 | 2007-07-04 21:55:50 +0000 | [diff] [blame] | 218 | virtual int ExecuteProgram(const std::string &Bitcode, |
Chris Lattner | 7915a1e | 2003-10-14 21:34:11 +0000 | [diff] [blame] | 219 | const std::vector<std::string> &Args, |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 220 | const std::string &InputFile, |
| 221 | const std::string &OutputFile, |
Nick Lewycky | 22ff748 | 2010-04-12 05:08:25 +0000 | [diff] [blame] | 222 | std::string *Error, |
Reid Spencer | 51ab5c8 | 2006-06-06 00:00:42 +0000 | [diff] [blame] | 223 | const std::vector<std::string> &GCCArgs = |
| 224 | std::vector<std::string>(), |
Misha Brukman | 63b3afa | 2005-04-21 20:48:15 +0000 | [diff] [blame] | 225 | const std::vector<std::string> &SharedLibs = |
Chris Lattner | 62c91fc | 2004-07-24 07:48:50 +0000 | [diff] [blame] | 226 | std::vector<std::string>(), |
Anton Korobeynikov | 9ba8a76 | 2007-02-16 19:11:07 +0000 | [diff] [blame] | 227 | unsigned Timeout = 0, |
| 228 | unsigned MemoryLimit = 0); |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 229 | |
Nick Lewycky | 22ff748 | 2010-04-12 05:08:25 +0000 | [diff] [blame] | 230 | /// OutputCode - Compile the specified program from bitcode to code |
| 231 | /// understood by the GCC driver (either C or asm). If the code generator |
| 232 | /// fails, it sets Error, otherwise, this function returns the type of code |
| 233 | /// emitted. |
Gabor Greif | 8ff70c2 | 2007-07-04 21:55:50 +0000 | [diff] [blame] | 234 | virtual GCC::FileType OutputCode(const std::string &Bitcode, |
Duncan Sands | 4139630 | 2010-05-24 07:49:55 +0000 | [diff] [blame] | 235 | sys::Path &OutFile, std::string &Error, |
| 236 | unsigned Timeout = 0, |
| 237 | unsigned MemoryLimit = 0); |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 238 | }; |
| 239 | |
Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 240 | } // End llvm namespace |
| 241 | |
Misha Brukman | 29afb64 | 2003-09-29 22:38:57 +0000 | [diff] [blame] | 242 | #endif |