summaryrefslogtreecommitdiffstats
path: root/lib/ExecutionEngine
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-04-21 17:11:45 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-04-21 17:11:45 +0000
commitb3b0727032e58c8b8f3017c2b3f560616c6905af (patch)
treeaa2a50e9bf7dde9bc331e2865d230d74fcc89760 /lib/ExecutionEngine
parent8f192e0ee03f2cf120f6b7301a52017e4ea45d5b (diff)
downloadexternal_llvm-b3b0727032e58c8b8f3017c2b3f560616c6905af.zip
external_llvm-b3b0727032e58c8b8f3017c2b3f560616c6905af.tar.gz
external_llvm-b3b0727032e58c8b8f3017c2b3f560616c6905af.tar.bz2
We only need one putchar which gives it a shot at getting matched by its
users. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36305 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine')
-rw-r--r--lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp21
1 files changed, 4 insertions, 17 deletions
diff --git a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
index 99b3fd6..53f5deb 100644
--- a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
+++ b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
@@ -112,20 +112,8 @@ GenericValue Interpreter::callExternalFunction(Function *F,
//
extern "C" { // Don't add C++ manglings to llvm mangling :)
-// void putchar(sbyte)
-GenericValue lle_VB_putchar(FunctionType *FT, const vector<GenericValue> &Args){
- cout << ((char)Args[0].IntVal.getZExtValue());
- return GenericValue();
-}
-
-// int putchar(int)
-GenericValue lle_ii_putchar(FunctionType *FT, const vector<GenericValue> &Args){
- cout << ((char)Args[0].IntVal.getZExtValue()) << std::flush;
- return Args[0];
-}
-
// void putchar(ubyte)
-GenericValue lle_Vb_putchar(FunctionType *FT, const vector<GenericValue> &Args){
+GenericValue lle_X_putchar(FunctionType *FT, const vector<GenericValue> &Args){
cout << ((char)Args[0].IntVal.getZExtValue()) << std::flush;
return Args[0];
}
@@ -354,13 +342,14 @@ GenericValue lle_X_sprintf(FunctionType *FT, const vector<GenericValue> &Args) {
break;
}
}
+ return GV;
}
// int printf(sbyte *, ...) - a very rough implementation to make output useful.
GenericValue lle_X_printf(FunctionType *FT, const vector<GenericValue> &Args) {
char Buffer[10000];
vector<GenericValue> NewArgs;
- NewArgs.push_back(PTOGV(Buffer));
+ NewArgs.push_back(PTOGV((void*)&Buffer[0]));
NewArgs.insert(NewArgs.end(), Args.begin(), Args.end());
GenericValue GV = lle_X_sprintf(FT, NewArgs);
cout << Buffer;
@@ -704,9 +693,7 @@ GenericValue lle_X_fprintf(FunctionType *FT, const vector<GenericValue> &Args) {
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_X_putchar"] = lle_X_putchar;
FuncNames["lle_X_exit"] = lle_X_exit;
FuncNames["lle_X_abort"] = lle_X_abort;
FuncNames["lle_X_malloc"] = lle_X_malloc;