aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
diff options
context:
space:
mode:
authorBrian Gaeke <gaeke@uiuc.edu>2003-09-05 18:42:01 +0000
committerBrian Gaeke <gaeke@uiuc.edu>2003-09-05 18:42:01 +0000
commita7669038fc8ab1447bc1f68108b30996adf50ef4 (patch)
treebb30cf4fc477b9d52f92be78b6b89e6c6b47e978 /llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
parent15ad3f07db8df51636369c51d9aae83550fcd1bc (diff)
downloadllvm-a7669038fc8ab1447bc1f68108b30996adf50ef4.zip
llvm-a7669038fc8ab1447bc1f68108b30996adf50ef4.tar.gz
llvm-a7669038fc8ab1447bc1f68108b30996adf50ef4.tar.bz2
Make CreateArgv part of lli rather than part of ExecutionEngine.
Switch Interpreter and JIT's "run" methods to take a Function and a vector of GenericValues. Move (almost all of) the stuff that constructs a canonical call to main() into lli (new methods "callAsMain", "makeStringVector"). Nuke getCurrentExecutablePath(), enableTracing(), getCurrentFunction(), isStopped(), and many dead decls from interpreter. Add linux strdup() support to interpreter. Make interpreter's atexit handler runner and JIT's runAtExitHandlers() look more alike, in preparation for refactoring. atexit() is spelled "atexit", not "at_exit". llvm-svn: 8366
Diffstat (limited to 'llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp22
1 files changed, 6 insertions, 16 deletions
diff --git a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
index d24557a..1a28e46 100644
--- a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
+++ b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
@@ -29,22 +29,6 @@ static std::map<std::string, ExFunc> FuncNames;
static Interpreter *TheInterpreter;
-// getCurrentExecutablePath() - Return the directory that the lli executable
-// lives in.
-//
-std::string Interpreter::getCurrentExecutablePath() const {
- Dl_info Info;
- if (dladdr(&TheInterpreter, &Info) == 0) return "";
-
- std::string LinkAddr(Info.dli_fname);
- unsigned SlashPos = LinkAddr.rfind('/');
- if (SlashPos != std::string::npos)
- LinkAddr.resize(SlashPos); // Trim the executable name off...
-
- return LinkAddr;
-}
-
-
static char getTypeID(const Type *Ty) {
switch (Ty->getPrimitiveID()) {
case Type::VoidTyID: return 'V';
@@ -498,6 +482,12 @@ GenericValue lle_X_strlen(FunctionType *M, const vector<GenericValue> &Args) {
return Ret;
}
+// char *strdup(const char *src);
+GenericValue lle_X_strdup(FunctionType *M, const vector<GenericValue> &Args) {
+ assert(Args.size() == 1);
+ return PTOGV(strdup((char*)GVTOP(Args[0])));
+}
+
// char *__strdup(const char *src);
GenericValue lle_X___strdup(FunctionType *M, const vector<GenericValue> &Args) {
assert(Args.size() == 1);