aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-05-14 14:21:30 +0000
committerChris Lattner <sabre@nondot.org>2003-05-14 14:21:30 +0000
commit4a5bb95729a5335bfdddd401454003ac05ba4316 (patch)
tree607258b2be0e52186b222f3d3f17b0002b47b3e8 /llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
parent2537ca318a65e29e085ed1f8e4f88387b21fdbad (diff)
downloadllvm-4a5bb95729a5335bfdddd401454003ac05ba4316.zip
llvm-4a5bb95729a5335bfdddd401454003ac05ba4316.tar.gz
llvm-4a5bb95729a5335bfdddd401454003ac05ba4316.tar.bz2
Add support for atexit function, remove support for __main function
llvm-svn: 6194
Diffstat (limited to 'llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
index 88b994c..8eaae50 100644
--- a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
+++ b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
@@ -91,7 +91,7 @@ static ExFunc lookupFunction(const Function *M) {
}
GenericValue Interpreter::callExternalFunction(Function *M,
- const vector<GenericValue> &ArgVals) {
+ const std::vector<GenericValue> &ArgVals) {
TheInterpreter = this;
// Do a lookup to see if the function is in our cache... this should just be a
@@ -134,9 +134,13 @@ GenericValue lle_VB_putchar(FunctionType *M, const vector<GenericValue> &Args) {
return Args[0];
}
-// void __main()
-GenericValue lle_V___main(FunctionType *M, const vector<GenericValue> &Args) {
- return GenericValue();
+// void atexit(Function*)
+GenericValue lle_X_atexit(FunctionType *M, const vector<GenericValue> &Args) {
+ assert(Args.size() == 1);
+ TheInterpreter->addAtExitHandler((Function*)GVTOP(Args[0]));
+ GenericValue GV;
+ GV.IntVal = 0;
+ return GV;
}
// void exit(int)
@@ -731,7 +735,6 @@ void Interpreter::initializeExternalFunctions() {
FuncNames["lle_Vb_putchar"] = lle_Vb_putchar;
FuncNames["lle_ii_putchar"] = lle_ii_putchar;
FuncNames["lle_VB_putchar"] = lle_VB_putchar;
- FuncNames["lle_V___main"] = lle_V___main;
FuncNames["lle_X_exit"] = lle_X_exit;
FuncNames["lle_X_abort"] = lle_X_abort;
FuncNames["lle_X_malloc"] = lle_X_malloc;