コード例 #1
0
void NaClBitstreamCursor::readAbbreviatedLiteral(
    const NaClBitCodeAbbrevOp &Op,
    SmallVectorImpl<uint64_t> &Vals) {
  assert(Op.isLiteral() && "Not a literal");
  // If the abbrev specifies the literal value to use, use it.
  Vals.push_back(Op.getLiteralValue());
}
コード例 #2
0
void NaClBitstreamCursor::skipAbbreviatedField(const NaClBitCodeAbbrevOp &Op) {
  assert(!Op.isLiteral() && "Use ReadAbbreviatedLiteral for literals!");

  // Decode the value as we are commanded.
  switch (Op.getEncoding()) {
  default:
    report_fatal_error("Should not reach here");
  case NaClBitCodeAbbrevOp::Fixed:
    (void)Read((unsigned)Op.getEncodingData());
    break;
  case NaClBitCodeAbbrevOp::VBR:
    (void)ReadVBR64((unsigned)Op.getEncodingData());
    break;
  case NaClBitCodeAbbrevOp::Char6:
    (void)Read(6);
    break;
  }
}
コード例 #3
0
uint64_t NaClBitstreamCursor::readArrayAbbreviatedField(
    const NaClBitCodeAbbrevOp &Op) {
  // Decode the value as we are commanded.
  switch (Op.getEncoding()) {
  case NaClBitCodeAbbrevOp::Literal:
    return Op.getValue();
  case NaClBitCodeAbbrevOp::Fixed:
    return Read((unsigned)Op.getValue());
  case NaClBitCodeAbbrevOp::VBR:
    return ReadVBR64((unsigned)Op.getValue());
  case NaClBitCodeAbbrevOp::Array:
    // This can't happen because the abbreviation must be valid.
    llvm_unreachable("Bad array abbreviation encoding!");
    break;
  case NaClBitCodeAbbrevOp::Char6:
    return NaClBitCodeAbbrevOp::DecodeChar6(Read(6));
  }
  llvm_unreachable("Illegal abbreviation encoding for field!");
}
コード例 #4
0
void NaClBitstreamCursor::readAbbreviatedField(
    const NaClBitCodeAbbrevOp &Op,
    SmallVectorImpl<uint64_t> &Vals) {
  assert(!Op.isLiteral() && "Use ReadAbbreviatedLiteral for literals!");

  // Decode the value as we are commanded.
  switch (Op.getEncoding()) {
  default:
    report_fatal_error("Should not reach here");
  case NaClBitCodeAbbrevOp::Fixed:
    Vals.push_back(Read((unsigned)Op.getEncodingData()));
    break;
  case NaClBitCodeAbbrevOp::VBR:
    Vals.push_back(ReadVBR64((unsigned)Op.getEncodingData()));
    break;
  case NaClBitCodeAbbrevOp::Char6:
    Vals.push_back(NaClBitCodeAbbrevOp::DecodeChar6(Read(6)));
    break;
  }
}
コード例 #5
0
void NaClBitstreamCursor::skipAbbreviatedField(const NaClBitCodeAbbrevOp &Op) {
  // Decode the value as we are commanded.
  switch (Op.getEncoding()) {
  case NaClBitCodeAbbrevOp::Literal:
    // No read necessary for literal.
    break;
  case NaClBitCodeAbbrevOp::Fixed:
    (void)Read((unsigned)Op.getValue());
    break;
  case NaClBitCodeAbbrevOp::VBR:
    (void)ReadVBR64((unsigned)Op.getValue());
    break;
  case NaClBitCodeAbbrevOp::Array:
    // This can't happen because the abbreviation must be valid.
    llvm_unreachable("Bad array abbreviation encoding!");
    break;
  case NaClBitCodeAbbrevOp::Char6:
    (void)Read(6);
    break;
  }
}
コード例 #6
0
bool NaClBitstreamCursor::readRecordAbbrevField(
    const NaClBitCodeAbbrevOp &Op, uint64_t &Value) {
  switch (Op.getEncoding()) {
  case NaClBitCodeAbbrevOp::Literal:
    Value = Op.getValue();
    break;
  case NaClBitCodeAbbrevOp::Array:
    // Returns number of elements in the array.
    Value = ReadVBR(6);
    return true;
  case NaClBitCodeAbbrevOp::Fixed:
    Value = Read((unsigned)Op.getValue());
    break;
  case NaClBitCodeAbbrevOp::VBR:
    Value = ReadVBR64((unsigned)Op.getValue());
    break;
  case NaClBitCodeAbbrevOp::Char6:
    Value = NaClBitCodeAbbrevOp::DecodeChar6(Read(6));
    break;
  }
  return false;
}