summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/Interpreter
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2001-10-28 20:52:27 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2001-10-28 20:52:27 +0000
commit578a840b29321d9638b03c1e62eb333787900fab (patch)
tree92eb95b3df332ef3f467722f8496c645fe682278 /llvm/lib/ExecutionEngine/Interpreter
parent03fb2f3916c87422bde9090fd16915190ff1420a (diff)
downloadbcm5719-llvm-578a840b29321d9638b03c1e62eb333787900fab.tar.gz
bcm5719-llvm-578a840b29321d9638b03c1e62eb333787900fab.zip
Add methods print<TYPE> for String, Pointer, and each primitive type.
llvm-svn: 994
Diffstat (limited to 'llvm/lib/ExecutionEngine/Interpreter')
-rw-r--r--llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
index 662abc22919..7c60126aaef 100644
--- a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
+++ b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
@@ -142,6 +142,37 @@ GenericValue lle_X_printVal(MethodType *M, const vector<GenericValue> &ArgVal) {
return GenericValue();
}
+// Implement 'void printString(X)'
+// Argument must be [ubyte {x N} ] * or sbyte *
+GenericValue lle_X_printString(MethodType *M, const vector<GenericValue> &ArgVal) {
+ assert(ArgVal.size() == 1 && "generic print only takes one argument!");
+ return lle_VP_printstr(M, ArgVal);
+}
+
+// Implement 'void print<TYPE>(X)' for each primitive type or pointer type
+#define PRINT_TYPE_FUNC(TYPENAME,TYPEID) \
+ GenericValue lle_X_print##TYPENAME##(MethodType *M,\
+ const vector<GenericValue> &ArgVal) {\
+ assert(ArgVal.size() == 1 && "generic print only takes one argument!");\
+ assert(M->getParamTypes()[0].get()->getPrimitiveID()\
+ == Type::##TYPEID##);\
+ Interpreter::printValue(M->getParamTypes()[0], ArgVal[0]);\
+ return GenericValue();\
+ }
+
+PRINT_TYPE_FUNC(Byte, SByteTyID)
+PRINT_TYPE_FUNC(UByte, UByteTyID)
+PRINT_TYPE_FUNC(Short, ShortTyID)
+PRINT_TYPE_FUNC(UShort, UShortTyID)
+PRINT_TYPE_FUNC(Int, IntTyID)
+PRINT_TYPE_FUNC(UInt, UIntTyID)
+PRINT_TYPE_FUNC(Long, LongTyID)
+PRINT_TYPE_FUNC(ULong, ULongTyID)
+PRINT_TYPE_FUNC(Float, FloatTyID)
+PRINT_TYPE_FUNC(Double, DoubleTyID)
+PRINT_TYPE_FUNC(Pointer, PointerTyID)
+
+
// void "putchar"(sbyte)
GenericValue lle_Vb_putchar(MethodType *M, const vector<GenericValue> &Args) {
cout << Args[0].SByteVal;
OpenPOWER on IntegriCloud