aboutsummaryrefslogtreecommitdiff
path: root/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp
diff options
context:
space:
mode:
authorKarl Schimpf <kschimpf@google.com>2013-07-29 08:41:58 -0700
committerKarl Schimpf <kschimpf@google.com>2013-07-29 08:41:58 -0700
commit3beb037fee2d77e09a96fbd5a507a2eeea7e860e (patch)
tree5b13cf507505c6c6e2614610ca2eb18a0ed1b827 /lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp
parentd0c3e5a5d23f2d7c91a7091918bd85ca495dae19 (diff)
Remove handling of nongenerable instructions in PNaCl reader.
The PNaCl bitcode writer doesn't generate certain forms of instructions that the PNaCl bitcode writer accepts. Since these instructions do not get generated, remove them from the bitcode reader. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3590 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/20442002
Diffstat (limited to 'lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp')
-rw-r--r--lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp36
1 files changed, 3 insertions, 33 deletions
diff --git a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp
index b384df7f58..9c2f45ea56 100644
--- a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp
+++ b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp
@@ -29,10 +29,6 @@
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
-enum {
- SWITCH_INST_MAGIC = 0x4B5 // May 2012 => 1205 => Hex
-};
-
void NaClBitcodeReader::FreeState() {
if (BufferOwned)
delete Buffer;
@@ -1443,20 +1439,6 @@ bool NaClBitcodeReader::ParseFunctionBody(Function *F) {
break;
}
- case naclbitc::FUNC_CODE_INST_SELECT: { // SELECT: [opval, opval, opval]
- // obsolete form of select
- // handles select i1 ... in old bitcode
- unsigned OpNum = 0;
- Value *TrueVal, *FalseVal, *Cond;
- if (popValue(Record, &OpNum, NextValueNo, &TrueVal) ||
- popValue(Record, &OpNum, NextValueNo, &FalseVal) ||
- popValue(Record, &OpNum, NextValueNo, &Cond))
- return Error("Invalid SELECT record");
-
- I = SelectInst::Create(Cond, TrueVal, FalseVal);
- break;
- }
-
case naclbitc::FUNC_CODE_INST_VSELECT: {// VSELECT: [opval, opval, pred]
// new form of select
// handles select i1 or select [N x i1]
@@ -1467,26 +1449,14 @@ bool NaClBitcodeReader::ParseFunctionBody(Function *F) {
popValue(Record, &OpNum, NextValueNo, &Cond))
return Error("Invalid SELECT record");
- // select condition can be either i1 or [N x i1]
- if (VectorType* vector_type =
- dyn_cast<VectorType>(Cond->getType())) {
- // expect <n x i1>
- if (vector_type->getElementType() != Type::getInt1Ty(Context))
- return Error("Invalid SELECT condition type");
- } else {
- // expect i1
- if (Cond->getType() != Type::getInt1Ty(Context))
- return Error("Invalid SELECT condition type");
- }
+ // expect i1
+ if (Cond->getType() != Type::getInt1Ty(Context))
+ return Error("Invalid SELECT condition type");
I = SelectInst::Create(Cond, TrueVal, FalseVal);
break;
}
- case naclbitc::FUNC_CODE_INST_CMP: // CMP: [opval, opval, pred]
- // Old form of ICmp/FCmp returning bool
- // Existed to differentiate between icmp/fcmp and vicmp/vfcmp which were
- // both legal on vectors but had different behaviour.
case naclbitc::FUNC_CODE_INST_CMP2: { // CMP2: [opval, opval, pred]
// FCmp/ICmp returning bool or vector of bool