LLVM  4.0.0
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
llvm::DiagnosticInfoOptimizationBase Class Referenceabstract

Common features for diagnostics dealing with optimization remarks. More...

#include <DiagnosticInfo.h>

Inheritance diagram for llvm::DiagnosticInfoOptimizationBase:
[legend]
Collaboration diagram for llvm::DiagnosticInfoOptimizationBase:
[legend]

Classes

struct  Argument
 Used in the streaming interface as the general argument type. More...
 
struct  setExtraArgs
 When an instance of this is inserted into the stream, the arguments following will not appear in the remark printed in the compiler output (-Rpass) but only in the optimization record file (-fsave-optimization-record). More...
 
struct  setIsVerbose
 Used to set IsVerbose via the stream interface. More...
 

Public Member Functions

 DiagnosticInfoOptimizationBase (enum DiagnosticKind Kind, enum DiagnosticSeverity Severity, const char *PassName, StringRef RemarkName, const Function &Fn, const DebugLoc &DLoc, Value *CodeRegion=nullptr)
 PassName is the name of the pass emitting this diagnostic. More...
 
 DiagnosticInfoOptimizationBase (const char *PassName, StringRef Prepend, const DiagnosticInfoOptimizationBase &Orig)
 This is ctor variant allows a pass to build an optimization remark from an existing remark. More...
 
 DiagnosticInfoOptimizationBase (enum DiagnosticKind Kind, enum DiagnosticSeverity Severity, const char *PassName, const Function &Fn, const DebugLoc &DLoc, const Twine &Msg, Optional< uint64_t > Hotness=None)
 Legacy interface. More...
 
DiagnosticInfoOptimizationBaseoperator<< (StringRef S)
 
DiagnosticInfoOptimizationBaseoperator<< (Argument A)
 
DiagnosticInfoOptimizationBaseoperator<< (setIsVerbose V)
 
DiagnosticInfoOptimizationBaseoperator<< (setExtraArgs EA)
 
void print (DiagnosticPrinter &DP) const override
 
virtual bool isEnabled () const =0
 Return true if this optimization remark is enabled by one of of the LLVM command line flags (-pass-remarks, -pass-remarks-missed, or -pass-remarks-analysis). More...
 
StringRef getPassName () const
 
std::string getMsg () const
 
Optional< uint64_t > getHotness () const
 
void setHotness (Optional< uint64_t > H)
 
ValuegetCodeRegion () const
 
bool isVerbose () const
 
- Public Member Functions inherited from llvm::DiagnosticInfoWithDebugLocBase
 DiagnosticInfoWithDebugLocBase (enum DiagnosticKind Kind, enum DiagnosticSeverity Severity, const Function &Fn, const DebugLoc &DLoc)
 Fn is the function where the diagnostic is being emitted. More...
 
bool isLocationAvailable () const
 Return true if location information is available for this diagnostic. More...
 
const std::string getLocationStr () const
 Return a string with the location information for this diagnostic in the format "file:line:col". More...
 
void getLocation (StringRef *Filename, unsigned *Line, unsigned *Column) const
 Return location information for this diagnostic in three parts: the source file name, line number and column. More...
 
const FunctiongetFunction () const
 
const DebugLocgetDebugLoc () const
 
- Public Member Functions inherited from llvm::DiagnosticInfo
 DiagnosticInfo (int Kind, DiagnosticSeverity Severity)
 
virtual ~DiagnosticInfo ()=default
 
int getKind () const
 
DiagnosticSeverity getSeverity () const
 

Static Public Member Functions

static bool classof (const DiagnosticInfo *DI)
 

Friends

struct yaml::MappingTraits< DiagnosticInfoOptimizationBase * >
 

Detailed Description

Common features for diagnostics dealing with optimization remarks.

Definition at line 380 of file DiagnosticInfo.h.

Constructor & Destructor Documentation

llvm::DiagnosticInfoOptimizationBase::DiagnosticInfoOptimizationBase ( enum DiagnosticKind  Kind,
enum DiagnosticSeverity  Severity,
const char *  PassName,
StringRef  RemarkName,
const Function Fn,
const DebugLoc DLoc,
Value CodeRegion = nullptr 
)
inline

PassName is the name of the pass emitting this diagnostic.

RemarkName is a textual identifier for the remark. Fn is the function where the diagnostic is being emitted. DLoc is the location information to use in the diagnostic. If line table information is available, the diagnostic will include the source code location. CodeRegion is IR value (currently basic block) that the optimization operates on. This is currently used to provide run-time hotness information with PGO.

Definition at line 414 of file DiagnosticInfo.h.

llvm::DiagnosticInfoOptimizationBase::DiagnosticInfoOptimizationBase ( const char *  PassName,
StringRef  Prepend,
const DiagnosticInfoOptimizationBase Orig 
)
inline

This is ctor variant allows a pass to build an optimization remark from an existing remark.

This is useful when a transformation pass (e.g LV) wants to emit a remark (Orig) generated by one of its analyses (e.g. LAA) as its own analysis remark. The string Prepend will be emitted before the original message.

Definition at line 429 of file DiagnosticInfo.h.

llvm::DiagnosticInfoOptimizationBase::DiagnosticInfoOptimizationBase ( enum DiagnosticKind  Kind,
enum DiagnosticSeverity  Severity,
const char *  PassName,
const Function Fn,
const DebugLoc DLoc,
const Twine Msg,
Optional< uint64_t >  Hotness = None 
)
inline

Legacy interface.

PassName is the name of the pass emitting this diagnostic. Fn is the function where the diagnostic is being emitted. DLoc is the location information to use in the diagnostic. If line table information is available, the diagnostic will include the source code location. Msg is the message to show. Note that this class does not copy this message, so this reference must be valid for the whole life time of the diagnostic.

Definition at line 448 of file DiagnosticInfo.h.

References llvm::Twine::str().

Member Function Documentation

static bool llvm::DiagnosticInfoOptimizationBase::classof ( const DiagnosticInfo DI)
inlinestatic
Value* llvm::DiagnosticInfoOptimizationBase::getCodeRegion ( ) const
inline

Definition at line 478 of file DiagnosticInfo.h.

Optional<uint64_t> llvm::DiagnosticInfoOptimizationBase::getHotness ( ) const
inline

Definition at line 475 of file DiagnosticInfo.h.

std::string DiagnosticInfoOptimizationBase::getMsg ( ) const

Definition at line 379 of file DiagnosticInfo.cpp.

References llvm::make_range(), and llvm::raw_string_ostream::str().

Referenced by print().

StringRef llvm::DiagnosticInfoOptimizationBase::getPassName ( ) const
inline
virtual bool llvm::DiagnosticInfoOptimizationBase::isEnabled ( ) const
pure virtual

Return true if this optimization remark is enabled by one of of the LLVM command line flags (-pass-remarks, -pass-remarks-missed, or -pass-remarks-analysis).

Note that this only handles the LLVM flags. We cannot access Clang flags from here (they are handled in BackendConsumer::OptimizationRemarkHandler).

Implemented in llvm::DiagnosticInfoOptimizationFailure, llvm::OptimizationRemarkAnalysis, llvm::OptimizationRemarkMissed, and llvm::OptimizationRemark.

bool llvm::DiagnosticInfoOptimizationBase::isVerbose ( ) const
inline

Definition at line 480 of file DiagnosticInfo.h.

Referenced by llvm::OptimizationRemarkEmitter::emit().

DiagnosticInfoOptimizationBase & DiagnosticInfoOptimizationBase::operator<< ( StringRef  S)

Definition at line 356 of file DiagnosticInfo.cpp.

DiagnosticInfoOptimizationBase & DiagnosticInfoOptimizationBase::operator<< ( Argument  A)

Definition at line 362 of file DiagnosticInfo.cpp.

DiagnosticInfoOptimizationBase & DiagnosticInfoOptimizationBase::operator<< ( setIsVerbose  V)

Definition at line 368 of file DiagnosticInfo.cpp.

DiagnosticInfoOptimizationBase & DiagnosticInfoOptimizationBase::operator<< ( setExtraArgs  EA)

Definition at line 374 of file DiagnosticInfo.cpp.

void DiagnosticInfoOptimizationBase::print ( DiagnosticPrinter DP) const
overridevirtual
void llvm::DiagnosticInfoOptimizationBase::setHotness ( Optional< uint64_t >  H)
inline

Definition at line 476 of file DiagnosticInfo.h.

References H.

Friends And Related Function Documentation

Definition at line 516 of file DiagnosticInfo.h.


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