diff options
author | Chris Lattner <sabre@nondot.org> | 2003-10-14 21:34:11 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-10-14 21:34:11 +0000 |
commit | 7915a1e764a5472d89a5ea40fbc22515afc5abf2 (patch) | |
tree | d9379244ff8904afd841c2d36eedaf9d9a5635a3 | |
parent | a0f5b15e1eb8642d92b3141a6b88a5729ea979dc (diff) | |
download | external_llvm-7915a1e764a5472d89a5ea40fbc22515afc5abf2.zip external_llvm-7915a1e764a5472d89a5ea40fbc22515afc5abf2.tar.gz external_llvm-7915a1e764a5472d89a5ea40fbc22515afc5abf2.tar.bz2 |
Substantial cleanups:
* Add header comment
* Remove extraneous #includes
* Move the FileType enum into the GCC class
* The GCC class is not virtual.
* Move all of the "constructor" functions into the classes themselves
* Stop using cl::list as arguments, use std::vector instead (which cl::list
derives from)
* Improve comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9121 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Support/ToolRunner.h | 77 | ||||
-rw-r--r-- | lib/Support/ToolRunner.cpp | 63 | ||||
-rw-r--r-- | tools/bugpoint/ToolRunner.cpp | 63 | ||||
-rw-r--r-- | tools/bugpoint/ToolRunner.h | 77 |
4 files changed, 146 insertions, 134 deletions
diff --git a/include/llvm/Support/ToolRunner.h b/include/llvm/Support/ToolRunner.h index 6ae0211..77ae109 100644 --- a/include/llvm/Support/ToolRunner.h +++ b/include/llvm/Support/ToolRunner.h @@ -1,39 +1,39 @@ //===-- Support/ToolRunner.h ------------------------------------*- C++ -*-===// // -// FIXME: document +// This file exposes an abstraction around a platform C compiler, used to +// compile C and assembly code. It also exposes an "AbstractIntepreter" +// interface, which is used to execute code using one of the LLVM execution +// engines. // //===----------------------------------------------------------------------===// #ifndef TOOLRUNNER_H #define TOOLRUNNER_H -#include "Support/CommandLine.h" #include "Support/SystemUtils.h" -#include <fstream> -#include <iostream> -#include <string> #include <vector> -enum FileType { AsmFile, CFile }; +class CBE; +class LLC; //===---------------------------------------------------------------------===// // GCC abstraction // -// This is not a *real* AbstractInterpreter as it does not accept bytecode -// files, but only input acceptable to GCC, i.e. C, C++, and assembly files -// class GCC { std::string GCCPath; // The path to the gcc executable -public: GCC(const std::string &gccPath) : GCCPath(gccPath) { } - virtual ~GCC() {} +public: + enum FileType { AsmFile, CFile }; + + static GCC* create(const std::string &ProgramPath, std::string &Message); - virtual int ExecuteProgram(const std::string &ProgramFile, - const cl::list<std::string> &Args, - FileType fileType, - const std::string &InputFile, - const std::string &OutputFile, - const std::string &SharedLib = ""); + + int ExecuteProgram(const std::string &ProgramFile, + const std::vector<std::string> &Args, + FileType fileType, + const std::string &InputFile, + const std::string &OutputFile, + const std::string &SharedLib = ""); int MakeSharedObject(const std::string &InputFile, FileType fileType, @@ -42,14 +42,22 @@ public: void ProcessFailure(const char **Args); }; -GCC* createGCCtool(const std::string &ProgramPath, - std::string &Message); +//===---------------------------------------------------------------------===// /// AbstractInterpreter Class - Subclasses of this class are used to execute /// LLVM bytecode in a variety of ways. This abstract interface hides this /// complexity behind a simple interface. /// struct AbstractInterpreter { + static CBE* createCBE(const std::string &ProgramPath, std::string &Message); + static LLC *createLLC(const std::string &ProgramPath, std::string &Message); + + static AbstractInterpreter* createLLI(const std::string &ProgramPath, + std::string &Message); + + static AbstractInterpreter* createJIT(const std::string &ProgramPath, + std::string &Message); + virtual ~AbstractInterpreter() {} @@ -57,7 +65,7 @@ struct AbstractInterpreter { /// specified filename. This returns the exit code of the program. /// virtual int ExecuteProgram(const std::string &Bytecode, - const cl::list<std::string> &Args, + const std::vector<std::string> &Args, const std::string &InputFile, const std::string &OutputFile, const std::string &SharedLib = "") = 0; @@ -74,19 +82,17 @@ public: ~CBE() { delete gcc; } virtual int ExecuteProgram(const std::string &Bytecode, - const cl::list<std::string> &Args, + const std::vector<std::string> &Args, const std::string &InputFile, const std::string &OutputFile, const std::string &SharedLib = ""); - // Sometimes we just want to go half-way and only generate the C file, - // not necessarily compile it with GCC and run the program - virtual int OutputC(const std::string &Bytecode, - std::string &OutputCFile); - + // Sometimes we just want to go half-way and only generate the .c file, + // not necessarily compile it with GCC and run the program. + // + virtual int OutputC(const std::string &Bytecode, std::string &OutputCFile); }; -CBE* createCBEtool(const std::string &ProgramPath, std::string &Message); //===---------------------------------------------------------------------===// // LLC Implementation of AbstractIntepreter interface @@ -100,22 +106,15 @@ public: ~LLC() { delete gcc; } virtual int ExecuteProgram(const std::string &Bytecode, - const cl::list<std::string> &Args, + const std::vector<std::string> &Args, const std::string &InputFile, const std::string &OutputFile, const std::string &SharedLib = ""); - int OutputAsm(const std::string &Bytecode, - std::string &OutputAsmFile); + // Sometimes we just want to go half-way and only generate the .s file, + // not necessarily compile it all the way and run the program. + // + int OutputAsm(const std::string &Bytecode, std::string &OutputAsmFile); }; -LLC* createLLCtool(const std::string &ProgramPath, std::string &Message); - -AbstractInterpreter* createLLItool(const std::string &ProgramPath, - std::string &Message); - -AbstractInterpreter* createJITtool(const std::string &ProgramPath, - std::string &Message); - - #endif diff --git a/lib/Support/ToolRunner.cpp b/lib/Support/ToolRunner.cpp index 2fa5b39..a8f99bc 100644 --- a/lib/Support/ToolRunner.cpp +++ b/lib/Support/ToolRunner.cpp @@ -1,6 +1,14 @@ +//===-- ToolRunner.cpp ----------------------------------------------------===// +// +// This file implements the interfaces described in the ToolRunner.h file. +// +//===----------------------------------------------------------------------===// + #include "llvm/Support/ToolRunner.h" #include "Support/Debug.h" #include "Support/FileUtilities.h" +#include <iostream> +#include <fstream> //===---------------------------------------------------------------------===// // LLI Implementation of AbstractIntepreter interface @@ -12,14 +20,14 @@ public: virtual int ExecuteProgram(const std::string &Bytecode, - const cl::list<std::string> &Args, + const std::vector<std::string> &Args, const std::string &InputFile, const std::string &OutputFile, const std::string &SharedLib = ""); }; int LLI::ExecuteProgram(const std::string &Bytecode, - const cl::list<std::string> &Args, + const std::vector<std::string> &Args, const std::string &InputFile, const std::string &OutputFile, const std::string &SharedLib) { @@ -50,9 +58,9 @@ int LLI::ExecuteProgram(const std::string &Bytecode, } // LLI create method - Try to find the LLI executable -AbstractInterpreter *createLLItool(const std::string &ProgramPath, - std::string &Message) { - std::string LLIPath = FindExecutable("lli", ProgramPath); +AbstractInterpreter *AbstractInterpreter::createLLI(const std::string &ProgPath, + std::string &Message) { + std::string LLIPath = FindExecutable("lli", ProgPath); if (!LLIPath.empty()) { Message = "Found lli: " + LLIPath + "\n"; return new LLI(LLIPath); @@ -65,8 +73,7 @@ AbstractInterpreter *createLLItool(const std::string &ProgramPath, //===----------------------------------------------------------------------===// // LLC Implementation of AbstractIntepreter interface // -int LLC::OutputAsm(const std::string &Bytecode, - std::string &OutputAsmFile) { +int LLC::OutputAsm(const std::string &Bytecode, std::string &OutputAsmFile) { OutputAsmFile = getUniqueFilename(Bytecode+".llc.s"); const char *LLCArgs[] = { LLCPath.c_str(), @@ -89,11 +96,10 @@ int LLC::OutputAsm(const std::string &Bytecode, } int LLC::ExecuteProgram(const std::string &Bytecode, - const cl::list<std::string> &Args, + const std::vector<std::string> &Args, const std::string &InputFile, const std::string &OutputFile, const std::string &SharedLib) { - std::string OutputAsmFile; if (OutputAsm(Bytecode, OutputAsmFile)) { std::cerr << "Could not generate asm code with `llc', exiting.\n"; @@ -101,16 +107,16 @@ int LLC::ExecuteProgram(const std::string &Bytecode, } // Assuming LLC worked, compile the result with GCC and run it. - int Result = gcc->ExecuteProgram(OutputAsmFile, Args, AsmFile, + int Result = gcc->ExecuteProgram(OutputAsmFile, Args, GCC::AsmFile, InputFile, OutputFile, SharedLib); removeFile(OutputAsmFile); return Result; } -/// createLLCtool - Try to find the LLC executable +/// createLLC - Try to find the LLC executable /// -LLC *createLLCtool(const std::string &ProgramPath, std::string &Message) -{ +LLC *AbstractInterpreter::createLLC(const std::string &ProgramPath, + std::string &Message) { std::string LLCPath = FindExecutable("llc", ProgramPath); if (LLCPath.empty()) { Message = "Cannot find `llc' in executable directory or PATH!\n"; @@ -118,7 +124,7 @@ LLC *createLLCtool(const std::string &ProgramPath, std::string &Message) } Message = "Found llc: " + LLCPath + "\n"; - GCC *gcc = createGCCtool(ProgramPath, Message); + GCC *gcc = GCC::create(ProgramPath, Message); if (!gcc) { std::cerr << Message << "\n"; exit(1); @@ -136,14 +142,14 @@ public: virtual int ExecuteProgram(const std::string &Bytecode, - const cl::list<std::string> &Args, + const std::vector<std::string> &Args, const std::string &InputFile, const std::string &OutputFile, const std::string &SharedLib = ""); }; int JIT::ExecuteProgram(const std::string &Bytecode, - const cl::list<std::string> &Args, + const std::vector<std::string> &Args, const std::string &InputFile, const std::string &OutputFile, const std::string &SharedLib) { @@ -173,11 +179,11 @@ int JIT::ExecuteProgram(const std::string &Bytecode, InputFile, OutputFile, OutputFile); } -/// createJITtool - Try to find the LLI executable +/// createJIT - Try to find the LLI executable /// -AbstractInterpreter *createJITtool(const std::string &ProgramPath, - std::string &Message) { - std::string LLIPath = FindExecutable("lli", ProgramPath); +AbstractInterpreter *AbstractInterpreter::createJIT(const std::string &ProgPath, + std::string &Message) { + std::string LLIPath = FindExecutable("lli", ProgPath); if (!LLIPath.empty()) { Message = "Found lli: " + LLIPath + "\n"; return new JIT(LLIPath); @@ -211,7 +217,7 @@ int CBE::OutputC(const std::string &Bytecode, } int CBE::ExecuteProgram(const std::string &Bytecode, - const cl::list<std::string> &Args, + const std::vector<std::string> &Args, const std::string &InputFile, const std::string &OutputFile, const std::string &SharedLib) { @@ -221,16 +227,17 @@ int CBE::ExecuteProgram(const std::string &Bytecode, exit(1); } - int Result = gcc->ExecuteProgram(OutputCFile, Args, CFile, + int Result = gcc->ExecuteProgram(OutputCFile, Args, GCC::CFile, InputFile, OutputFile, SharedLib); removeFile(OutputCFile); return Result; } -/// createCBEtool - Try to find the 'dis' executable +/// createCBE - Try to find the 'llvm-dis' executable /// -CBE *createCBEtool(const std::string &ProgramPath, std::string &Message) { +CBE *AbstractInterpreter::createCBE(const std::string &ProgramPath, + std::string &Message) { std::string DISPath = FindExecutable("llvm-dis", ProgramPath); if (DISPath.empty()) { Message = @@ -239,7 +246,7 @@ CBE *createCBEtool(const std::string &ProgramPath, std::string &Message) { } Message = "Found llvm-dis: " + DISPath + "\n"; - GCC *gcc = createGCCtool(ProgramPath, Message); + GCC *gcc = GCC::create(ProgramPath, Message); if (!gcc) { std::cerr << Message << "\n"; exit(1); @@ -254,7 +261,7 @@ CBE *createCBEtool(const std::string &ProgramPath, std::string &Message) { // files, but only input acceptable to GCC, i.e. C, C++, and assembly files // int GCC::ExecuteProgram(const std::string &ProgramFile, - const cl::list<std::string> &Args, + const std::vector<std::string> &Args, FileType fileType, const std::string &InputFile, const std::string &OutputFile, @@ -358,9 +365,9 @@ void GCC::ProcessFailure(const char** GCCArgs) { removeFile(ErrorFilename); } -/// createGCCtool - Try to find the `gcc' executable +/// create - Try to find the `gcc' executable /// -GCC *createGCCtool(const std::string &ProgramPath, std::string &Message) { +GCC *GCC::create(const std::string &ProgramPath, std::string &Message) { std::string GCCPath = FindExecutable("gcc", ProgramPath); if (GCCPath.empty()) { Message = "Cannot find `gcc' in executable directory or PATH!\n"; diff --git a/tools/bugpoint/ToolRunner.cpp b/tools/bugpoint/ToolRunner.cpp index 2fa5b39..a8f99bc 100644 --- a/tools/bugpoint/ToolRunner.cpp +++ b/tools/bugpoint/ToolRunner.cpp @@ -1,6 +1,14 @@ +//===-- ToolRunner.cpp ----------------------------------------------------===// +// +// This file implements the interfaces described in the ToolRunner.h file. +// +//===----------------------------------------------------------------------===// + #include "llvm/Support/ToolRunner.h" #include "Support/Debug.h" #include "Support/FileUtilities.h" +#include <iostream> +#include <fstream> //===---------------------------------------------------------------------===// // LLI Implementation of AbstractIntepreter interface @@ -12,14 +20,14 @@ public: virtual int ExecuteProgram(const std::string &Bytecode, - const cl::list<std::string> &Args, + const std::vector<std::string> &Args, const std::string &InputFile, const std::string &OutputFile, const std::string &SharedLib = ""); }; int LLI::ExecuteProgram(const std::string &Bytecode, - const cl::list<std::string> &Args, + const std::vector<std::string> &Args, const std::string &InputFile, const std::string &OutputFile, const std::string &SharedLib) { @@ -50,9 +58,9 @@ int LLI::ExecuteProgram(const std::string &Bytecode, } // LLI create method - Try to find the LLI executable -AbstractInterpreter *createLLItool(const std::string &ProgramPath, - std::string &Message) { - std::string LLIPath = FindExecutable("lli", ProgramPath); +AbstractInterpreter *AbstractInterpreter::createLLI(const std::string &ProgPath, + std::string &Message) { + std::string LLIPath = FindExecutable("lli", ProgPath); if (!LLIPath.empty()) { Message = "Found lli: " + LLIPath + "\n"; return new LLI(LLIPath); @@ -65,8 +73,7 @@ AbstractInterpreter *createLLItool(const std::string &ProgramPath, //===----------------------------------------------------------------------===// // LLC Implementation of AbstractIntepreter interface // -int LLC::OutputAsm(const std::string &Bytecode, - std::string &OutputAsmFile) { +int LLC::OutputAsm(const std::string &Bytecode, std::string &OutputAsmFile) { OutputAsmFile = getUniqueFilename(Bytecode+".llc.s"); const char *LLCArgs[] = { LLCPath.c_str(), @@ -89,11 +96,10 @@ int LLC::OutputAsm(const std::string &Bytecode, } int LLC::ExecuteProgram(const std::string &Bytecode, - const cl::list<std::string> &Args, + const std::vector<std::string> &Args, const std::string &InputFile, const std::string &OutputFile, const std::string &SharedLib) { - std::string OutputAsmFile; if (OutputAsm(Bytecode, OutputAsmFile)) { std::cerr << "Could not generate asm code with `llc', exiting.\n"; @@ -101,16 +107,16 @@ int LLC::ExecuteProgram(const std::string &Bytecode, } // Assuming LLC worked, compile the result with GCC and run it. - int Result = gcc->ExecuteProgram(OutputAsmFile, Args, AsmFile, + int Result = gcc->ExecuteProgram(OutputAsmFile, Args, GCC::AsmFile, InputFile, OutputFile, SharedLib); removeFile(OutputAsmFile); return Result; } -/// createLLCtool - Try to find the LLC executable +/// createLLC - Try to find the LLC executable /// -LLC *createLLCtool(const std::string &ProgramPath, std::string &Message) -{ +LLC *AbstractInterpreter::createLLC(const std::string &ProgramPath, + std::string &Message) { std::string LLCPath = FindExecutable("llc", ProgramPath); if (LLCPath.empty()) { Message = "Cannot find `llc' in executable directory or PATH!\n"; @@ -118,7 +124,7 @@ LLC *createLLCtool(const std::string &ProgramPath, std::string &Message) } Message = "Found llc: " + LLCPath + "\n"; - GCC *gcc = createGCCtool(ProgramPath, Message); + GCC *gcc = GCC::create(ProgramPath, Message); if (!gcc) { std::cerr << Message << "\n"; exit(1); @@ -136,14 +142,14 @@ public: virtual int ExecuteProgram(const std::string &Bytecode, - const cl::list<std::string> &Args, + const std::vector<std::string> &Args, const std::string &InputFile, const std::string &OutputFile, const std::string &SharedLib = ""); }; int JIT::ExecuteProgram(const std::string &Bytecode, - const cl::list<std::string> &Args, + const std::vector<std::string> &Args, const std::string &InputFile, const std::string &OutputFile, const std::string &SharedLib) { @@ -173,11 +179,11 @@ int JIT::ExecuteProgram(const std::string &Bytecode, InputFile, OutputFile, OutputFile); } -/// createJITtool - Try to find the LLI executable +/// createJIT - Try to find the LLI executable /// -AbstractInterpreter *createJITtool(const std::string &ProgramPath, - std::string &Message) { - std::string LLIPath = FindExecutable("lli", ProgramPath); +AbstractInterpreter *AbstractInterpreter::createJIT(const std::string &ProgPath, + std::string &Message) { + std::string LLIPath = FindExecutable("lli", ProgPath); if (!LLIPath.empty()) { Message = "Found lli: " + LLIPath + "\n"; return new JIT(LLIPath); @@ -211,7 +217,7 @@ int CBE::OutputC(const std::string &Bytecode, } int CBE::ExecuteProgram(const std::string &Bytecode, - const cl::list<std::string> &Args, + const std::vector<std::string> &Args, const std::string &InputFile, const std::string &OutputFile, const std::string &SharedLib) { @@ -221,16 +227,17 @@ int CBE::ExecuteProgram(const std::string &Bytecode, exit(1); } - int Result = gcc->ExecuteProgram(OutputCFile, Args, CFile, + int Result = gcc->ExecuteProgram(OutputCFile, Args, GCC::CFile, InputFile, OutputFile, SharedLib); removeFile(OutputCFile); return Result; } -/// createCBEtool - Try to find the 'dis' executable +/// createCBE - Try to find the 'llvm-dis' executable /// -CBE *createCBEtool(const std::string &ProgramPath, std::string &Message) { +CBE *AbstractInterpreter::createCBE(const std::string &ProgramPath, + std::string &Message) { std::string DISPath = FindExecutable("llvm-dis", ProgramPath); if (DISPath.empty()) { Message = @@ -239,7 +246,7 @@ CBE *createCBEtool(const std::string &ProgramPath, std::string &Message) { } Message = "Found llvm-dis: " + DISPath + "\n"; - GCC *gcc = createGCCtool(ProgramPath, Message); + GCC *gcc = GCC::create(ProgramPath, Message); if (!gcc) { std::cerr << Message << "\n"; exit(1); @@ -254,7 +261,7 @@ CBE *createCBEtool(const std::string &ProgramPath, std::string &Message) { // files, but only input acceptable to GCC, i.e. C, C++, and assembly files // int GCC::ExecuteProgram(const std::string &ProgramFile, - const cl::list<std::string> &Args, + const std::vector<std::string> &Args, FileType fileType, const std::string &InputFile, const std::string &OutputFile, @@ -358,9 +365,9 @@ void GCC::ProcessFailure(const char** GCCArgs) { removeFile(ErrorFilename); } -/// createGCCtool - Try to find the `gcc' executable +/// create - Try to find the `gcc' executable /// -GCC *createGCCtool(const std::string &ProgramPath, std::string &Message) { +GCC *GCC::create(const std::string &ProgramPath, std::string &Message) { std::string GCCPath = FindExecutable("gcc", ProgramPath); if (GCCPath.empty()) { Message = "Cannot find `gcc' in executable directory or PATH!\n"; diff --git a/tools/bugpoint/ToolRunner.h b/tools/bugpoint/ToolRunner.h index 6ae0211..77ae109 100644 --- a/tools/bugpoint/ToolRunner.h +++ b/tools/bugpoint/ToolRunner.h @@ -1,39 +1,39 @@ //===-- Support/ToolRunner.h ------------------------------------*- C++ -*-===// // -// FIXME: document +// This file exposes an abstraction around a platform C compiler, used to +// compile C and assembly code. It also exposes an "AbstractIntepreter" +// interface, which is used to execute code using one of the LLVM execution +// engines. // //===----------------------------------------------------------------------===// #ifndef TOOLRUNNER_H #define TOOLRUNNER_H -#include "Support/CommandLine.h" #include "Support/SystemUtils.h" -#include <fstream> -#include <iostream> -#include <string> #include <vector> -enum FileType { AsmFile, CFile }; +class CBE; +class LLC; //===---------------------------------------------------------------------===// // GCC abstraction // -// This is not a *real* AbstractInterpreter as it does not accept bytecode -// files, but only input acceptable to GCC, i.e. C, C++, and assembly files -// class GCC { std::string GCCPath; // The path to the gcc executable -public: GCC(const std::string &gccPath) : GCCPath(gccPath) { } - virtual ~GCC() {} +public: + enum FileType { AsmFile, CFile }; + + static GCC* create(const std::string &ProgramPath, std::string &Message); - virtual int ExecuteProgram(const std::string &ProgramFile, - const cl::list<std::string> &Args, - FileType fileType, - const std::string &InputFile, - const std::string &OutputFile, - const std::string &SharedLib = ""); + + int ExecuteProgram(const std::string &ProgramFile, + const std::vector<std::string> &Args, + FileType fileType, + const std::string &InputFile, + const std::string &OutputFile, + const std::string &SharedLib = ""); int MakeSharedObject(const std::string &InputFile, FileType fileType, @@ -42,14 +42,22 @@ public: void ProcessFailure(const char **Args); }; -GCC* createGCCtool(const std::string &ProgramPath, - std::string &Message); +//===---------------------------------------------------------------------===// /// AbstractInterpreter Class - Subclasses of this class are used to execute /// LLVM bytecode in a variety of ways. This abstract interface hides this /// complexity behind a simple interface. /// struct AbstractInterpreter { + static CBE* createCBE(const std::string &ProgramPath, std::string &Message); + static LLC *createLLC(const std::string &ProgramPath, std::string &Message); + + static AbstractInterpreter* createLLI(const std::string &ProgramPath, + std::string &Message); + + static AbstractInterpreter* createJIT(const std::string &ProgramPath, + std::string &Message); + virtual ~AbstractInterpreter() {} @@ -57,7 +65,7 @@ struct AbstractInterpreter { /// specified filename. This returns the exit code of the program. /// virtual int ExecuteProgram(const std::string &Bytecode, - const cl::list<std::string> &Args, + const std::vector<std::string> &Args, const std::string &InputFile, const std::string &OutputFile, const std::string &SharedLib = "") = 0; @@ -74,19 +82,17 @@ public: ~CBE() { delete gcc; } virtual int ExecuteProgram(const std::string &Bytecode, - const cl::list<std::string> &Args, + const std::vector<std::string> &Args, const std::string &InputFile, const std::string &OutputFile, const std::string &SharedLib = ""); - // Sometimes we just want to go half-way and only generate the C file, - // not necessarily compile it with GCC and run the program - virtual int OutputC(const std::string &Bytecode, - std::string &OutputCFile); - + // Sometimes we just want to go half-way and only generate the .c file, + // not necessarily compile it with GCC and run the program. + // + virtual int OutputC(const std::string &Bytecode, std::string &OutputCFile); }; -CBE* createCBEtool(const std::string &ProgramPath, std::string &Message); //===---------------------------------------------------------------------===// // LLC Implementation of AbstractIntepreter interface @@ -100,22 +106,15 @@ public: ~LLC() { delete gcc; } virtual int ExecuteProgram(const std::string &Bytecode, - const cl::list<std::string> &Args, + const std::vector<std::string> &Args, const std::string &InputFile, const std::string &OutputFile, const std::string &SharedLib = ""); - int OutputAsm(const std::string &Bytecode, - std::string &OutputAsmFile); + // Sometimes we just want to go half-way and only generate the .s file, + // not necessarily compile it all the way and run the program. + // + int OutputAsm(const std::string &Bytecode, std::string &OutputAsmFile); }; -LLC* createLLCtool(const std::string &ProgramPath, std::string &Message); - -AbstractInterpreter* createLLItool(const std::string &ProgramPath, - std::string &Message); - -AbstractInterpreter* createJITtool(const std::string &ProgramPath, - std::string &Message); - - #endif |