61
61
#include " llvm/MC/MCSymbolXCOFF.h"
62
62
#include " llvm/MC/SectionKind.h"
63
63
#include " llvm/MC/TargetRegistry.h"
64
+ #include " llvm/ProfileData/InstrProf.h"
64
65
#include " llvm/Support/Casting.h"
65
66
#include " llvm/Support/CodeGen.h"
66
67
#include " llvm/Support/Compiler.h"
@@ -254,7 +255,7 @@ class PPCAIXAsmPrinter : public PPCAsmPrinter {
254
255
GOAliasMap;
255
256
256
257
// The __profd_* symbol for the profiling instrumentation data and the
257
- // corresponding __profc_* counters it refernces .
258
+ // corresponding __profc_* counters it references .
258
259
struct ProfilingSubSection {
259
260
MCSectionXCOFF *ProfD;
260
261
MCSectionXCOFF *ProfC;
@@ -2984,15 +2985,26 @@ void PPCAIXAsmPrinter::emitSplitSectionPGORefs() {
2984
2985
MCSymbol *NamesSym = nullptr ;
2985
2986
MCSymbol *VNDSSym = nullptr ;
2986
2987
2988
+ auto profSectionName = [](InstrProfSectKind IPSK) -> std::string {
2989
+ return getInstrProfSectionName (IPSK, Triple::XCOFF,
2990
+ /* AddSegmentInfo */ false );
2991
+ };
2992
+
2987
2993
if (OutContext.hasXCOFFSection (
2988
- " __llvm_prf_names" ,
2989
- XCOFF::CsectProperties (XCOFF::XMC_RO, XCOFF::XTY_SD)))
2990
- NamesSym = OutContext.getOrCreateSymbol (" __llvm_prf_names[RO]" );
2994
+ profSectionName (IPSK_name),
2995
+ XCOFF::CsectProperties (XCOFF::XMC_RO, XCOFF::XTY_SD))) {
2996
+ std::string SymName = profSectionName (IPSK_name);
2997
+ SymName += " [RO]" ;
2998
+ NamesSym = OutContext.getOrCreateSymbol (SymName);
2999
+ }
2991
3000
2992
3001
if (OutContext.hasXCOFFSection (
2993
- " __llvm_prf_vnds" ,
2994
- XCOFF::CsectProperties (XCOFF::XMC_RW, XCOFF::XTY_SD)))
2995
- VNDSSym = OutContext.getOrCreateSymbol (" __llvm_prf_vnds[RW]" );
3002
+ profSectionName (IPSK_vnodes),
3003
+ XCOFF::CsectProperties (XCOFF::XMC_RW, XCOFF::XTY_SD))) {
3004
+ std::string SymName = profSectionName (IPSK_vnodes);
3005
+ SymName += " [RW]" ;
3006
+ VNDSSym = OutContext.getOrCreateSymbol (SymName);
3007
+ }
2996
3008
2997
3009
for (auto SubSections : ProfGenSubSections) {
2998
3010
MCSectionXCOFF *ProfDCsect = SubSections.ProfD ;
@@ -3010,13 +3022,13 @@ void PPCAIXAsmPrinter::emitSplitSectionPGORefs() {
3010
3022
3011
3023
// Rename the subsection for the counters
3012
3024
OutStreamer->emitXCOFFRenameDirective (ProfCCsect->getQualNameSymbol (),
3013
- " __llvm_prf_cnts " );
3025
+ profSectionName (IPSK_cnts) );
3014
3026
OutStreamer->addBlankLine ();
3015
3027
3016
3028
// Rename the subsection for the data.
3017
3029
OutStreamer->switchSection (ProfDCsect);
3018
3030
OutStreamer->emitXCOFFRenameDirective (ProfDCsect->getQualNameSymbol (),
3019
- " __llvm_prf_data " );
3031
+ profSectionName (IPSK_data) );
3020
3032
OutStreamer->addBlankLine ();
3021
3033
}
3022
3034
}
0 commit comments