aboutsummaryrefslogtreecommitdiff
path: root/lib/Bytecode/Reader/Reader.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-12-04 05:23:49 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-12-04 05:23:49 +0000
commit595b477915ad972b19db5a9ce8de5d31f5aa6410 (patch)
treecce7d742ba417a35c583f9769530e3e924a5ae1b /lib/Bytecode/Reader/Reader.cpp
parent763ed5e4ac4e896d66ad73b6df5b6fcf91ea58d3 (diff)
For PR950: Implement read/write of ICmp and FCmp constant expressions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32172 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode/Reader/Reader.cpp')
-rw-r--r--lib/Bytecode/Reader/Reader.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp
index 9286279216..3cc3b1d362 100644
--- a/lib/Bytecode/Reader/Reader.cpp
+++ b/lib/Bytecode/Reader/Reader.cpp
@@ -1355,14 +1355,18 @@ Value *BytecodeReader::ParseConstantPoolValue(unsigned TypeID) {
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]);
+ error("Invalid ICmp constant expr arguments.");
+ unsigned predicate = read_vbr_uint();
+ Constant *Result = ConstantExpr::getICmp(predicate, ArgVec[0], ArgVec[1]);
+ if (Handler) Handler->handleConstantExpression(Opcode, ArgVec, Result);
+ return Result;
} 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]);
+ error("Invalid FCmp constant expr arguments.");
+ unsigned predicate = read_vbr_uint();
+ Constant *Result = ConstantExpr::getFCmp(predicate, ArgVec[0], ArgVec[1]);
+ if (Handler) Handler->handleConstantExpression(Opcode, ArgVec, Result);
+ return Result;
} else { // All other 2-operand expressions
Constant* Result = ConstantExpr::get(Opcode, ArgVec[0], ArgVec[1]);
if (Handler) Handler->handleConstantExpression(Opcode, ArgVec, Result);