aboutsummaryrefslogtreecommitdiff
path: root/lib/Bytecode/Reader/Reader.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-12-03 06:28:54 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-12-03 06:28:54 +0000
commitc8dab49aad45169275c2c40240d56cf01f37d21e (patch)
tree299276bb56427b2f2de6992adf0f70d1aacba1a7 /lib/Bytecode/Reader/Reader.cpp
parent74f1642bc1c2981e4573c9f0690d91b6a9bbc68c (diff)
Implement reading and writing of the ICmp and FCmp instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32149 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode/Reader/Reader.cpp')
-rw-r--r--lib/Bytecode/Reader/Reader.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp
index 6a5a9ca88c..d294e9e025 100644
--- a/lib/Bytecode/Reader/Reader.cpp
+++ b/lib/Bytecode/Reader/Reader.cpp
@@ -550,12 +550,11 @@ void BytecodeReader::ParseInstruction(std::vector<unsigned> &Oprnds,
// 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 @@ void BytecodeReader::ParseInstruction(std::vector<unsigned> &Oprnds,
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: