diff options
author | Mark Seaborn <mseaborn@chromium.org> | 2013-06-25 21:33:49 -0700 |
---|---|---|
committer | Mark Seaborn <mseaborn@chromium.org> | 2013-06-25 21:33:49 -0700 |
commit | 3a69b22c3d95634002f80e1e491616942e0407d7 (patch) | |
tree | f7df10be8a96b0bf50f718deeb0d6e13a49dcae3 | |
parent | 838d8e9753498212ca9587dd0d5b3ddebe824068 (diff) |
PNaCl wire format: Remove code for reading old SwitchInst representation
The PNaCl pexe writer never writes this old representation.
This is part of a cleanup to make forward reference handling stricter:
it removes a use of getOrCreateFnValueByID(), which isn't strict (that
is, it doesn't reject duplicate FORWARDTYPEREF records).
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3507
TEST=PNaCl toolchain trybots
Review URL: https://codereview.chromium.org/17764003
-rw-r--r-- | lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp index bd6ddcb020..0fe72704e0 100644 --- a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp +++ b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp @@ -2184,32 +2184,7 @@ bool NaClBitcodeReader::ParseFunctionBody(Function *F) { I = SI; break; } - - // Old SwitchInst format without case ranges. - - if (Record.size() < 3 || (Record.size() & 1) == 0) - return Error("Invalid SWITCH record"); - Type *OpTy = getTypeByID(Record[0]); - Value *Cond = getValue(Record, 1, NextValueNo, OpTy); - BasicBlock *Default = getBasicBlock(Record[2]); - if (OpTy == 0 || Cond == 0 || Default == 0) - return Error("Invalid SWITCH record"); - unsigned NumCases = (Record.size()-3)/2; - SwitchInst *SI = SwitchInst::Create(Cond, Default, NumCases); - InstructionList.push_back(SI); - for (unsigned i = 0, e = NumCases; i != e; ++i) { - ConstantInt *CaseVal = - dyn_cast_or_null<ConstantInt>( - getOrCreateFnValueByID(Record[3+i*2], OpTy)); - BasicBlock *DestBB = getBasicBlock(Record[1+3+i*2]); - if (CaseVal == 0 || DestBB == 0) { - delete SI; - return Error("Invalid SWITCH record!"); - } - SI->addCase(CaseVal, DestBB); - } - I = SI; - break; + return Error("Old SwitchInst representation not supported"); } case naclbitc::FUNC_CODE_INST_INDIRECTBR: { // INDIRECTBR: [opty, op0, op1, ...] if (Record.size() < 2) |