[llvm-commits] CVS: llvm-java/lib/Compiler/OperandStack.cpp

Alkis Evlogimenos alkis at cs.uiuc.edu
Sun Nov 7 03:42:57 CST 2004



Changes in directory llvm-java/lib/Compiler:

OperandStack.cpp updated: 1.2 -> 1.3
---
Log message:

Automatically convert jbool, jchar, jbyte and jshort to a jint when
pushing it on the operand stack.


---
Diffs of the changes:  (+9 -0)

Index: llvm-java/lib/Compiler/OperandStack.cpp
diff -u llvm-java/lib/Compiler/OperandStack.cpp:1.2 llvm-java/lib/Compiler/OperandStack.cpp:1.3
--- llvm-java/lib/Compiler/OperandStack.cpp:1.2	Thu Oct 28 14:37:24 2004
+++ llvm-java/lib/Compiler/OperandStack.cpp	Sun Nov  7 03:42:46 2004
@@ -21,6 +21,15 @@
 
 void OperandStack::push(Value* value, BasicBlock* insertAtEnd)
 {
+  const Type* valueTy = value->getType();
+  // Values of jboolean, jbyte, jchar and jshort are extended to a
+  // jint when pushed on the operand stack.
+  if (valueTy == Type::BoolTy ||
+      valueTy == Type::SByteTy ||
+      valueTy == Type::UShortTy ||
+      valueTy == Type::ShortTy)
+    value = new CastInst(value, Type::IntTy, "int-extend", insertAtEnd);
+
   TheStack.push(new AllocaInst(value->getType(),
 			       NULL,
 			       "opStack" + utostr(TheStack.size()),






More information about the llvm-commits mailing list