| OLD | NEW |
| 1 //===- NaClBitcodeHeader.cpp ----------------------------------------------===// | 1 //===- NaClBitcodeHeader.cpp ----------------------------------------------===// |
| 2 // PNaCl bitcode header reader. | 2 // PNaCl bitcode header reader. |
| 3 // | 3 // |
| 4 // The LLVM Compiler Infrastructure | 4 // The LLVM Compiler Infrastructure |
| 5 // | 5 // |
| 6 // This file is distributed under the University of Illinois Open Source | 6 // This file is distributed under the University of Illinois Open Source |
| 7 // License. See LICENSE.TXT for details. | 7 // License. See LICENSE.TXT for details. |
| 8 // | 8 // |
| 9 //===----------------------------------------------------------------------===// | 9 //===----------------------------------------------------------------------===// |
| 10 // | 10 // |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 switch (NaClBitCodeAbbrevOp::Encoding(E)) { | 47 switch (NaClBitCodeAbbrevOp::Encoding(E)) { |
| 48 case Literal: | 48 case Literal: |
| 49 return true; | 49 return true; |
| 50 case Fixed: | 50 case Fixed: |
| 51 case VBR: | 51 case VBR: |
| 52 return Val <= naclbitc::MaxAbbrevWidth; | 52 return Val <= naclbitc::MaxAbbrevWidth; |
| 53 case Char6: | 53 case Char6: |
| 54 case Array: | 54 case Array: |
| 55 return Val == 0; | 55 return Val == 0; |
| 56 } | 56 } |
| 57 llvm_unreachable("unhandled abbreviation"); |
| 57 } | 58 } |
| 58 | 59 |
| 59 void NaClBitCodeAbbrevOp::Print(raw_ostream& Stream) const { | 60 void NaClBitCodeAbbrevOp::Print(raw_ostream& Stream) const { |
| 60 if (Enc == Literal) { | 61 if (Enc == Literal) { |
| 61 Stream << getValue(); | 62 Stream << getValue(); |
| 62 return; | 63 return; |
| 63 } | 64 } |
| 64 Stream << getEncodingName(Enc); | 65 Stream << getEncodingName(Enc); |
| 65 if (!hasValue()) | 66 if (!hasValue()) |
| 66 return; | 67 return; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // Verify that an array op appears can only appear if it is the | 120 // Verify that an array op appears can only appear if it is the |
| 120 // second to last element. | 121 // second to last element. |
| 121 unsigned NumOperands = getNumOperandInfos(); | 122 unsigned NumOperands = getNumOperandInfos(); |
| 122 for (unsigned i = 0; i < NumOperands; ++i) { | 123 for (unsigned i = 0; i < NumOperands; ++i) { |
| 123 const NaClBitCodeAbbrevOp &Op = getOperandInfo(i); | 124 const NaClBitCodeAbbrevOp &Op = getOperandInfo(i); |
| 124 if (Op.isArrayOp() && i + 2 != NumOperands) | 125 if (Op.isArrayOp() && i + 2 != NumOperands) |
| 125 return false; | 126 return false; |
| 126 } | 127 } |
| 127 return true; | 128 return true; |
| 128 } | 129 } |
| OLD | NEW |