From 84e376f669d1bf37fbfa402a89a9a3221cc670b4 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 29 Apr 2007 21:49:05 +0000 Subject: [PATCH] add some helpers llvm-svn: 36580 --- llvm/include/llvm/Bitcode/BitstreamReader.h | 5 ++++- llvm/include/llvm/Bitcode/LLVMBitCodes.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/llvm/include/llvm/Bitcode/BitstreamReader.h b/llvm/include/llvm/Bitcode/BitstreamReader.h index c6394b6c99a5..71cb5bb33d66 100644 --- a/llvm/include/llvm/Bitcode/BitstreamReader.h +++ b/llvm/include/llvm/Bitcode/BitstreamReader.h @@ -79,6 +79,8 @@ public: return (NextChar-FirstChar)*8 + (32-BitsInCurWord); } + /// GetAbbrevIDWidth - Return the number of bits used to encode an abbrev #. + unsigned GetAbbrevIDWidth() const { return CurCodeSize; } uint32_t Read(unsigned NumBits) { // If the field is fully contained by CurWord, return it quickly. @@ -205,7 +207,7 @@ public: /// EnterSubBlock - Having read the ENTER_SUBBLOCK abbrevid, read and enter /// the block, returning the BlockID of the block we just entered. - bool EnterSubBlock() { + bool EnterSubBlock(unsigned *NumWordsP = 0) { BlockScope.push_back(Block(CurCodeSize)); BlockScope.back().PrevAbbrevs.swap(CurAbbrevs); @@ -213,6 +215,7 @@ public: CurCodeSize = ReadVBR(bitc::CodeLenWidth); SkipToWord(); unsigned NumWords = Read(bitc::BlockSizeWidth); + if (NumWordsP) *NumWordsP = NumWords; // Validate that this block is sane. if (CurCodeSize == 0 || AtEndOfStream() || NextChar+NumWords*4 > LastChar) diff --git a/llvm/include/llvm/Bitcode/LLVMBitCodes.h b/llvm/include/llvm/Bitcode/LLVMBitCodes.h index 9f790f45b6aa..8022c389f669 100644 --- a/llvm/include/llvm/Bitcode/LLVMBitCodes.h +++ b/llvm/include/llvm/Bitcode/LLVMBitCodes.h @@ -92,7 +92,7 @@ namespace bitc { // The constants block (CONSTANTS_BLOCK_ID) describes emission for each // constant and maintains an implicit current type value. - enum ConstantsSymtabCodes { + enum ConstantsCodes { CST_CODE_SETTYPE = 1, // SETTYPE: [typeid] CST_CODE_NULL = 2, // NULL CST_CODE_UNDEF = 3, // UNDEF