Bitcode: Simplify BitstreamWriter::EnterBlockInfoBlock() interface.

No block info block should need to define local abbreviations, so we can
always use a code width of 2.

Also change all block info block writers to use EnterBlockInfoBlock.

Differential Revision: https://reviews.llvm.org/D26168

llvm-svn: 285660
This commit is contained in:
Peter Collingbourne 2016-11-01 01:18:57 +00:00
parent f3dd863031
commit d3a6c70b2d
5 changed files with 6 additions and 6 deletions

View File

@ -436,7 +436,7 @@ static void AddRangeLocationAbbrev(llvm::BitCodeAbbrev *Abbrev) {
} }
void SDiagsWriter::EmitBlockInfoBlock() { void SDiagsWriter::EmitBlockInfoBlock() {
State->Stream.EnterBlockInfoBlock(3); State->Stream.EnterBlockInfoBlock();
using namespace llvm; using namespace llvm;
llvm::BitstreamWriter &Stream = State->Stream; llvm::BitstreamWriter &Stream = State->Stream;

View File

@ -991,7 +991,7 @@ static void AddStmtsExprs(llvm::BitstreamWriter &Stream,
void ASTWriter::WriteBlockInfoBlock() { void ASTWriter::WriteBlockInfoBlock() {
RecordData Record; RecordData Record;
Stream.EnterSubblock(llvm::bitc::BLOCKINFO_BLOCK_ID, 3); Stream.EnterBlockInfoBlock();
#define BLOCK(X) EmitBlockID(X ## _ID, #X, Stream, Record) #define BLOCK(X) EmitBlockID(X ## _ID, #X, Stream, Record)
#define RECORD(X) EmitRecordID(X, #X, Stream, Record) #define RECORD(X) EmitRecordID(X, #X, Stream, Record)

View File

@ -460,7 +460,7 @@ static void emitRecordID(unsigned ID, const char *Name,
void void
GlobalModuleIndexBuilder::emitBlockInfoBlock(llvm::BitstreamWriter &Stream) { GlobalModuleIndexBuilder::emitBlockInfoBlock(llvm::BitstreamWriter &Stream) {
SmallVector<uint64_t, 64> Record; SmallVector<uint64_t, 64> Record;
Stream.EnterSubblock(llvm::bitc::BLOCKINFO_BLOCK_ID, 3); Stream.EnterBlockInfoBlock();
#define BLOCK(X) emitBlockID(X ## _ID, #X, Stream, Record) #define BLOCK(X) emitBlockID(X ## _ID, #X, Stream, Record)
#define RECORD(X) emitRecordID(X, #X, Stream, Record) #define RECORD(X) emitRecordID(X, #X, Stream, Record)

View File

@ -506,8 +506,8 @@ public:
//===--------------------------------------------------------------------===// //===--------------------------------------------------------------------===//
/// EnterBlockInfoBlock - Start emitting the BLOCKINFO_BLOCK. /// EnterBlockInfoBlock - Start emitting the BLOCKINFO_BLOCK.
void EnterBlockInfoBlock(unsigned CodeWidth) { void EnterBlockInfoBlock() {
EnterSubblock(bitc::BLOCKINFO_BLOCK_ID, CodeWidth); EnterSubblock(bitc::BLOCKINFO_BLOCK_ID, 2);
BlockInfoCurBID = ~0U; BlockInfoCurBID = ~0U;
} }
private: private:

View File

@ -3031,7 +3031,7 @@ void ModuleBitcodeWriter::writeBlockInfo() {
// We only want to emit block info records for blocks that have multiple // We only want to emit block info records for blocks that have multiple
// instances: CONSTANTS_BLOCK, FUNCTION_BLOCK and VALUE_SYMTAB_BLOCK. // instances: CONSTANTS_BLOCK, FUNCTION_BLOCK and VALUE_SYMTAB_BLOCK.
// Other blocks can define their abbrevs inline. // Other blocks can define their abbrevs inline.
Stream.EnterBlockInfoBlock(2); Stream.EnterBlockInfoBlock();
{ // 8-bit fixed-width VST_CODE_ENTRY/VST_CODE_BBENTRY strings. { // 8-bit fixed-width VST_CODE_ENTRY/VST_CODE_BBENTRY strings.
BitCodeAbbrev *Abbv = new BitCodeAbbrev(); BitCodeAbbrev *Abbv = new BitCodeAbbrev();