diff options
Diffstat (limited to 'llvm/tools/bugpoint/ToolRunner.h')
| -rw-r--r-- | llvm/tools/bugpoint/ToolRunner.h | 106 |
1 files changed, 47 insertions, 59 deletions
diff --git a/llvm/tools/bugpoint/ToolRunner.h b/llvm/tools/bugpoint/ToolRunner.h index 3accd70ed4c..3e5d83d2e1c 100644 --- a/llvm/tools/bugpoint/ToolRunner.h +++ b/llvm/tools/bugpoint/ToolRunner.h @@ -36,20 +36,21 @@ class LLC; // CC abstraction // class CC { - std::string CCPath; // The path to the cc executable. - std::string RemoteClientPath; // The path to the rsh / ssh executable. + std::string CCPath; // The path to the cc executable. + std::string RemoteClientPath; // The path to the rsh / ssh executable. std::vector<std::string> ccArgs; // CC-specific arguments. CC(StringRef ccPath, StringRef RemotePath, - const std::vector<std::string> *CCArgs) - : CCPath(ccPath), RemoteClientPath(RemotePath) { - if (CCArgs) ccArgs = *CCArgs; + const std::vector<std::string> *CCArgs) + : CCPath(ccPath), RemoteClientPath(RemotePath) { + if (CCArgs) + ccArgs = *CCArgs; } + public: enum FileType { AsmFile, ObjectFile, CFile }; - static CC *create(std::string &Message, - const std::string &CCBinary, - const std::vector<std::string> *Args); + static CC *create(std::string &Message, const std::string &CCBinary, + const std::vector<std::string> *Args); /// ExecuteProgram - Execute the program specified by "ProgramFile" (which is /// either a .s file, or a .c file, specified by FileType), with the specified @@ -58,16 +59,12 @@ public: /// option specifies optional native shared objects that can be loaded into /// the program for execution. /// - int ExecuteProgram(const std::string &ProgramFile, - const std::vector<std::string> &Args, - FileType fileType, - const std::string &InputFile, - const std::string &OutputFile, - std::string *Error = nullptr, - const std::vector<std::string> &CCArgs = - std::vector<std::string>(), - unsigned Timeout = 0, - unsigned MemoryLimit = 0); + int ExecuteProgram( + const std::string &ProgramFile, const std::vector<std::string> &Args, + FileType fileType, const std::string &InputFile, + const std::string &OutputFile, std::string *Error = nullptr, + const std::vector<std::string> &CCArgs = std::vector<std::string>(), + unsigned Timeout = 0, unsigned MemoryLimit = 0); /// MakeSharedObject - This compiles the specified file (which is either a .c /// file or a .s file) into a shared object. @@ -78,7 +75,6 @@ public: std::string &Error); }; - //===---------------------------------------------------------------------===// /// AbstractInterpreter Class - Subclasses of this class are used to execute /// LLVM bitcode in a variety of ways. This abstract interface hides this @@ -86,30 +82,30 @@ public: /// class AbstractInterpreter { virtual void anchor(); + public: static LLC *createLLC(const char *Argv0, std::string &Message, - const std::string &CCBinary, + const std::string &CCBinary, const std::vector<std::string> *Args = nullptr, const std::vector<std::string> *CCArgs = nullptr, bool UseIntegratedAssembler = false); - static AbstractInterpreter* + static AbstractInterpreter * createLLI(const char *Argv0, std::string &Message, const std::vector<std::string> *Args = nullptr); - static AbstractInterpreter* + static AbstractInterpreter * createJIT(const char *Argv0, std::string &Message, const std::vector<std::string> *Args = nullptr); - static AbstractInterpreter* + static AbstractInterpreter * createCustomCompiler(std::string &Message, const std::string &CompileCommandLine); - static AbstractInterpreter* + static AbstractInterpreter * createCustomExecutor(std::string &Message, const std::string &ExecCommandLine); - virtual ~AbstractInterpreter() {} /// compileProgram - Compile the specified program from bitcode to executable @@ -123,9 +119,9 @@ public: /// fails, it sets Error, otherwise, this function returns the type of code /// emitted. virtual CC::FileType OutputCode(const std::string &Bitcode, - std::string &OutFile, std::string &Error, - unsigned Timeout = 0, - unsigned MemoryLimit = 0) { + std::string &OutFile, std::string &Error, + unsigned Timeout = 0, + unsigned MemoryLimit = 0) { Error = "OutputCode not supported by this AbstractInterpreter!"; return CC::AsmFile; } @@ -135,17 +131,13 @@ public: /// returns false if a problem was encountered that prevented execution of /// the program. /// - virtual int ExecuteProgram(const std::string &Bitcode, - const std::vector<std::string> &Args, - const std::string &InputFile, - const std::string &OutputFile, - std::string *Error, - const std::vector<std::string> &CCArgs = - std::vector<std::string>(), - const std::vector<std::string> &SharedLibs = - std::vector<std::string>(), - unsigned Timeout = 0, - unsigned MemoryLimit = 0) = 0; + virtual int ExecuteProgram( + const std::string &Bitcode, const std::vector<std::string> &Args, + const std::string &InputFile, const std::string &OutputFile, + std::string *Error, + const std::vector<std::string> &CCArgs = std::vector<std::string>(), + const std::vector<std::string> &SharedLibs = std::vector<std::string>(), + unsigned Timeout = 0, unsigned MemoryLimit = 0) = 0; }; //===---------------------------------------------------------------------===// @@ -156,14 +148,15 @@ class LLC : public AbstractInterpreter { std::vector<std::string> ToolArgs; // Extra args to pass to LLC. CC *cc; bool UseIntegratedAssembler; + public: - LLC(const std::string &llcPath, CC *cc, - const std::vector<std::string> *Args, + LLC(const std::string &llcPath, CC *cc, const std::vector<std::string> *Args, bool useIntegratedAssembler) - : LLCPath(llcPath), cc(cc), - UseIntegratedAssembler(useIntegratedAssembler) { + : LLCPath(llcPath), cc(cc), + UseIntegratedAssembler(useIntegratedAssembler) { ToolArgs.clear(); - if (Args) ToolArgs = *Args; + if (Args) + ToolArgs = *Args; } ~LLC() override { delete cc; } @@ -173,26 +166,21 @@ public: void compileProgram(const std::string &Bitcode, std::string *Error, unsigned Timeout = 0, unsigned MemoryLimit = 0) override; - int ExecuteProgram(const std::string &Bitcode, - const std::vector<std::string> &Args, - const std::string &InputFile, - const std::string &OutputFile, - std::string *Error, - const std::vector<std::string> &CCArgs = - std::vector<std::string>(), - const std::vector<std::string> &SharedLibs = - std::vector<std::string>(), - unsigned Timeout = 0, - unsigned MemoryLimit = 0) override; + int ExecuteProgram( + const std::string &Bitcode, const std::vector<std::string> &Args, + const std::string &InputFile, const std::string &OutputFile, + std::string *Error, + const std::vector<std::string> &CCArgs = std::vector<std::string>(), + const std::vector<std::string> &SharedLibs = std::vector<std::string>(), + unsigned Timeout = 0, unsigned MemoryLimit = 0) override; /// OutputCode - Compile the specified program from bitcode to code /// understood by the CC driver (either C or asm). If the code generator /// fails, it sets Error, otherwise, this function returns the type of code /// emitted. - CC::FileType OutputCode(const std::string &Bitcode, - std::string &OutFile, std::string &Error, - unsigned Timeout = 0, - unsigned MemoryLimit = 0) override; + CC::FileType OutputCode(const std::string &Bitcode, std::string &OutFile, + std::string &Error, unsigned Timeout = 0, + unsigned MemoryLimit = 0) override; }; } // End llvm namespace |

