[llvm-commits] CVS: llvm/tools/lli/ExternalFunctions.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Nov 6 17:06:01 PST 2002


Changes in directory llvm/tools/lli:

ExternalFunctions.cpp updated: 1.35 -> 1.36

---
Log message:

Implement fprintf


---
Diffs of the changes:

Index: llvm/tools/lli/ExternalFunctions.cpp
diff -u llvm/tools/lli/ExternalFunctions.cpp:1.35 llvm/tools/lli/ExternalFunctions.cpp:1.36
--- llvm/tools/lli/ExternalFunctions.cpp:1.35	Wed Nov  6 16:59:28 2002
+++ llvm/tools/lli/ExternalFunctions.cpp	Wed Nov  6 17:05:03 2002
@@ -565,6 +565,21 @@
   return GV;
 }
 
+// int fprintf(FILE *,sbyte *, ...) - a very rough implementation to make output
+// useful.
+GenericValue lle_X_fprintf(FunctionType *M, const vector<GenericValue> &Args) {
+  assert(Args.size() > 2);
+  char Buffer[10000];
+  vector<GenericValue> NewArgs;
+  GenericValue GV; GV.PointerVal = (PointerTy)Buffer;
+  NewArgs.push_back(GV);
+  NewArgs.insert(NewArgs.end(), Args.begin()+1, Args.end());
+  GV = lle_X_sprintf(M, NewArgs);
+
+  fputs(Buffer, getFILE(Args[0].PointerVal));
+  return GV;
+}
+
 } // End extern "C"
 
 
@@ -616,4 +631,5 @@
   FuncNames["lle_X_getc"]         = lle_X_getc;
   FuncNames["lle_X_fputc"]        = lle_X_fputc;
   FuncNames["lle_X_ungetc"]       = lle_X_ungetc;
+  FuncNames["lle_X_fprintf"]      = lle_X_fprintf;
 }





More information about the llvm-commits mailing list