mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 22:24:07 +00:00
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". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8366 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user