diff options
Diffstat (limited to 'lib/ExecutionEngine/Interpreter/Interpreter.h')
-rw-r--r-- | lib/ExecutionEngine/Interpreter/Interpreter.h | 53 |
1 files changed, 15 insertions, 38 deletions
diff --git a/lib/ExecutionEngine/Interpreter/Interpreter.h b/lib/ExecutionEngine/Interpreter/Interpreter.h index 5434fe0b81..ef0540c1fe 100644 --- a/lib/ExecutionEngine/Interpreter/Interpreter.h +++ b/lib/ExecutionEngine/Interpreter/Interpreter.h @@ -79,41 +79,38 @@ class Interpreter : public ExecutionEngine, public InstVisitor<Interpreter> { // function record. std::vector<ExecutionContext> ECStack; - // AtExitHandlers - List of functions to call when the program exits. + // AtExitHandlers - List of functions to call when the program exits, + // registered with the atexit() library function. std::vector<Function*> AtExitHandlers; public: Interpreter(Module *M, bool isLittleEndian, bool isLongPointer, bool TraceMode); inline ~Interpreter() { CW.setModule(0); } + /// runAtExitHandlers - Run any functions registered by the + /// program's calls to atexit(3), which we intercept and store in + /// AtExitHandlers. + /// + void runAtExitHandlers (); + /// create - Create an interpreter ExecutionEngine. This can never fail. /// static ExecutionEngine *create(Module *M, bool TraceMode); /// run - Start execution with the specified function and arguments. /// - virtual int run(const std::string &FnName, - const std::vector<std::string> &Args, - const char ** envp); - - - void enableTracing() { Trace = true; } + virtual GenericValue run(Function *F, + const std::vector<GenericValue> &ArgValues); - void handleUserInput(); - - // User Interation Methods... - bool callFunction(const std::string &Name); // return true on failure + // Methods used for debug printouts: static void print(const Type *Ty, GenericValue V); static void printValue(const Type *Ty, GenericValue V); - bool callMainFunction(const std::string &MainName, - const std::vector<std::string> &InputFilename); - - // Code execution methods... + // Methods used to execute code: + // Place a call on the stack void callFunction(Function *F, const std::vector<GenericValue> &ArgVals); - void executeInstruction(); // Execute one instruction... - - void run(); // Do the 'run' command + void executeInstruction(); // Execute one instruction + void run(); // Execute instructions until nothing left to do // Opcode Implementations void visitReturnInst(ReturnInst &I); @@ -142,16 +139,6 @@ public: const std::vector<GenericValue> &ArgVals); void exitCalled(GenericValue GV); - // getCurrentFunction - Return the currently executing function - inline Function *getCurrentFunction() const { - return CurFrame < 0 ? 0 : ECStack[CurFrame].CurFunction; - } - - // isStopped - Return true if a program is stopped. Return false if no - // program is running. - // - inline bool isStopped() const { return !ECStack.empty(); } - void addAtExitHandler(Function *F) { AtExitHandlers.push_back(F); } @@ -170,16 +157,6 @@ private: // Helper functions void *getPointerToFunction(Function *F) { return (void*)F; } - // getCurrentExecutablePath() - Return the directory that the lli executable - // lives in. - // - std::string getCurrentExecutablePath() const; - - // printCurrentInstruction - Print out the instruction that the virtual PC is - // at, or fail silently if no program is running. - // - void printCurrentInstruction(); - void initializeExecutionEngine(); void initializeExternalFunctions(); }; |