LLVM 22.0.0git
|
Common features for diagnostics dealing with optimization remarks that are used by both IR and MIR passes. More...
#include "llvm/IR/DiagnosticInfo.h"
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. | |
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_t > | getHotness () const |
void | setHotness (std::optional< uint64_t > H) |
bool | isVerbose () const |
ArrayRef< Argument > | getArgs () 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 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. | |
StringRef | RemarkName |
Textual identifier for the remark (single-word, CamelCase). | |
std::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. | |
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. |
Common features for diagnostics dealing with optimization remarks that are used by both IR and MIR passes.
Definition at line 522 of file DiagnosticInfo.h.
|
inline |
PassName
is the name of the pass emitting this diagnostic.
RemarkName
is a textual identifier for the remark (single-word, CamelCase). 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 566 of file DiagnosticInfo.h.
References llvm::DiagnosticInfoWithLocationBase::DiagnosticInfoWithLocationBase(), PassName, and RemarkName.
Referenced by llvm::DiagnosticInfoIROptimization::DiagnosticInfoIROptimization(), llvm::DiagnosticInfoIROptimization::DiagnosticInfoIROptimization(), llvm::DiagnosticInfoIROptimization::DiagnosticInfoIROptimization(), and llvm::DiagnosticInfoMIROptimization::DiagnosticInfoMIROptimization().
|
inlinestatic |
Definition at line 599 of file DiagnosticInfo.h.
References llvm::DK_FirstMachineRemark, llvm::DK_FirstRemark, llvm::DK_LastMachineRemark, llvm::DK_LastRemark, and llvm::DiagnosticInfo::getKind().
Definition at line 597 of file DiagnosticInfo.h.
References Args.
|
inline |
Definition at line 592 of file DiagnosticInfo.h.
References Hotness.
Referenced by llvm::OptimizationRemarkEmitter::emit().
std::string DiagnosticInfoOptimizationBase::getMsg | ( | ) | const |
Definition at line 441 of file DiagnosticInfo.cpp.
References Args, FirstExtraArgIndex, and llvm::make_range().
Referenced by EmitAndPrintRemark(), and print().
|
inline |
Definition at line 589 of file DiagnosticInfo.h.
References PassName.
Referenced by llvm::LLVMRemarkStreamer::emit(), llvm::MachineOptimizationRemark::isEnabled(), llvm::MachineOptimizationRemarkAnalysis::isEnabled(), llvm::MachineOptimizationRemarkMissed::isEnabled(), llvm::OptimizationRemark::isEnabled(), llvm::OptimizationRemarkAnalysis::isEnabled(), llvm::OptimizationRemarkMissed::isEnabled(), and llvm::OptimizationRemarkAnalysis::shouldAlwaysPrint().
|
inline |
Definition at line 590 of file DiagnosticInfo.h.
References RemarkName.
void DiagnosticInfoOptimizationBase::insert | ( | Argument | A | ) |
Definition at line 429 of file DiagnosticInfo.cpp.
void DiagnosticInfoOptimizationBase::insert | ( | setExtraArgs | EA | ) |
Definition at line 437 of file DiagnosticInfo.cpp.
References Args, and FirstExtraArgIndex.
void DiagnosticInfoOptimizationBase::insert | ( | setIsVerbose | V | ) |
Definition at line 433 of file DiagnosticInfo.cpp.
References IsVerbose.
void DiagnosticInfoOptimizationBase::insert | ( | StringRef | S | ) |
Definition at line 425 of file DiagnosticInfo.cpp.
References Args.
|
inline |
Definition at line 616 of file DiagnosticInfo.h.
References llvm::DK_MachineOptimizationRemarkAnalysis, llvm::DK_OptimizationRemarkAnalysis, and llvm::DiagnosticInfo::getKind().
|
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::MachineOptimizationRemark, llvm::MachineOptimizationRemarkAnalysis, llvm::MachineOptimizationRemarkMissed, llvm::OptimizationRemark, llvm::OptimizationRemarkAnalysis, and llvm::OptimizationRemarkMissed.
|
inline |
Definition at line 611 of file DiagnosticInfo.h.
References llvm::DK_MachineOptimizationRemarkMissed, llvm::DK_OptimizationRemarkMissed, and llvm::DiagnosticInfo::getKind().
|
inline |
Definition at line 606 of file DiagnosticInfo.h.
References llvm::DK_MachineOptimizationRemark, llvm::DK_OptimizationRemark, and llvm::DiagnosticInfo::getKind().
|
inline |
Definition at line 595 of file DiagnosticInfo.h.
References IsVerbose.
|
overridevirtual |
Implements llvm::DiagnosticInfo.
Definition at line 286 of file DiagnosticInfo.cpp.
References llvm::DiagnosticInfoWithLocationBase::getLocationStr(), getMsg(), and Hotness.
|
inline |
Definition at line 593 of file DiagnosticInfo.h.
|
protected |
Arguments collected via the streaming interface.
Definition at line 637 of file DiagnosticInfo.h.
Referenced by llvm::DiagnosticInfoIROptimization::DiagnosticInfoIROptimization(), getArgs(), getMsg(), insert(), insert(), and insert().
|
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 645 of file DiagnosticInfo.h.
|
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 634 of file DiagnosticInfo.h.
Referenced by getHotness(), print(), and setHotness().
|
protected |
The remark is expected to be noisy.
Definition at line 640 of file DiagnosticInfo.h.
Referenced by insert(), and isVerbose().
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 625 of file DiagnosticInfo.h.
Referenced by llvm::DiagnosticInfoIROptimization::DiagnosticInfoIROptimization(), llvm::DiagnosticInfoIROptimization::DiagnosticInfoIROptimization(), llvm::DiagnosticInfoIROptimization::DiagnosticInfoIROptimization(), llvm::DiagnosticInfoMIROptimization::DiagnosticInfoMIROptimization(), DiagnosticInfoOptimizationBase(), llvm::DiagnosticInfoOptimizationFailure::DiagnosticInfoOptimizationFailure(), getPassName(), llvm::MachineOptimizationRemark::MachineOptimizationRemark(), llvm::MachineOptimizationRemarkAnalysis::MachineOptimizationRemarkAnalysis(), llvm::MachineOptimizationRemarkAnalysis::MachineOptimizationRemarkAnalysis(), llvm::MachineOptimizationRemarkMissed::MachineOptimizationRemarkMissed(), llvm::OptimizationRemark::OptimizationRemark(), llvm::OptimizationRemark::OptimizationRemark(), llvm::OptimizationRemark::OptimizationRemark(), llvm::OptimizationRemarkAnalysis::OptimizationRemarkAnalysis(), llvm::OptimizationRemarkAnalysis::OptimizationRemarkAnalysis(), llvm::OptimizationRemarkAnalysis::OptimizationRemarkAnalysis(), llvm::OptimizationRemarkAnalysis::OptimizationRemarkAnalysis(), llvm::OptimizationRemarkAnalysis::OptimizationRemarkAnalysis(), llvm::OptimizationRemarkAnalysis::OptimizationRemarkAnalysis(), llvm::OptimizationRemarkAnalysisAliasing::OptimizationRemarkAnalysisAliasing(), llvm::OptimizationRemarkAnalysisFPCommute::OptimizationRemarkAnalysisFPCommute(), llvm::OptimizationRemarkMissed::OptimizationRemarkMissed(), llvm::OptimizationRemarkMissed::OptimizationRemarkMissed(), and llvm::OptimizationRemarkMissed::OptimizationRemarkMissed().
|
protected |
Textual identifier for the remark (single-word, CamelCase).
Can be used by external tools reading the output file for optimization remarks to identify the remark.
Definition at line 630 of file DiagnosticInfo.h.
Referenced by llvm::DiagnosticInfoIROptimization::DiagnosticInfoIROptimization(), llvm::DiagnosticInfoIROptimization::DiagnosticInfoIROptimization(), llvm::DiagnosticInfoMIROptimization::DiagnosticInfoMIROptimization(), DiagnosticInfoOptimizationBase(), llvm::DiagnosticInfoOptimizationFailure::DiagnosticInfoOptimizationFailure(), getRemarkName(), llvm::MachineOptimizationRemark::MachineOptimizationRemark(), llvm::MachineOptimizationRemarkAnalysis::MachineOptimizationRemarkAnalysis(), llvm::MachineOptimizationRemarkAnalysis::MachineOptimizationRemarkAnalysis(), llvm::MachineOptimizationRemarkMissed::MachineOptimizationRemarkMissed(), llvm::OptimizationRemark::OptimizationRemark(), llvm::OptimizationRemark::OptimizationRemark(), llvm::OptimizationRemark::OptimizationRemark(), llvm::OptimizationRemarkAnalysis::OptimizationRemarkAnalysis(), llvm::OptimizationRemarkAnalysis::OptimizationRemarkAnalysis(), llvm::OptimizationRemarkAnalysis::OptimizationRemarkAnalysis(), llvm::OptimizationRemarkAnalysis::OptimizationRemarkAnalysis(), llvm::OptimizationRemarkAnalysisAliasing::OptimizationRemarkAnalysisAliasing(), llvm::OptimizationRemarkAnalysisFPCommute::OptimizationRemarkAnalysisFPCommute(), llvm::OptimizationRemarkMissed::OptimizationRemarkMissed(), llvm::OptimizationRemarkMissed::OptimizationRemarkMissed(), and llvm::OptimizationRemarkMissed::OptimizationRemarkMissed().