LLVM  6.0.0svn
Public Member Functions | List of all members
llvm::OptimizationRemarkEmitter Class Reference

The optimization diagnostic interface. More...

#include "llvm/Analysis/OptimizationRemarkEmitter.h"

Public Member Functions

 OptimizationRemarkEmitter (const Function *F, BlockFrequencyInfo *BFI)
 OptimizationRemarkEmitter (const Function *F)
 This variant can be used to generate ORE on demand (without the analysis pass). More...
 OptimizationRemarkEmitter (OptimizationRemarkEmitter &&Arg)
OptimizationRemarkEmitteroperator= (OptimizationRemarkEmitter &&RHS)
bool invalidate (Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &Inv)
 Handle invalidation events in the new pass manager. More...
void emit (DiagnosticInfoOptimizationBase &OptDiag)
 Output the remark via the diagnostic handler and to the optimization record file. More...
template<typename T >
void emit (T RemarkBuilder, decltype(RemarkBuilder()) *=nullptr)
 Take a lambda that returns a remark which will be emitted. More...
bool allowExtraAnalysis (StringRef PassName) const
 Whether we allow for extra compile-time budget to perform more analysis to produce fewer false positives. More...

Detailed Description

The optimization diagnostic interface.

It allows reporting when optimizations are performed and when they are not along with the reasons for it. Hotness information of the corresponding code region can be included in the remark if DiagnosticsHotnessRequested is enabled in the LLVM context.

Definition at line 38 of file OptimizationRemarkEmitter.h.

Constructor & Destructor Documentation

◆ OptimizationRemarkEmitter() [1/3]

llvm::OptimizationRemarkEmitter::OptimizationRemarkEmitter ( const Function F,
BlockFrequencyInfo BFI 

Definition at line 40 of file OptimizationRemarkEmitter.h.

Referenced by allowExtraAnalysis().

◆ OptimizationRemarkEmitter() [2/3]

OptimizationRemarkEmitter::OptimizationRemarkEmitter ( const Function F)

This variant can be used to generate ORE on demand (without the analysis pass).

Note that this ctor has a very different cost depending on whether F->getContext().getDiagnosticsHotnessRequested() is on or not. If it's off the operation is free.

Whereas if DiagnosticsHotnessRequested is on, it is fairly expensive operation since BFI and all its required analyses are computed. This is for example useful for CGSCC passes that can't use function analyses passes in the old PM.

Definition at line 26 of file OptimizationRemarkEmitter.cpp.

References llvm::LoopInfoBase< BlockT, LoopT >::analyze(), llvm::BranchProbabilityInfo::calculate(), llvm::Function::getContext(), llvm::LLVMContext::getDiagnosticsHotnessRequested(), and llvm::DominatorTreeBase< NodeT, IsPostDom >::recalculate().

◆ OptimizationRemarkEmitter() [3/3]

llvm::OptimizationRemarkEmitter::OptimizationRemarkEmitter ( OptimizationRemarkEmitter &&  Arg)

Definition at line 56 of file OptimizationRemarkEmitter.h.

Member Function Documentation

◆ allowExtraAnalysis()

bool llvm::OptimizationRemarkEmitter::allowExtraAnalysis ( StringRef  PassName) const

Whether we allow for extra compile-time budget to perform more analysis to produce fewer false positives.

This is useful when reporting missed optimizations. In this case we can use the extra analysis (1) to filter trivial false positives or (2) to provide more context so that non-trivial false positives can be quickly detected by the user.

Definition at line 95 of file OptimizationRemarkEmitter.h.

References llvm::Function::getContext(), llvm::LLVMContext::getDiagHandlerPtr(), llvm::LLVMContext::getDiagnosticsOutputFile(), llvm::DiagnosticHandler::isAnyRemarkEnabled(), operator=(), and OptimizationRemarkEmitter().

Referenced by canIfConvertPHINodes().

◆ emit() [1/2]

void OptimizationRemarkEmitter::emit ( DiagnosticInfoOptimizationBase OptDiag)

◆ emit() [2/2]

template<typename T >
void llvm::OptimizationRemarkEmitter::emit ( T  RemarkBuilder,
decltype(RemarkBuilder()) *  = nullptr 

Take a lambda that returns a remark which will be emitted.

Second argument is only used to restrict this to functions.

Definition at line 76 of file OptimizationRemarkEmitter.h.

References emit(), llvm::Function::getContext(), llvm::LLVMContext::getDiagHandlerPtr(), llvm::LLVMContext::getDiagnosticsOutputFile(), and llvm::DiagnosticHandler::isAnyRemarkEnabled().

◆ invalidate()

bool OptimizationRemarkEmitter::invalidate ( Function F,
const PreservedAnalyses PA,
FunctionAnalysisManager::Invalidator Inv 

◆ operator=()

OptimizationRemarkEmitter& llvm::OptimizationRemarkEmitter::operator= ( OptimizationRemarkEmitter &&  RHS)

Definition at line 59 of file OptimizationRemarkEmitter.h.

References emit(), and invalidate().

Referenced by allowExtraAnalysis().

The documentation for this class was generated from the following files: