1 //===-- ExternalFunctions.cpp - Implement External Functions --------------===//
3 // This file contains both code to deal with invoking "external" functions, but
4 // also contains code that implements "exported" external functions.
6 // External functions in LLI are implemented by dlopen'ing the lli executable
7 // and using dlsym to look op the functions that we want to invoke. If a
8 // function is found, then the arguments are mangled and passed in to the
11 //===----------------------------------------------------------------------===//
13 #include "Interpreter.h"
14 #include "ExecutionAnnotations.h"
15 #include "llvm/Module.h"
16 #include "llvm/DerivedTypes.h"
17 #include "llvm/SymbolTable.h"
18 #include "llvm/Target/TargetData.h"
20 #include "Config/dlfcn.h"
21 #include "Config/link.h"
23 #include "Config/stdio.h"
26 typedef GenericValue (*ExFunc)(FunctionType *, const vector<GenericValue> &);
27 static std::map<const Function *, ExFunc> Functions;
28 static std::map<std::string, ExFunc> FuncNames;
30 static Interpreter *TheInterpreter;
32 // getCurrentExecutablePath() - Return the directory that the lli executable
35 std::string Interpreter::getCurrentExecutablePath() const {
37 if (dladdr(&TheInterpreter, &Info) == 0) return "";
39 std::string LinkAddr(Info.dli_fname);
40 unsigned SlashPos = LinkAddr.rfind('/');
41 if (SlashPos != std::string::npos)
42 LinkAddr.resize(SlashPos); // Trim the executable name off...
48 static char getTypeID(const Type *Ty) {
49 switch (Ty->getPrimitiveID()) {
50 case Type::VoidTyID: return 'V';
51 case Type::BoolTyID: return 'o';
52 case Type::UByteTyID: return 'B';
53 case Type::SByteTyID: return 'b';
54 case Type::UShortTyID: return 'S';
55 case Type::ShortTyID: return 's';
56 case Type::UIntTyID: return 'I';
57 case Type::IntTyID: return 'i';
58 case Type::ULongTyID: return 'L';
59 case Type::LongTyID: return 'l';
60 case Type::FloatTyID: return 'F';
61 case Type::DoubleTyID: return 'D';
62 case Type::PointerTyID: return 'P';
63 case Type::FunctionTyID: return 'M';
64 case Type::StructTyID: return 'T';
65 case Type::ArrayTyID: return 'A';
66 case Type::OpaqueTyID: return 'O';
71 static ExFunc lookupFunction(const Function *M) {
72 // Function not found, look it up... start by figuring out what the
73 // composite function name should be.
74 std::string ExtName = "lle_";
75 const FunctionType *MT = M->getFunctionType();
76 for (unsigned i = 0; const Type *Ty = MT->getContainedType(i); ++i)
77 ExtName += getTypeID(Ty);
78 ExtName += "_" + M->getName();
80 //std::cout << "Tried: '" << ExtName << "'\n";
81 ExFunc FnPtr = FuncNames[ExtName];
83 FnPtr = (ExFunc)dlsym(RTLD_DEFAULT, ExtName.c_str());
85 FnPtr = FuncNames["lle_X_"+M->getName()];
86 if (FnPtr == 0) // Try calling a generic function... if it exists...
87 FnPtr = (ExFunc)dlsym(RTLD_DEFAULT, ("lle_X_"+M->getName()).c_str());
89 Functions.insert(std::make_pair(M, FnPtr)); // Cache for later
93 GenericValue Interpreter::callExternalFunction(Function *M,
94 const std::vector<GenericValue> &ArgVals) {
95 TheInterpreter = this;
97 // Do a lookup to see if the function is in our cache... this should just be a
98 // defered annotation!
99 std::map<const Function *, ExFunc>::iterator FI = Functions.find(M);
100 ExFunc Fn = (FI == Functions.end()) ? lookupFunction(M) : FI->second;
102 std::cout << "Tried to execute an unknown external function: "
103 << M->getType()->getDescription() << " " << M->getName() << "\n";
104 return GenericValue();
107 // TODO: FIXME when types are not const!
108 GenericValue Result = Fn(const_cast<FunctionType*>(M->getFunctionType()),
114 //===----------------------------------------------------------------------===//
115 // Functions "exported" to the running application...
117 extern "C" { // Don't add C++ manglings to llvm mangling :)
119 // void putchar(sbyte)
120 GenericValue lle_Vb_putchar(FunctionType *M, const vector<GenericValue> &Args) {
121 std::cout << Args[0].SByteVal;
122 return GenericValue();
126 GenericValue lle_ii_putchar(FunctionType *M, const vector<GenericValue> &Args) {
127 std::cout << ((char)Args[0].IntVal) << std::flush;
131 // void putchar(ubyte)
132 GenericValue lle_VB_putchar(FunctionType *M, const vector<GenericValue> &Args) {
133 std::cout << Args[0].SByteVal << std::flush;
137 // void atexit(Function*)
138 GenericValue lle_X_atexit(FunctionType *M, const vector<GenericValue> &Args) {
139 assert(Args.size() == 1);
140 TheInterpreter->addAtExitHandler((Function*)GVTOP(Args[0]));
147 GenericValue lle_X_exit(FunctionType *M, const vector<GenericValue> &Args) {
148 TheInterpreter->exitCalled(Args[0]);
149 return GenericValue();
153 GenericValue lle_X_abort(FunctionType *M, const vector<GenericValue> &Args) {
154 std::cerr << "***PROGRAM ABORTED***!\n";
157 TheInterpreter->exitCalled(GV);
158 return GenericValue();
161 // void *malloc(uint)
162 GenericValue lle_X_malloc(FunctionType *M, const vector<GenericValue> &Args) {
163 assert(Args.size() == 1 && "Malloc expects one argument!");
164 return PTOGV(malloc(Args[0].UIntVal));
167 // void *calloc(uint, uint)
168 GenericValue lle_X_calloc(FunctionType *M, const vector<GenericValue> &Args) {
169 assert(Args.size() == 2 && "calloc expects two arguments!");
170 return PTOGV(calloc(Args[0].UIntVal, Args[1].UIntVal));
174 GenericValue lle_X_free(FunctionType *M, const vector<GenericValue> &Args) {
175 assert(Args.size() == 1);
176 free(GVTOP(Args[0]));
177 return GenericValue();
181 GenericValue lle_X_atoi(FunctionType *M, const vector<GenericValue> &Args) {
182 assert(Args.size() == 1);
184 GV.IntVal = atoi((char*)GVTOP(Args[0]));
188 // double pow(double, double)
189 GenericValue lle_X_pow(FunctionType *M, const vector<GenericValue> &Args) {
190 assert(Args.size() == 2);
192 GV.DoubleVal = pow(Args[0].DoubleVal, Args[1].DoubleVal);
196 // double exp(double)
197 GenericValue lle_X_exp(FunctionType *M, const vector<GenericValue> &Args) {
198 assert(Args.size() == 1);
200 GV.DoubleVal = exp(Args[0].DoubleVal);
204 // double sqrt(double)
205 GenericValue lle_X_sqrt(FunctionType *M, const vector<GenericValue> &Args) {
206 assert(Args.size() == 1);
208 GV.DoubleVal = sqrt(Args[0].DoubleVal);
212 // double log(double)
213 GenericValue lle_X_log(FunctionType *M, const vector<GenericValue> &Args) {
214 assert(Args.size() == 1);
216 GV.DoubleVal = log(Args[0].DoubleVal);
220 // double floor(double)
221 GenericValue lle_X_floor(FunctionType *M, const vector<GenericValue> &Args) {
222 assert(Args.size() == 1);
224 GV.DoubleVal = floor(Args[0].DoubleVal);
229 GenericValue lle_X_drand48(FunctionType *M, const vector<GenericValue> &Args) {
230 assert(Args.size() == 0);
232 GV.DoubleVal = drand48();
237 GenericValue lle_X_lrand48(FunctionType *M, const vector<GenericValue> &Args) {
238 assert(Args.size() == 0);
240 GV.IntVal = lrand48();
244 // void srand48(long)
245 GenericValue lle_X_srand48(FunctionType *M, const vector<GenericValue> &Args) {
246 assert(Args.size() == 1);
247 srand48(Args[0].IntVal);
248 return GenericValue();
252 GenericValue lle_X_srand(FunctionType *M, const vector<GenericValue> &Args) {
253 assert(Args.size() == 1);
254 srand(Args[0].UIntVal);
255 return GenericValue();
258 // int puts(const char*)
259 GenericValue lle_X_puts(FunctionType *M, const vector<GenericValue> &Args) {
260 assert(Args.size() == 1);
262 GV.IntVal = puts((char*)GVTOP(Args[0]));
266 // int sprintf(sbyte *, sbyte *, ...) - a very rough implementation to make
268 GenericValue lle_X_sprintf(FunctionType *M, const vector<GenericValue> &Args) {
269 char *OutputBuffer = (char *)GVTOP(Args[0]);
270 const char *FmtStr = (const char *)GVTOP(Args[1]);
273 // printf should return # chars printed. This is completely incorrect, but
274 // close enough for now.
275 GenericValue GV; GV.IntVal = strlen(FmtStr);
278 case 0: return GV; // Null terminator...
279 default: // Normal nonspecial character
280 sprintf(OutputBuffer++, "%c", *FmtStr++);
282 case '\\': { // Handle escape codes
283 sprintf(OutputBuffer, "%c%c", *FmtStr, *(FmtStr+1));
284 FmtStr += 2; OutputBuffer += 2;
287 case '%': { // Handle format specifiers
288 char FmtBuf[100] = "", Buffer[1000] = "";
291 char Last = *FB++ = *FmtStr++;
292 unsigned HowLong = 0;
293 while (Last != 'c' && Last != 'd' && Last != 'i' && Last != 'u' &&
294 Last != 'o' && Last != 'x' && Last != 'X' && Last != 'e' &&
295 Last != 'E' && Last != 'g' && Last != 'G' && Last != 'f' &&
296 Last != 'p' && Last != 's' && Last != '%') {
297 if (Last == 'l' || Last == 'L') HowLong++; // Keep track of l's
298 Last = *FB++ = *FmtStr++;
304 sprintf(Buffer, FmtBuf); break;
306 sprintf(Buffer, FmtBuf, Args[ArgNo++].IntVal); break;
311 if (HowLong == 1 && TheInterpreter->getModule().has64BitPointers() &&
312 sizeof(long) < sizeof(long long)) {
313 // Make sure we use %lld with a 64 bit argument because we might be
314 // compiling LLI on a 32 bit compiler.
315 unsigned Size = strlen(FmtBuf);
316 FmtBuf[Size] = FmtBuf[Size-1];
318 FmtBuf[Size-1] = 'l';
320 sprintf(Buffer, FmtBuf, Args[ArgNo++].ULongVal);
322 sprintf(Buffer, FmtBuf, Args[ArgNo++].IntVal); break;
323 case 'e': case 'E': case 'g': case 'G': case 'f':
324 sprintf(Buffer, FmtBuf, Args[ArgNo++].DoubleVal); break;
326 sprintf(Buffer, FmtBuf, (void*)GVTOP(Args[ArgNo++])); break;
328 sprintf(Buffer, FmtBuf, (char*)GVTOP(Args[ArgNo++])); break;
329 default: std::cout << "<unknown printf code '" << *FmtStr << "'!>";
332 strcpy(OutputBuffer, Buffer);
333 OutputBuffer += strlen(Buffer);
340 // int printf(sbyte *, ...) - a very rough implementation to make output useful.
341 GenericValue lle_X_printf(FunctionType *M, const vector<GenericValue> &Args) {
343 vector<GenericValue> NewArgs;
344 NewArgs.push_back(PTOGV(Buffer));
345 NewArgs.insert(NewArgs.end(), Args.begin(), Args.end());
346 GenericValue GV = lle_X_sprintf(M, NewArgs);
351 static void ByteswapSCANFResults(const char *Fmt, void *Arg0, void *Arg1,
352 void *Arg2, void *Arg3, void *Arg4, void *Arg5,
353 void *Arg6, void *Arg7, void *Arg8) {
354 void *Args[] = { Arg0, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, 0 };
356 // Loop over the format string, munging read values as appropriate (performs
357 // byteswaps as necessary).
361 // Read any flag characters that may be present...
362 bool Suppress = false;
365 bool LongLong = false; // long long or long double
369 case '*': Suppress = true; break;
370 case 'a': /*Allocate = true;*/ break; // We don't need to track this
371 case 'h': Half = true; break;
372 case 'l': Long = true; break;
374 case 'L': LongLong = true; break;
376 if (Fmt[-1] > '9' || Fmt[-1] < '0') // Ignore field width specs
382 // Read the conversion character
383 if (!Suppress && Fmt[-1] != '%') { // Nothing to do?
388 case 'i': case 'o': case 'u': case 'x': case 'X': case 'n': case 'p':
390 if (Long || LongLong) {
391 Size = 8; Ty = Type::ULongTy;
393 Size = 4; Ty = Type::UShortTy;
395 Size = 4; Ty = Type::UIntTy;
399 case 'e': case 'g': case 'E':
401 if (Long || LongLong) {
402 Size = 8; Ty = Type::DoubleTy;
404 Size = 4; Ty = Type::FloatTy;
408 case 's': case 'c': case '[': // No byteswap needed
418 void *Arg = Args[ArgNo++];
419 memcpy(&GV, Arg, Size);
420 TheInterpreter->StoreValueToMemory(GV, (GenericValue*)Arg, Ty);
427 // int sscanf(const char *format, ...);
428 GenericValue lle_X_sscanf(FunctionType *M, const vector<GenericValue> &args) {
429 assert(args.size() < 10 && "Only handle up to 10 args to sscanf right now!");
432 for (unsigned i = 0; i < args.size(); ++i)
433 Args[i] = (char*)GVTOP(args[i]);
436 GV.IntVal = sscanf(Args[0], Args[1], Args[2], Args[3], Args[4],
437 Args[5], Args[6], Args[7], Args[8], Args[9]);
438 ByteswapSCANFResults(Args[1], Args[2], Args[3], Args[4],
439 Args[5], Args[6], Args[7], Args[8], Args[9], 0);
443 // int scanf(const char *format, ...);
444 GenericValue lle_X_scanf(FunctionType *M, const vector<GenericValue> &args) {
445 assert(args.size() < 10 && "Only handle up to 10 args to scanf right now!");
448 for (unsigned i = 0; i < args.size(); ++i)
449 Args[i] = (char*)GVTOP(args[i]);
452 GV.IntVal = scanf(Args[0], Args[1], Args[2], Args[3], Args[4],
453 Args[5], Args[6], Args[7], Args[8], Args[9]);
454 ByteswapSCANFResults(Args[0], Args[1], Args[2], Args[3], Args[4],
455 Args[5], Args[6], Args[7], Args[8], Args[9]);
460 // int clock(void) - Profiling implementation
461 GenericValue lle_i_clock(FunctionType *M, const vector<GenericValue> &Args) {
462 extern int clock(void);
463 GenericValue GV; GV.IntVal = clock();
468 //===----------------------------------------------------------------------===//
469 // String Functions...
470 //===----------------------------------------------------------------------===//
472 // int strcmp(const char *S1, const char *S2);
473 GenericValue lle_X_strcmp(FunctionType *M, const vector<GenericValue> &Args) {
474 assert(Args.size() == 2);
476 Ret.IntVal = strcmp((char*)GVTOP(Args[0]), (char*)GVTOP(Args[1]));
480 // char *strcat(char *Dest, const char *src);
481 GenericValue lle_X_strcat(FunctionType *M, const vector<GenericValue> &Args) {
482 assert(Args.size() == 2);
483 return PTOGV(strcat((char*)GVTOP(Args[0]), (char*)GVTOP(Args[1])));
486 // char *strcpy(char *Dest, const char *src);
487 GenericValue lle_X_strcpy(FunctionType *M, const vector<GenericValue> &Args) {
488 assert(Args.size() == 2);
489 return PTOGV(strcpy((char*)GVTOP(Args[0]), (char*)GVTOP(Args[1])));
492 // long strlen(const char *src);
493 GenericValue lle_X_strlen(FunctionType *M, const vector<GenericValue> &Args) {
494 assert(Args.size() == 1);
496 Ret.LongVal = strlen((char*)GVTOP(Args[0]));
500 // char *__strdup(const char *src);
501 GenericValue lle_X___strdup(FunctionType *M, const vector<GenericValue> &Args) {
502 assert(Args.size() == 1);
503 return PTOGV(strdup((char*)GVTOP(Args[0])));
506 // void *memset(void *S, int C, size_t N)
507 GenericValue lle_X_memset(FunctionType *M, const vector<GenericValue> &Args) {
508 assert(Args.size() == 3);
509 return PTOGV(memset(GVTOP(Args[0]), Args[1].IntVal, Args[2].UIntVal));
512 // void *memcpy(void *Dest, void *src, size_t Size);
513 GenericValue lle_X_memcpy(FunctionType *M, const vector<GenericValue> &Args) {
514 assert(Args.size() == 3);
515 return PTOGV(memcpy((char*)GVTOP(Args[0]), (char*)GVTOP(Args[1]),
519 //===----------------------------------------------------------------------===//
521 //===----------------------------------------------------------------------===//
523 // getFILE - Turn a pointer in the host address space into a legit pointer in
524 // the interpreter address space. For the most part, this is an identity
525 // transformation, but if the program refers to stdio, stderr, stdin then they
526 // have pointers that are relative to the __iob array. If this is the case,
527 // change the FILE into the REAL stdio stream.
529 static FILE *getFILE(void *Ptr) {
530 static Module *LastMod = 0;
531 static PointerTy IOBBase = 0;
532 static unsigned FILESize;
534 if (LastMod != &TheInterpreter->getModule()) { // Module change or initialize?
535 Module *M = LastMod = &TheInterpreter->getModule();
537 // Check to see if the currently loaded module contains an __iob symbol...
538 GlobalVariable *IOB = 0;
539 SymbolTable &ST = M->getSymbolTable();
540 for (SymbolTable::iterator I = ST.begin(), E = ST.end(); I != E; ++I) {
541 SymbolTable::VarMap &M = I->second;
542 for (SymbolTable::VarMap::iterator J = M.begin(), E = M.end();
544 if (J->first == "__iob")
545 if ((IOB = dyn_cast<GlobalVariable>(J->second)))
550 #if 0 /// FIXME! __iob support for LLI
551 // If we found an __iob symbol now, find out what the actual address it's
554 // Get the address the array lives in...
555 GlobalAddress *Address =
556 (GlobalAddress*)IOB->getOrCreateAnnotation(GlobalAddressAID);
557 IOBBase = (PointerTy)(GenericValue*)Address->Ptr;
559 // Figure out how big each element of the array is...
560 const ArrayType *AT =
561 dyn_cast<ArrayType>(IOB->getType()->getElementType());
563 FILESize = TD.getTypeSize(AT->getElementType());
565 FILESize = 16*8; // Default size
570 // Check to see if this is a reference to __iob...
572 unsigned FDNum = ((unsigned long)Ptr-IOBBase)/FILESize;
585 // FILE *fopen(const char *filename, const char *mode);
586 GenericValue lle_X_fopen(FunctionType *M, const vector<GenericValue> &Args) {
587 assert(Args.size() == 2);
588 return PTOGV(fopen((const char *)GVTOP(Args[0]),
589 (const char *)GVTOP(Args[1])));
592 // int fclose(FILE *F);
593 GenericValue lle_X_fclose(FunctionType *M, const vector<GenericValue> &Args) {
594 assert(Args.size() == 1);
596 GV.IntVal = fclose(getFILE(GVTOP(Args[0])));
600 // int feof(FILE *stream);
601 GenericValue lle_X_feof(FunctionType *M, const vector<GenericValue> &Args) {
602 assert(Args.size() == 1);
605 GV.IntVal = feof(getFILE(GVTOP(Args[0])));
609 // size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream);
610 GenericValue lle_X_fread(FunctionType *M, const vector<GenericValue> &Args) {
611 assert(Args.size() == 4);
614 GV.UIntVal = fread((void*)GVTOP(Args[0]), Args[1].UIntVal,
615 Args[2].UIntVal, getFILE(GVTOP(Args[3])));
619 // size_t fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream);
620 GenericValue lle_X_fwrite(FunctionType *M, const vector<GenericValue> &Args) {
621 assert(Args.size() == 4);
624 GV.UIntVal = fwrite((void*)GVTOP(Args[0]), Args[1].UIntVal,
625 Args[2].UIntVal, getFILE(GVTOP(Args[3])));
629 // char *fgets(char *s, int n, FILE *stream);
630 GenericValue lle_X_fgets(FunctionType *M, const vector<GenericValue> &Args) {
631 assert(Args.size() == 3);
632 return GVTOP(fgets((char*)GVTOP(Args[0]), Args[1].IntVal,
633 getFILE(GVTOP(Args[2]))));
636 // FILE *freopen(const char *path, const char *mode, FILE *stream);
637 GenericValue lle_X_freopen(FunctionType *M, const vector<GenericValue> &Args) {
638 assert(Args.size() == 3);
639 return PTOGV(freopen((char*)GVTOP(Args[0]), (char*)GVTOP(Args[1]),
640 getFILE(GVTOP(Args[2]))));
643 // int fflush(FILE *stream);
644 GenericValue lle_X_fflush(FunctionType *M, const vector<GenericValue> &Args) {
645 assert(Args.size() == 1);
647 GV.IntVal = fflush(getFILE(GVTOP(Args[0])));
651 // int getc(FILE *stream);
652 GenericValue lle_X_getc(FunctionType *M, const vector<GenericValue> &Args) {
653 assert(Args.size() == 1);
655 GV.IntVal = getc(getFILE(GVTOP(Args[0])));
659 // int _IO_getc(FILE *stream);
660 GenericValue lle_X__IO_getc(FunctionType *F, const vector<GenericValue> &Args) {
661 return lle_X_getc(F, Args);
664 // int fputc(int C, FILE *stream);
665 GenericValue lle_X_fputc(FunctionType *M, const vector<GenericValue> &Args) {
666 assert(Args.size() == 2);
668 GV.IntVal = fputc(Args[0].IntVal, getFILE(GVTOP(Args[1])));
672 // int ungetc(int C, FILE *stream);
673 GenericValue lle_X_ungetc(FunctionType *M, const vector<GenericValue> &Args) {
674 assert(Args.size() == 2);
676 GV.IntVal = ungetc(Args[0].IntVal, getFILE(GVTOP(Args[1])));
680 // int fprintf(FILE *,sbyte *, ...) - a very rough implementation to make output
682 GenericValue lle_X_fprintf(FunctionType *M, const vector<GenericValue> &Args) {
683 assert(Args.size() >= 2);
685 vector<GenericValue> NewArgs;
686 NewArgs.push_back(PTOGV(Buffer));
687 NewArgs.insert(NewArgs.end(), Args.begin()+1, Args.end());
688 GenericValue GV = lle_X_sprintf(M, NewArgs);
690 fputs(Buffer, getFILE(GVTOP(Args[0])));
694 //===----------------------------------------------------------------------===//
695 // LLVM Intrinsic Functions...
696 //===----------------------------------------------------------------------===//
698 // void llvm.va_start(<va_list> *) - Implement the va_start operation...
699 GenericValue llvm_va_start(FunctionType *F, const vector<GenericValue> &Args) {
700 assert(Args.size() == 1);
701 GenericValue *VAListP = (GenericValue *)GVTOP(Args[0]);
703 Val.UIntVal = 0; // Start at the first '...' argument...
704 TheInterpreter->StoreValueToMemory(Val, VAListP, Type::UIntTy);
705 return GenericValue();
708 // void llvm.va_end(<va_list> *) - Implement the va_end operation...
709 GenericValue llvm_va_end(FunctionType *F, const vector<GenericValue> &Args) {
710 assert(Args.size() == 1);
711 return GenericValue(); // Noop!
714 // void llvm.va_copy(<va_list> *, <va_list>) - Implement the va_copy
716 GenericValue llvm_va_copy(FunctionType *F, const vector<GenericValue> &Args) {
717 assert(Args.size() == 2);
718 GenericValue *DestVAList = (GenericValue*)GVTOP(Args[0]);
719 TheInterpreter->StoreValueToMemory(Args[1], DestVAList, Type::UIntTy);
720 return GenericValue();
726 void Interpreter::initializeExternalFunctions() {
727 FuncNames["lle_Vb_putchar"] = lle_Vb_putchar;
728 FuncNames["lle_ii_putchar"] = lle_ii_putchar;
729 FuncNames["lle_VB_putchar"] = lle_VB_putchar;
730 FuncNames["lle_X_exit"] = lle_X_exit;
731 FuncNames["lle_X_abort"] = lle_X_abort;
732 FuncNames["lle_X_malloc"] = lle_X_malloc;
733 FuncNames["lle_X_calloc"] = lle_X_calloc;
734 FuncNames["lle_X_free"] = lle_X_free;
735 FuncNames["lle_X_atoi"] = lle_X_atoi;
736 FuncNames["lle_X_pow"] = lle_X_pow;
737 FuncNames["lle_X_exp"] = lle_X_exp;
738 FuncNames["lle_X_log"] = lle_X_log;
739 FuncNames["lle_X_floor"] = lle_X_floor;
740 FuncNames["lle_X_srand"] = lle_X_srand;
741 FuncNames["lle_X_drand48"] = lle_X_drand48;
742 FuncNames["lle_X_srand48"] = lle_X_srand48;
743 FuncNames["lle_X_lrand48"] = lle_X_lrand48;
744 FuncNames["lle_X_sqrt"] = lle_X_sqrt;
745 FuncNames["lle_X_puts"] = lle_X_puts;
746 FuncNames["lle_X_printf"] = lle_X_printf;
747 FuncNames["lle_X_sprintf"] = lle_X_sprintf;
748 FuncNames["lle_X_sscanf"] = lle_X_sscanf;
749 FuncNames["lle_X_scanf"] = lle_X_scanf;
750 FuncNames["lle_i_clock"] = lle_i_clock;
752 FuncNames["lle_X_strcmp"] = lle_X_strcmp;
753 FuncNames["lle_X_strcat"] = lle_X_strcat;
754 FuncNames["lle_X_strcpy"] = lle_X_strcpy;
755 FuncNames["lle_X_strlen"] = lle_X_strlen;
756 FuncNames["lle_X___strdup"] = lle_X___strdup;
757 FuncNames["lle_X_memset"] = lle_X_memset;
758 FuncNames["lle_X_memcpy"] = lle_X_memcpy;
760 FuncNames["lle_X_fopen"] = lle_X_fopen;
761 FuncNames["lle_X_fclose"] = lle_X_fclose;
762 FuncNames["lle_X_feof"] = lle_X_feof;
763 FuncNames["lle_X_fread"] = lle_X_fread;
764 FuncNames["lle_X_fwrite"] = lle_X_fwrite;
765 FuncNames["lle_X_fgets"] = lle_X_fgets;
766 FuncNames["lle_X_fflush"] = lle_X_fflush;
767 FuncNames["lle_X_fgetc"] = lle_X_getc;
768 FuncNames["lle_X_getc"] = lle_X_getc;
769 FuncNames["lle_X__IO_getc"] = lle_X__IO_getc;
770 FuncNames["lle_X_fputc"] = lle_X_fputc;
771 FuncNames["lle_X_ungetc"] = lle_X_ungetc;
772 FuncNames["lle_X_fprintf"] = lle_X_fprintf;
773 FuncNames["lle_X_freopen"] = lle_X_freopen;
775 FuncNames["lle_X_llvm.va_start"]= llvm_va_start;
776 FuncNames["lle_X_llvm.va_end"] = llvm_va_end;
777 FuncNames["lle_X_llvm.va_copy"] = llvm_va_copy;