diff options
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 61 |
1 files changed, 5 insertions, 56 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 56656c74906..ba4f932e2e6 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -215,8 +215,7 @@ private: const Function &F); void writeModuleLevelReferences(const GlobalVariable &V, SmallVector<uint64_t, 64> &NameVals, - unsigned FSModRefsAbbrev, - unsigned FSModVTableRefsAbbrev); + unsigned FSModRefsAbbrev); void assignValueId(GlobalValue::GUID ValGUID) { GUIDToValueIdMap[ValGUID] = ++GlobalValueId; @@ -3529,18 +3528,6 @@ static void writeTypeIdSummaryRecord(SmallVector<uint64_t, 64> &NameVals, W.second); } -static void writeTypeIdMetadataSummaryRecord( - SmallVector<uint64_t, 64> &NameVals, StringTableBuilder &StrtabBuilder, - const std::string &Id, const TypeIdGVInfo &Summary, ValueEnumerator &VE) { - NameVals.push_back(StrtabBuilder.add(Id)); - NameVals.push_back(Id.size()); - - for (auto &P : Summary) { - NameVals.push_back(P.first); - NameVals.push_back(VE.getValueID(P.second.getValue())); - } -} - // Helper to emit a single function summary record. void ModuleBitcodeWriterBase::writePerModuleFunctionSummaryRecord( SmallVector<uint64_t, 64> &NameVals, GlobalValueSummary *Summary, @@ -3585,7 +3572,7 @@ void ModuleBitcodeWriterBase::writePerModuleFunctionSummaryRecord( // and emit them in a summary record. void ModuleBitcodeWriterBase::writeModuleLevelReferences( const GlobalVariable &V, SmallVector<uint64_t, 64> &NameVals, - unsigned FSModRefsAbbrev, unsigned FSModVTableRefsAbbrev) { + unsigned FSModRefsAbbrev) { auto VI = Index->getValueInfo(V.getGUID()); if (!VI || VI.getSummaryList().empty()) { // Only declarations should not have a summary (a declaration might however @@ -3599,10 +3586,6 @@ void ModuleBitcodeWriterBase::writeModuleLevelReferences( NameVals.push_back(getEncodedGVSummaryFlags(VS->flags())); NameVals.push_back(getEncodedGVarFlags(VS->varflags())); - auto VTableFuncs = VS->vTableFuncs(); - if (!VTableFuncs.empty()) - NameVals.push_back(VS->refs().size()); - unsigned SizeBeforeRefs = NameVals.size(); for (auto &RI : VS->refs()) NameVals.push_back(VE.getValueID(RI.getValue())); @@ -3610,20 +3593,8 @@ void ModuleBitcodeWriterBase::writeModuleLevelReferences( // been initialized from a DenseSet. llvm::sort(NameVals.begin() + SizeBeforeRefs, NameVals.end()); - if (!VTableFuncs.empty()) { - // VTableFuncs pairs should already be sorted by offset. - for (auto &P : VTableFuncs) { - NameVals.push_back(VE.getValueID(P.first.getValue())); - NameVals.push_back(P.second); - } - } - - if (VTableFuncs.empty()) - Stream.EmitRecord(bitc::FS_PERMODULE_GLOBALVAR_INIT_REFS, NameVals, - FSModRefsAbbrev); - else - Stream.EmitRecord(bitc::FS_PERMODULE_VTABLE_GLOBALVAR_INIT_REFS, NameVals, - FSModVTableRefsAbbrev); + Stream.EmitRecord(bitc::FS_PERMODULE_GLOBALVAR_INIT_REFS, NameVals, + FSModRefsAbbrev); NameVals.clear(); } @@ -3704,17 +3675,6 @@ void ModuleBitcodeWriterBase::writePerModuleGlobalValueSummary() { Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); unsigned FSModRefsAbbrev = Stream.EmitAbbrev(std::move(Abbv)); - // Abbrev for FS_PERMODULE_VTABLE_GLOBALVAR_INIT_REFS. - Abbv = std::make_shared<BitCodeAbbrev>(); - Abbv->Add(BitCodeAbbrevOp(bitc::FS_PERMODULE_VTABLE_GLOBALVAR_INIT_REFS)); - Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // valueid - Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // flags - Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 4)); // numrefs - // numrefs x valueid, n x (valueid , offset) - Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array)); - Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); - unsigned FSModVTableRefsAbbrev = Stream.EmitAbbrev(std::move(Abbv)); - // Abbrev for FS_ALIAS. Abbv = std::make_shared<BitCodeAbbrev>(); Abbv->Add(BitCodeAbbrevOp(bitc::FS_ALIAS)); @@ -3747,8 +3707,7 @@ void ModuleBitcodeWriterBase::writePerModuleGlobalValueSummary() { // Capture references from GlobalVariable initializers, which are outside // of a function scope. for (const GlobalVariable &G : M.globals()) - writeModuleLevelReferences(G, NameVals, FSModRefsAbbrev, - FSModVTableRefsAbbrev); + writeModuleLevelReferences(G, NameVals, FSModRefsAbbrev); for (const GlobalAlias &A : M.aliases()) { auto *Aliasee = A.getBaseObject(); @@ -3766,16 +3725,6 @@ void ModuleBitcodeWriterBase::writePerModuleGlobalValueSummary() { NameVals.clear(); } - if (!Index->typeIdMetadataMap().empty()) { - SmallVector<uint64_t, 64> NameVals; - for (auto &S : Index->typeIdMetadataMap()) { - writeTypeIdMetadataSummaryRecord(NameVals, StrtabBuilder, S.first, - S.second, VE); - Stream.EmitRecord(bitc::FS_TYPE_ID_METADATA, NameVals); - NameVals.clear(); - } - } - Stream.ExitBlock(); } |