diff options
author | Jeremy Morse <jeremy.morse@sony.com> | 2025-07-07 11:57:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-07 11:57:46 +0100 |
commit | c995c5035567a0d5f3c9bcd6d07cdc3e5651099a (patch) | |
tree | 8bbaffa15674ec44242899f8a12e53540539e51a /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
parent | 7a6435bec59010e4bb2e1e52a9ba840ed152b4ce (diff) | |
download | llvm-c995c5035567a0d5f3c9bcd6d07cdc3e5651099a.zip llvm-c995c5035567a0d5f3c9bcd6d07cdc3e5651099a.tar.gz llvm-c995c5035567a0d5f3c9bcd6d07cdc3e5651099a.tar.bz2 |
[KeyInstr] Add bitcode support (#147260)
Serialise key-instruction fields of DILocations and DISubprograms into
and outof bitcode, add tests. debug-info bitcode sizes grow, but it
balances out given an earlier size optimisation in 51f4e2c.
Co-authored-by: Orlando Cazalet-Hyams <orlando.hyams@sony.com>
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index b143318..7e0d81f 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -1807,12 +1807,14 @@ unsigned ModuleBitcodeWriter::createDILocationAbbrev() { // location (it's never more expensive than building an array size 1). auto Abbv = std::make_shared<BitCodeAbbrev>(); Abbv->Add(BitCodeAbbrevOp(bitc::METADATA_LOCATION)); - Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); - 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)); + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isDistinct + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // line + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // column + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // scope + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // inlinedAt + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isImplicitCode + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // atomGroup + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // atomRank return Stream.EmitAbbrev(std::move(Abbv)); } @@ -1828,7 +1830,8 @@ void ModuleBitcodeWriter::writeDILocation(const DILocation *N, Record.push_back(VE.getMetadataID(N->getScope())); Record.push_back(VE.getMetadataOrNullID(N->getInlinedAt())); Record.push_back(N->isImplicitCode()); - + Record.push_back(N->getAtomGroup()); + Record.push_back(N->getAtomRank()); Stream.EmitRecord(bitc::METADATA_LOCATION, Record, Abbrev); Record.clear(); } @@ -2156,6 +2159,7 @@ void ModuleBitcodeWriter::writeDISubprogram(const DISubprogram *N, Record.push_back(VE.getMetadataOrNullID(N->getThrownTypes().get())); Record.push_back(VE.getMetadataOrNullID(N->getAnnotations().get())); Record.push_back(VE.getMetadataOrNullID(N->getRawTargetFuncName())); + Record.push_back(N->getKeyInstructionsEnabled()); Stream.EmitRecord(bitc::METADATA_SUBPROGRAM, Record, Abbrev); Record.clear(); @@ -3748,6 +3752,8 @@ void ModuleBitcodeWriter::writeFunction( Vals.push_back(VE.getMetadataOrNullID(DL->getScope())); Vals.push_back(VE.getMetadataOrNullID(DL->getInlinedAt())); Vals.push_back(DL->isImplicitCode()); + Vals.push_back(DL->getAtomGroup()); + Vals.push_back(DL->getAtomRank()); Stream.EmitRecord(bitc::FUNC_CODE_DEBUG_LOC, Vals, FUNCTION_DEBUG_LOC_ABBREV); Vals.clear(); @@ -4142,6 +4148,8 @@ void ModuleBitcodeWriter::writeBlockInfo() { Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Atom group. + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 3)); // Atom rank. if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID, Abbv) != FUNCTION_DEBUG_LOC_ABBREV) llvm_unreachable("Unexpected abbrev ordering!"); |