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

Alkis Evlogimenos alkis at cs.uiuc.edu
Thu May 27 15:52:03 PDT 2004


Changes in directory llvm-java/lib/Compiler:

Compiler.cpp updated: 1.37 -> 1.38

---
Log message:

Handle LDC, LDC_W and LDC2_W bytecodes.


---
Diffs of the changes:  (+17 -1)

Index: llvm-java/lib/Compiler/Compiler.cpp
diff -u llvm-java/lib/Compiler/Compiler.cpp:1.37 llvm-java/lib/Compiler/Compiler.cpp:1.38
--- llvm-java/lib/Compiler/Compiler.cpp:1.37	Thu May 27 15:38:21 2004
+++ llvm-java/lib/Compiler/Compiler.cpp	Thu May 27 15:48:19 2004
@@ -236,7 +236,23 @@
         }
 
         void do_ldc(unsigned bcI, unsigned index) {
-            assert(0 && "not implemented");
+            const Constant* c = cf_->getConstantPool()[index];
+            if (dynamic_cast<const ConstantString*>(c))
+                assert(0 && "not implemented");
+            else if (const ConstantInteger* i =
+                     dynamic_cast<const ConstantInteger*>(c))
+                opStack_.push(ConstantSInt::get(Type::IntTy, i->getValue()));
+            else if (const ConstantFloat* f =
+                     dynamic_cast<const ConstantFloat*>(c))
+                opStack_.push(ConstantFP::get(Type::FloatTy, f->getValue()));
+            else if (const ConstantLong* l =
+                     dynamic_cast<const ConstantLong*>(c))
+                opStack_.push(ConstantSInt::get(Type::LongTy, l->getValue()));
+            else if (const ConstantDouble* d =
+                     dynamic_cast<const ConstantDouble*>(c))
+                opStack_.push(ConstantFP::get(Type::DoubleTy, d->getValue()));
+            else
+                ; // FIXME: throw something
         }
 
         void do_load(unsigned bcI, JType type, unsigned index) {





More information about the llvm-commits mailing list