llvm.org GIT mirror llvm / fe94ca2
Make BitCodeAbbrev ownership explicit using shared_ptr rather than IntrusiveRefCntPtr If this is a problem for anyone (shared_ptr is two pointers in size, whereas IntrusiveRefCntPtr is 1 - and the ref count control block that make_shared adds is probably larger than the one int in RefCountedBase) I'd prefer to address this by adding a lower-overhead version of shared_ptr (possibly refactoring IntrusiveRefCntPtr into such a thing) to avoid the intrusiveness - this allows memory ownership to remain orthogonal to types and at least to me, seems to make code easier to understand (since no implicit ownership acquisition can happen). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291006 91177308-0d34-0410-b5e6-96231b3b80d8 David Blaikie 3 years ago
7 changed file(s) with 120 addition(s) and 128 deletion(s). Raw diff Collapse all Expand all
165165 /// BitCodeAbbrev - This class represents an abbreviation record. An
166166 /// abbreviation allows a complex record that has redundancy to be stored in a
167167 /// specialized format instead of the fully-general, fully-vbr, format.
168 class BitCodeAbbrev : public RefCountedBase {
168 class BitCodeAbbrev {
169169 SmallVector OperandList;
170 // Only RefCountedBase is allowed to delete.
171 ~BitCodeAbbrev() = default;
172 friend class RefCountedBase;
173170
174171 public:
175172 unsigned getNumOperandInfos() const {
4141 /// describe abbreviations that all blocks of the specified ID inherit.
4242 struct BlockInfo {
4343 unsigned BlockID;
44 std::vector<IntrusiveRefCntPtr> Abbrevs;
44 std::vector<std::shared_ptr> Abbrevs;
4545 std::string Name;
4646 std::vector > RecordNames;
4747 };
315315 unsigned CurCodeSize = 2;
316316
317317 /// Abbrevs installed at in this block.
318 std::vector<IntrusiveRefCntPtr> CurAbbrevs;
318 std::vector<std::shared_ptr> CurAbbrevs;
319319
320320 struct Block {
321321 unsigned PrevCodeSize;
322 std::vector<IntrusiveRefCntPtr> PrevAbbrevs;
322 std::vector<std::shared_ptr> PrevAbbrevs;
323323
324324 explicit Block(unsigned PCS) : PrevCodeSize(PCS) {}
325325 };
4242 unsigned BlockInfoCurBID;
4343
4444 /// CurAbbrevs - Abbrevs installed at in this block.
45 std::vector<IntrusiveRefCntPtr> CurAbbrevs;
45 std::vector<std::shared_ptr> CurAbbrevs;
4646
4747 struct Block {
4848 unsigned PrevCodeSize;
4949 size_t StartSizeWord;
50 std::vector<IntrusiveRefCntPtr> PrevAbbrevs;
50 std::vector<std::shared_ptr> PrevAbbrevs;
5151 Block(unsigned PCS, size_t SSW) : PrevCodeSize(PCS), StartSizeWord(SSW) {}
5252 };
5353
5858 /// These describe abbreviations that all blocks of the specified ID inherit.
5959 struct BlockInfo {
6060 unsigned BlockID;
61 std::vector<IntrusiveRefCntPtr> Abbrevs;
61 std::vector<std::shared_ptr> Abbrevs;
6262 };
6363 std::vector BlockInfoRecords;
6464
468468
469469 private:
470470 // Emit the abbreviation as a DEFINE_ABBREV record.
471 void EncodeAbbrev(BitCodeAbbrev *Abbv) {
471 void EncodeAbbrev(const BitCodeAbbrev &Abbv) {
472472 EmitCode(bitc::DEFINE_ABBREV);
473 EmitVBR(Abbv->getNumOperandInfos(), 5);
474 for (unsigned i = 0, e = static_cast(Abbv->getNumOperandInfos());
473 EmitVBR(Abbv.getNumOperandInfos(), 5);
474 for (unsigned i = 0, e = static_cast(Abbv.getNumOperandInfos());
475475 i != e; ++i) {
476 const BitCodeAbbrevOp &Op = Abbv->getOperandInfo(i);
476 const BitCodeAbbrevOp &Op = Abbv.getOperandInfo(i);
477477 Emit(Op.isLiteral(), 1);
478478 if (Op.isLiteral()) {
479479 EmitVBR64(Op.getLiteralValue(), 8);
488488
489489 /// EmitAbbrev - This emits an abbreviation to the stream. Note that this
490490 /// method takes ownership of the specified abbrev.
491 unsigned EmitAbbrev(BitCodeAbbrev *Abbv) {
491 unsigned EmitAbbrev(std::shared_ptr Abbv) {
492492 // Emit the abbreviation as a record.
493 EncodeAbbrev(Abbv);
494 CurAbbrevs.push_back(Abbv);
493 EncodeAbbrev(*Abbv);
494 CurAbbrevs.push_back(std::move(Abbv));
495495 return static_cast(CurAbbrevs.size())-1 +
496496 bitc::FIRST_APPLICATION_ABBREV;
497497 }
531531
532532 /// EmitBlockInfoAbbrev - Emit a DEFINE_ABBREV record for the specified
533533 /// BlockID.
534 unsigned EmitBlockInfoAbbrev(unsigned BlockID, BitCodeAbbrev *Abbv) {
534 unsigned EmitBlockInfoAbbrev(unsigned BlockID, std::shared_ptr Abbv) {
535535 SwitchToBlockID(BlockID);
536 EncodeAbbrev(Abbv);
536 EncodeAbbrev(*Abbv);
537537
538538 // Add the abbrev to the specified block record.
539539 BlockInfo &Info = getOrCreateBlockInfo(BlockID);
540 Info.Abbrevs.push_back(Abbv);
540 Info.Abbrevs.push_back(std::move(Abbv));
541541
542542 return Info.Abbrevs.size()-1+bitc::FIRST_APPLICATION_ABBREV;
543543 }
828828 };
829829
830830 namespace detail {
831 /// RecDirIterState - Keeps state for the recursive_directory_iterator. It is
832 /// reference counted in order to preserve InputIterator semantics on copy.
833 struct RecDirIterState : public RefCountedBase {
834 RecDirIterState()
835 : Level(0)
836 , HasNoPushRequest(false) {}
837
831 /// Keeps state for the recursive_directory_iterator.
832 struct RecDirIterState {
838833 std::stack> Stack;
839 uint16_t Level;
840 bool HasNoPushRequest;
834 uint16_t Level = 0;
835 bool HasNoPushRequest = false;
841836 };
842837 } // end namespace detail
843838
844839 /// recursive_directory_iterator - Same as directory_iterator except for it
845840 /// recurses down into child directories.
846841 class recursive_directory_iterator {
847 IntrusiveRefCntPtr State;
842 std::shared_ptr State;
848843
849844 public:
850845 recursive_directory_iterator() = default;
851846 explicit recursive_directory_iterator(const Twine &path, std::error_code &ec)
852 : State(new detail::RecDirIterState) {
847 : State(std::make_shared()) {
853848 State->Stack.push(directory_iterator(path, ec));
854849 if (State->Stack.top() == directory_iterator())
855850 State.reset();
272272 }
273273
274274 void BitstreamCursor::ReadAbbrevRecord() {
275 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
275 auto Abbv = std::make_shared();
276276 unsigned NumOpInfo = ReadVBR(5);
277277 for (unsigned i = 0; i != NumOpInfo; ++i) {
278278 bool IsLiteral = Read(1);
306306
307307 if (Abbv->getNumOperandInfos() == 0)
308308 report_fatal_error("Abbrev record with no operands");
309 CurAbbrevs.push_back(Abbv);
309 CurAbbrevs.push_back(std::move(Abbv));
310310 }
311311
312312 Optional
783783 uint64_t NumBits = VE.computeBitsRequiredForTypeIndicies();
784784
785785 // Abbrev for TYPE_CODE_POINTER.
786 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
786 auto Abbv = std::make_shared();
787787 Abbv->Add(BitCodeAbbrevOp(bitc::TYPE_CODE_POINTER));
788788 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, NumBits));
789789 Abbv->Add(BitCodeAbbrevOp(0)); // Addrspace = 0
790 unsigned PtrAbbrev = Stream.EmitAbbrev(Abbv);
790 unsigned PtrAbbrev = Stream.EmitAbbrev(std::move(Abbv));
791791
792792 // Abbrev for TYPE_CODE_FUNCTION.
793 Abbv = new BitCodeAbbrev();
793 Abbv = std::make_shared();
794794 Abbv->Add(BitCodeAbbrevOp(bitc::TYPE_CODE_FUNCTION));
795795 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isvararg
796796 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
797797 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, NumBits));
798798
799 unsigned FunctionAbbrev = Stream.EmitAbbrev(Abbv);
799 unsigned FunctionAbbrev = Stream.EmitAbbrev(std::move(Abbv));
800800
801801 // Abbrev for TYPE_CODE_STRUCT_ANON.
802 Abbv = new BitCodeAbbrev();
802 Abbv = std::make_shared();
803803 Abbv->Add(BitCodeAbbrevOp(bitc::TYPE_CODE_STRUCT_ANON));
804804 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ispacked
805805 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
806806 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, NumBits));
807807
808 unsigned StructAnonAbbrev = Stream.EmitAbbrev(Abbv);
808 unsigned StructAnonAbbrev = Stream.EmitAbbrev(std::move(Abbv));
809809
810810 // Abbrev for TYPE_CODE_STRUCT_NAME.
811 Abbv = new BitCodeAbbrev();
811 Abbv = std::make_shared();
812812 Abbv->Add(BitCodeAbbrevOp(bitc::TYPE_CODE_STRUCT_NAME));
813813 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
814814 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Char6));
815 unsigned StructNameAbbrev = Stream.EmitAbbrev(Abbv);
815 unsigned StructNameAbbrev = Stream.EmitAbbrev(std::move(Abbv));
816816
817817 // Abbrev for TYPE_CODE_STRUCT_NAMED.
818 Abbv = new BitCodeAbbrev();
818 Abbv = std::make_shared();
819819 Abbv->Add(BitCodeAbbrevOp(bitc::TYPE_CODE_STRUCT_NAMED));
820820 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ispacked
821821 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
822822 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, NumBits));
823823
824 unsigned StructNamedAbbrev = Stream.EmitAbbrev(Abbv);
824 unsigned StructNamedAbbrev = Stream.EmitAbbrev(std::move(Abbv));
825825
826826 // Abbrev for TYPE_CODE_ARRAY.
827 Abbv = new BitCodeAbbrev();
827 Abbv = std::make_shared();
828828 Abbv->Add(BitCodeAbbrevOp(bitc::TYPE_CODE_ARRAY));
829829 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // size
830830 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, NumBits));
831831
832 unsigned ArrayAbbrev = Stream.EmitAbbrev(Abbv);
832 unsigned ArrayAbbrev = Stream.EmitAbbrev(std::move(Abbv));
833833
834834 // Emit an entry count so the reader can reserve space.
835835 TypeVals.push_back(TypeList.size());
10581058 // which is written after the function blocks so that it can include
10591059 // the offset of each function. The placeholder offset will be
10601060 // updated when the real VST is written.
1061 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
1061 auto Abbv = std::make_shared();
10621062 Abbv->Add(BitCodeAbbrevOp(bitc::MODULE_CODE_VSTOFFSET));
10631063 // Blocks are 32-bit aligned, so we can use a 32-bit word offset to
10641064 // hold the real VST offset. Must use fixed instead of VBR as we don't
10651065 // know how many VBR chunks to reserve ahead of time.
10661066 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
1067 unsigned VSTOffsetAbbrev = Stream.EmitAbbrev(Abbv);
1067 unsigned VSTOffsetAbbrev = Stream.EmitAbbrev(std::move(Abbv));
10681068
10691069 // Emit the placeholder
10701070 uint64_t Vals[] = {bitc::MODULE_CODE_VSTOFFSET, 0};
11541154 unsigned SimpleGVarAbbrev = 0;
11551155 if (!M.global_empty()) {
11561156 // Add an abbrev for common globals with no visibility or thread localness.
1157 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
1157 auto Abbv = std::make_shared();
11581158 Abbv->Add(BitCodeAbbrevOp(bitc::MODULE_CODE_GLOBALVAR));
11591159 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
11601160 Log2_32_Ceil(MaxGlobalType+1)));
11761176 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
11771177 Log2_32_Ceil(SectionMap.size()+1)));
11781178 // Don't bother emitting vis + thread local.
1179 SimpleGVarAbbrev = Stream.EmitAbbrev(Abbv);
1179 SimpleGVarAbbrev = Stream.EmitAbbrev(std::move(Abbv));
11801180 }
11811181
11821182 // Emit the global variable information.
12841284 AbbrevOpToUse = BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7);
12851285
12861286 // MODULE_CODE_SOURCE_FILENAME: [namechar x N]
1287 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
1287 auto Abbv = std::make_shared();
12881288 Abbv->Add(BitCodeAbbrevOp(bitc::MODULE_CODE_SOURCE_FILENAME));
12891289 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
12901290 Abbv->Add(AbbrevOpToUse);
1291 unsigned FilenameAbbrev = Stream.EmitAbbrev(Abbv);
1291 unsigned FilenameAbbrev = Stream.EmitAbbrev(std::move(Abbv));
12921292
12931293 for (const auto P : M.getSourceFileName())
12941294 Vals.push_back((unsigned char)P);
13591359 unsigned ModuleBitcodeWriter::createDILocationAbbrev() {
13601360 // Assume the column is usually under 128, and always output the inlined-at
13611361 // location (it's never more expensive than building an array size 1).
1362 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
1362 auto Abbv = std::make_shared();
13631363 Abbv->Add(BitCodeAbbrevOp(bitc::METADATA_LOCATION));
13641364 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
13651365 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
13661366 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
13671367 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
13681368 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1369 return Stream.EmitAbbrev(Abbv);
1369 return Stream.EmitAbbrev(std::move(Abbv));
13701370 }
13711371
13721372 void ModuleBitcodeWriter::writeDILocation(const DILocation *N,
13881388 unsigned ModuleBitcodeWriter::createGenericDINodeAbbrev() {
13891389 // Assume the column is usually under 128, and always output the inlined-at
13901390 // location (it's never more expensive than building an array size 1).
1391 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
1391 auto Abbv = std::make_shared();
13921392 Abbv->Add(BitCodeAbbrevOp(bitc::METADATA_GENERIC_DEBUG));
13931393 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
13941394 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
13961396 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
13971397 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
13981398 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1399 return Stream.EmitAbbrev(Abbv);
1399 return Stream.EmitAbbrev(std::move(Abbv));
14001400 }
14011401
14021402 void ModuleBitcodeWriter::writeGenericDINode(const GenericDINode *N,
17891789 }
17901790
17911791 unsigned ModuleBitcodeWriter::createNamedMetadataAbbrev() {
1792 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
1792 auto Abbv = std::make_shared();
17931793 Abbv->Add(BitCodeAbbrevOp(bitc::METADATA_NAME));
17941794 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
17951795 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8));
1796 return Stream.EmitAbbrev(Abbv);
1796 return Stream.EmitAbbrev(std::move(Abbv));
17971797 }
17981798
17991799 void ModuleBitcodeWriter::writeNamedMetadata(
18181818 }
18191819
18201820 unsigned ModuleBitcodeWriter::createMetadataStringsAbbrev() {
1821 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
1821 auto Abbv = std::make_shared();
18221822 Abbv->Add(BitCodeAbbrevOp(bitc::METADATA_STRINGS));
18231823 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // # of strings
18241824 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // offset to chars
18251825 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
1826 return Stream.EmitAbbrev(Abbv);
1826 return Stream.EmitAbbrev(std::move(Abbv));
18271827 }
18281828
18291829 /// Write out a record for MDString.
19171917 MDAbbrevs[MetadataAbbrev::GenericDINodeAbbrevID] =
19181918 createGenericDINodeAbbrev();
19191919
1920 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
1920 auto Abbv = std::make_shared();
19211921 Abbv->Add(BitCodeAbbrevOp(bitc::METADATA_INDEX_OFFSET));
19221922 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
19231923 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
1924 unsigned OffsetAbbrev = Stream.EmitAbbrev(Abbv);
1925
1926 Abbv = new BitCodeAbbrev();
1924 unsigned OffsetAbbrev = Stream.EmitAbbrev(std::move(Abbv));
1925
1926 Abbv = std::make_shared();
19271927 Abbv->Add(BitCodeAbbrevOp(bitc::METADATA_INDEX));
19281928 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
19291929 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1930 unsigned IndexAbbrev = Stream.EmitAbbrev(Abbv);
1930 unsigned IndexAbbrev = Stream.EmitAbbrev(std::move(Abbv));
19311931
19321932 // Emit MDStrings together upfront.
19331933 writeMetadataStrings(VE.getMDStrings(), Record);
21242124 // If this is a constant pool for the module, emit module-specific abbrevs.
21252125 if (isGlobal) {
21262126 // Abbrev for CST_CODE_AGGREGATE.
2127 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
2127 auto Abbv = std::make_shared();
21282128 Abbv->Add(BitCodeAbbrevOp(bitc::CST_CODE_AGGREGATE));
21292129 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
21302130 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, Log2_32_Ceil(LastVal+1)));
2131 AggregateAbbrev = Stream.EmitAbbrev(Abbv);
2131 AggregateAbbrev = Stream.EmitAbbrev(std::move(Abbv));
21322132
21332133 // Abbrev for CST_CODE_STRING.
2134 Abbv = new BitCodeAbbrev();
2134 Abbv = std::make_shared();
21352135 Abbv->Add(BitCodeAbbrevOp(bitc::CST_CODE_STRING));
21362136 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
21372137 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8));
2138 String8Abbrev = Stream.EmitAbbrev(Abbv);
2138 String8Abbrev = Stream.EmitAbbrev(std::move(Abbv));
21392139 // Abbrev for CST_CODE_CSTRING.
2140 Abbv = new BitCodeAbbrev();
2140 Abbv = std::make_shared();
21412141 Abbv->Add(BitCodeAbbrevOp(bitc::CST_CODE_CSTRING));
21422142 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
21432143 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7));
2144 CString7Abbrev = Stream.EmitAbbrev(Abbv);
2144 CString7Abbrev = Stream.EmitAbbrev(std::move(Abbv));
21452145 // Abbrev for CST_CODE_CSTRING.
2146 Abbv = new BitCodeAbbrev();
2146 Abbv = std::make_shared();
21472147 Abbv->Add(BitCodeAbbrevOp(bitc::CST_CODE_CSTRING));
21482148 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
21492149 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Char6));
2150 CString6Abbrev = Stream.EmitAbbrev(Abbv);
2150 CString6Abbrev = Stream.EmitAbbrev(std::move(Abbv));
21512151 }
21522152
21532153 SmallVector Record;
28572857 unsigned GUIDEntryAbbrev;
28582858 if (IsModuleLevel && hasVSTOffsetPlaceholder()) {
28592859 // 8-bit fixed-width VST_CODE_FNENTRY function strings.
2860 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
2860 auto Abbv = std::make_shared();
28612861 Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_FNENTRY));
28622862 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // value id
28632863 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // funcoffset
28642864 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
28652865 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8));
2866 FnEntry8BitAbbrev = Stream.EmitAbbrev(Abbv);
2866 FnEntry8BitAbbrev = Stream.EmitAbbrev(std::move(Abbv));
28672867
28682868 // 7-bit fixed width VST_CODE_FNENTRY function strings.
2869 Abbv = new BitCodeAbbrev();
2869 Abbv = std::make_shared();
28702870 Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_FNENTRY));
28712871 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // value id
28722872 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // funcoffset
28732873 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
28742874 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7));
2875 FnEntry7BitAbbrev = Stream.EmitAbbrev(Abbv);
2875 FnEntry7BitAbbrev = Stream.EmitAbbrev(std::move(Abbv));
28762876
28772877 // 6-bit char6 VST_CODE_FNENTRY function strings.
2878 Abbv = new BitCodeAbbrev();
2878 Abbv = std::make_shared();
28792879 Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_FNENTRY));
28802880 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // value id
28812881 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // funcoffset
28822882 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
28832883 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Char6));
2884 FnEntry6BitAbbrev = Stream.EmitAbbrev(Abbv);
2884 FnEntry6BitAbbrev = Stream.EmitAbbrev(std::move(Abbv));
28852885
28862886 // FIXME: Change the name of this record as it is now used by
28872887 // the per-module index as well.
2888 Abbv = new BitCodeAbbrev();
2888 Abbv = std::make_shared();
28892889 Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_COMBINED_ENTRY));
28902890 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // valueid
28912891 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // refguid
2892 GUIDEntryAbbrev = Stream.EmitAbbrev(Abbv);
2892 GUIDEntryAbbrev = Stream.EmitAbbrev(std::move(Abbv));
28932893 }
28942894
28952895 // FIXME: Set up the abbrev, we know how many values there are!
29832983
29842984 Stream.EnterSubblock(bitc::VALUE_SYMTAB_BLOCK_ID, 4);
29852985
2986 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
2986 auto Abbv = std::make_shared();
29872987 Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_COMBINED_ENTRY));
29882988 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // valueid
29892989 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // refguid
2990 unsigned EntryAbbrev = Stream.EmitAbbrev(Abbv);
2990 unsigned EntryAbbrev = Stream.EmitAbbrev(std::move(Abbv));
29912991
29922992 SmallVector NameVals;
29932993 for (const auto &GVI : valueIds()) {
31203120 Stream.EnterBlockInfoBlock();
31213121
31223122 { // 8-bit fixed-width VST_CODE_ENTRY/VST_CODE_BBENTRY strings.
3123 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
3123 auto Abbv = std::make_shared();
31243124 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3));
31253125 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
31263126 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
31313131 }
31323132
31333133 { // 7-bit fixed width VST_CODE_ENTRY strings.
3134 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
3134 auto Abbv = std::make_shared();
31353135 Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_ENTRY));
31363136 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
31373137 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
31413141 llvm_unreachable("Unexpected abbrev ordering!");
31423142 }
31433143 { // 6-bit char6 VST_CODE_ENTRY strings.
3144 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
3144 auto Abbv = std::make_shared();
31453145 Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_ENTRY));
31463146 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
31473147 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
31513151 llvm_unreachable("Unexpected abbrev ordering!");
31523152 }
31533153 { // 6-bit char6 VST_CODE_BBENTRY strings.
3154 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
3154 auto Abbv = std::make_shared();
31553155 Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_BBENTRY));
31563156 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
31573157 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
31643164
31653165
31663166 { // SETTYPE abbrev for CONSTANTS_BLOCK.
3167 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
3167 auto Abbv = std::make_shared();
31683168 Abbv->Add(BitCodeAbbrevOp(bitc::CST_CODE_SETTYPE));
31693169 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
31703170 VE.computeBitsRequiredForTypeIndicies()));
31743174 }
31753175
31763176 { // INTEGER abbrev for CONSTANTS_BLOCK.
3177 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
3177 auto Abbv = std::make_shared();
31783178 Abbv->Add(BitCodeAbbrevOp(bitc::CST_CODE_INTEGER));
31793179 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
31803180 if (Stream.EmitBlockInfoAbbrev(bitc::CONSTANTS_BLOCK_ID, Abbv) !=
31833183 }
31843184
31853185 { // CE_CAST abbrev for CONSTANTS_BLOCK.
3186 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
3186 auto Abbv = std::make_shared();
31873187 Abbv->Add(BitCodeAbbrevOp(bitc::CST_CODE_CE_CAST));
31883188 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 4)); // cast opc
31893189 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, // typeid
31953195 llvm_unreachable("Unexpected abbrev ordering!");
31963196 }
31973197 { // NULL abbrev for CONSTANTS_BLOCK.
3198 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
3198 auto Abbv = std::make_shared();
31993199 Abbv->Add(BitCodeAbbrevOp(bitc::CST_CODE_NULL));
32003200 if (Stream.EmitBlockInfoAbbrev(bitc::CONSTANTS_BLOCK_ID, Abbv) !=
32013201 CONSTANTS_NULL_Abbrev)
32053205 // FIXME: This should only use space for first class types!
32063206
32073207 { // INST_LOAD abbrev for FUNCTION_BLOCK.
3208 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
3208 auto Abbv = std::make_shared();
32093209 Abbv->Add(BitCodeAbbrevOp(bitc::FUNC_CODE_INST_LOAD));
32103210 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Ptr
32113211 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, // dest ty
32173217 llvm_unreachable("Unexpected abbrev ordering!");
32183218 }
32193219 { // INST_BINOP abbrev for FUNCTION_BLOCK.
3220 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
3220 auto Abbv = std::make_shared();
32213221 Abbv->Add(BitCodeAbbrevOp(bitc::FUNC_CODE_INST_BINOP));
32223222 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LHS
32233223 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // RHS
32273227 llvm_unreachable("Unexpected abbrev ordering!");
32283228 }
32293229 { // INST_BINOP_FLAGS abbrev for FUNCTION_BLOCK.
3230 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
3230 auto Abbv = std::make_shared();
32313231 Abbv->Add(BitCodeAbbrevOp(bitc::FUNC_CODE_INST_BINOP));
32323232 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LHS
32333233 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // RHS
32383238 llvm_unreachable("Unexpected abbrev ordering!");
32393239 }
32403240 { // INST_CAST abbrev for FUNCTION_BLOCK.
3241 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
3241 auto Abbv = std::make_shared();
32423242 Abbv->Add(BitCodeAbbrevOp(bitc::FUNC_CODE_INST_CAST));
32433243 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // OpVal
32443244 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, // dest ty
32503250 }
32513251
32523252 { // INST_RET abbrev for FUNCTION_BLOCK.
3253 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
3253 auto Abbv = std::make_shared();
32543254 Abbv->Add(BitCodeAbbrevOp(bitc::FUNC_CODE_INST_RET));
32553255 if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID, Abbv) !=
32563256 FUNCTION_INST_RET_VOID_ABBREV)
32573257 llvm_unreachable("Unexpected abbrev ordering!");
32583258 }
32593259 { // INST_RET abbrev for FUNCTION_BLOCK.
3260 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
3260 auto Abbv = std::make_shared();
32613261 Abbv->Add(BitCodeAbbrevOp(bitc::FUNC_CODE_INST_RET));
32623262 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // ValID
32633263 if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID, Abbv) !=
32653265 llvm_unreachable("Unexpected abbrev ordering!");
32663266 }
32673267 { // INST_UNREACHABLE abbrev for FUNCTION_BLOCK.
3268 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
3268 auto Abbv = std::make_shared();
32693269 Abbv->Add(BitCodeAbbrevOp(bitc::FUNC_CODE_INST_UNREACHABLE));
32703270 if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID, Abbv) !=
32713271 FUNCTION_INST_UNREACHABLE_ABBREV)
32723272 llvm_unreachable("Unexpected abbrev ordering!");
32733273 }
32743274 {
3275 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
3275 auto Abbv = std::make_shared();
32763276 Abbv->Add(BitCodeAbbrevOp(bitc::FUNC_CODE_INST_GEP));
32773277 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
32783278 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, // dest ty
32953295 // TODO: See which abbrev sizes we actually need to emit
32963296
32973297 // 8-bit fixed-width MST_ENTRY strings.
3298 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
3298 auto Abbv = std::make_shared();
32993299 Abbv->Add(BitCodeAbbrevOp(bitc::MST_CODE_ENTRY));
33003300 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
33013301 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
33023302 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8));
3303 unsigned Abbrev8Bit = Stream.EmitAbbrev(Abbv);
3303 unsigned Abbrev8Bit = Stream.EmitAbbrev(std::move(Abbv));
33043304
33053305 // 7-bit fixed width MST_ENTRY strings.
3306 Abbv = new BitCodeAbbrev();
3306 Abbv = std::make_shared();
33073307 Abbv->Add(BitCodeAbbrevOp(bitc::MST_CODE_ENTRY));
33083308 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
33093309 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
33103310 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7));
3311 unsigned Abbrev7Bit = Stream.EmitAbbrev(Abbv);
3311 unsigned Abbrev7Bit = Stream.EmitAbbrev(std::move(Abbv));
33123312
33133313 // 6-bit char6 MST_ENTRY strings.
3314 Abbv = new BitCodeAbbrev();
3314 Abbv = std::make_shared();
33153315 Abbv->Add(BitCodeAbbrevOp(bitc::MST_CODE_ENTRY));
33163316 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
33173317 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
33183318 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Char6));
3319 unsigned Abbrev6Bit = Stream.EmitAbbrev(Abbv);
3319 unsigned Abbrev6Bit = Stream.EmitAbbrev(std::move(Abbv));
33203320
33213321 // Module Hash, 160 bits SHA1. Optionally, emitted after each MST_CODE_ENTRY.
3322 Abbv = new BitCodeAbbrev();
3322 Abbv = std::make_shared();
33233323 Abbv->Add(BitCodeAbbrevOp(bitc::MST_CODE_HASH));
33243324 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
33253325 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
33263326 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
33273327 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
33283328 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
3329 unsigned AbbrevHash = Stream.EmitAbbrev(Abbv);
3329 unsigned AbbrevHash = Stream.EmitAbbrev(std::move(Abbv));
33303330
33313331 SmallVector Vals;
33323332 for (const auto &MPSE : Index.modulePaths()) {
34493449 }
34503450
34513451 // Abbrev for FS_PERMODULE.
3452 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
3452 auto Abbv = std::make_shared();
34533453 Abbv->Add(BitCodeAbbrevOp(bitc::FS_PERMODULE));
34543454 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // valueid
34553455 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // flags
34583458 // numrefs x valueid, n x (valueid)
34593459 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
34603460 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
3461 unsigned FSCallsAbbrev = Stream.EmitAbbrev(Abbv);
3461 unsigned FSCallsAbbrev = Stream.EmitAbbrev(std::move(Abbv));
34623462
34633463 // Abbrev for FS_PERMODULE_PROFILE.
3464 Abbv = new BitCodeAbbrev();
3464 Abbv = std::make_shared();
34653465 Abbv->Add(BitCodeAbbrevOp(bitc::FS_PERMODULE_PROFILE));
34663466 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // valueid
34673467 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // flags
34703470 // numrefs x valueid, n x (valueid, hotness)
34713471 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
34723472 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
3473 unsigned FSCallsProfileAbbrev = Stream.EmitAbbrev(Abbv);
3473 unsigned FSCallsProfileAbbrev = Stream.EmitAbbrev(std::move(Abbv));
34743474
34753475 // Abbrev for FS_PERMODULE_GLOBALVAR_INIT_REFS.
3476 Abbv = new BitCodeAbbrev();
3476 Abbv = std::make_shared();
34773477 Abbv->Add(BitCodeAbbrevOp(bitc::FS_PERMODULE_GLOBALVAR_INIT_REFS));
34783478 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // valueid
34793479 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // flags
34803480 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array)); // valueids
34813481 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
3482 unsigned FSModRefsAbbrev = Stream.EmitAbbrev(Abbv);
3482 unsigned FSModRefsAbbrev = Stream.EmitAbbrev(std::move(Abbv));
34833483
34843484 // Abbrev for FS_ALIAS.
3485 Abbv = new BitCodeAbbrev();
3485 Abbv = std::make_shared();
34863486 Abbv->Add(BitCodeAbbrevOp(bitc::FS_ALIAS));
34873487 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // valueid
34883488 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // flags
34893489 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // valueid
3490 unsigned FSAliasAbbrev = Stream.EmitAbbrev(Abbv);
3490 unsigned FSAliasAbbrev = Stream.EmitAbbrev(std::move(Abbv));
34913491
34923492 SmallVector NameVals;
34933493 // Iterate over the list of functions instead of the Index to
35413541 Stream.EmitRecord(bitc::FS_VERSION, ArrayRef{INDEX_VERSION});
35423542
35433543 // Abbrev for FS_COMBINED.
3544 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
3544 auto Abbv = std::make_shared();
35453545 Abbv->Add(BitCodeAbbrevOp(bitc::FS_COMBINED));
35463546 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // valueid
35473547 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // modid
35513551 // numrefs x valueid, n x (valueid)
35523552 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
35533553 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
3554 unsigned FSCallsAbbrev = Stream.EmitAbbrev(Abbv);
3554 unsigned FSCallsAbbrev = Stream.EmitAbbrev(std::move(Abbv));
35553555
35563556 // Abbrev for FS_COMBINED_PROFILE.
3557 Abbv = new BitCodeAbbrev();
3557 Abbv = std::make_shared();
35583558 Abbv->Add(BitCodeAbbrevOp(bitc::FS_COMBINED_PROFILE));
35593559 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // valueid
35603560 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // modid
35643564 // numrefs x valueid, n x (valueid, hotness)
35653565 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
35663566 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
3567 unsigned FSCallsProfileAbbrev = Stream.EmitAbbrev(Abbv);
3567 unsigned FSCallsProfileAbbrev = Stream.EmitAbbrev(std::move(Abbv));
35683568
35693569 // Abbrev for FS_COMBINED_GLOBALVAR_INIT_REFS.
3570 Abbv = new BitCodeAbbrev();
3570 Abbv = std::make_shared();
35713571 Abbv->Add(BitCodeAbbrevOp(bitc::FS_COMBINED_GLOBALVAR_INIT_REFS));
35723572 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // valueid
35733573 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // modid
35743574 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // flags
35753575 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array)); // valueids
35763576 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
3577 unsigned FSModRefsAbbrev = Stream.EmitAbbrev(Abbv);
3577 unsigned FSModRefsAbbrev = Stream.EmitAbbrev(std::move(Abbv));
35783578
35793579 // Abbrev for FS_COMBINED_ALIAS.
3580 Abbv = new BitCodeAbbrev();
3580 Abbv = std::make_shared();
35813581 Abbv->Add(BitCodeAbbrevOp(bitc::FS_COMBINED_ALIAS));
35823582 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // valueid
35833583 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // modid
35843584 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // flags
35853585 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // valueid
3586 unsigned FSAliasAbbrev = Stream.EmitAbbrev(Abbv);
3586 unsigned FSAliasAbbrev = Stream.EmitAbbrev(std::move(Abbv));
35873587
35883588 // The aliases are emitted as a post-pass, and will point to the value
35893589 // id of the aliasee. Save them in a vector for post-processing.
37013701 Stream.EnterSubblock(bitc::IDENTIFICATION_BLOCK_ID, 5);
37023702
37033703 // Write the "user readable" string identifying the bitcode producer
3704 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
3704 auto Abbv = std::make_shared();
37053705 Abbv->Add(BitCodeAbbrevOp(bitc::IDENTIFICATION_CODE_STRING));
37063706 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
37073707 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Char6));
3708 auto StringAbbrev = Stream.EmitAbbrev(Abbv);
3708 auto StringAbbrev = Stream.EmitAbbrev(std::move(Abbv));
37093709 writeStringRecord(Stream, bitc::IDENTIFICATION_CODE_STRING,
37103710 "LLVM" LLVM_VERSION_STRING, StringAbbrev);
37113711
37123712 // Write the epoch version
3713 Abbv = new BitCodeAbbrev();
3713 Abbv = std::make_shared();
37143714 Abbv->Add(BitCodeAbbrevOp(bitc::IDENTIFICATION_CODE_EPOCH));
37153715 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
3716 auto EpochAbbrev = Stream.EmitAbbrev(Abbv);
3716 auto EpochAbbrev = Stream.EmitAbbrev(std::move(Abbv));
37173717 SmallVector Vals = {bitc::BITCODE_CURRENT_EPOCH};
37183718 Stream.EmitRecord(bitc::IDENTIFICATION_CODE_EPOCH, Vals, EpochAbbrev);
37193719 Stream.ExitBlock();
100100 Stream.Emit(Magic, 32);
101101 Stream.EnterSubblock(BlockID, 3);
102102
103 BitCodeAbbrev *Abbrev = new BitCodeAbbrev();
103 auto Abbrev = std::make_shared();
104104 Abbrev->Add(BitCodeAbbrevOp(RecordID));
105105 Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
106 AbbrevID = Stream.EmitAbbrev(Abbrev);
106 AbbrevID = Stream.EmitAbbrev(std::move(Abbrev));
107107 unsigned Record[] = {RecordID};
108108 Stream.EmitRecordWithBlob(AbbrevID, makeArrayRef(Record), BlobIn);
109109