39#define DEBUG_TYPE "static-data-annotator"
60 ModulePass::getAnalysisUsage(AU);
69 SDPI = &getAnalysis<StaticDataProfileInfoWrapperPass>()
70 .getStaticDataProfileInfo();
71 PSI = &getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI();
77 for (
auto &GV : M.globals()) {
78 if (GV.isDeclarationForLinker())
84 if (
auto maybeSectionPrefix = GV.getSectionPrefix();
85 maybeSectionPrefix && !maybeSectionPrefix->empty())
87 " already has a section prefix " +
91 if (SectionPrefix.
empty())
94 GV.setSectionPrefix(SectionPrefix);
Module.h This file contains the declarations for the Module class.
This header defines various interfaces for pass management in LLVM.
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
A module pass which iterates global variables in the module and annotates their section prefixes base...
StaticDataProfileInfo * SDPI
bool runOnModule(Module &M) override
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
const ProfileSummaryInfo * PSI
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
void setPreservesAll()
Set by analyses that do not transform their input at all.
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
A Module instance is used to store all the information related to an LLVM module.
static LLVM_ABI PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
An analysis pass based on legacy pass manager to deliver ProfileSummaryInfo.
Analysis providing profile information.
bool hasProfileSummary() const
Returns true if profile summary is available.
This wraps the StaticDataProfileInfo object as an immutable pass, for a backend pass to operate on.
A class that holds the constants that represent static data and their profile information and provide...
LLVM_ABI StringRef getConstantSectionPrefix(const Constant *C, const ProfileSummaryInfo *PSI) const
Return a section prefix for the constant C based on its profile count.
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
Pass manager infrastructure for declaring and invalidating analyses.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
LLVM_ABI ModulePass * createStaticDataAnnotatorPass()
createStaticDataAnnotatorPASS - This is a module pass that reads from StaticDataProfileInfoWrapperPas...
LLVM_ABI void initializeStaticDataAnnotatorPass(PassRegistry &)