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

Alkis Evlogimenos alkis at cs.uiuc.edu
Tue May 25 20:32:02 PDT 2004


Changes in directory llvm-java/lib/Compiler:

Compiler.cpp updated: 1.31 -> 1.32

---
Log message:

Implement the IINC bytecode.


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

Index: llvm-java/lib/Compiler/Compiler.cpp
diff -u llvm-java/lib/Compiler/Compiler.cpp:1.31 llvm-java/lib/Compiler/Compiler.cpp:1.32
--- llvm-java/lib/Compiler/Compiler.cpp:1.31	Tue May 25 19:53:37 2004
+++ llvm-java/lib/Compiler/Compiler.cpp	Tue May 25 20:29:08 2004
@@ -467,7 +467,16 @@
 
 
         void do_iinc(unsigned bcI, unsigned index, int amount) {
-            assert(0 && "not implemented");
+            Instruction* in =
+                new LoadInst(getOrCreateLocal(index, Type::IntTy), TMP);
+            bc2bbMap_[bcI]->getInstList().push_back(in);
+            in = BinaryOperator::create(Instruction::Add,
+                                        in,
+                                        ConstantSInt::get(Type::IntTy, amount),
+                                        TMP);
+            bc2bbMap_[bcI]->getInstList().push_back(in);
+            in = new StoreInst(in, getOrCreateLocal(index, Type::IntTy));
+            bc2bbMap_[bcI]->getInstList().push_back(in);
         }
 
         void do_convert(unsigned bcI, JType to) {





More information about the llvm-commits mailing list