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

The optimization diagnostic interface. More...

#include <OptimizationDiagnosticInfo.h>

Public Member Functions

 OptimizationRemarkEmitter (Function *F, BlockFrequencyInfo *BFI)
 
 OptimizationRemarkEmitter (Function *F)
 This variant can be used to generate ORE on demand (without the analysis pass). More...
 
 OptimizationRemarkEmitter (OptimizationRemarkEmitter &&Arg)
 
OptimizationRemarkEmitteroperator= (OptimizationRemarkEmitter &&RHS)
 
void emit (DiagnosticInfoOptimizationBase &OptDiag)
 The new interface to emit remarks. More...
 
void emitOptimizationRemark (const char *PassName, const DebugLoc &DLoc, const Value *V, const Twine &Msg)
 Emit an optimization-applied message. More...
 
void emitOptimizationRemark (const char *PassName, Loop *L, const Twine &Msg)
 Same as above but derives the IR Value for the code region and the debug location from the Loop parameter L. More...
 
void emitOptimizationRemark (const char *PassName, Instruction *Inst, const Twine &Msg)
 Same as above but derives the debug location and the code region from the debug location and the basic block of Inst, respectively. More...
 
void emitOptimizationRemarkMissed (const char *PassName, const DebugLoc &DLoc, const Value *V, const Twine &Msg, bool IsVerbose=false)
 Emit an optimization-missed message. More...
 
void emitOptimizationRemarkMissed (const char *PassName, Loop *L, const Twine &Msg, bool IsVerbose=false)
 Same as above but derives the IR Value for the code region and the debug location from the Loop parameter L. More...
 
void emitOptimizationRemarkMissed (const char *PassName, Instruction *Inst, const Twine &Msg, bool IsVerbose=false)
 Same as above but derives the debug location and the code region from the debug location and the basic block of Inst, respectively. More...
 
void emitOptimizationRemarkAnalysis (const char *PassName, const DebugLoc &DLoc, const Value *V, const Twine &Msg, bool IsVerbose=false)
 Emit an optimization analysis remark message. More...
 
void emitOptimizationRemarkAnalysis (const char *PassName, Loop *L, const Twine &Msg, bool IsVerbose=false)
 Same as above but derives the IR Value for the code region and the debug location from the Loop parameter L. More...
 
void emitOptimizationRemarkAnalysis (const char *PassName, Instruction *Inst, const Twine &Msg, bool IsVerbose=false)
 Same as above but derives the debug location and the code region from the debug location and the basic block of Inst, respectively. More...
 
void emitOptimizationRemarkMissedAndAnalysis (const char *PassName, Instruction *Inst, const Twine &MsgForMissedRemark, const Twine &MsgForAnalysisRemark, bool IsVerbose=false)
 This variant allows specifying what should be emitted for missed and analysis remarks in one call. More...
 
void emitOptimizationRemarkAnalysisFPCommute (const char *PassName, const DebugLoc &DLoc, const Value *V, const Twine &Msg)
 Emit an optimization analysis remark related to floating-point non-commutativity. More...
 
void emitOptimizationRemarkAnalysisAliasing (const char *PassName, const DebugLoc &DLoc, const Value *V, const Twine &Msg)
 Emit an optimization analysis remark related to pointer aliasing. More...
 
void emitOptimizationRemarkAnalysisAliasing (const char *PassName, Loop *L, const Twine &Msg)
 Same as above but derives the IR Value for the code region and the debug location from the Loop parameter L. More...
 
bool allowExtraAnalysis () 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 DiagnosticHotnessRequested is enabled in the LLVM context.

Definition at line 39 of file OptimizationDiagnosticInfo.h.

Constructor & Destructor Documentation

llvm::OptimizationRemarkEmitter::OptimizationRemarkEmitter ( Function F,
BlockFrequencyInfo BFI 
)
inline

Definition at line 41 of file OptimizationDiagnosticInfo.h.

OptimizationRemarkEmitter::OptimizationRemarkEmitter ( 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().getDiagnosticHotnessRequested() is on or not. If it's off the operation is free.

Whereas if DiagnosticHotnessRequested 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 OptimizationDiagnosticInfo.cpp.

References llvm::LoopInfoBase< N, M >::analyze(), llvm::BranchProbabilityInfo::calculate(), llvm::Function::getContext(), llvm::LLVMContext::getDiagnosticHotnessRequested(), and llvm::DominatorTreeBase< N >::recalculate().

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

Definition at line 57 of file OptimizationDiagnosticInfo.h.

Member Function Documentation

bool llvm::OptimizationRemarkEmitter::allowExtraAnalysis ( ) const
inline

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 204 of file OptimizationDiagnosticInfo.h.

References llvm::Function::getContext(), and llvm::LLVMContext::getDiagnosticsOutputFile().

void OptimizationRemarkEmitter::emit ( DiagnosticInfoOptimizationBase OptDiag)
void OptimizationRemarkEmitter::emitOptimizationRemark ( const char *  PassName,
const DebugLoc DLoc,
const Value V,
const Twine Msg 
)

Emit an optimization-applied message.

PassName is the name of the pass emitting the message. If -Rpass= is given and PassName matches the regular expression in -Rpass, then the remark will be emitted. Fn is the function triggering the remark, DLoc is the debug location where the diagnostic is generated. V is the IR Value that identifies the code region. Msg is the message string to use.

Definition at line 150 of file OptimizationDiagnosticInfo.cpp.

References llvm::LLVMContext::diagnose(), and llvm::Function::getContext().

Referenced by emitOptimizationRemark().

void OptimizationRemarkEmitter::emitOptimizationRemark ( const char *  PassName,
Loop L,
const Twine Msg 
)

Same as above but derives the IR Value for the code region and the debug location from the Loop parameter L.

Definition at line 158 of file OptimizationDiagnosticInfo.cpp.

References emitOptimizationRemark(), llvm::LoopBase< N, M >::getHeader(), and llvm::Loop::getStartLoc().

void llvm::OptimizationRemarkEmitter::emitOptimizationRemark ( const char *  PassName,
Instruction Inst,
const Twine Msg 
)
inline

Same as above but derives the debug location and the code region from the debug location and the basic block of Inst, respectively.

Definition at line 86 of file OptimizationDiagnosticInfo.h.

References emitOptimizationRemark(), llvm::Instruction::getDebugLoc(), and llvm::Instruction::getParent().

void OptimizationRemarkEmitter::emitOptimizationRemarkAnalysis ( const char *  PassName,
const DebugLoc DLoc,
const Value V,
const Twine Msg,
bool  IsVerbose = false 
)

Emit an optimization analysis remark message.

PassName is the name of the pass emitting the message. If -Rpass-analysis= is given and PassName matches the regular expression in -Rpass, then the remark will be emitted. DLoc is the debug location where the diagnostic is generated. V is the IR Value that identifies the code region. Msg is the message string to use. If IsVerbose is true, the message is considered verbose and will only be emitted when verbose output is turned on.

Definition at line 179 of file OptimizationDiagnosticInfo.cpp.

References llvm::LLVMContext::diagnose(), and llvm::Function::getContext().

Referenced by llvm::LoopAccessReport::emitAnalysis(), emitOptimizationRemarkAnalysis(), and emitOptimizationRemarkMissedAndAnalysis().

void OptimizationRemarkEmitter::emitOptimizationRemarkAnalysis ( const char *  PassName,
Loop L,
const Twine Msg,
bool  IsVerbose = false 
)

Same as above but derives the IR Value for the code region and the debug location from the Loop parameter L.

Definition at line 188 of file OptimizationDiagnosticInfo.cpp.

References emitOptimizationRemarkAnalysis(), llvm::LoopBase< N, M >::getHeader(), and llvm::Loop::getStartLoc().

void llvm::OptimizationRemarkEmitter::emitOptimizationRemarkAnalysis ( const char *  PassName,
Instruction Inst,
const Twine Msg,
bool  IsVerbose = false 
)
inline

Same as above but derives the debug location and the code region from the debug location and the basic block of Inst, respectively.

Definition at line 138 of file OptimizationDiagnosticInfo.h.

References emitOptimizationRemarkAnalysis(), llvm::Instruction::getDebugLoc(), and llvm::Instruction::getParent().

void OptimizationRemarkEmitter::emitOptimizationRemarkAnalysisAliasing ( const char *  PassName,
const DebugLoc DLoc,
const Value V,
const Twine Msg 
)

Emit an optimization analysis remark related to pointer aliasing.

PassName is the name of the pass emitting the message. If -Rpass-analysis= is given and PassName matches the regular expression in -Rpass, then the remark will be emitted. Fn is the function triggering the remark, DLoc is the debug location where the diagnostic is generated.V is the IR Value that identifies the code region. Msg is the message string to use.

Definition at line 202 of file OptimizationDiagnosticInfo.cpp.

References llvm::LLVMContext::diagnose(), and llvm::Function::getContext().

Referenced by emitOptimizationRemarkAnalysisAliasing().

void OptimizationRemarkEmitter::emitOptimizationRemarkAnalysisAliasing ( const char *  PassName,
Loop L,
const Twine Msg 
)

Same as above but derives the IR Value for the code region and the debug location from the Loop parameter L.

Definition at line 210 of file OptimizationDiagnosticInfo.cpp.

References emitOptimizationRemarkAnalysisAliasing(), llvm::LoopBase< N, M >::getHeader(), and llvm::Loop::getStartLoc().

void OptimizationRemarkEmitter::emitOptimizationRemarkAnalysisFPCommute ( const char *  PassName,
const DebugLoc DLoc,
const Value V,
const Twine Msg 
)

Emit an optimization analysis remark related to floating-point non-commutativity.

PassName is the name of the pass emitting the message. If -Rpass-analysis= is given and PassName matches the regular expression in -Rpass, then the remark will be emitted. Fn is the function triggering the remark, DLoc is the debug location where the diagnostic is generated.V is the IR Value that identifies the code region. Msg is the message string to use.

Definition at line 194 of file OptimizationDiagnosticInfo.cpp.

References llvm::LLVMContext::diagnose(), and llvm::Function::getContext().

void OptimizationRemarkEmitter::emitOptimizationRemarkMissed ( const char *  PassName,
const DebugLoc DLoc,
const Value V,
const Twine Msg,
bool  IsVerbose = false 
)

Emit an optimization-missed message.

PassName is the name of the pass emitting the message. If -Rpass-missed= is given and the name matches the regular expression in -Rpass, then the remark will be emitted. DLoc is the debug location where the diagnostic is generated. V is the IR Value that identifies the code region. Msg is the message string to use. If IsVerbose is true, the message is considered verbose and will only be emitted when verbose output is turned on.

Definition at line 164 of file OptimizationDiagnosticInfo.cpp.

References llvm::LLVMContext::diagnose(), and llvm::Function::getContext().

Referenced by emitOptimizationRemarkMissed(), and emitOptimizationRemarkMissedAndAnalysis().

void OptimizationRemarkEmitter::emitOptimizationRemarkMissed ( const char *  PassName,
Loop L,
const Twine Msg,
bool  IsVerbose = false 
)

Same as above but derives the IR Value for the code region and the debug location from the Loop parameter L.

Definition at line 173 of file OptimizationDiagnosticInfo.cpp.

References emitOptimizationRemarkMissed(), llvm::LoopBase< N, M >::getHeader(), and llvm::Loop::getStartLoc().

void llvm::OptimizationRemarkEmitter::emitOptimizationRemarkMissed ( const char *  PassName,
Instruction Inst,
const Twine Msg,
bool  IsVerbose = false 
)
inline

Same as above but derives the debug location and the code region from the debug location and the basic block of Inst, respectively.

Definition at line 112 of file OptimizationDiagnosticInfo.h.

References emitOptimizationRemarkMissed(), llvm::Instruction::getDebugLoc(), and llvm::Instruction::getParent().

void llvm::OptimizationRemarkEmitter::emitOptimizationRemarkMissedAndAnalysis ( const char *  PassName,
Instruction Inst,
const Twine MsgForMissedRemark,
const Twine MsgForAnalysisRemark,
bool  IsVerbose = false 
)
inline

This variant allows specifying what should be emitted for missed and analysis remarks in one call.

PassName is the name of the pass emitting the message. If -Rpass-missed= is given and PassName matches the regular expression, MsgForMissedRemark is emitted.

If -Rpass-analysis= is given and PassName matches the regular expression, MsgForAnalysisRemark is emitted.

The debug location and the code region is derived from Inst. If IsVerbose is true, the message is considered verbose and will only be emitted when verbose output is turned on.

Definition at line 158 of file OptimizationDiagnosticInfo.h.

References emitOptimizationRemarkAnalysis(), and emitOptimizationRemarkMissed().

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

Definition at line 60 of file OptimizationDiagnosticInfo.h.


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