LLVM 20.0.0git
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
llvm::OptimizationRemarkAnalysis Class Reference

Diagnostic information for optimization analysis remarks. More...

#include "llvm/IR/DiagnosticInfo.h"

Inheritance diagram for llvm::OptimizationRemarkAnalysis:
Inheritance graph
[legend]

Public Member Functions

 OptimizationRemarkAnalysis (const char *PassName, StringRef RemarkName, const DiagnosticLocation &Loc, const Value *CodeRegion)
 PassName is the name of the pass emitting this diagnostic.
 
 OptimizationRemarkAnalysis (const char *PassName, StringRef Prepend, const OptimizationRemarkAnalysis &Orig)
 This is ctor variant allows a pass to build an optimization remark from an existing remark.
 
 OptimizationRemarkAnalysis (const char *PassName, StringRef RemarkName, const Instruction *Inst)
 Same as above but Inst is used to derive code region and debug location.
 
 OptimizationRemarkAnalysis (const char *PassName, StringRef RemarkName, const Function *F)
 Same as above but F is used to derive code region and debug location.
 
bool isEnabled () const override
 
bool shouldAlwaysPrint () const
 
- Public Member Functions inherited from llvm::DiagnosticInfoIROptimization
 DiagnosticInfoIROptimization (enum DiagnosticKind Kind, enum DiagnosticSeverity Severity, const char *PassName, StringRef RemarkName, const Function &Fn, const DiagnosticLocation &Loc, const Value *CodeRegion=nullptr)
 PassName is the name of the pass emitting this diagnostic.
 
 DiagnosticInfoIROptimization (const char *PassName, StringRef Prepend, const DiagnosticInfoIROptimization &Orig)
 This is ctor variant allows a pass to build an optimization remark from an existing remark.
 
 DiagnosticInfoIROptimization (enum DiagnosticKind Kind, enum DiagnosticSeverity Severity, const char *PassName, const Function &Fn, const DiagnosticLocation &Loc, const Twine &Msg)
 Legacy interface.
 
const ValuegetCodeRegion () const
 
- Public Member Functions inherited from llvm::DiagnosticInfoOptimizationBase
 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.
 
void insert (StringRef S)
 
void insert (Argument A)
 
void insert (setIsVerbose V)
 
void insert (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).
 
StringRef getPassName () const
 
StringRef getRemarkName () const
 
std::string getMsg () const
 
std::optional< uint64_tgetHotness () const
 
void setHotness (std::optional< uint64_t > H)
 
bool isVerbose () const
 
ArrayRef< ArgumentgetArgs () 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.
 
bool isLocationAvailable () const
 Return true if location information is available for this diagnostic.
 
std::string getLocationStr () const
 Return a string with the location information for this diagnostic in the format "file:line:col".
 
void getLocation (StringRef &RelativePath, unsigned &Line, unsigned &Column) const
 Return location information for this diagnostic in three parts: the relative source file path, line number and column.
 
std::string getAbsolutePath () const
 Return the absolute path tot the file.
 
const FunctiongetFunction () 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
 
virtual void print (DiagnosticPrinter &DP) const =0
 Print using the given DP a user-friendly message.
 

Static Public Member Functions

static bool classof (const DiagnosticInfo *DI)
 
- Static Public Member Functions inherited from llvm::DiagnosticInfoIROptimization
static bool classof (const DiagnosticInfo *DI)
 
- Static Public Member Functions inherited from llvm::DiagnosticInfoOptimizationBase
static bool classof (const DiagnosticInfo *DI)
 

Static Public Attributes

static const charAlwaysPrint = ""
 

Protected Member Functions

 OptimizationRemarkAnalysis (enum DiagnosticKind Kind, const char *PassName, const Function &Fn, const DiagnosticLocation &Loc, const Twine &Msg)
 
 OptimizationRemarkAnalysis (enum DiagnosticKind Kind, const char *PassName, StringRef RemarkName, const DiagnosticLocation &Loc, const Value *CodeRegion)
 

Additional Inherited Members

- Protected Attributes inherited from llvm::DiagnosticInfoOptimizationBase
const charPassName
 Name of the pass that triggers this report.
 
StringRef RemarkName
 Textual identifier for the remark (single-word, camel-case).
 
std::optional< uint64_tHotness
 If profile information is available, this is the number of times the corresponding code was executed in a profile instrumentation run.
 
SmallVector< Argument, 4 > Args
 Arguments collected via the streaming interface.
 
bool IsVerbose = false
 The remark is expected to be noisy.
 
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.
 

Detailed Description

Diagnostic information for optimization analysis remarks.

Definition at line 780 of file DiagnosticInfo.h.

Constructor & Destructor Documentation

◆ OptimizationRemarkAnalysis() [1/6]

OptimizationRemarkAnalysis::OptimizationRemarkAnalysis ( const char PassName,
StringRef  RemarkName,
const DiagnosticLocation Loc,
const Value CodeRegion 
)

PassName is the name of the pass emitting this diagnostic.

If this name matches the regular expression given in -Rpass-analysis=, then the diagnostic will be emitted. RemarkName is a textual identifier for the remark (single-word, camel-case). Loc is the debug location and CodeRegion is the region that the optimization operates on (currently only block is supported).

Definition at line 312 of file DiagnosticInfo.cpp.

◆ OptimizationRemarkAnalysis() [2/6]

llvm::OptimizationRemarkAnalysis::OptimizationRemarkAnalysis ( const char PassName,
StringRef  Prepend,
const OptimizationRemarkAnalysis 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 799 of file DiagnosticInfo.h.

◆ OptimizationRemarkAnalysis() [3/6]

OptimizationRemarkAnalysis::OptimizationRemarkAnalysis ( const char PassName,
StringRef  RemarkName,
const Instruction Inst 
)

Same as above but Inst is used to derive code region and debug location.

Definition at line 319 of file DiagnosticInfo.cpp.

◆ OptimizationRemarkAnalysis() [4/6]

OptimizationRemarkAnalysis::OptimizationRemarkAnalysis ( const char PassName,
StringRef  RemarkName,
const Function F 
)

Same as above but F is used to derive code region and debug location.

Definition at line 334 of file DiagnosticInfo.cpp.

◆ OptimizationRemarkAnalysis() [5/6]

llvm::OptimizationRemarkAnalysis::OptimizationRemarkAnalysis ( enum DiagnosticKind  Kind,
const char PassName,
const Function Fn,
const DiagnosticLocation Loc,
const Twine Msg 
)
inlineprotected

Definition at line 825 of file DiagnosticInfo.h.

◆ OptimizationRemarkAnalysis() [6/6]

OptimizationRemarkAnalysis::OptimizationRemarkAnalysis ( enum DiagnosticKind  Kind,
const char PassName,
StringRef  RemarkName,
const DiagnosticLocation Loc,
const Value CodeRegion 
)
protected

Definition at line 327 of file DiagnosticInfo.cpp.

Member Function Documentation

◆ classof()

static bool llvm::OptimizationRemarkAnalysis::classof ( const DiagnosticInfo DI)
inlinestatic

◆ isEnabled()

bool OptimizationRemarkAnalysis::isEnabled ( ) const
overridevirtual

◆ shouldAlwaysPrint()

bool llvm::OptimizationRemarkAnalysis::shouldAlwaysPrint ( ) const
inline

Definition at line 822 of file DiagnosticInfo.h.

References AlwaysPrint, and llvm::DiagnosticInfoOptimizationBase::getPassName().

Referenced by isEnabled().

Member Data Documentation

◆ AlwaysPrint

const char * OptimizationRemarkAnalysis::AlwaysPrint = ""
static

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