Add support for atexit function, remove support for __main function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6194 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/ExecutionEngine/Interpreter/Interpreter.h b/lib/ExecutionEngine/Interpreter/Interpreter.h
index 6481cb7..5076581 100644
--- a/lib/ExecutionEngine/Interpreter/Interpreter.h
+++ b/lib/ExecutionEngine/Interpreter/Interpreter.h
@@ -84,6 +84,8 @@
// function record.
std::vector<ExecutionContext> ECStack;
+ // AtExitHandlers - List of functions to call when the program exits.
+ std::vector<Function*> AtExitHandlers;
public:
Interpreter(Module *M, unsigned Config, bool DebugMode, bool TraceMode);
inline ~Interpreter() { CW.setModule(0); }
@@ -164,6 +166,10 @@
//
inline bool isStopped() const { return !ECStack.empty(); }
+ void addAtExitHandler(Function *F) {
+ AtExitHandlers.push_back(F);
+ }
+
//FIXME: private:
public:
GenericValue executeGEPOperation(Value *Ptr, User::op_iterator I,
@@ -207,6 +213,9 @@
Value *ChooseOneOption(const std::string &Name,
const std::vector<Value*> &Opts);
+ // PerformExitStuff - Print out counters and profiling information if
+ // applicable...
+ void PerformExitStuff();
void initializeExecutionEngine();
void initializeExternalFunctions();