[llvm-commits] [llvm] r68463 - /llvm/trunk/include/llvm/Bitcode/BitstreamReader.h
Chris Lattner
sabre at nondot.org
Mon Apr 6 14:37:10 PDT 2009
Author: lattner
Date: Mon Apr 6 16:37:10 2009
New Revision: 68463
URL: http://llvm.org/viewvc/llvm-project?rev=68463&view=rev
Log:
split ReadAbbreviatedLiteral out of ReadAbbreviatedField.
Modified:
llvm/trunk/include/llvm/Bitcode/BitstreamReader.h
Modified: llvm/trunk/include/llvm/Bitcode/BitstreamReader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/BitstreamReader.h?rev=68463&r1=68462&r2=68463&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Bitcode/BitstreamReader.h (original)
+++ llvm/trunk/include/llvm/Bitcode/BitstreamReader.h Mon Apr 6 16:37:10 2009
@@ -337,13 +337,17 @@
//===--------------------------------------------------------------------===//
private:
+ void ReadAbbreviatedLiteral(const BitCodeAbbrevOp &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());
+ }
+
void ReadAbbreviatedField(const BitCodeAbbrevOp &Op,
SmallVectorImpl<uint64_t> &Vals) {
- if (Op.isLiteral()) {
- // If the abbrev specifies the literal value to use, use it.
- Vals.push_back(Op.getLiteralValue());
- return;
- }
+ assert(!Op.isLiteral() && "Use ReadAbbreviatedLiteral for literals!");
+
// Decode the value as we are commanded.
switch (Op.getEncoding()) {
default: assert(0 && "Unknown encoding!");
@@ -374,7 +378,9 @@
for (unsigned i = 0, e = Abbv->getNumOperandInfos(); i != e; ++i) {
const BitCodeAbbrevOp &Op = Abbv->getOperandInfo(i);
- if (Op.isLiteral() || Op.getEncoding() != BitCodeAbbrevOp::Array) {
+ if (Op.isLiteral()) {
+ ReadAbbreviatedLiteral(Op, Vals);
+ } else if (Op.getEncoding() != BitCodeAbbrevOp::Array) {
ReadAbbreviatedField(Op, Vals);
} else {
// Array case. Read the number of elements as a vbr6.
More information about the llvm-commits
mailing list