[llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp
Reid Spencer
reid at x10sys.com
Sat Dec 2 22:29:10 PST 2006
Changes in directory llvm/lib/Bytecode/Reader:
Reader.cpp updated: 1.208 -> 1.209
---
Log message:
Implement reading and writing of the ICmp and FCmp instructions.
---
Diffs of the changes: (+9 -3)
Reader.cpp | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.208 llvm/lib/Bytecode/Reader/Reader.cpp:1.209
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.208 Sat Dec 2 23:47:10 2006
+++ llvm/lib/Bytecode/Reader/Reader.cpp Sun Dec 3 00:28:54 2006
@@ -550,12 +550,11 @@
// First, handle the easy binary operators case
if (Opcode >= Instruction::BinaryOpsBegin &&
- Opcode < Instruction::BinaryOpsEnd && Oprnds.size() == 2)
+ Opcode < Instruction::BinaryOpsEnd && Oprnds.size() == 2) {
Result = BinaryOperator::create(Instruction::BinaryOps(Opcode),
getValue(iType, Oprnds[0]),
getValue(iType, Oprnds[1]));
-
- if (!Result) {
+ } else {
// Indicate that we don't think this is a call instruction (yet).
// Process based on the Opcode read
switch (Opcode) {
@@ -700,6 +699,13 @@
Result = PN;
break;
}
+ case Instruction::ICmp:
+ case Instruction::FCmp:
+ // These instructions encode the comparison predicate as the 3rd operand.
+ Result = CmpInst::create(Instruction::OtherOps(Opcode),
+ static_cast<unsigned short>(Oprnds[2]),
+ getValue(iType, Oprnds[0]), getValue(iType, Oprnds[1]));
+ break;
case Instruction::Shl:
case Instruction::LShr:
case Instruction::AShr:
More information about the llvm-commits
mailing list