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

Alkis Evlogimenos alkis at cs.uiuc.edu
Thu Jun 10 05:00:01 PDT 2004


Changes in directory llvm-java/lib/Compiler:

Compiler.cpp updated: 1.42 -> 1.43

---
Log message:

Simplify code using the newly aded BinaryOperator::create* factory functions.


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

Index: llvm-java/lib/Compiler/Compiler.cpp
diff -u llvm-java/lib/Compiler/Compiler.cpp:1.42 llvm-java/lib/Compiler/Compiler.cpp:1.43
--- llvm-java/lib/Compiler/Compiler.cpp:1.42	Sat May 29 04:35:21 2004
+++ llvm-java/lib/Compiler/Compiler.cpp	Thu Jun 10 04:54:11 2004
@@ -517,9 +517,8 @@
         void do_iinc(unsigned bcI, unsigned index, int amount) {
             Value* v = new LoadInst(getOrCreateLocal(index, Type::IntTy),
                                     TMP, getBBAt(bcI));
-            BinaryOperator::create(Instruction::Add, v,
-                                   ConstantSInt::get(Type::IntTy, amount),
-                                   TMP, getBBAt(bcI));
+            BinaryOperator::createAdd(v, ConstantSInt::get(Type::IntTy, amount),
+                                      TMP, getBBAt(bcI));
             new StoreInst(v, getOrCreateLocal(index, Type::IntTy),
                           getBBAt(bcI));
         }
@@ -532,13 +531,11 @@
         void do_lcmp(unsigned bcI) {
             Value* v2 = opStack_.top(); opStack_.pop();
             Value* v1 = opStack_.top(); opStack_.pop();
-            Value* c =
-                new SetCondInst(Instruction::SetGT, v1, v2, TMP, getBBAt(bcI));
-            Value* r =
-                new SelectInst(c, ConstantSInt::get(Type::IntTy, 1),
-                               ConstantSInt::get(Type::IntTy, 0), TMP,
-                               getBBAt(bcI));
-            c = new SetCondInst(Instruction::SetLT, v1, v2, TMP, getBBAt(bcI));
+            Value* c = BinaryOperator::createSetGT(v1, v2, TMP, getBBAt(bcI));
+            Value* r = new SelectInst(c, ConstantSInt::get(Type::IntTy, 1),
+                                      ConstantSInt::get(Type::IntTy, 0), TMP,
+                                      getBBAt(bcI));
+            c = BinaryOperator::createSetLT(v1, v2, TMP, getBBAt(bcI));
             r = new SelectInst(c, ConstantSInt::get(Type::IntTy, -1), r, TMP,
                                getBBAt(bcI));
             opStack_.push(r);





More information about the llvm-commits mailing list