<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Apr 23, 2016 at 2:48 PM, Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ah, okay; mistakes happen. One option (next time) is to respond on the<br>
list to the bad commit with an explanation, to keep reviews at bay ;).<br></blockquote><div><br></div><div>Ok thanks. I thought about doing that when it happened, sounds like I should have gone with my instinct!</div><div><br></div><div>Teresa</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
<br>
> On 2016-Apr-23, at 14:39, Teresa Johnson <<a href="mailto:tejohnson@google.com">tejohnson@google.com</a>> wrote:<br>
><br>
> This was a mistake on my part - I forgot to squash the two commits on my branch into one before I did the commit. I realized right away but it was too late, and my dcommit created two revisions. =( Figured it wasn't worth rolling back to fix.<br>
><br>
> Teresa<br>
><br>
> On Sat, Apr 23, 2016 at 2:37 PM, Duncan P. N. Exon Smith <<a href="mailto:dexonsmith@apple.com">dexonsmith@apple.com</a>> wrote:<br>
><br>
> > On 2016-Apr-22, at 21:31, Teresa Johnson via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
> ><br>
> > Author: tejohnson<br>
> > Date: Fri Apr 22 23:31:20 2016<br>
> > New Revision: 267274<br>
> ><br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project?rev=267274&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=267274&view=rev</a><br>
> > Log:<br>
> > Address comments.<br>
><br>
> This doesn't describe the commit in a useful way. In the future,<br>
> please describe the changes you're making, even when you're responding<br>
> to reviews!<br>
><br>
> ><br>
> > Modified:<br>
> > llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp<br>
> ><br>
> > Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=267274&r1=267273&r2=267274&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=267274&r1=267273&r2=267274&view=diff</a><br>
> > ==============================================================================<br>
> > --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)<br>
> > +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Fri Apr 22 23:31:20 2016<br>
> > @@ -63,12 +63,13 @@ enum {<br>
> > FUNCTION_INST_GEP_ABBREV,<br>
> > };<br>
> ><br>
> > -/// Class to manage the bitcode writing for all bitcode file types.<br>
> > -/// Owns the BitstreamWriter, and includes the main entry point for<br>
> > +/// Abstract class to manage the bitcode writing, subclassed for each bitcode<br>
> > +/// file type. Owns the BitstreamWriter, and includes the main entry point for<br>
> > /// writing.<br>
> > class BitcodeWriter {<br>
> > +protected:<br>
> > /// Pointer to the buffer allocated by caller for bitcode writing.<br>
> > - SmallVectorImpl<char> *Buffer;<br>
> > + const SmallVectorImpl<char> &Buffer;<br>
> ><br>
> > /// The stream created and owned by the BitodeWriter.<br>
> > BitstreamWriter Stream;<br>
> > @@ -80,8 +81,8 @@ class BitcodeWriter {<br>
> > public:<br>
> > /// Constructs a BitcodeWriter object, and initializes a BitstreamRecord,<br>
> > /// writing to the provided \p Buffer.<br>
> > - BitcodeWriter(SmallVectorImpl<char> *Buffer)<br>
> > - : Buffer(Buffer), Stream(*Buffer) {}<br>
> > + BitcodeWriter(SmallVectorImpl<char> &Buffer)<br>
> > + : Buffer(Buffer), Stream(Buffer) {}<br>
> ><br>
> > virtual ~BitcodeWriter() = default;<br>
> ><br>
> > @@ -96,9 +97,6 @@ private:<br>
> ><br>
> > protected:<br>
> > bool hasVSTOffsetPlaceholder() { return VSTOffsetPlaceholder != 0; }<br>
> > - uint64_t getVSTOffsetPlaceholder() { return VSTOffsetPlaceholder; }<br>
> > - SmallVectorImpl<char> &buffer() { return *Buffer; }<br>
> > - BitstreamWriter &stream() { return Stream; }<br>
> > void writeValueSymbolTableForwardDecl();<br>
> > void writeBitcodeHeader();<br>
> > };<br>
> > @@ -106,7 +104,7 @@ protected:<br>
> > /// Class to manage the bitcode writing for a module.<br>
> > class ModuleBitcodeWriter : public BitcodeWriter {<br>
> > /// The Module to write to bitcode.<br>
> > - const Module *M;<br>
> > + const Module &M;<br>
> ><br>
> > /// Enumerates ids for all values in the module.<br>
> > ValueEnumerator VE;<br>
> > @@ -123,16 +121,16 @@ class ModuleBitcodeWriter : public Bitco<br>
> > public:<br>
> > /// Constructs a ModuleBitcodeWriter object for the given Module,<br>
> > /// writing to the provided \p Buffer.<br>
> > - ModuleBitcodeWriter(const Module *M, SmallVectorImpl<char> *Buffer,<br>
> > + ModuleBitcodeWriter(const Module *M, SmallVectorImpl<char> &Buffer,<br>
> > bool ShouldPreserveUseListOrder,<br>
> > const ModuleSummaryIndex *Index, bool GenerateHash)<br>
> > - : BitcodeWriter(Buffer), M(M), VE(*M, ShouldPreserveUseListOrder),<br>
> > + : BitcodeWriter(Buffer), M(*M), VE(*M, ShouldPreserveUseListOrder),<br>
> > Index(Index), GenerateHash(GenerateHash) {<br>
> > // Save the start bit of the actual bitcode, in case there is space<br>
> > // saved at the start for the darwin header above. The reader stream<br>
> > // will start at the bitcode, and we need the offset of the VST<br>
> > // to line up.<br>
> > - BitcodeStartBit = stream().GetCurrentBitNo();<br>
> > + BitcodeStartBit = Stream.GetCurrentBitNo();<br>
> > }<br>
> ><br>
> > private:<br>
> > @@ -263,7 +261,7 @@ private:<br>
> > /// Class to manage the bitcode writing for a combined index.<br>
> > class IndexBitcodeWriter : public BitcodeWriter {<br>
> > /// The combined index to write to bitcode.<br>
> > - const ModuleSummaryIndex *Index;<br>
> > + const ModuleSummaryIndex &Index;<br>
> ><br>
> > /// Map that holds the correspondence between the GUID used in the combined<br>
> > /// index and a value id generated by this class to use in references.<br>
> > @@ -275,14 +273,14 @@ class IndexBitcodeWriter : public Bitcod<br>
> > public:<br>
> > /// Constructs a IndexBitcodeWriter object for the given combined index,<br>
> > /// writing to the provided \p Buffer.<br>
> > - IndexBitcodeWriter(SmallVectorImpl<char> *Buffer,<br>
> > - const ModuleSummaryIndex *Index)<br>
> > + IndexBitcodeWriter(SmallVectorImpl<char> &Buffer,<br>
> > + const ModuleSummaryIndex &Index)<br>
> > : BitcodeWriter(Buffer), Index(Index) {<br>
> > // Assign unique value ids to all functions in the index for use<br>
> > // in writing out the call graph edges. Save the mapping from GUID<br>
> > // to the new global value id to use when writing those edges, which<br>
> > // are currently saved in the index in terms of GUID.<br>
> > - for (auto &II : *Index)<br>
> > + for (auto &II : Index)<br>
> > GUIDToValueIdMap[II.first] = ++GlobalValueId;<br>
> > }<br>
> ><br>
> > @@ -413,7 +411,7 @@ void ModuleBitcodeWriter::writeStringRec<br>
> > }<br>
> ><br>
> > // Emit the finished record.<br>
> > - stream().EmitRecord(Code, Vals, AbbrevToUse);<br>
> > + Stream.EmitRecord(Code, Vals, AbbrevToUse);<br>
> > }<br>
> ><br>
> > static uint64_t getAttrKindEncoding(Attribute::AttrKind Kind) {<br>
> > @@ -533,7 +531,7 @@ void ModuleBitcodeWriter::writeAttribute<br>
> > const std::vector<AttributeSet> &AttrGrps = VE.getAttributeGroups();<br>
> > if (AttrGrps.empty()) return;<br>
> ><br>
> > - stream().EnterSubblock(bitc::PARAMATTR_GROUP_BLOCK_ID, 3);<br>
> > + Stream.EnterSubblock(bitc::PARAMATTR_GROUP_BLOCK_ID, 3);<br>
> ><br>
> > SmallVector<uint64_t, 64> Record;<br>
> > for (unsigned i = 0, e = AttrGrps.size(); i != e; ++i) {<br>
> > @@ -568,19 +566,19 @@ void ModuleBitcodeWriter::writeAttribute<br>
> > }<br>
> > }<br>
> ><br>
> > - stream().EmitRecord(bitc::PARAMATTR_GRP_CODE_ENTRY, Record);<br>
> > + Stream.EmitRecord(bitc::PARAMATTR_GRP_CODE_ENTRY, Record);<br>
> > Record.clear();<br>
> > }<br>
> > }<br>
> ><br>
> > - stream().ExitBlock();<br>
> > + Stream.ExitBlock();<br>
> > }<br>
> ><br>
> > void ModuleBitcodeWriter::writeAttributeTable() {<br>
> > const std::vector<AttributeSet> &Attrs = VE.getAttributes();<br>
> > if (Attrs.empty()) return;<br>
> ><br>
> > - stream().EnterSubblock(bitc::PARAMATTR_BLOCK_ID, 3);<br>
> > + Stream.EnterSubblock(bitc::PARAMATTR_BLOCK_ID, 3);<br>
> ><br>
> > SmallVector<uint64_t, 64> Record;<br>
> > for (unsigned i = 0, e = Attrs.size(); i != e; ++i) {<br>
> > @@ -588,18 +586,18 @@ void ModuleBitcodeWriter::writeAttribute<br>
> > for (unsigned i = 0, e = A.getNumSlots(); i != e; ++i)<br>
> > Record.push_back(VE.getAttributeGroupID(A.getSlotAttributes(i)));<br>
> ><br>
> > - stream().EmitRecord(bitc::PARAMATTR_CODE_ENTRY, Record);<br>
> > + Stream.EmitRecord(bitc::PARAMATTR_CODE_ENTRY, Record);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > - stream().ExitBlock();<br>
> > + Stream.ExitBlock();<br>
> > }<br>
> ><br>
> > /// WriteTypeTable - Write out the type table for a module.<br>
> > void ModuleBitcodeWriter::writeTypeTable() {<br>
> > const ValueEnumerator::TypeList &TypeList = VE.getTypes();<br>
> ><br>
> > - stream().EnterSubblock(bitc::TYPE_BLOCK_ID_NEW, 4 /*count from # abbrevs */);<br>
> > + Stream.EnterSubblock(bitc::TYPE_BLOCK_ID_NEW, 4 /*count from # abbrevs */);<br>
> > SmallVector<uint64_t, 64> TypeVals;<br>
> ><br>
> > uint64_t NumBits = VE.computeBitsRequiredForTypeIndicies();<br>
> > @@ -609,7 +607,7 @@ void ModuleBitcodeWriter::writeTypeTable<br>
> > Abbv->Add(BitCodeAbbrevOp(bitc::TYPE_CODE_POINTER));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, NumBits));<br>
> > Abbv->Add(BitCodeAbbrevOp(0)); // Addrspace = 0<br>
> > - unsigned PtrAbbrev = stream().EmitAbbrev(Abbv);<br>
> > + unsigned PtrAbbrev = Stream.EmitAbbrev(Abbv);<br>
> ><br>
> > // Abbrev for TYPE_CODE_FUNCTION.<br>
> > Abbv = new BitCodeAbbrev();<br>
> > @@ -618,7 +616,7 @@ void ModuleBitcodeWriter::writeTypeTable<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, NumBits));<br>
> ><br>
> > - unsigned FunctionAbbrev = stream().EmitAbbrev(Abbv);<br>
> > + unsigned FunctionAbbrev = Stream.EmitAbbrev(Abbv);<br>
> ><br>
> > // Abbrev for TYPE_CODE_STRUCT_ANON.<br>
> > Abbv = new BitCodeAbbrev();<br>
> > @@ -627,14 +625,14 @@ void ModuleBitcodeWriter::writeTypeTable<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, NumBits));<br>
> ><br>
> > - unsigned StructAnonAbbrev = stream().EmitAbbrev(Abbv);<br>
> > + unsigned StructAnonAbbrev = Stream.EmitAbbrev(Abbv);<br>
> ><br>
> > // Abbrev for TYPE_CODE_STRUCT_NAME.<br>
> > Abbv = new BitCodeAbbrev();<br>
> > Abbv->Add(BitCodeAbbrevOp(bitc::TYPE_CODE_STRUCT_NAME));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Char6));<br>
> > - unsigned StructNameAbbrev = stream().EmitAbbrev(Abbv);<br>
> > + unsigned StructNameAbbrev = Stream.EmitAbbrev(Abbv);<br>
> ><br>
> > // Abbrev for TYPE_CODE_STRUCT_NAMED.<br>
> > Abbv = new BitCodeAbbrev();<br>
> > @@ -643,7 +641,7 @@ void ModuleBitcodeWriter::writeTypeTable<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, NumBits));<br>
> ><br>
> > - unsigned StructNamedAbbrev = stream().EmitAbbrev(Abbv);<br>
> > + unsigned StructNamedAbbrev = Stream.EmitAbbrev(Abbv);<br>
> ><br>
> > // Abbrev for TYPE_CODE_ARRAY.<br>
> > Abbv = new BitCodeAbbrev();<br>
> > @@ -651,11 +649,11 @@ void ModuleBitcodeWriter::writeTypeTable<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // size<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, NumBits));<br>
> ><br>
> > - unsigned ArrayAbbrev = stream().EmitAbbrev(Abbv);<br>
> > + unsigned ArrayAbbrev = Stream.EmitAbbrev(Abbv);<br>
> ><br>
> > // Emit an entry count so the reader can reserve space.<br>
> > TypeVals.push_back(TypeList.size());<br>
> > - stream().EmitRecord(bitc::TYPE_CODE_NUMENTRY, TypeVals);<br>
> > + Stream.EmitRecord(bitc::TYPE_CODE_NUMENTRY, TypeVals);<br>
> > TypeVals.clear();<br>
> ><br>
> > // Loop over all of the types, emitting each in turn.<br>
> > @@ -749,11 +747,11 @@ void ModuleBitcodeWriter::writeTypeTable<br>
> > }<br>
> ><br>
> > // Emit the finished record.<br>
> > - stream().EmitRecord(Code, TypeVals, AbbrevToUse);<br>
> > + Stream.EmitRecord(Code, TypeVals, AbbrevToUse);<br>
> > TypeVals.clear();<br>
> > }<br>
> ><br>
> > - stream().ExitBlock();<br>
> > + Stream.ExitBlock();<br>
> > }<br>
> ><br>
> > static unsigned getEncodedLinkage(const GlobalValue::LinkageTypes Linkage) {<br>
> > @@ -843,7 +841,7 @@ void ModuleBitcodeWriter::writeComdats()<br>
> > Vals.push_back(Size);<br>
> > for (char Chr : C->getName())<br>
> > Vals.push_back((unsigned char)Chr);<br>
> > - stream().EmitRecord(bitc::MODULE_CODE_COMDAT, Vals, /*AbbrevToUse=*/0);<br>
> > + Stream.EmitRecord(bitc::MODULE_CODE_COMDAT, Vals, /*AbbrevToUse=*/0);<br>
> > Vals.clear();<br>
> > }<br>
> > }<br>
> > @@ -862,16 +860,16 @@ void BitcodeWriter::writeValueSymbolTabl<br>
> > // hold the real VST offset. Must use fixed instead of VBR as we don't<br>
> > // know how many VBR chunks to reserve ahead of time.<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));<br>
> > - unsigned VSTOffsetAbbrev = stream().EmitAbbrev(Abbv);<br>
> > + unsigned VSTOffsetAbbrev = Stream.EmitAbbrev(Abbv);<br>
> ><br>
> > // Emit the placeholder<br>
> > uint64_t Vals[] = {bitc::MODULE_CODE_VSTOFFSET, 0};<br>
> > - stream().EmitRecordWithAbbrev(VSTOffsetAbbrev, Vals);<br>
> > + Stream.EmitRecordWithAbbrev(VSTOffsetAbbrev, Vals);<br>
> ><br>
> > // Compute and save the bit offset to the placeholder, which will be<br>
> > // patched when the real VST is written. We can simply subtract the 32-bit<br>
> > // fixed size from the current bit number to get the location to backpatch.<br>
> > - VSTOffsetPlaceholder = stream().GetCurrentBitNo() - 32;<br>
> > + VSTOffsetPlaceholder = Stream.GetCurrentBitNo() - 32;<br>
> > }<br>
> ><br>
> > enum StringEncoding { SE_Char6, SE_Fixed7, SE_Fixed8 };<br>
> > @@ -897,14 +895,14 @@ static StringEncoding getStringEncoding(<br>
> > /// Returns the bit offset to backpatch with the location of the real VST.<br>
> > void ModuleBitcodeWriter::writeModuleInfo() {<br>
> > // Emit various pieces of data attached to a module.<br>
> > - if (!M->getTargetTriple().empty())<br>
> > - writeStringRecord(bitc::MODULE_CODE_TRIPLE, M->getTargetTriple(),<br>
> > + if (!M.getTargetTriple().empty())<br>
> > + writeStringRecord(bitc::MODULE_CODE_TRIPLE, M.getTargetTriple(),<br>
> > 0 /*TODO*/);<br>
> > - const std::string &DL = M->getDataLayoutStr();<br>
> > + const std::string &DL = M.getDataLayoutStr();<br>
> > if (!DL.empty())<br>
> > writeStringRecord(bitc::MODULE_CODE_DATALAYOUT, DL, 0 /*TODO*/);<br>
> > - if (!M->getModuleInlineAsm().empty())<br>
> > - writeStringRecord(bitc::MODULE_CODE_ASM, M->getModuleInlineAsm(),<br>
> > + if (!M.getModuleInlineAsm().empty())<br>
> > + writeStringRecord(bitc::MODULE_CODE_ASM, M.getModuleInlineAsm(),<br>
> > 0 /*TODO*/);<br>
> ><br>
> > // Emit information about sections and GC, computing how many there are. Also<br>
> > @@ -913,7 +911,7 @@ void ModuleBitcodeWriter::writeModuleInf<br>
> > std::map<std::string, unsigned> GCMap;<br>
> > unsigned MaxAlignment = 0;<br>
> > unsigned MaxGlobalType = 0;<br>
> > - for (const GlobalValue &GV : M->globals()) {<br>
> > + for (const GlobalValue &GV : M.globals()) {<br>
> > MaxAlignment = std::max(MaxAlignment, GV.getAlignment());<br>
> > MaxGlobalType = std::max(MaxGlobalType, VE.getTypeID(GV.getValueType()));<br>
> > if (GV.hasSection()) {<br>
> > @@ -926,7 +924,7 @@ void ModuleBitcodeWriter::writeModuleInf<br>
> > }<br>
> > }<br>
> > }<br>
> > - for (const Function &F : *M) {<br>
> > + for (const Function &F : M) {<br>
> > MaxAlignment = std::max(MaxAlignment, F.getAlignment());<br>
> > if (F.hasSection()) {<br>
> > // Give section names unique ID's.<br>
> > @@ -949,7 +947,7 @@ void ModuleBitcodeWriter::writeModuleInf<br>
> ><br>
> > // Emit abbrev for globals, now that we know # sections and max alignment.<br>
> > unsigned SimpleGVarAbbrev = 0;<br>
> > - if (!M->global_empty()) {<br>
> > + if (!M.global_empty()) {<br>
> > // Add an abbrev for common globals with no visibility or thread localness.<br>
> > BitCodeAbbrev *Abbv = new BitCodeAbbrev();<br>
> > Abbv->Add(BitCodeAbbrevOp(bitc::MODULE_CODE_GLOBALVAR));<br>
> > @@ -973,12 +971,12 @@ void ModuleBitcodeWriter::writeModuleInf<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,<br>
> > Log2_32_Ceil(SectionMap.size()+1)));<br>
> > // Don't bother emitting vis + thread local.<br>
> > - SimpleGVarAbbrev = stream().EmitAbbrev(Abbv);<br>
> > + SimpleGVarAbbrev = Stream.EmitAbbrev(Abbv);<br>
> > }<br>
> ><br>
> > // Emit the global variable information.<br>
> > SmallVector<unsigned, 64> Vals;<br>
> > - for (const GlobalVariable &GV : M->globals()) {<br>
> > + for (const GlobalVariable &GV : M.globals()) {<br>
> > unsigned AbbrevToUse = 0;<br>
> ><br>
> > // GLOBALVAR: [type, isconst, initid,<br>
> > @@ -1007,12 +1005,12 @@ void ModuleBitcodeWriter::writeModuleInf<br>
> > AbbrevToUse = SimpleGVarAbbrev;<br>
> > }<br>
> ><br>
> > - stream().EmitRecord(bitc::MODULE_CODE_GLOBALVAR, Vals, AbbrevToUse);<br>
> > + Stream.EmitRecord(bitc::MODULE_CODE_GLOBALVAR, Vals, AbbrevToUse);<br>
> > Vals.clear();<br>
> > }<br>
> ><br>
> > // Emit the function proto information.<br>
> > - for (const Function &F : *M) {<br>
> > + for (const Function &F : M) {<br>
> > // FUNCTION: [type, callingconv, isproto, linkage, paramattrs, alignment,<br>
> > // section, visibility, gc, unnamed_addr, prologuedata,<br>
> > // dllstorageclass, comdat, prefixdata, personalityfn]<br>
> > @@ -1036,12 +1034,12 @@ void ModuleBitcodeWriter::writeModuleInf<br>
> > F.hasPersonalityFn() ? (VE.getValueID(F.getPersonalityFn()) + 1) : 0);<br>
> ><br>
> > unsigned AbbrevToUse = 0;<br>
> > - stream().EmitRecord(bitc::MODULE_CODE_FUNCTION, Vals, AbbrevToUse);<br>
> > + Stream.EmitRecord(bitc::MODULE_CODE_FUNCTION, Vals, AbbrevToUse);<br>
> > Vals.clear();<br>
> > }<br>
> ><br>
> > // Emit the alias information.<br>
> > - for (const GlobalAlias &A : M->aliases()) {<br>
> > + for (const GlobalAlias &A : M.aliases()) {<br>
> > // ALIAS: [alias type, aliasee val#, linkage, visibility]<br>
> > Vals.push_back(VE.getTypeID(A.getValueType()));<br>
> > Vals.push_back(A.getType()->getAddressSpace());<br>
> > @@ -1052,26 +1050,26 @@ void ModuleBitcodeWriter::writeModuleInf<br>
> > Vals.push_back(getEncodedThreadLocalMode(A));<br>
> > Vals.push_back(A.hasUnnamedAddr());<br>
> > unsigned AbbrevToUse = 0;<br>
> > - stream().EmitRecord(bitc::MODULE_CODE_ALIAS, Vals, AbbrevToUse);<br>
> > + Stream.EmitRecord(bitc::MODULE_CODE_ALIAS, Vals, AbbrevToUse);<br>
> > Vals.clear();<br>
> > }<br>
> ><br>
> > // Emit the ifunc information.<br>
> > - for (const GlobalIFunc &I : M->ifuncs()) {<br>
> > + for (const GlobalIFunc &I : M.ifuncs()) {<br>
> > // IFUNC: [ifunc type, address space, resolver val#, linkage, visibility]<br>
> > Vals.push_back(VE.getTypeID(I.getValueType()));<br>
> > Vals.push_back(I.getType()->getAddressSpace());<br>
> > Vals.push_back(VE.getValueID(I.getResolver()));<br>
> > Vals.push_back(getEncodedLinkage(I));<br>
> > Vals.push_back(getEncodedVisibility(I));<br>
> > - stream().EmitRecord(bitc::MODULE_CODE_IFUNC, Vals);<br>
> > + Stream.EmitRecord(bitc::MODULE_CODE_IFUNC, Vals);<br>
> > Vals.clear();<br>
> > }<br>
> ><br>
> > // Emit the module's source file name.<br>
> > {<br>
> > - StringEncoding Bits = getStringEncoding(M->getSourceFileName().data(),<br>
> > - M->getSourceFileName().size());<br>
> > + StringEncoding Bits = getStringEncoding(M.getSourceFileName().data(),<br>
> > + M.getSourceFileName().size());<br>
> > BitCodeAbbrevOp AbbrevOpToUse = BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8);<br>
> > if (Bits == SE_Char6)<br>
> > AbbrevOpToUse = BitCodeAbbrevOp(BitCodeAbbrevOp::Char6);<br>
> > @@ -1083,19 +1081,18 @@ void ModuleBitcodeWriter::writeModuleInf<br>
> > Abbv->Add(BitCodeAbbrevOp(bitc::MODULE_CODE_SOURCE_FILENAME));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(AbbrevOpToUse);<br>
> > - unsigned FilenameAbbrev = stream().EmitAbbrev(Abbv);<br>
> > + unsigned FilenameAbbrev = Stream.EmitAbbrev(Abbv);<br>
> ><br>
> > - for (const auto P : M->getSourceFileName())<br>
> > + for (const auto P : M.getSourceFileName())<br>
> > Vals.push_back((unsigned char)P);<br>
> ><br>
> > // Emit the finished record.<br>
> > - stream().EmitRecord(bitc::MODULE_CODE_SOURCE_FILENAME, Vals,<br>
> > - FilenameAbbrev);<br>
> > + Stream.EmitRecord(bitc::MODULE_CODE_SOURCE_FILENAME, Vals, FilenameAbbrev);<br>
> > Vals.clear();<br>
> > }<br>
> ><br>
> > // If we have a VST, write the VSTOFFSET record placeholder.<br>
> > - if (M->getValueSymbolTable().empty())<br>
> > + if (M.getValueSymbolTable().empty())<br>
> > return;<br>
> > writeValueSymbolTableForwardDecl();<br>
> > }<br>
> > @@ -1133,7 +1130,7 @@ void ModuleBitcodeWriter::writeValueAsMe<br>
> > Value *V = MD->getValue();<br>
> > Record.push_back(VE.getTypeID(V->getType()));<br>
> > Record.push_back(VE.getValueID(V));<br>
> > - stream().EmitRecord(bitc::METADATA_VALUE, Record, 0);<br>
> > + Stream.EmitRecord(bitc::METADATA_VALUE, Record, 0);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1146,9 +1143,9 @@ void ModuleBitcodeWriter::writeMDTuple(c<br>
> > "Unexpected function-local metadata");<br>
> > Record.push_back(VE.getMetadataOrNullID(MD));<br>
> > }<br>
> > - stream().EmitRecord(N->isDistinct() ? bitc::METADATA_DISTINCT_NODE<br>
> > - : bitc::METADATA_NODE,<br>
> > - Record, Abbrev);<br>
> > + Stream.EmitRecord(N->isDistinct() ? bitc::METADATA_DISTINCT_NODE<br>
> > + : bitc::METADATA_NODE,<br>
> > + Record, Abbrev);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1162,7 +1159,7 @@ unsigned ModuleBitcodeWriter::createDILo<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));<br>
> > - return stream().EmitAbbrev(Abbv);<br>
> > + return Stream.EmitAbbrev(Abbv);<br>
> > }<br>
> ><br>
> > void ModuleBitcodeWriter::writeDILocation(const DILocation *N,<br>
> > @@ -1177,7 +1174,7 @@ void ModuleBitcodeWriter::writeDILocatio<br>
> > Record.push_back(VE.getMetadataID(N->getScope()));<br>
> > Record.push_back(VE.getMetadataOrNullID(N->getInlinedAt()));<br>
> ><br>
> > - stream().EmitRecord(bitc::METADATA_LOCATION, Record, Abbrev);<br>
> > + Stream.EmitRecord(bitc::METADATA_LOCATION, Record, Abbrev);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1192,7 +1189,7 @@ unsigned ModuleBitcodeWriter::createGene<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));<br>
> > - return stream().EmitAbbrev(Abbv);<br>
> > + return Stream.EmitAbbrev(Abbv);<br>
> > }<br>
> ><br>
> > void ModuleBitcodeWriter::writeGenericDINode(const GenericDINode *N,<br>
> > @@ -1208,7 +1205,7 @@ void ModuleBitcodeWriter::writeGenericDI<br>
> > for (auto &I : N->operands())<br>
> > Record.push_back(VE.getMetadataOrNullID(I));<br>
> ><br>
> > - stream().EmitRecord(bitc::METADATA_GENERIC_DEBUG, Record, Abbrev);<br>
> > + Stream.EmitRecord(bitc::METADATA_GENERIC_DEBUG, Record, Abbrev);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1224,7 +1221,7 @@ void ModuleBitcodeWriter::writeDISubrang<br>
> > Record.push_back(N->getCount());<br>
> > Record.push_back(rotateSign(N->getLowerBound()));<br>
> ><br>
> > - stream().EmitRecord(bitc::METADATA_SUBRANGE, Record, Abbrev);<br>
> > + Stream.EmitRecord(bitc::METADATA_SUBRANGE, Record, Abbrev);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1235,7 +1232,7 @@ void ModuleBitcodeWriter::writeDIEnumera<br>
> > Record.push_back(rotateSign(N->getValue()));<br>
> > Record.push_back(VE.getMetadataOrNullID(N->getRawName()));<br>
> ><br>
> > - stream().EmitRecord(bitc::METADATA_ENUMERATOR, Record, Abbrev);<br>
> > + Stream.EmitRecord(bitc::METADATA_ENUMERATOR, Record, Abbrev);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1249,7 +1246,7 @@ void ModuleBitcodeWriter::writeDIBasicTy<br>
> > Record.push_back(N->getAlignInBits());<br>
> > Record.push_back(N->getEncoding());<br>
> ><br>
> > - stream().EmitRecord(bitc::METADATA_BASIC_TYPE, Record, Abbrev);<br>
> > + Stream.EmitRecord(bitc::METADATA_BASIC_TYPE, Record, Abbrev);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1269,7 +1266,7 @@ void ModuleBitcodeWriter::writeDIDerived<br>
> > Record.push_back(N->getFlags());<br>
> > Record.push_back(VE.getMetadataOrNullID(N->getExtraData()));<br>
> ><br>
> > - stream().EmitRecord(bitc::METADATA_DERIVED_TYPE, Record, Abbrev);<br>
> > + Stream.EmitRecord(bitc::METADATA_DERIVED_TYPE, Record, Abbrev);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1293,7 +1290,7 @@ void ModuleBitcodeWriter::writeDIComposi<br>
> > Record.push_back(VE.getMetadataOrNullID(N->getTemplateParams().get()));<br>
> > Record.push_back(VE.getMetadataOrNullID(N->getRawIdentifier()));<br>
> ><br>
> > - stream().EmitRecord(bitc::METADATA_COMPOSITE_TYPE, Record, Abbrev);<br>
> > + Stream.EmitRecord(bitc::METADATA_COMPOSITE_TYPE, Record, Abbrev);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1304,7 +1301,7 @@ void ModuleBitcodeWriter::writeDISubrout<br>
> > Record.push_back(N->getFlags());<br>
> > Record.push_back(VE.getMetadataOrNullID(N->getTypeArray().get()));<br>
> ><br>
> > - stream().EmitRecord(bitc::METADATA_SUBROUTINE_TYPE, Record, Abbrev);<br>
> > + Stream.EmitRecord(bitc::METADATA_SUBROUTINE_TYPE, Record, Abbrev);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1315,7 +1312,7 @@ void ModuleBitcodeWriter::writeDIFile(co<br>
> > Record.push_back(VE.getMetadataOrNullID(N->getRawFilename()));<br>
> > Record.push_back(VE.getMetadataOrNullID(N->getRawDirectory()));<br>
> ><br>
> > - stream().EmitRecord(bitc::METADATA_FILE, Record, Abbrev);<br>
> > + Stream.EmitRecord(bitc::METADATA_FILE, Record, Abbrev);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1340,7 +1337,7 @@ void ModuleBitcodeWriter::writeDICompile<br>
> > Record.push_back(N->getDWOId());<br>
> > Record.push_back(VE.getMetadataOrNullID(N->getMacros().get()));<br>
> ><br>
> > - stream().EmitRecord(bitc::METADATA_COMPILE_UNIT, Record, Abbrev);<br>
> > + Stream.EmitRecord(bitc::METADATA_COMPILE_UNIT, Record, Abbrev);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1367,7 +1364,7 @@ void ModuleBitcodeWriter::writeDISubprog<br>
> > Record.push_back(VE.getMetadataOrNullID(N->getDeclaration()));<br>
> > Record.push_back(VE.getMetadataOrNullID(N->getVariables().get()));<br>
> ><br>
> > - stream().EmitRecord(bitc::METADATA_SUBPROGRAM, Record, Abbrev);<br>
> > + Stream.EmitRecord(bitc::METADATA_SUBPROGRAM, Record, Abbrev);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1380,7 +1377,7 @@ void ModuleBitcodeWriter::writeDILexical<br>
> > Record.push_back(N->getLine());<br>
> > Record.push_back(N->getColumn());<br>
> ><br>
> > - stream().EmitRecord(bitc::METADATA_LEXICAL_BLOCK, Record, Abbrev);<br>
> > + Stream.EmitRecord(bitc::METADATA_LEXICAL_BLOCK, Record, Abbrev);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1392,7 +1389,7 @@ void ModuleBitcodeWriter::writeDILexical<br>
> > Record.push_back(VE.getMetadataOrNullID(N->getFile()));<br>
> > Record.push_back(N->getDiscriminator());<br>
> ><br>
> > - stream().EmitRecord(bitc::METADATA_LEXICAL_BLOCK_FILE, Record, Abbrev);<br>
> > + Stream.EmitRecord(bitc::METADATA_LEXICAL_BLOCK_FILE, Record, Abbrev);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1405,7 +1402,7 @@ void ModuleBitcodeWriter::writeDINamespa<br>
> > Record.push_back(VE.getMetadataOrNullID(N->getRawName()));<br>
> > Record.push_back(N->getLine());<br>
> ><br>
> > - stream().EmitRecord(bitc::METADATA_NAMESPACE, Record, Abbrev);<br>
> > + Stream.EmitRecord(bitc::METADATA_NAMESPACE, Record, Abbrev);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1418,7 +1415,7 @@ void ModuleBitcodeWriter::writeDIMacro(c<br>
> > Record.push_back(VE.getMetadataOrNullID(N->getRawName()));<br>
> > Record.push_back(VE.getMetadataOrNullID(N->getRawValue()));<br>
> ><br>
> > - stream().EmitRecord(bitc::METADATA_MACRO, Record, Abbrev);<br>
> > + Stream.EmitRecord(bitc::METADATA_MACRO, Record, Abbrev);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1431,7 +1428,7 @@ void ModuleBitcodeWriter::writeDIMacroFi<br>
> > Record.push_back(VE.getMetadataOrNullID(N->getFile()));<br>
> > Record.push_back(VE.getMetadataOrNullID(N->getElements().get()));<br>
> ><br>
> > - stream().EmitRecord(bitc::METADATA_MACRO_FILE, Record, Abbrev);<br>
> > + Stream.EmitRecord(bitc::METADATA_MACRO_FILE, Record, Abbrev);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1442,7 +1439,7 @@ void ModuleBitcodeWriter::writeDIModule(<br>
> > for (auto &I : N->operands())<br>
> > Record.push_back(VE.getMetadataOrNullID(I));<br>
> ><br>
> > - stream().EmitRecord(bitc::METADATA_MODULE, Record, Abbrev);<br>
> > + Stream.EmitRecord(bitc::METADATA_MODULE, Record, Abbrev);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1453,7 +1450,7 @@ void ModuleBitcodeWriter::writeDITemplat<br>
> > Record.push_back(VE.getMetadataOrNullID(N->getRawName()));<br>
> > Record.push_back(VE.getMetadataOrNullID(N->getType()));<br>
> ><br>
> > - stream().EmitRecord(bitc::METADATA_TEMPLATE_TYPE, Record, Abbrev);<br>
> > + Stream.EmitRecord(bitc::METADATA_TEMPLATE_TYPE, Record, Abbrev);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1466,7 +1463,7 @@ void ModuleBitcodeWriter::writeDITemplat<br>
> > Record.push_back(VE.getMetadataOrNullID(N->getType()));<br>
> > Record.push_back(VE.getMetadataOrNullID(N->getValue()));<br>
> ><br>
> > - stream().EmitRecord(bitc::METADATA_TEMPLATE_VALUE, Record, Abbrev);<br>
> > + Stream.EmitRecord(bitc::METADATA_TEMPLATE_VALUE, Record, Abbrev);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1485,7 +1482,7 @@ void ModuleBitcodeWriter::writeDIGlobalV<br>
> > Record.push_back(VE.getMetadataOrNullID(N->getRawVariable()));<br>
> > Record.push_back(VE.getMetadataOrNullID(N->getStaticDataMemberDeclaration()));<br>
> ><br>
> > - stream().EmitRecord(bitc::METADATA_GLOBAL_VAR, Record, Abbrev);<br>
> > + Stream.EmitRecord(bitc::METADATA_GLOBAL_VAR, Record, Abbrev);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1501,7 +1498,7 @@ void ModuleBitcodeWriter::writeDILocalVa<br>
> > Record.push_back(N->getArg());<br>
> > Record.push_back(N->getFlags());<br>
> ><br>
> > - stream().EmitRecord(bitc::METADATA_LOCAL_VAR, Record, Abbrev);<br>
> > + Stream.EmitRecord(bitc::METADATA_LOCAL_VAR, Record, Abbrev);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1513,7 +1510,7 @@ void ModuleBitcodeWriter::writeDIExpress<br>
> > Record.push_back(N->isDistinct());<br>
> > Record.append(N->elements_begin(), N->elements_end());<br>
> ><br>
> > - stream().EmitRecord(bitc::METADATA_EXPRESSION, Record, Abbrev);<br>
> > + Stream.EmitRecord(bitc::METADATA_EXPRESSION, Record, Abbrev);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1529,7 +1526,7 @@ void ModuleBitcodeWriter::writeDIObjCPro<br>
> > Record.push_back(N->getAttributes());<br>
> > Record.push_back(VE.getMetadataOrNullID(N->getType()));<br>
> ><br>
> > - stream().EmitRecord(bitc::METADATA_OBJC_PROPERTY, Record, Abbrev);<br>
> > + Stream.EmitRecord(bitc::METADATA_OBJC_PROPERTY, Record, Abbrev);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1543,7 +1540,7 @@ void ModuleBitcodeWriter::writeDIImporte<br>
> > Record.push_back(N->getLine());<br>
> > Record.push_back(VE.getMetadataOrNullID(N->getRawName()));<br>
> ><br>
> > - stream().EmitRecord(bitc::METADATA_IMPORTED_ENTITY, Record, Abbrev);<br>
> > + Stream.EmitRecord(bitc::METADATA_IMPORTED_ENTITY, Record, Abbrev);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1552,26 +1549,26 @@ unsigned ModuleBitcodeWriter::createName<br>
> > Abbv->Add(BitCodeAbbrevOp(bitc::METADATA_NAME));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8));<br>
> > - return stream().EmitAbbrev(Abbv);<br>
> > + return Stream.EmitAbbrev(Abbv);<br>
> > }<br>
> ><br>
> > void ModuleBitcodeWriter::writeNamedMetadata(<br>
> > SmallVectorImpl<uint64_t> &Record) {<br>
> > - if (M->named_metadata_empty())<br>
> > + if (M.named_metadata_empty())<br>
> > return;<br>
> ><br>
> > unsigned Abbrev = createNamedMetadataAbbrev();<br>
> > - for (const NamedMDNode &NMD : M->named_metadata()) {<br>
> > + for (const NamedMDNode &NMD : M.named_metadata()) {<br>
> > // Write name.<br>
> > StringRef Str = NMD.getName();<br>
> > Record.append(Str.bytes_begin(), Str.bytes_end());<br>
> > - stream().EmitRecord(bitc::METADATA_NAME, Record, Abbrev);<br>
> > + Stream.EmitRecord(bitc::METADATA_NAME, Record, Abbrev);<br>
> > Record.clear();<br>
> ><br>
> > // Write named metadata operands.<br>
> > for (const MDNode *N : NMD.operands())<br>
> > Record.push_back(VE.getMetadataID(N));<br>
> > - stream().EmitRecord(bitc::METADATA_NAMED_NODE, Record, 0);<br>
> > + Stream.EmitRecord(bitc::METADATA_NAMED_NODE, Record, 0);<br>
> > Record.clear();<br>
> > }<br>
> > }<br>
> > @@ -1582,7 +1579,7 @@ unsigned ModuleBitcodeWriter::createMeta<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // # of strings<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // offset to chars<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));<br>
> > - return stream().EmitAbbrev(Abbv);<br>
> > + return Stream.EmitAbbrev(Abbv);<br>
> > }<br>
> ><br>
> > /// Write out a record for MDString.<br>
> > @@ -1615,7 +1612,7 @@ void ModuleBitcodeWriter::writeMetadataS<br>
> > Blob.append(cast<MDString>(MD)->getString());<br>
> ><br>
> > // Emit the final record.<br>
> > - stream().EmitRecordWithBlob(createMetadataStringsAbbrev(), Record, Blob);<br>
> > + Stream.EmitRecordWithBlob(createMetadataStringsAbbrev(), Record, Blob);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1647,30 +1644,30 @@ void ModuleBitcodeWriter::writeMetadataR<br>
> > }<br>
> ><br>
> > void ModuleBitcodeWriter::writeModuleMetadata() {<br>
> > - if (!VE.hasMDs() && M->named_metadata_empty())<br>
> > + if (!VE.hasMDs() && M.named_metadata_empty())<br>
> > return;<br>
> ><br>
> > - stream().EnterSubblock(bitc::METADATA_BLOCK_ID, 3);<br>
> > + Stream.EnterSubblock(bitc::METADATA_BLOCK_ID, 3);<br>
> > SmallVector<uint64_t, 64> Record;<br>
> > writeMetadataStrings(VE.getMDStrings(), Record);<br>
> > writeMetadataRecords(VE.getNonMDStrings(), Record);<br>
> > writeNamedMetadata(Record);<br>
> > - stream().ExitBlock();<br>
> > + Stream.ExitBlock();<br>
> > }<br>
> ><br>
> > void ModuleBitcodeWriter::writeFunctionMetadata(const Function &F) {<br>
> > if (!VE.hasMDs())<br>
> > return;<br>
> ><br>
> > - stream().EnterSubblock(bitc::METADATA_BLOCK_ID, 3);<br>
> > + Stream.EnterSubblock(bitc::METADATA_BLOCK_ID, 3);<br>
> > SmallVector<uint64_t, 64> Record;<br>
> > writeMetadataStrings(VE.getMDStrings(), Record);<br>
> > writeMetadataRecords(VE.getNonMDStrings(), Record);<br>
> > - stream().ExitBlock();<br>
> > + Stream.ExitBlock();<br>
> > }<br>
> ><br>
> > void ModuleBitcodeWriter::writeMetadataAttachment(const Function &F) {<br>
> > - stream().EnterSubblock(bitc::METADATA_ATTACHMENT_ID, 3);<br>
> > + Stream.EnterSubblock(bitc::METADATA_ATTACHMENT_ID, 3);<br>
> ><br>
> > SmallVector<uint64_t, 64> Record;<br>
> ><br>
> > @@ -1683,7 +1680,7 @@ void ModuleBitcodeWriter::writeMetadataA<br>
> > Record.push_back(I.first);<br>
> > Record.push_back(VE.getMetadataID(I.second));<br>
> > }<br>
> > - stream().EmitRecord(bitc::METADATA_ATTACHMENT, Record, 0);<br>
> > + Stream.EmitRecord(bitc::METADATA_ATTACHMENT, Record, 0);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1701,11 +1698,11 @@ void ModuleBitcodeWriter::writeMetadataA<br>
> > Record.push_back(MDs[i].first);<br>
> > Record.push_back(VE.getMetadataID(MDs[i].second));<br>
> > }<br>
> > - stream().EmitRecord(bitc::METADATA_ATTACHMENT, Record, 0);<br>
> > + Stream.EmitRecord(bitc::METADATA_ATTACHMENT, Record, 0);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > - stream().ExitBlock();<br>
> > + Stream.ExitBlock();<br>
> > }<br>
> ><br>
> > void ModuleBitcodeWriter::writeModuleMetadataStore() {<br>
> > @@ -1714,22 +1711,22 @@ void ModuleBitcodeWriter::writeModuleMet<br>
> > // Write metadata kinds<br>
> > // METADATA_KIND - [n x [id, name]]<br>
> > SmallVector<StringRef, 8> Names;<br>
> > - M->getMDKindNames(Names);<br>
> > + M.getMDKindNames(Names);<br>
> ><br>
> > if (Names.empty()) return;<br>
> ><br>
> > - stream().EnterSubblock(bitc::METADATA_KIND_BLOCK_ID, 3);<br>
> > + Stream.EnterSubblock(bitc::METADATA_KIND_BLOCK_ID, 3);<br>
> ><br>
> > for (unsigned MDKindID = 0, e = Names.size(); MDKindID != e; ++MDKindID) {<br>
> > Record.push_back(MDKindID);<br>
> > StringRef KName = Names[MDKindID];<br>
> > Record.append(KName.begin(), KName.end());<br>
> ><br>
> > - stream().EmitRecord(bitc::METADATA_KIND, Record, 0);<br>
> > + Stream.EmitRecord(bitc::METADATA_KIND, Record, 0);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > - stream().ExitBlock();<br>
> > + Stream.ExitBlock();<br>
> > }<br>
> ><br>
> > void ModuleBitcodeWriter::writeOperandBundleTags() {<br>
> > @@ -1740,23 +1737,23 @@ void ModuleBitcodeWriter::writeOperandBu<br>
> > // OPERAND_BUNDLE_TAG - [strchr x N]<br>
> ><br>
> > SmallVector<StringRef, 8> Tags;<br>
> > - M->getOperandBundleTags(Tags);<br>
> > + M.getOperandBundleTags(Tags);<br>
> ><br>
> > if (Tags.empty())<br>
> > return;<br>
> ><br>
> > - stream().EnterSubblock(bitc::OPERAND_BUNDLE_TAGS_BLOCK_ID, 3);<br>
> > + Stream.EnterSubblock(bitc::OPERAND_BUNDLE_TAGS_BLOCK_ID, 3);<br>
> ><br>
> > SmallVector<uint64_t, 64> Record;<br>
> ><br>
> > for (auto Tag : Tags) {<br>
> > Record.append(Tag.begin(), Tag.end());<br>
> ><br>
> > - stream().EmitRecord(bitc::OPERAND_BUNDLE_TAG, Record, 0);<br>
> > + Stream.EmitRecord(bitc::OPERAND_BUNDLE_TAG, Record, 0);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > - stream().ExitBlock();<br>
> > + Stream.ExitBlock();<br>
> > }<br>
> ><br>
> > static void emitSignedInt64(SmallVectorImpl<uint64_t> &Vals, uint64_t V) {<br>
> > @@ -1770,7 +1767,7 @@ void ModuleBitcodeWriter::writeConstants<br>
> > bool isGlobal) {<br>
> > if (FirstVal == LastVal) return;<br>
> ><br>
> > - stream().EnterSubblock(bitc::CONSTANTS_BLOCK_ID, 4);<br>
> > + Stream.EnterSubblock(bitc::CONSTANTS_BLOCK_ID, 4);<br>
> ><br>
> > unsigned AggregateAbbrev = 0;<br>
> > unsigned String8Abbrev = 0;<br>
> > @@ -1783,26 +1780,26 @@ void ModuleBitcodeWriter::writeConstants<br>
> > Abbv->Add(BitCodeAbbrevOp(bitc::CST_CODE_AGGREGATE));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, Log2_32_Ceil(LastVal+1)));<br>
> > - AggregateAbbrev = stream().EmitAbbrev(Abbv);<br>
> > + AggregateAbbrev = Stream.EmitAbbrev(Abbv);<br>
> ><br>
> > // Abbrev for CST_CODE_STRING.<br>
> > Abbv = new BitCodeAbbrev();<br>
> > Abbv->Add(BitCodeAbbrevOp(bitc::CST_CODE_STRING));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8));<br>
> > - String8Abbrev = stream().EmitAbbrev(Abbv);<br>
> > + String8Abbrev = Stream.EmitAbbrev(Abbv);<br>
> > // Abbrev for CST_CODE_CSTRING.<br>
> > Abbv = new BitCodeAbbrev();<br>
> > Abbv->Add(BitCodeAbbrevOp(bitc::CST_CODE_CSTRING));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7));<br>
> > - CString7Abbrev = stream().EmitAbbrev(Abbv);<br>
> > + CString7Abbrev = Stream.EmitAbbrev(Abbv);<br>
> > // Abbrev for CST_CODE_CSTRING.<br>
> > Abbv = new BitCodeAbbrev();<br>
> > Abbv->Add(BitCodeAbbrevOp(bitc::CST_CODE_CSTRING));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Char6));<br>
> > - CString6Abbrev = stream().EmitAbbrev(Abbv);<br>
> > + CString6Abbrev = Stream.EmitAbbrev(Abbv);<br>
> > }<br>
> ><br>
> > SmallVector<uint64_t, 64> Record;<br>
> > @@ -1815,8 +1812,8 @@ void ModuleBitcodeWriter::writeConstants<br>
> > if (V->getType() != LastTy) {<br>
> > LastTy = V->getType();<br>
> > Record.push_back(VE.getTypeID(LastTy));<br>
> > - stream().EmitRecord(bitc::CST_CODE_SETTYPE, Record,<br>
> > - CONSTANTS_SETTYPE_ABBREV);<br>
> > + Stream.EmitRecord(bitc::CST_CODE_SETTYPE, Record,<br>
> > + CONSTANTS_SETTYPE_ABBREV);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > @@ -1834,7 +1831,7 @@ void ModuleBitcodeWriter::writeConstants<br>
> > const std::string &ConstraintStr = IA->getConstraintString();<br>
> > Record.push_back(ConstraintStr.size());<br>
> > Record.append(ConstraintStr.begin(), ConstraintStr.end());<br>
> > - stream().EmitRecord(bitc::CST_CODE_INLINEASM, Record);<br>
> > + Stream.EmitRecord(bitc::CST_CODE_INLINEASM, Record);<br>
> > Record.clear();<br>
> > continue;<br>
> > }<br>
> > @@ -2014,11 +2011,11 @@ void ModuleBitcodeWriter::writeConstants<br>
> > #endif<br>
> > llvm_unreachable("Unknown constant!");<br>
> > }<br>
> > - stream().EmitRecord(Code, Record, AbbrevToUse);<br>
> > + Stream.EmitRecord(Code, Record, AbbrevToUse);<br>
> > Record.clear();<br>
> > }<br>
> ><br>
> > - stream().ExitBlock();<br>
> > + Stream.ExitBlock();<br>
> > }<br>
> ><br>
> > void ModuleBitcodeWriter::writeModuleConstants() {<br>
> > @@ -2066,7 +2063,7 @@ void ModuleBitcodeWriter::writeOperandBu<br>
> > for (auto &Input : Bundle.Inputs)<br>
> > pushValueAndType(Input, InstID, Record);<br>
> ><br>
> > - stream().EmitRecord(bitc::FUNC_CODE_OPERAND_BUNDLE, Record);<br>
> > + Stream.EmitRecord(bitc::FUNC_CODE_OPERAND_BUNDLE, Record);<br>
> > Record.clear();<br>
> > }<br>
> > }<br>
> > @@ -2320,7 +2317,7 @@ void ModuleBitcodeWriter::writeInstructi<br>
> > Vals64.push_back(VE.getValueID(PN.getIncomingBlock(i)));<br>
> > }<br>
> > // Emit a Vals64 vector and exit.<br>
> > - stream().EmitRecord(Code, Vals64, AbbrevToUse);<br>
> > + Stream.EmitRecord(Code, Vals64, AbbrevToUse);<br>
> > Vals64.clear();<br>
> > return;<br>
> > }<br>
> > @@ -2468,7 +2465,7 @@ void ModuleBitcodeWriter::writeInstructi<br>
> > break;<br>
> > }<br>
> ><br>
> > - stream().EmitRecord(Code, Vals, AbbrevToUse);<br>
> > + Stream.EmitRecord(Code, Vals, AbbrevToUse);<br>
> > Vals.clear();<br>
> > }<br>
> ><br>
> > @@ -2489,15 +2486,15 @@ void ModuleBitcodeWriter::writeValueSymb<br>
> > if (IsModuleLevel && hasVSTOffsetPlaceholder()) {<br>
> > // Get the offset of the VST we are writing, and backpatch it into<br>
> > // the VST forward declaration record.<br>
> > - uint64_t VSTOffset = stream().GetCurrentBitNo();<br>
> > + uint64_t VSTOffset = Stream.GetCurrentBitNo();<br>
> > // The BitcodeStartBit was the stream offset of the actual bitcode<br>
> > // (e.g. excluding any initial darwin header).<br>
> > VSTOffset -= bitcodeStartBit();<br>
> > assert((VSTOffset & 31) == 0 && "VST block not 32-bit aligned");<br>
> > - stream().BackpatchWord(getVSTOffsetPlaceholder(), VSTOffset / 32);<br>
> > + Stream.BackpatchWord(VSTOffsetPlaceholder, VSTOffset / 32);<br>
> > }<br>
> ><br>
> > - stream().EnterSubblock(bitc::VALUE_SYMTAB_BLOCK_ID, 4);<br>
> > + Stream.EnterSubblock(bitc::VALUE_SYMTAB_BLOCK_ID, 4);<br>
> ><br>
> > // For the module-level VST, add abbrev Ids for the VST_CODE_FNENTRY<br>
> > // records, which are not used in the per-function VSTs.<br>
> > @@ -2512,7 +2509,7 @@ void ModuleBitcodeWriter::writeValueSymb<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // funcoffset<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8));<br>
> > - FnEntry8BitAbbrev = stream().EmitAbbrev(Abbv);<br>
> > + FnEntry8BitAbbrev = Stream.EmitAbbrev(Abbv);<br>
> ><br>
> > // 7-bit fixed width VST_CODE_FNENTRY function strings.<br>
> > Abbv = new BitCodeAbbrev();<br>
> > @@ -2521,7 +2518,7 @@ void ModuleBitcodeWriter::writeValueSymb<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // funcoffset<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7));<br>
> > - FnEntry7BitAbbrev = stream().EmitAbbrev(Abbv);<br>
> > + FnEntry7BitAbbrev = Stream.EmitAbbrev(Abbv);<br>
> ><br>
> > // 6-bit char6 VST_CODE_FNENTRY function strings.<br>
> > Abbv = new BitCodeAbbrev();<br>
> > @@ -2530,7 +2527,7 @@ void ModuleBitcodeWriter::writeValueSymb<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // funcoffset<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Char6));<br>
> > - FnEntry6BitAbbrev = stream().EmitAbbrev(Abbv);<br>
> > + FnEntry6BitAbbrev = Stream.EmitAbbrev(Abbv);<br>
> > }<br>
> ><br>
> > // FIXME: Set up the abbrev, we know how many values there are!<br>
> > @@ -2593,10 +2590,10 @@ void ModuleBitcodeWriter::writeValueSymb<br>
> > NameVals.push_back((unsigned char)P);<br>
> ><br>
> > // Emit the finished record.<br>
> > - stream().EmitRecord(Code, NameVals, AbbrevToUse);<br>
> > + Stream.EmitRecord(Code, NameVals, AbbrevToUse);<br>
> > NameVals.clear();<br>
> > }<br>
> > - stream().ExitBlock();<br>
> > + Stream.ExitBlock();<br>
> > }<br>
> ><br>
> > /// Emit function names and summary offsets for the combined index<br>
> > @@ -2605,28 +2602,28 @@ void IndexBitcodeWriter::writeCombinedVa<br>
> > assert(hasVSTOffsetPlaceholder() && "Expected non-zero VSTOffsetPlaceholder");<br>
> > // Get the offset of the VST we are writing, and backpatch it into<br>
> > // the VST forward declaration record.<br>
> > - uint64_t VSTOffset = stream().GetCurrentBitNo();<br>
> > + uint64_t VSTOffset = Stream.GetCurrentBitNo();<br>
> > assert((VSTOffset & 31) == 0 && "VST block not 32-bit aligned");<br>
> > - stream().BackpatchWord(getVSTOffsetPlaceholder(), VSTOffset / 32);<br>
> > + Stream.BackpatchWord(VSTOffsetPlaceholder, VSTOffset / 32);<br>
> ><br>
> > - stream().EnterSubblock(bitc::VALUE_SYMTAB_BLOCK_ID, 4);<br>
> > + Stream.EnterSubblock(bitc::VALUE_SYMTAB_BLOCK_ID, 4);<br>
> ><br>
> > BitCodeAbbrev *Abbv = new BitCodeAbbrev();<br>
> > Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_COMBINED_GVDEFENTRY));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // valueid<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // sumoffset<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // guid<br>
> > - unsigned DefEntryAbbrev = stream().EmitAbbrev(Abbv);<br>
> > + unsigned DefEntryAbbrev = Stream.EmitAbbrev(Abbv);<br>
> ><br>
> > Abbv = new BitCodeAbbrev();<br>
> > Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_COMBINED_ENTRY));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // valueid<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // refguid<br>
> > - unsigned EntryAbbrev = stream().EmitAbbrev(Abbv);<br>
> > + unsigned EntryAbbrev = Stream.EmitAbbrev(Abbv);<br>
> ><br>
> > SmallVector<uint64_t, 64> NameVals;<br>
> ><br>
> > - for (const auto &FII : *Index) {<br>
> > + for (const auto &FII : Index) {<br>
> > GlobalValue::GUID FuncGUID = FII.first;<br>
> > unsigned ValueId = popValueId(FuncGUID);<br>
> ><br>
> > @@ -2637,8 +2634,8 @@ void IndexBitcodeWriter::writeCombinedVa<br>
> > NameVals.push_back(FuncGUID);<br>
> ><br>
> > // Emit the finished record.<br>
> > - stream().EmitRecord(bitc::VST_CODE_COMBINED_GVDEFENTRY, NameVals,<br>
> > - DefEntryAbbrev);<br>
> > + Stream.EmitRecord(bitc::VST_CODE_COMBINED_GVDEFENTRY, NameVals,<br>
> > + DefEntryAbbrev);<br>
> > NameVals.clear();<br>
> > }<br>
> > }<br>
> > @@ -2648,10 +2645,10 @@ void IndexBitcodeWriter::writeCombinedVa<br>
> > NameVals.push_back(GVI.first);<br>
> ><br>
> > // Emit the finished record.<br>
> > - stream().EmitRecord(bitc::VST_CODE_COMBINED_ENTRY, NameVals, EntryAbbrev);<br>
> > + Stream.EmitRecord(bitc::VST_CODE_COMBINED_ENTRY, NameVals, EntryAbbrev);<br>
> > NameVals.clear();<br>
> > }<br>
> > - stream().ExitBlock();<br>
> > + Stream.ExitBlock();<br>
> > }<br>
> ><br>
> > void ModuleBitcodeWriter::writeUseList(UseListOrder &&Order) {<br>
> > @@ -2664,7 +2661,7 @@ void ModuleBitcodeWriter::writeUseList(U<br>
> ><br>
> > SmallVector<uint64_t, 64> Record(Order.Shuffle.begin(), Order.Shuffle.end());<br>
> > Record.push_back(VE.getValueID(Order.V));<br>
> > - stream().EmitRecord(Code, Record);<br>
> > + Stream.EmitRecord(Code, Record);<br>
> > }<br>
> ><br>
> > void ModuleBitcodeWriter::writeUseListBlock(const Function *F) {<br>
> > @@ -2678,12 +2675,12 @@ void ModuleBitcodeWriter::writeUseListBl<br>
> > // Nothing to do.<br>
> > return;<br>
> ><br>
> > - stream().EnterSubblock(bitc::USELIST_BLOCK_ID, 3);<br>
> > + Stream.EnterSubblock(bitc::USELIST_BLOCK_ID, 3);<br>
> > while (hasMore()) {<br>
> > writeUseList(std::move(VE.UseListOrders.back()));<br>
> > VE.UseListOrders.pop_back();<br>
> > }<br>
> > - stream().ExitBlock();<br>
> > + Stream.ExitBlock();<br>
> > }<br>
> ><br>
> > /// Emit a function body to the module stream.<br>
> > @@ -2692,9 +2689,9 @@ void ModuleBitcodeWriter::writeFunction(<br>
> > DenseMap<const Function *, uint64_t> &FunctionToBitcodeIndex) {<br>
> > // Save the bitcode index of the start of this function block for recording<br>
> > // in the VST.<br>
> > - FunctionToBitcodeIndex[&F] = stream().GetCurrentBitNo();<br>
> > + FunctionToBitcodeIndex[&F] = Stream.GetCurrentBitNo();<br>
> ><br>
> > - stream().EnterSubblock(bitc::FUNCTION_BLOCK_ID, 4);<br>
> > + Stream.EnterSubblock(bitc::FUNCTION_BLOCK_ID, 4);<br>
> > VE.incorporateFunction(F);<br>
> ><br>
> > SmallVector<unsigned, 64> Vals;<br>
> > @@ -2702,7 +2699,7 @@ void ModuleBitcodeWriter::writeFunction(<br>
> > // Emit the number of basic blocks, so the reader can create them ahead of<br>
> > // time.<br>
> > Vals.push_back(VE.getBasicBlocks().size());<br>
> > - stream().EmitRecord(bitc::FUNC_CODE_DECLAREBLOCKS, Vals);<br>
> > + Stream.EmitRecord(bitc::FUNC_CODE_DECLAREBLOCKS, Vals);<br>
> > Vals.clear();<br>
> ><br>
> > // If there are function-local constants, emit them now.<br>
> > @@ -2738,7 +2735,7 @@ void ModuleBitcodeWriter::writeFunction(<br>
> ><br>
> > if (DL == LastDL) {<br>
> > // Just repeat the same debug loc as last time.<br>
> > - stream().EmitRecord(bitc::FUNC_CODE_DEBUG_LOC_AGAIN, Vals);<br>
> > + Stream.EmitRecord(bitc::FUNC_CODE_DEBUG_LOC_AGAIN, Vals);<br>
> > continue;<br>
> > }<br>
> ><br>
> > @@ -2746,7 +2743,7 @@ void ModuleBitcodeWriter::writeFunction(<br>
> > Vals.push_back(DL->getColumn());<br>
> > Vals.push_back(VE.getMetadataOrNullID(DL->getScope()));<br>
> > Vals.push_back(VE.getMetadataOrNullID(DL->getInlinedAt()));<br>
> > - stream().EmitRecord(bitc::FUNC_CODE_DEBUG_LOC, Vals);<br>
> > + Stream.EmitRecord(bitc::FUNC_CODE_DEBUG_LOC, Vals);<br>
> > Vals.clear();<br>
> ><br>
> > LastDL = DL;<br>
> > @@ -2760,7 +2757,7 @@ void ModuleBitcodeWriter::writeFunction(<br>
> > if (VE.shouldPreserveUseListOrder())<br>
> > writeUseListBlock(&F);<br>
> > VE.purgeFunction();<br>
> > - stream().ExitBlock();<br>
> > + Stream.ExitBlock();<br>
> > }<br>
> ><br>
> > // Emit blockinfo, which defines the standard abbreviations etc.<br>
> > @@ -2768,7 +2765,7 @@ void ModuleBitcodeWriter::writeBlockInfo<br>
> > // We only want to emit block info records for blocks that have multiple<br>
> > // instances: CONSTANTS_BLOCK, FUNCTION_BLOCK and VALUE_SYMTAB_BLOCK.<br>
> > // Other blocks can define their abbrevs inline.<br>
> > - stream().EnterBlockInfoBlock(2);<br>
> > + Stream.EnterBlockInfoBlock(2);<br>
> ><br>
> > { // 8-bit fixed-width VST_CODE_ENTRY/VST_CODE_BBENTRY strings.<br>
> > BitCodeAbbrev *Abbv = new BitCodeAbbrev();<br>
> > @@ -2776,7 +2773,7 @@ void ModuleBitcodeWriter::writeBlockInfo<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8));<br>
> > - if (stream().EmitBlockInfoAbbrev(bitc::VALUE_SYMTAB_BLOCK_ID, Abbv) !=<br>
> > + if (Stream.EmitBlockInfoAbbrev(bitc::VALUE_SYMTAB_BLOCK_ID, Abbv) !=<br>
> > VST_ENTRY_8_ABBREV)<br>
> > llvm_unreachable("Unexpected abbrev ordering!");<br>
> > }<br>
> > @@ -2787,7 +2784,7 @@ void ModuleBitcodeWriter::writeBlockInfo<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7));<br>
> > - if (stream().EmitBlockInfoAbbrev(bitc::VALUE_SYMTAB_BLOCK_ID, Abbv) !=<br>
> > + if (Stream.EmitBlockInfoAbbrev(bitc::VALUE_SYMTAB_BLOCK_ID, Abbv) !=<br>
> > VST_ENTRY_7_ABBREV)<br>
> > llvm_unreachable("Unexpected abbrev ordering!");<br>
> > }<br>
> > @@ -2797,7 +2794,7 @@ void ModuleBitcodeWriter::writeBlockInfo<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Char6));<br>
> > - if (stream().EmitBlockInfoAbbrev(bitc::VALUE_SYMTAB_BLOCK_ID, Abbv) !=<br>
> > + if (Stream.EmitBlockInfoAbbrev(bitc::VALUE_SYMTAB_BLOCK_ID, Abbv) !=<br>
> > VST_ENTRY_6_ABBREV)<br>
> > llvm_unreachable("Unexpected abbrev ordering!");<br>
> > }<br>
> > @@ -2807,7 +2804,7 @@ void ModuleBitcodeWriter::writeBlockInfo<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Char6));<br>
> > - if (stream().EmitBlockInfoAbbrev(bitc::VALUE_SYMTAB_BLOCK_ID, Abbv) !=<br>
> > + if (Stream.EmitBlockInfoAbbrev(bitc::VALUE_SYMTAB_BLOCK_ID, Abbv) !=<br>
> > VST_BBENTRY_6_ABBREV)<br>
> > llvm_unreachable("Unexpected abbrev ordering!");<br>
> > }<br>
> > @@ -2819,7 +2816,7 @@ void ModuleBitcodeWriter::writeBlockInfo<br>
> > Abbv->Add(BitCodeAbbrevOp(bitc::CST_CODE_SETTYPE));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,<br>
> > VE.computeBitsRequiredForTypeIndicies()));<br>
> > - if (stream().EmitBlockInfoAbbrev(bitc::CONSTANTS_BLOCK_ID, Abbv) !=<br>
> > + if (Stream.EmitBlockInfoAbbrev(bitc::CONSTANTS_BLOCK_ID, Abbv) !=<br>
> > CONSTANTS_SETTYPE_ABBREV)<br>
> > llvm_unreachable("Unexpected abbrev ordering!");<br>
> > }<br>
> > @@ -2828,7 +2825,7 @@ void ModuleBitcodeWriter::writeBlockInfo<br>
> > BitCodeAbbrev *Abbv = new BitCodeAbbrev();<br>
> > Abbv->Add(BitCodeAbbrevOp(bitc::CST_CODE_INTEGER));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));<br>
> > - if (stream().EmitBlockInfoAbbrev(bitc::CONSTANTS_BLOCK_ID, Abbv) !=<br>
> > + if (Stream.EmitBlockInfoAbbrev(bitc::CONSTANTS_BLOCK_ID, Abbv) !=<br>
> > CONSTANTS_INTEGER_ABBREV)<br>
> > llvm_unreachable("Unexpected abbrev ordering!");<br>
> > }<br>
> > @@ -2841,14 +2838,14 @@ void ModuleBitcodeWriter::writeBlockInfo<br>
> > VE.computeBitsRequiredForTypeIndicies()));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // value id<br>
> ><br>
> > - if (stream().EmitBlockInfoAbbrev(bitc::CONSTANTS_BLOCK_ID, Abbv) !=<br>
> > + if (Stream.EmitBlockInfoAbbrev(bitc::CONSTANTS_BLOCK_ID, Abbv) !=<br>
> > CONSTANTS_CE_CAST_Abbrev)<br>
> > llvm_unreachable("Unexpected abbrev ordering!");<br>
> > }<br>
> > { // NULL abbrev for CONSTANTS_BLOCK.<br>
> > BitCodeAbbrev *Abbv = new BitCodeAbbrev();<br>
> > Abbv->Add(BitCodeAbbrevOp(bitc::CST_CODE_NULL));<br>
> > - if (stream().EmitBlockInfoAbbrev(bitc::CONSTANTS_BLOCK_ID, Abbv) !=<br>
> > + if (Stream.EmitBlockInfoAbbrev(bitc::CONSTANTS_BLOCK_ID, Abbv) !=<br>
> > CONSTANTS_NULL_Abbrev)<br>
> > llvm_unreachable("Unexpected abbrev ordering!");<br>
> > }<br>
> > @@ -2863,7 +2860,7 @@ void ModuleBitcodeWriter::writeBlockInfo<br>
> > VE.computeBitsRequiredForTypeIndicies()));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 4)); // Align<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // volatile<br>
> > - if (stream().EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID, Abbv) !=<br>
> > + if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID, Abbv) !=<br>
> > FUNCTION_INST_LOAD_ABBREV)<br>
> > llvm_unreachable("Unexpected abbrev ordering!");<br>
> > }<br>
> > @@ -2873,7 +2870,7 @@ void ModuleBitcodeWriter::writeBlockInfo<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LHS<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // RHS<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 4)); // opc<br>
> > - if (stream().EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID, Abbv) !=<br>
> > + if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID, Abbv) !=<br>
> > FUNCTION_INST_BINOP_ABBREV)<br>
> > llvm_unreachable("Unexpected abbrev ordering!");<br>
> > }<br>
> > @@ -2884,7 +2881,7 @@ void ModuleBitcodeWriter::writeBlockInfo<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // RHS<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 4)); // opc<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7)); // flags<br>
> > - if (stream().EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID, Abbv) !=<br>
> > + if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID, Abbv) !=<br>
> > FUNCTION_INST_BINOP_FLAGS_ABBREV)<br>
> > llvm_unreachable("Unexpected abbrev ordering!");<br>
> > }<br>
> > @@ -2895,7 +2892,7 @@ void ModuleBitcodeWriter::writeBlockInfo<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, // dest ty<br>
> > VE.computeBitsRequiredForTypeIndicies()));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 4)); // opc<br>
> > - if (stream().EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID, Abbv) !=<br>
> > + if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID, Abbv) !=<br>
> > FUNCTION_INST_CAST_ABBREV)<br>
> > llvm_unreachable("Unexpected abbrev ordering!");<br>
> > }<br>
> > @@ -2903,7 +2900,7 @@ void ModuleBitcodeWriter::writeBlockInfo<br>
> > { // INST_RET abbrev for FUNCTION_BLOCK.<br>
> > BitCodeAbbrev *Abbv = new BitCodeAbbrev();<br>
> > Abbv->Add(BitCodeAbbrevOp(bitc::FUNC_CODE_INST_RET));<br>
> > - if (stream().EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID, Abbv) !=<br>
> > + if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID, Abbv) !=<br>
> > FUNCTION_INST_RET_VOID_ABBREV)<br>
> > llvm_unreachable("Unexpected abbrev ordering!");<br>
> > }<br>
> > @@ -2911,14 +2908,14 @@ void ModuleBitcodeWriter::writeBlockInfo<br>
> > BitCodeAbbrev *Abbv = new BitCodeAbbrev();<br>
> > Abbv->Add(BitCodeAbbrevOp(bitc::FUNC_CODE_INST_RET));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // ValID<br>
> > - if (stream().EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID, Abbv) !=<br>
> > + if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID, Abbv) !=<br>
> > FUNCTION_INST_RET_VAL_ABBREV)<br>
> > llvm_unreachable("Unexpected abbrev ordering!");<br>
> > }<br>
> > { // INST_UNREACHABLE abbrev for FUNCTION_BLOCK.<br>
> > BitCodeAbbrev *Abbv = new BitCodeAbbrev();<br>
> > Abbv->Add(BitCodeAbbrevOp(bitc::FUNC_CODE_INST_UNREACHABLE));<br>
> > - if (stream().EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID, Abbv) !=<br>
> > + if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID, Abbv) !=<br>
> > FUNCTION_INST_UNREACHABLE_ABBREV)<br>
> > llvm_unreachable("Unexpected abbrev ordering!");<br>
> > }<br>
> > @@ -2930,18 +2927,18 @@ void ModuleBitcodeWriter::writeBlockInfo<br>
> > Log2_32_Ceil(VE.getTypes().size() + 1)));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));<br>
> > - if (stream().EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID, Abbv) !=<br>
> > + if (Stream.EmitBlockInfoAbbrev(bitc::FUNCTION_BLOCK_ID, Abbv) !=<br>
> > FUNCTION_INST_GEP_ABBREV)<br>
> > llvm_unreachable("Unexpected abbrev ordering!");<br>
> > }<br>
> ><br>
> > - stream().ExitBlock();<br>
> > + Stream.ExitBlock();<br>
> > }<br>
> ><br>
> > /// Write the module path strings, currently only used when generating<br>
> > /// a combined index file.<br>
> > void IndexBitcodeWriter::writeModStrings() {<br>
> > - stream().EnterSubblock(bitc::MODULE_STRTAB_BLOCK_ID, 3);<br>
> > + Stream.EnterSubblock(bitc::MODULE_STRTAB_BLOCK_ID, 3);<br>
> ><br>
> > // TODO: See which abbrev sizes we actually need to emit<br>
> ><br>
> > @@ -2951,7 +2948,7 @@ void IndexBitcodeWriter::writeModStrings<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8));<br>
> > - unsigned Abbrev8Bit = stream().EmitAbbrev(Abbv);<br>
> > + unsigned Abbrev8Bit = Stream.EmitAbbrev(Abbv);<br>
> ><br>
> > // 7-bit fixed width MST_ENTRY strings.<br>
> > Abbv = new BitCodeAbbrev();<br>
> > @@ -2959,7 +2956,7 @@ void IndexBitcodeWriter::writeModStrings<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7));<br>
> > - unsigned Abbrev7Bit = stream().EmitAbbrev(Abbv);<br>
> > + unsigned Abbrev7Bit = Stream.EmitAbbrev(Abbv);<br>
> ><br>
> > // 6-bit char6 MST_ENTRY strings.<br>
> > Abbv = new BitCodeAbbrev();<br>
> > @@ -2967,7 +2964,7 @@ void IndexBitcodeWriter::writeModStrings<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Char6));<br>
> > - unsigned Abbrev6Bit = stream().EmitAbbrev(Abbv);<br>
> > + unsigned Abbrev6Bit = Stream.EmitAbbrev(Abbv);<br>
> ><br>
> > // Module Hash, 160 bits SHA1. Optionally, emitted after each MST_CODE_ENTRY.<br>
> > Abbv = new BitCodeAbbrev();<br>
> > @@ -2977,10 +2974,10 @@ void IndexBitcodeWriter::writeModStrings<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));<br>
> > - unsigned AbbrevHash = stream().EmitAbbrev(Abbv);<br>
> > + unsigned AbbrevHash = Stream.EmitAbbrev(Abbv);<br>
> ><br>
> > SmallVector<unsigned, 64> Vals;<br>
> > - for (const auto &MPSE : Index->modulePaths()) {<br>
> > + for (const auto &MPSE : Index.modulePaths()) {<br>
> > StringEncoding Bits =<br>
> > getStringEncoding(MPSE.getKey().data(), MPSE.getKey().size());<br>
> > unsigned AbbrevToUse = Abbrev8Bit;<br>
> > @@ -2995,7 +2992,7 @@ void IndexBitcodeWriter::writeModStrings<br>
> > Vals.push_back((unsigned char)P);<br>
> ><br>
> > // Emit the finished record.<br>
> > - stream().EmitRecord(bitc::MST_CODE_ENTRY, Vals, AbbrevToUse);<br>
> > + Stream.EmitRecord(bitc::MST_CODE_ENTRY, Vals, AbbrevToUse);<br>
> ><br>
> > Vals.clear();<br>
> > // Emit an optional hash for the module now<br>
> > @@ -3008,12 +3005,12 @@ void IndexBitcodeWriter::writeModStrings<br>
> > }<br>
> > if (!AllZero) {<br>
> > // Emit the hash record.<br>
> > - stream().EmitRecord(bitc::MST_CODE_HASH, Vals, AbbrevHash);<br>
> > + Stream.EmitRecord(bitc::MST_CODE_HASH, Vals, AbbrevHash);<br>
> > }<br>
> ><br>
> > Vals.clear();<br>
> > }<br>
> > - stream().ExitBlock();<br>
> > + Stream.ExitBlock();<br>
> > }<br>
> ><br>
> > // Helper to emit a single function summary record.<br>
> > @@ -3045,7 +3042,7 @@ void ModuleBitcodeWriter::writePerModule<br>
> > (HasProfileData ? bitc::FS_PERMODULE_PROFILE : bitc::FS_PERMODULE);<br>
> ><br>
> > // Emit the finished record.<br>
> > - stream().EmitRecord(Code, NameVals, FSAbbrev);<br>
> > + Stream.EmitRecord(Code, NameVals, FSAbbrev);<br>
> > NameVals.clear();<br>
> > }<br>
> ><br>
> > @@ -3063,21 +3060,21 @@ void ModuleBitcodeWriter::writeModuleLev<br>
> > GlobalVarSummary *VS = cast<GlobalVarSummary>(Info->summary());<br>
> > for (auto Ref : VS->refs())<br>
> > NameVals.push_back(VE.getValueID(Ref.getValue()));<br>
> > - stream().EmitRecord(bitc::FS_PERMODULE_GLOBALVAR_INIT_REFS, NameVals,<br>
> > - FSModRefsAbbrev);<br>
> > + Stream.EmitRecord(bitc::FS_PERMODULE_GLOBALVAR_INIT_REFS, NameVals,<br>
> > + FSModRefsAbbrev);<br>
> > NameVals.clear();<br>
> > }<br>
> ><br>
> > /// Emit the per-module summary section alongside the rest of<br>
> > /// the module's bitcode.<br>
> > void ModuleBitcodeWriter::writePerModuleGlobalValueSummary() {<br>
> > - if (M->empty())<br>
> > + if (M.empty())<br>
> > return;<br>
> ><br>
> > if (Index->begin() == Index->end())<br>
> > return;<br>
> ><br>
> > - stream().EnterSubblock(bitc::GLOBALVAL_SUMMARY_BLOCK_ID, 3);<br>
> > + Stream.EnterSubblock(bitc::GLOBALVAL_SUMMARY_BLOCK_ID, 3);<br>
> ><br>
> > // Abbrev for FS_PERMODULE.<br>
> > BitCodeAbbrev *Abbv = new BitCodeAbbrev();<br>
> > @@ -3089,7 +3086,7 @@ void ModuleBitcodeWriter::writePerModule<br>
> > // numrefs x valueid, n x (valueid, callsitecount)<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));<br>
> > - unsigned FSCallsAbbrev = stream().EmitAbbrev(Abbv);<br>
> > + unsigned FSCallsAbbrev = Stream.EmitAbbrev(Abbv);<br>
> ><br>
> > // Abbrev for FS_PERMODULE_PROFILE.<br>
> > Abbv = new BitCodeAbbrev();<br>
> > @@ -3101,7 +3098,7 @@ void ModuleBitcodeWriter::writePerModule<br>
> > // numrefs x valueid, n x (valueid, callsitecount, profilecount)<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));<br>
> > - unsigned FSCallsProfileAbbrev = stream().EmitAbbrev(Abbv);<br>
> > + unsigned FSCallsProfileAbbrev = Stream.EmitAbbrev(Abbv);<br>
> ><br>
> > // Abbrev for FS_PERMODULE_GLOBALVAR_INIT_REFS.<br>
> > Abbv = new BitCodeAbbrev();<br>
> > @@ -3110,7 +3107,7 @@ void ModuleBitcodeWriter::writePerModule<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5)); // linkage<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array)); // valueids<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));<br>
> > - unsigned FSModRefsAbbrev = stream().EmitAbbrev(Abbv);<br>
> > + unsigned FSModRefsAbbrev = Stream.EmitAbbrev(Abbv);<br>
> ><br>
> > // Abbrev for FS_ALIAS.<br>
> > Abbv = new BitCodeAbbrev();<br>
> > @@ -3118,12 +3115,12 @@ void ModuleBitcodeWriter::writePerModule<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // valueid<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5)); // linkage<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // valueid<br>
> > - unsigned FSAliasAbbrev = stream().EmitAbbrev(Abbv);<br>
> > + unsigned FSAliasAbbrev = Stream.EmitAbbrev(Abbv);<br>
> ><br>
> > SmallVector<uint64_t, 64> NameVals;<br>
> > // Iterate over the list of functions instead of the Index to<br>
> > // ensure the ordering is stable.<br>
> > - for (const Function &F : *M) {<br>
> > + for (const Function &F : M) {<br>
> > if (F.isDeclaration())<br>
> > continue;<br>
> > // Summary emission does not support anonymous functions, they have to<br>
> > @@ -3134,16 +3131,16 @@ void ModuleBitcodeWriter::writePerModule<br>
> > auto *Info = Index->getGlobalValueInfo(F);<br>
> > writePerModuleFunctionSummaryRecord(<br>
> > NameVals, Info,<br>
> > - VE.getValueID(M->getValueSymbolTable().lookup(F.getName())),<br>
> > + VE.getValueID(M.getValueSymbolTable().lookup(F.getName())),<br>
> > FSCallsAbbrev, FSCallsProfileAbbrev, F);<br>
> > }<br>
> ><br>
> > // Capture references from GlobalVariable initializers, which are outside<br>
> > // of a function scope.<br>
> > - for (const GlobalVariable &G : M->globals())<br>
> > + for (const GlobalVariable &G : M.globals())<br>
> > writeModuleLevelReferences(G, NameVals, FSModRefsAbbrev);<br>
> ><br>
> > - for (const GlobalAlias &A : M->aliases()) {<br>
> > + for (const GlobalAlias &A : M.aliases()) {<br>
> > auto *Aliasee = A.getBaseObject();<br>
> > if (!Aliasee->hasName())<br>
> > // Nameless function don't have an entry in the summary, skip it.<br>
> > @@ -3153,16 +3150,16 @@ void ModuleBitcodeWriter::writePerModule<br>
> > NameVals.push_back(AliasId);<br>
> > NameVals.push_back(getEncodedLinkage(A.getLinkage()));<br>
> > NameVals.push_back(AliaseeId);<br>
> > - stream().EmitRecord(bitc::FS_ALIAS, NameVals, FSAliasAbbrev);<br>
> > + Stream.EmitRecord(bitc::FS_ALIAS, NameVals, FSAliasAbbrev);<br>
> > NameVals.clear();<br>
> > }<br>
> ><br>
> > - stream().ExitBlock();<br>
> > + Stream.ExitBlock();<br>
> > }<br>
> ><br>
> > /// Emit the combined summary section into the combined index file.<br>
> > void IndexBitcodeWriter::writeCombinedGlobalValueSummary() {<br>
> > - stream().EnterSubblock(bitc::GLOBALVAL_SUMMARY_BLOCK_ID, 3);<br>
> > + Stream.EnterSubblock(bitc::GLOBALVAL_SUMMARY_BLOCK_ID, 3);<br>
> ><br>
> > // Abbrev for FS_COMBINED.<br>
> > BitCodeAbbrev *Abbv = new BitCodeAbbrev();<br>
> > @@ -3174,7 +3171,7 @@ void IndexBitcodeWriter::writeCombinedGl<br>
> > // numrefs x valueid, n x (valueid, callsitecount)<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));<br>
> > - unsigned FSCallsAbbrev = stream().EmitAbbrev(Abbv);<br>
> > + unsigned FSCallsAbbrev = Stream.EmitAbbrev(Abbv);<br>
> ><br>
> > // Abbrev for FS_COMBINED_PROFILE.<br>
> > Abbv = new BitCodeAbbrev();<br>
> > @@ -3186,7 +3183,7 @@ void IndexBitcodeWriter::writeCombinedGl<br>
> > // numrefs x valueid, n x (valueid, callsitecount, profilecount)<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));<br>
> > - unsigned FSCallsProfileAbbrev = stream().EmitAbbrev(Abbv);<br>
> > + unsigned FSCallsProfileAbbrev = Stream.EmitAbbrev(Abbv);<br>
> ><br>
> > // Abbrev for FS_COMBINED_GLOBALVAR_INIT_REFS.<br>
> > Abbv = new BitCodeAbbrev();<br>
> > @@ -3195,7 +3192,7 @@ void IndexBitcodeWriter::writeCombinedGl<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5)); // linkage<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array)); // valueids<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));<br>
> > - unsigned FSModRefsAbbrev = stream().EmitAbbrev(Abbv);<br>
> > + unsigned FSModRefsAbbrev = Stream.EmitAbbrev(Abbv);<br>
> ><br>
> > // Abbrev for FS_COMBINED_ALIAS.<br>
> > Abbv = new BitCodeAbbrev();<br>
> > @@ -3203,7 +3200,7 @@ void IndexBitcodeWriter::writeCombinedGl<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // modid<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5)); // linkage<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // offset<br>
> > - unsigned FSAliasAbbrev = stream().EmitAbbrev(Abbv);<br>
> > + unsigned FSAliasAbbrev = Stream.EmitAbbrev(Abbv);<br>
> ><br>
> > // The aliases are emitted as a post-pass, and will point to the summary<br>
> > // offset id of the aliasee. For this purpose we need to be able to get back<br>
> > @@ -3212,7 +3209,7 @@ void IndexBitcodeWriter::writeCombinedGl<br>
> > DenseMap<const GlobalValueSummary *, uint64_t> SummaryToOffsetMap;<br>
> ><br>
> > SmallVector<uint64_t, 64> NameVals;<br>
> > - for (const auto &FII : *Index) {<br>
> > + for (const auto &FII : Index) {<br>
> > for (auto &FI : FII.second) {<br>
> > GlobalValueSummary *S = FI->summary();<br>
> > assert(S);<br>
> > @@ -3224,7 +3221,7 @@ void IndexBitcodeWriter::writeCombinedGl<br>
> > }<br>
> ><br>
> > if (auto *VS = dyn_cast<GlobalVarSummary>(S)) {<br>
> > - NameVals.push_back(Index->getModuleId(VS->modulePath()));<br>
> > + NameVals.push_back(Index.getModuleId(VS->modulePath()));<br>
> > NameVals.push_back(getEncodedLinkage(VS->linkage()));<br>
> > for (auto &RI : VS->refs()) {<br>
> > NameVals.push_back(getValueId(RI.getGUID()));<br>
> > @@ -3233,20 +3230,20 @@ void IndexBitcodeWriter::writeCombinedGl<br>
> > // Record the starting offset of this summary entry for use<br>
> > // in the VST entry. Add the current code size since the<br>
> > // reader will invoke readRecord after the abbrev id read.<br>
> > - FI->setBitcodeIndex(stream().GetCurrentBitNo() +<br>
> > - stream().GetAbbrevIDWidth());<br>
> > + FI->setBitcodeIndex(Stream.GetCurrentBitNo() +<br>
> > + Stream.GetAbbrevIDWidth());<br>
> > // Store temporarily the offset in the map for a possible alias.<br>
> > SummaryToOffsetMap[S] = FI->bitcodeIndex();<br>
> ><br>
> > // Emit the finished record.<br>
> > - stream().EmitRecord(bitc::FS_COMBINED_GLOBALVAR_INIT_REFS, NameVals,<br>
> > - FSModRefsAbbrev);<br>
> > + Stream.EmitRecord(bitc::FS_COMBINED_GLOBALVAR_INIT_REFS, NameVals,<br>
> > + FSModRefsAbbrev);<br>
> > NameVals.clear();<br>
> > continue;<br>
> > }<br>
> ><br>
> > auto *FS = cast<FunctionSummary>(S);<br>
> > - NameVals.push_back(Index->getModuleId(FS->modulePath()));<br>
> > + NameVals.push_back(Index.getModuleId(FS->modulePath()));<br>
> > NameVals.push_back(getEncodedLinkage(FS->linkage()));<br>
> > NameVals.push_back(FS->instCount());<br>
> > NameVals.push_back(FS->refs().size());<br>
> > @@ -3277,8 +3274,7 @@ void IndexBitcodeWriter::writeCombinedGl<br>
> > // Record the starting offset of this summary entry for use<br>
> > // in the VST entry. Add the current code size since the<br>
> > // reader will invoke readRecord after the abbrev id read.<br>
> > - FI->setBitcodeIndex(stream().GetCurrentBitNo() +<br>
> > - stream().GetAbbrevIDWidth());<br>
> > + FI->setBitcodeIndex(Stream.GetCurrentBitNo() + Stream.GetAbbrevIDWidth());<br>
> > // Store temporarily the offset in the map for a possible alias.<br>
> > SummaryToOffsetMap[S] = FI->bitcodeIndex();<br>
> ><br>
> > @@ -3288,14 +3284,14 @@ void IndexBitcodeWriter::writeCombinedGl<br>
> > (HasProfileData ? bitc::FS_COMBINED_PROFILE : bitc::FS_COMBINED);<br>
> ><br>
> > // Emit the finished record.<br>
> > - stream().EmitRecord(Code, NameVals, FSAbbrev);<br>
> > + Stream.EmitRecord(Code, NameVals, FSAbbrev);<br>
> > NameVals.clear();<br>
> > }<br>
> > }<br>
> ><br>
> > for (auto GVI : Aliases) {<br>
> > AliasSummary *AS = cast<AliasSummary>(GVI->summary());<br>
> > - NameVals.push_back(Index->getModuleId(AS->modulePath()));<br>
> > + NameVals.push_back(Index.getModuleId(AS->modulePath()));<br>
> > NameVals.push_back(getEncodedLinkage(AS->linkage()));<br>
> > auto AliaseeOffset = SummaryToOffsetMap[&AS->getAliasee()];<br>
> > assert(AliaseeOffset);<br>
> > @@ -3304,26 +3300,25 @@ void IndexBitcodeWriter::writeCombinedGl<br>
> > // Record the starting offset of this summary entry for use<br>
> > // in the VST entry. Add the current code size since the<br>
> > // reader will invoke readRecord after the abbrev id read.<br>
> > - GVI->setBitcodeIndex(stream().GetCurrentBitNo() +<br>
> > - stream().GetAbbrevIDWidth());<br>
> > + GVI->setBitcodeIndex(Stream.GetCurrentBitNo() + Stream.GetAbbrevIDWidth());<br>
> ><br>
> > // Emit the finished record.<br>
> > - stream().EmitRecord(bitc::FS_COMBINED_ALIAS, NameVals, FSAliasAbbrev);<br>
> > + Stream.EmitRecord(bitc::FS_COMBINED_ALIAS, NameVals, FSAliasAbbrev);<br>
> > NameVals.clear();<br>
> > }<br>
> ><br>
> > - stream().ExitBlock();<br>
> > + Stream.ExitBlock();<br>
> > }<br>
> ><br>
> > void ModuleBitcodeWriter::writeIdentificationBlock() {<br>
> > - stream().EnterSubblock(bitc::IDENTIFICATION_BLOCK_ID, 5);<br>
> > + Stream.EnterSubblock(bitc::IDENTIFICATION_BLOCK_ID, 5);<br>
> ><br>
> > // Write the "user readable" string identifying the bitcode producer<br>
> > BitCodeAbbrev *Abbv = new BitCodeAbbrev();<br>
> > Abbv->Add(BitCodeAbbrevOp(bitc::IDENTIFICATION_CODE_STRING));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Char6));<br>
> > - auto StringAbbrev = stream().EmitAbbrev(Abbv);<br>
> > + auto StringAbbrev = Stream.EmitAbbrev(Abbv);<br>
> > writeStringRecord(bitc::IDENTIFICATION_CODE_STRING,<br>
> > "LLVM" LLVM_VERSION_STRING, StringAbbrev);<br>
> ><br>
> > @@ -3331,18 +3326,18 @@ void ModuleBitcodeWriter::writeIdentific<br>
> > Abbv = new BitCodeAbbrev();<br>
> > Abbv->Add(BitCodeAbbrevOp(bitc::IDENTIFICATION_CODE_EPOCH));<br>
> > Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));<br>
> > - auto EpochAbbrev = stream().EmitAbbrev(Abbv);<br>
> > + auto EpochAbbrev = Stream.EmitAbbrev(Abbv);<br>
> > SmallVector<unsigned, 1> Vals = {bitc::BITCODE_CURRENT_EPOCH};<br>
> > - stream().EmitRecord(bitc::IDENTIFICATION_CODE_EPOCH, Vals, EpochAbbrev);<br>
> > - stream().ExitBlock();<br>
> > + Stream.EmitRecord(bitc::IDENTIFICATION_CODE_EPOCH, Vals, EpochAbbrev);<br>
> > + Stream.ExitBlock();<br>
> > }<br>
> ><br>
> > void ModuleBitcodeWriter::writeModuleHash(size_t BlockStartPos) {<br>
> > // Emit the module's hash.<br>
> > // MODULE_CODE_HASH: [5*i32]<br>
> > SHA1 Hasher;<br>
> > - Hasher.update(ArrayRef<uint8_t>((uint8_t *)&(buffer())[BlockStartPos],<br>
> > - buffer().size() - BlockStartPos));<br>
> > + Hasher.update(ArrayRef<uint8_t>((uint8_t *)&(Buffer)[BlockStartPos],<br>
> > + Buffer.size() - BlockStartPos));<br>
> > auto Hash = Hasher.result();<br>
> > SmallVector<uint64_t, 20> Vals;<br>
> > auto LShift = [&](unsigned char Val, unsigned Amount)<br>
> > @@ -3355,7 +3350,7 @@ void ModuleBitcodeWriter::writeModuleHas<br>
> > }<br>
> ><br>
> > // Emit the finished record.<br>
> > - stream().EmitRecord(bitc::MODULE_CODE_HASH, Vals);<br>
> > + Stream.EmitRecord(bitc::MODULE_CODE_HASH, Vals);<br>
> > }<br>
> ><br>
> > void BitcodeWriter::write() {<br>
> > @@ -3376,13 +3371,13 @@ void IndexBitcodeWriter::writeBlocks() {<br>
> > }<br>
> ><br>
> > void ModuleBitcodeWriter::writeModule() {<br>
> > - stream().EnterSubblock(bitc::MODULE_BLOCK_ID, 3);<br>
> > - size_t BlockStartPos = buffer().size();<br>
> > + Stream.EnterSubblock(bitc::MODULE_BLOCK_ID, 3);<br>
> > + size_t BlockStartPos = Buffer.size();<br>
> ><br>
> > SmallVector<unsigned, 1> Vals;<br>
> > unsigned CurVersion = 1;<br>
> > Vals.push_back(CurVersion);<br>
> > - stream().EmitRecord(bitc::MODULE_CODE_VERSION, Vals);<br>
> > + Stream.EmitRecord(bitc::MODULE_CODE_VERSION, Vals);<br>
> ><br>
> > // Emit blockinfo, which defines the standard abbreviations etc.<br>
> > writeBlockInfo();<br>
> > @@ -3419,7 +3414,7 @@ void ModuleBitcodeWriter::writeModule()<br>
> ><br>
> > // Emit function bodies.<br>
> > DenseMap<const Function *, uint64_t> FunctionToBitcodeIndex;<br>
> > - for (Module::const_iterator F = M->begin(), E = M->end(); F != E; ++F)<br>
> > + for (Module::const_iterator F = M.begin(), E = M.end(); F != E; ++F)<br>
> > if (!F->isDeclaration())<br>
> > writeFunction(*F, FunctionToBitcodeIndex);<br>
> ><br>
> > @@ -3428,14 +3423,14 @@ void ModuleBitcodeWriter::writeModule()<br>
> > if (Index)<br>
> > writePerModuleGlobalValueSummary();<br>
> ><br>
> > - writeValueSymbolTable(M->getValueSymbolTable(),<br>
> > + writeValueSymbolTable(M.getValueSymbolTable(),<br>
> > /* IsModuleLevel */ true, &FunctionToBitcodeIndex);<br>
> ><br>
> > if (GenerateHash) {<br>
> > writeModuleHash(BlockStartPos);<br>
> > }<br>
> ><br>
> > - stream().ExitBlock();<br>
> > + Stream.ExitBlock();<br>
> > }<br>
> ><br>
> > static void writeInt32ToBuffer(uint32_t Value, SmallVectorImpl<char> &Buffer,<br>
> > @@ -3506,12 +3501,12 @@ static void emitDarwinBCHeaderAndTrailer<br>
> > /// Helper to write the header common to all bitcode files.<br>
> > void BitcodeWriter::writeBitcodeHeader() {<br>
> > // Emit the file header.<br>
> > - stream().Emit((unsigned)'B', 8);<br>
> > - stream().Emit((unsigned)'C', 8);<br>
> > - stream().Emit(0x0, 4);<br>
> > - stream().Emit(0xC, 4);<br>
> > - stream().Emit(0xE, 4);<br>
> > - stream().Emit(0xD, 4);<br>
> > + Stream.Emit((unsigned)'B', 8);<br>
> > + Stream.Emit((unsigned)'C', 8);<br>
> > + Stream.Emit(0x0, 4);<br>
> > + Stream.Emit(0xC, 4);<br>
> > + Stream.Emit(0xE, 4);<br>
> > + Stream.Emit(0xD, 4);<br>
> > }<br>
> ><br>
> > /// WriteBitcodeToFile - Write the specified module to the specified output<br>
> > @@ -3530,8 +3525,8 @@ void llvm::WriteBitcodeToFile(const Modu<br>
> > Buffer.insert(Buffer.begin(), BWH_HeaderSize, 0);<br>
> ><br>
> > // Emit the module into the buffer.<br>
> > - ModuleBitcodeWriter ModuleWriter(M, &Buffer, ShouldPreserveUseListOrder,<br>
> > - Index, GenerateHash);<br>
> > + ModuleBitcodeWriter ModuleWriter(M, Buffer, ShouldPreserveUseListOrder, Index,<br>
> > + GenerateHash);<br>
> > ModuleWriter.write();<br>
> ><br>
> > if (TT.isOSDarwin() || TT.isOSBinFormatMachO())<br>
> > @@ -3542,12 +3537,12 @@ void llvm::WriteBitcodeToFile(const Modu<br>
> > }<br>
> ><br>
> > void IndexBitcodeWriter::writeIndex() {<br>
> > - stream().EnterSubblock(bitc::MODULE_BLOCK_ID, 3);<br>
> > + Stream.EnterSubblock(bitc::MODULE_BLOCK_ID, 3);<br>
> ><br>
> > SmallVector<unsigned, 1> Vals;<br>
> > unsigned CurVersion = 1;<br>
> > Vals.push_back(CurVersion);<br>
> > - stream().EmitRecord(bitc::MODULE_CODE_VERSION, Vals);<br>
> > + Stream.EmitRecord(bitc::MODULE_CODE_VERSION, Vals);<br>
> ><br>
> > // If we have a VST, write the VSTOFFSET record placeholder.<br>
> > writeValueSymbolTableForwardDecl();<br>
> > @@ -3562,7 +3557,7 @@ void IndexBitcodeWriter::writeIndex() {<br>
> > // real VST and real values when this is invoked).<br>
> > writeCombinedValueSymbolTable();<br>
> ><br>
> > - stream().ExitBlock();<br>
> > + Stream.ExitBlock();<br>
> > }<br>
> ><br>
> > // Write the specified module summary index to the given raw output stream,<br>
> > @@ -3572,7 +3567,7 @@ void llvm::WriteIndexToFile(const Module<br>
> > SmallVector<char, 0> Buffer;<br>
> > Buffer.reserve(256 * 1024);<br>
> ><br>
> > - IndexBitcodeWriter IndexWriter(&Buffer, &Index);<br>
> > + IndexBitcodeWriter IndexWriter(Buffer, Index);<br>
> > IndexWriter.write();<br>
> ><br>
> > Out.write((char *)&Buffer.front(), Buffer.size());<br>
> ><br>
> ><br>
> > _______________________________________________<br>
> > llvm-commits mailing list<br>
> > <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
> > <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
><br>
><br>
><br>
><br>
> --<br>
> Teresa Johnson | Software Engineer | <a href="mailto:tejohnson@google.com">tejohnson@google.com</a> | 408-460-2413<br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><span style="font-family:Times;font-size:medium"><table cellspacing="0" cellpadding="0"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Teresa Johnson |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"> 408-460-2413</td></tr></tbody></table></span></div>
</div></div>