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

Common features for diagnostics dealing with optimization remarks that are used by both IR and MIR passes. More...

#include "llvm/IR/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 DiagnosticLocation &Loc)
 PassName is the name of the pass emitting this diagnostic. More...
 
DiagnosticInfoOptimizationBase & operator<< (StringRef S)
 
DiagnosticInfoOptimizationBase & operator<< (Argument A)
 
DiagnosticInfoOptimizationBase & operator<< (setIsVerbose V)
 
DiagnosticInfoOptimizationBase & operator<< (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)
 
bool isVerbose () const
 
bool isPassed () const
 
bool isMissed () const
 
bool isAnalysis () const
 
- Public Member Functions inherited from llvm::DiagnosticInfoWithLocationBase
 DiagnosticInfoWithLocationBase (enum DiagnosticKind Kind, enum DiagnosticSeverity Severity, const Function &Fn, const DiagnosticLocation &Loc)
 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 Function & getFunction () const
 
DiagnosticLocation getLocation () 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)
 

Protected Attributes

const char * PassName
 Name of the pass that triggers this report. More...
 
StringRef RemarkName
 Textual identifier for the remark (single-word, camel-case). More...
 
Optional< uint64_t > Hotness
 If profile information is available, this is the number of times the corresponding code was executed in a profile instrumentation run. More...
 
SmallVector< Argument, 4 > Args
 Arguments collected via the streaming interface. More...
 
bool IsVerbose = false
 The remark is expected to be noisy. More...
 
int FirstExtraArgIndex = -1
 If positive, the index of the first argument that only appear in the optimization records and not in the remark printed in the compiler output. More...
 

Friends

struct yaml::MappingTraits< DiagnosticInfoOptimizationBase * >
 

Detailed Description

Common features for diagnostics dealing with optimization remarks that are used by both IR and MIR passes.

Definition at line 400 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 DiagnosticLocation &  Loc 
)
inline

PassName is the name of the pass emitting this diagnostic.

RemarkName is a textual identifier for the remark (single-word, camel-case). Fn is the function where the diagnostic is being emitted. Loc is the location information to use in the diagnostic. If line table information is available, the diagnostic will include the source code location.

Definition at line 433 of file DiagnosticInfo.h.

Member Function Documentation

static bool llvm::DiagnosticInfoOptimizationBase::classof ( const DiagnosticInfo *  DI)
inlinestatic
Optional<uint64_t> llvm::DiagnosticInfoOptimizationBase::getHotness ( ) const
inline

Definition at line 458 of file DiagnosticInfo.h.

References Hotness.

std::string DiagnosticInfoOptimizationBase::getMsg ( ) const
StringRef llvm::DiagnosticInfoOptimizationBase::getPassName ( ) const
inline
bool llvm::DiagnosticInfoOptimizationBase::isAnalysis ( ) 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, llvm::OptimizationRemark, llvm::MachineOptimizationRemarkAnalysis, llvm::MachineOptimizationRemarkMissed, and llvm::MachineOptimizationRemark.

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

Definition at line 461 of file DiagnosticInfo.h.

References IsVerbose.

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

Definition at line 381 of file DiagnosticInfo.cpp.

References Args.

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

Definition at line 387 of file DiagnosticInfo.cpp.

References Args.

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

Definition at line 393 of file DiagnosticInfo.cpp.

References IsVerbose.

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

Definition at line 399 of file DiagnosticInfo.cpp.

References Args, and FirstExtraArgIndex.

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

Definition at line 459 of file DiagnosticInfo.h.

References H, and Hotness.

Friends And Related Function Documentation

Definition at line 511 of file DiagnosticInfo.h.

Member Data Documentation

SmallVector<Argument, 4> llvm::DiagnosticInfoOptimizationBase::Args
protected
int llvm::DiagnosticInfoOptimizationBase::FirstExtraArgIndex = -1
protected

If positive, the index of the first argument that only appear in the optimization records and not in the remark printed in the compiler output.

Definition at line 509 of file DiagnosticInfo.h.

Referenced by getMsg(), and operator<<().

Optional<uint64_t> llvm::DiagnosticInfoOptimizationBase::Hotness
protected

If profile information is available, this is the number of times the corresponding code was executed in a profile instrumentation run.

Definition at line 498 of file DiagnosticInfo.h.

Referenced by getHotness(), llvm::yaml::MappingTraits< DiagnosticInfoOptimizationBase * >::mapping(), print(), and setHotness().

bool llvm::DiagnosticInfoOptimizationBase::IsVerbose = false
protected

The remark is expected to be noisy.

Definition at line 504 of file DiagnosticInfo.h.

Referenced by isVerbose(), and operator<<().

const char* llvm::DiagnosticInfoOptimizationBase::PassName
protected

Name of the pass that triggers this report.

If this matches the regular expression given in -Rpass=regexp, then the remark will be emitted.

Definition at line 489 of file DiagnosticInfo.h.

Referenced by getPassName(), and llvm::yaml::MappingTraits< DiagnosticInfoOptimizationBase * >::mapping().

StringRef llvm::DiagnosticInfoOptimizationBase::RemarkName
protected

Textual identifier for the remark (single-word, camel-case).

Can be used by external tools reading the YAML output file for optimization remarks to identify the remark.

Definition at line 494 of file DiagnosticInfo.h.

Referenced by llvm::yaml::MappingTraits< DiagnosticInfoOptimizationBase * >::mapping().


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