[llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp
Alkis Evlogimenos
alkis at cs.uiuc.edu
Thu May 27 16:13:09 PDT 2004
Changes in directory llvm-java/lib/Compiler:
Compiler.cpp updated: 1.39 -> 1.40
---
Log message:
Implement the LCMP bytecode.
---
Diffs of the changes: (+12 -1)
Index: llvm-java/lib/Compiler/Compiler.cpp
diff -u llvm-java/lib/Compiler/Compiler.cpp:1.39 llvm-java/lib/Compiler/Compiler.cpp:1.40
--- llvm-java/lib/Compiler/Compiler.cpp:1.39 Thu May 27 15:51:38 2004
+++ llvm-java/lib/Compiler/Compiler.cpp Thu May 27 16:09:19 2004
@@ -492,7 +492,18 @@
}
void do_lcmp(unsigned bcI) {
- assert(0 && "not implemented");
+ 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));
+ r = new SelectInst(c, ConstantSInt::get(Type::IntTy, -1), r, TMP,
+ getBBAt(bcI));
+ opStack_.push(r);
}
void do_cmpl(unsigned bcI) {
More information about the llvm-commits
mailing list