Changes in directory llvm/lib/Bytecode/Reader:
Reader.cpp updated: 1.209 -> 1.210 --- Log message: Support ICmp/FCmp constant expression reading and writing. --- Diffs of the changes: (+12 -0) Reader.cpp | 12 ++++++++++++ 1 files changed, 12 insertions(+) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.209 llvm/lib/Bytecode/Reader/Reader.cpp:1.210 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.209 Sun Dec 3 00:28:54 2006 +++ llvm/lib/Bytecode/Reader/Reader.cpp Sun Dec 3 11:17:02 2006 @@ -701,6 +701,8 @@ } case Instruction::ICmp: case Instruction::FCmp: + if (Oprnds.size() != 3) + error("Cmp instructions requires 3 operands"); // These instructions encode the comparison predicate as the 3rd operand. Result = CmpInst::create(Instruction::OtherOps(Opcode), static_cast<unsigned short>(Oprnds[2]), @@ -1351,6 +1353,16 @@ ConstantExpr::getShuffleVector(ArgVec[0], ArgVec[1], ArgVec[2]); if (Handler) Handler->handleConstantExpression(Opcode, ArgVec, Result); return Result; + } else if (Opcode == Instruction::ICmp) { + if (ArgVec.size() != 2) + error("Invalid ICmp constant expr arguments"); + unsigned short pred = read_vbr_uint(); + return ConstantExpr::getICmp(pred, ArgVec[0], ArgVec[1]); + } else if (Opcode == Instruction::FCmp) { + if (ArgVec.size() != 2) + error("Invalid FCmp constant expr arguments"); + unsigned short pred = read_vbr_uint(); + return ConstantExpr::getFCmp(pred, ArgVec[0], ArgVec[1]); } else { // All other 2-operand expressions Constant* Result = ConstantExpr::get(Opcode, ArgVec[0], ArgVec[1]); if (Handler) Handler->handleConstantExpression(Opcode, ArgVec, Result); _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits