[llvm-commits] CVS: llvm-java/runtime/runtime.ll
Alkis Evlogimenos
alkis at cs.uiuc.edu
Sat Aug 14 01:58:17 PDT 2004
Changes in directory llvm-java/runtime:
runtime.ll updated: 1.5 -> 1.6
---
Log message:
Implement instanceof and checkcast bytecodes.
---
Diffs of the changes: (+30 -1)
Index: llvm-java/runtime/runtime.ll
diff -u llvm-java/runtime/runtime.ll:1.5 llvm-java/runtime/runtime.ll:1.6
--- llvm-java/runtime/runtime.ll:1.5 Thu Aug 5 13:22:43 2004
+++ llvm-java/runtime/runtime.ll Sat Aug 14 03:58:06 2004
@@ -1,12 +1,41 @@
"<llvm_java_base>" = type "<llvm_java_vtable_base>"*
"<llvm_java_vtable_base>" = type { "<llvm_java_type_info>" }
-"<llvm_java_type_info>" = type { }
+"<llvm_java_type_info>" = type { "<llvm_java_vtable_base>"* }
implementation
declare void %llvm_java_static_init()
declare void %llvm_java_main(int, sbyte**)
+int "<llvm_java_issubclass>"("<llvm_java_vtable_base>"* %self,
+ "<llvm_java_vtable_base>"* %class) {
+ %eq = seteq "<llvm_java_vtable_base>"* %self, %class
+ br bool %eq, label %isEqual, label %isNotEqual
+isEqual:
+ ret int 1
+isNotEqual:
+ %superPtr = getelementptr "<llvm_java_vtable_base>"* %self, uint 0, uint 0, uint 0
+ %super = load "<llvm_java_vtable_base>"** %superPtr
+ %nu = seteq "<llvm_java_vtable_base>"* %self, null
+ br bool %nu, label %isNull, label %isNotNull
+isNull:
+ ret int 0
+isNotNull:
+ %res = call int("<llvm_java_vtable_base>"*,"<llvm_java_vtable_base>"*)* "<llvm_java_issubclass>"("<llvm_java_vtable_base>"* %super, "<llvm_java_vtable_base>"* %class)
+ ret int %res
+}
+
+int "<llvm_java_instanceof>"("<llvm_java_vtable_base>"* %self,
+ "<llvm_java_vtable_base>"* %class) {
+ %c = seteq "<llvm_java_vtable_base>"* %self, null
+ br bool %c, label %isNull, label %isNotNull
+isNull:
+ ret int 0
+isNotNull:
+ %res = call int("<llvm_java_vtable_base>"*,"<llvm_java_vtable_base>"*)* "<llvm_java_issubclass>"("<llvm_java_vtable_base>"* %self, "<llvm_java_vtable_base>"* %class)
+ ret int %res
+}
+
int %main(int %argc, sbyte** %argv) {
entry:
call void %llvm_java_static_init()
More information about the llvm-commits
mailing list