27 : F(F),
BFI(nullptr) {
44 OwnedBFI = llvm::make_unique<BlockFrequencyInfo>(*F, BPI, LI);
64 else if (io.
mapTag(
"!Missed",
67 else if (io.
mapTag(
"!Analysis",
70 else if (io.
mapTag(
"!AnalysisFPCommute",
74 else if (io.
mapTag(
"!AnalysisAliasing",
101 auto *Scope = cast<DIScope>(DL.
getScope());
104 unsigned Col = DL.
getCol();
111 static const bool flow =
true;
131 Value *V = OptDiag.getCodeRegion();
133 OptDiag.setHotness(computeHotness(V));
137 computeHotness(OptDiag);
146 if (!OptDiag.
isVerbose() || shouldEmitVerbose())
166 const Twine &Msg,
bool IsVerbose) {
168 if (!IsVerbose || shouldEmitVerbose())
174 const char *PassName,
Loop *
L,
const Twine &Msg,
bool IsVerbose) {
181 const Twine &Msg,
bool IsVerbose) {
183 if (!IsVerbose || shouldEmitVerbose())
189 const char *PassName,
Loop *
L,
const Twine &Msg,
bool IsVerbose) {
211 const char *PassName,
Loop *
L,
const Twine &Msg) {
226 BFI = &getAnalysis<LazyBlockFrequencyInfoPass>().getBFI();
230 ORE = llvm::make_unique<OptimizationRemarkEmitter>(&Fn,
BFI);
240 AnalysisKey OptimizationRemarkEmitterAnalysis::Key;
256 static const char ore_name[] =
"Optimization Remark Emitter";
257 #define ORE_NAME "opt-remark-emitter"
static void mapping(IO &io, DiagnosticInfoOptimizationBase::Argument &A)
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
void mapOptional(const char *Key, T &Val)
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
LLVM Argument representation.
MDNode * getScope() const
const Function & getFunction() const
DebugLoc getStartLoc() const
Return the debug location of the start of this loop.
void initializeOptimizationRemarkEmitterWrapperPassPass(PassRegistry &)
#define LLVM_YAML_IS_SEQUENCE_VECTOR(_type)
Utility for declaring that a std::vector of a particular type should be considered a YAML sequence...
INITIALIZE_PASS_BEGIN(OptimizationRemarkEmitterWrapperPass, ORE_NAME, ore_name, false, true) INITIALIZE_PASS_END(OptimizationRemarkEmitterWrapperPass
const DebugLoc & getDebugLoc() const
BlockT * getHeader() const
StringRef getName() const
Return a constant reference to the value's name.
#define INITIALIZE_PASS_DEPENDENCY(depName)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
This class should be specialized by any type that needs to be converted to/from a YAML mapping...
virtual bool mapTag(StringRef Tag, bool Default=false)=0
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
yaml::Output * getDiagnosticsOutputFile()
Return the YAML file used by the backend to save optimization diagnostics.
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs...ExtraArgs)
Get the result of an analysis pass for a given IR unit.
This is an important class for using LLVM in a threaded context.
void analyze(const DominatorTreeBase< BlockT > &DomTree)
Create the loop forest using a stable algorithm.
static void mapping(IO &io, DebugLoc &DL)
Represent the analysis usage information of a pass.
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE,"Assign register bank of generic virtual registers", false, false) RegBankSelect
FunctionPass class - This class is used to implement most global optimizations.
The Output class is used to generate a yaml document from in-memory structs and vectors.
Used in the streaming interface as the general argument type.
bool getDiagnosticHotnessRequested() const
Return if a code hotness metric should be included in optimization diagnostics.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void calculate(const Function &F, const LoopInfo &LI)
Analysis pass which computes BlockFrequencyInfo.
Common features for diagnostics dealing with optimization remarks.
static void mapping(IO &io, DiagnosticInfoOptimizationBase *&OptDiag)
void setPreservesAll()
Set by analyses that do not transform their input at all.
static void getLazyBFIAnalysisUsage(AnalysisUsage &AU)
Helper for client passes to set up the analysis usage on behalf of this pass.
static StringRef getRealLinkageName(StringRef Name)
If special LLVM prefix that is used to inform the asm printer to not emit usual symbol prefix before ...
Analysis providing branch probability information.
Represents a single loop in the control flow graph.
void diagnose(const DiagnosticInfo &DI)
Report a message to the currently installed diagnostic handler.
static const char ore_name[]
virtual bool outputting()=0
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
void recalculate(FT &F)
recalculate - compute a dominator tree for the given function
StringRef - Represent a constant reference to a string, i.e.
A container for analyses that lazily runs them and caches their results.
void mapRequired(const char *Key, T &Val)
Optional< uint64_t > getBlockProfileCount(const BasicBlock *BB) const
Returns the estimated profile count of BB.
static GCRegistry::Add< ErlangGC > A("erlang","erlang-compatible garbage collector")
A special type used by analysis passes to provide an address that identifies that particular analysis...