aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ExecutionEngine
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
commit3eb60f8775941422a7f04c0e16bd3a7fac9b73f5 (patch)
tree731686b4c69f93481480de0a9ef1ff91a7faf83a /lib/ExecutionEngine
parent59a99604232c71a53fbe24b4b384722e9d9c0110 (diff)
downloadexternal_llvm-3eb60f8775941422a7f04c0e16bd3a7fac9b73f5.zip
external_llvm-3eb60f8775941422a7f04c0e16bd3a7fac9b73f5.tar.gz
external_llvm-3eb60f8775941422a7f04c0e16bd3a7fac9b73f5.tar.bz2
Add methods print<TYPE> for String, Pointer, and each primitive type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@994 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine')
-rw-r--r--lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
index 662abc2..7c60126 100644
--- a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
+++ b/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;