summaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 64cb509691a1..b143318a1e68 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -157,6 +157,7 @@ enum {
FUNCTION_INST_CMP_ABBREV,
FUNCTION_INST_CMP_FLAGS_ABBREV,
FUNCTION_DEBUG_RECORD_VALUE_ABBREV,
+ FUNCTION_DEBUG_LOC_ABBREV,
};
/// Abstract class to manage the bitcode writing, subclassed for each bitcode
@@ -3747,7 +3748,8 @@ void ModuleBitcodeWriter::writeFunction(
Vals.push_back(VE.getMetadataOrNullID(DL->getScope()));
Vals.push_back(VE.getMetadataOrNullID(DL->getInlinedAt()));
Vals.push_back(DL->isImplicitCode());
- Stream.EmitRecord(bitc::FUNC_CODE_DEBUG_LOC, Vals);
+ Stream.EmitRecord(bitc::FUNC_CODE_DEBUG_LOC, Vals,
+ FUNCTION_DEBUG_LOC_ABBREV);
Vals.clear();
LastDL = DL;
}
@@ -4131,6 +4133,19 @@ void ModuleBitcodeWriter::writeBlockInfo() {
FUNCTION_DEBUG_RECORD_VALUE_ABBREV)
llvm_unreachable("Unexpected abbrev ordering! 1");
}
+ {
+ auto Abbv = std::make_shared<BitCodeAbbrev>();
+ Abbv->Add(BitCodeAbbrevOp(bitc::FUNC_CODE_DEBUG_LOC));
+ // NOTE: No IsDistinct field for FUNC_CODE_DEBUG_LOC.
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
+ Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
+ if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID, Abbv) !=
+ FUNCTION_DEBUG_LOC_ABBREV)
+ llvm_unreachable("Unexpected abbrev ordering!");
+ }
Stream.ExitBlock();
}