llvm.org GIT mirror llvm / ca21c56
Pass FunctionInfoIndex by reference to WriteFunctionSummaryToFile (NFC) Implemented suggestion by dblakie in review for r250704. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250723 91177308-0d34-0410-b5e6-96231b3b80d8 Teresa Johnson 5 years ago
4 changed file(s) with 11 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
100100 /// Write the specified function summary index to the given raw output stream,
101101 /// where it will be written in a new bitcode block. This is used when
102102 /// writing the combined index file for ThinLTO.
103 void WriteFunctionSummaryToFile(const FunctionInfoIndex *Index,
103 void WriteFunctionSummaryToFile(const FunctionInfoIndex &Index,
104104 raw_ostream &Out);
105105
106106 /// isBitcodeWrapper - Return true if the given bytes are the magic bytes
23132313
23142314 /// Emit function names and summary offsets for the combined index
23152315 /// used by ThinLTO.
2316 static void WriteCombinedValueSymbolTable(const FunctionInfoIndex *Index,
2316 static void WriteCombinedValueSymbolTable(const FunctionInfoIndex &Index,
23172317 BitstreamWriter &Stream) {
23182318 Stream.EnterSubblock(bitc::VALUE_SYMTAB_BLOCK_ID, 4);
23192319
23442344 // FIXME: We know if the type names can use 7-bit ascii.
23452345 SmallVector NameVals;
23462346
2347 for (const auto &FII : *Index) {
2347 for (const auto &FII : Index) {
23482348 for (const auto &FI : FII.getValue()) {
23492349 NameVals.push_back(FI->bitcodeIndex());
23502350
26852685
26862686 /// Write the module path strings, currently only used when generating
26872687 /// a combined index file.
2688 static void WriteModStrings(const FunctionInfoIndex *I,
2688 static void WriteModStrings(const FunctionInfoIndex &I,
26892689 BitstreamWriter &Stream) {
26902690 Stream.EnterSubblock(bitc::MODULE_STRTAB_BLOCK_ID, 3);
26912691
27162716 unsigned Abbrev6Bit = Stream.EmitAbbrev(Abbv);
27172717
27182718 SmallVector NameVals;
2719 for (const StringMapEntry &MPSE : I->modPathStringEntries()) {
2719 for (const StringMapEntry &MPSE : I.modPathStringEntries()) {
27202720 StringEncoding Bits =
27212721 getStringEncoding(MPSE.getKey().data(), MPSE.getKey().size());
27222722 unsigned AbbrevToUse = Abbrev8Bit;
27942794
27952795 /// Emit the combined function summary section into the combined index
27962796 /// file.
2797 static void WriteCombinedFunctionSummary(const FunctionInfoIndex *I,
2797 static void WriteCombinedFunctionSummary(const FunctionInfoIndex &I,
27982798 BitstreamWriter &Stream) {
27992799 Stream.EnterSubblock(bitc::FUNCTION_SUMMARY_BLOCK_ID, 3);
28002800
28062806 unsigned FSAbbrev = Stream.EmitAbbrev(Abbv);
28072807
28082808 SmallVector NameVals;
2809 for (const auto &FII : *I) {
2809 for (const auto &FII : I) {
28102810 for (auto &FI : FII.getValue()) {
28112811 FunctionSummary *FS = FI->functionSummary();
28122812 assert(FS);
28132813
2814 NameVals.push_back(I->getModuleId(FS->modulePath()));
2814 NameVals.push_back(I.getModuleId(FS->modulePath()));
28152815 NameVals.push_back(FS->instCount());
28162816
28172817 // Record the starting offset of this summary entry for use
30143014 // Write the specified function summary index to the given raw output stream,
30153015 // where it will be written in a new bitcode block. This is used when
30163016 // writing the combined index file for ThinLTO.
3017 void llvm::WriteFunctionSummaryToFile(const FunctionInfoIndex *Index,
3017 void llvm::WriteFunctionSummaryToFile(const FunctionInfoIndex &Index,
30183018 raw_ostream &Out) {
30193019 SmallVector Buffer;
30203020 Buffer.reserve(256 * 1024);
913913 if (EC)
914914 message(LDPL_FATAL, "Unable to open %s.thinlto.bc for writing: %s",
915915 output_name.data(), EC.message().c_str());
916 WriteFunctionSummaryToFile(&CombinedIndex, OS);
916 WriteFunctionSummaryToFile(CombinedIndex, OS);
917917 OS.close();
918918
919919 cleanup_hook();
207207 << ".thinlto.bc': " << EC.message() << "\n";
208208 return 1;
209209 }
210 WriteFunctionSummaryToFile(&CombinedIndex, OS);
210 WriteFunctionSummaryToFile(CombinedIndex, OS);
211211 OS.close();
212212 return 0;
213213 }