Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(601)

Unified Diff: include/llvm/Bitcode/NaCl/NaClBitstreamReader.h

Issue 14813032: Make abbreviations explicit in pnacl-freeze/thaw. (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Small cleanups suggested by Jan in CL. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/llvm/Bitcode/NaCl/NaClBitCodes.h ('k') | include/llvm/Bitcode/NaCl/NaClBitstreamWriter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/llvm/Bitcode/NaCl/NaClBitstreamReader.h
diff --git a/include/llvm/Bitcode/NaCl/NaClBitstreamReader.h b/include/llvm/Bitcode/NaCl/NaClBitstreamReader.h
index 58c0a5d7fa355db91828922fbf45fccab9afcfcd..4c532bbc37bc55ec392c616117ac4b1447bb4dfb 100644
--- a/include/llvm/Bitcode/NaCl/NaClBitstreamReader.h
+++ b/include/llvm/Bitcode/NaCl/NaClBitstreamReader.h
@@ -171,7 +171,6 @@ class NaClBitstreamCursor {
NaClBitstreamReader *BitStream;
size_t NextChar;
-
/// CurWord/word_t - This is the current data we have pulled from the stream
/// but have not returned to the client. This is specifically and
/// intentionally defined to follow the word size of the host machine for
@@ -186,21 +185,22 @@ class NaClBitstreamCursor {
// CurCodeSize - This is the declared size of code values used for the current
// block, in bits.
- unsigned CurCodeSize;
+ NaClBitcodeSelectorAbbrev CurCodeSize;
/// CurAbbrevs - Abbrevs installed at in this block.
std::vector<NaClBitCodeAbbrev*> CurAbbrevs;
struct Block {
- unsigned PrevCodeSize;
+ NaClBitcodeSelectorAbbrev PrevCodeSize;
std::vector<NaClBitCodeAbbrev*> PrevAbbrevs;
- explicit Block(unsigned PCS) : PrevCodeSize(PCS) {}
+ explicit Block() : PrevCodeSize() {}
+ explicit Block(const NaClBitcodeSelectorAbbrev& PCS)
+ : PrevCodeSize(PCS) {}
};
/// BlockScope - This tracks the codesize of parent blocks.
SmallVector<Block, 8> BlockScope;
-
public:
NaClBitstreamCursor() : BitStream(0), NextChar(0) {
}
@@ -213,7 +213,6 @@ public:
NextChar = 0;
CurWord = 0;
BitsInCurWord = 0;
- CurCodeSize = 2;
}
void init(NaClBitstreamReader &R) {
@@ -223,7 +222,6 @@ public:
NextChar = 0;
CurWord = 0;
BitsInCurWord = 0;
- CurCodeSize = 2;
}
~NaClBitstreamCursor() {
@@ -255,7 +253,7 @@ public:
}
/// getAbbrevIDWidth - Return the number of bits used to encode an abbrev #.
- unsigned getAbbrevIDWidth() const { return CurCodeSize; }
+ unsigned getAbbrevIDWidth() const { return CurCodeSize.NumBits; }
/// GetCurrentBitNo - Return the bit # of the bit we are reading.
uint64_t GetCurrentBitNo() const {
@@ -343,7 +341,6 @@ public:
}
}
-
uint32_t Read(unsigned NumBits) {
assert(NumBits && NumBits <= 32 &&
"Cannot return zero or more than 32 bits!");
@@ -459,10 +456,11 @@ private:
public:
unsigned ReadCode() {
- return Read(CurCodeSize);
+ return CurCodeSize.IsFixed
+ ? Read(CurCodeSize.NumBits)
+ : ReadVBR(CurCodeSize.NumBits);
}
-
// Block header:
// [ENTER_SUBBLOCK, blockid, newcodelen, <align4bytes>, blocklen]
« no previous file with comments | « include/llvm/Bitcode/NaCl/NaClBitCodes.h ('k') | include/llvm/Bitcode/NaCl/NaClBitstreamWriter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698