15 #ifndef LLVM_IR_DIAGNOSTICINFO_H
16 #define LLVM_IR_DIAGNOSTICINFO_H
35 class DiagnosticPrinter;
106 : Kind(Kind), Severity(Severity) {}
129 unsigned LocCookie = 0;
180 const char *ResourceName;
183 uint64_t ResourceSize;
186 uint64_t ResourceLimit;
192 const char *ResourceName,
193 uint64_t ResourceSize,
196 uint64_t ResourceLimit = 0)
199 ResourceName(ResourceName),
200 ResourceSize(ResourceSize),
201 ResourceLimit(ResourceLimit) {}
222 uint64_t StackLimit = 0)
241 unsigned MetadataVersion;
249 MetadataVersion(MetadataVersion) {}
291 LineNum(LineNum), Msg(Msg) {}
317 unsigned LineNum = 0;
342 const char *FileName;
439 PassName(PassName), RemarkName(RemarkName) {}
457 std::string
getMsg()
const;
531 const Value *CodeRegion =
nullptr)
534 CodeRegion(CodeRegion) {}
550 std::copy(Orig.
Args.begin(), Orig.
Args.end(), std::back_inserter(
Args));
578 const Value *CodeRegion;
629 const DiagnosticLocation &Loc,
644 const Value *CodeRegion);
673 PassName, Fn, Loc, Msg) {}
676 const char *PassName,
678 const DiagnosticLocation &Loc,
693 const Value *CodeRegion);
735 const Value *CodeRegion);
750 PassName, Fn, Loc, Msg) {}
753 const char *PassName,
755 const DiagnosticLocation &Loc,
773 const Value *CodeRegion)
775 PassName, RemarkName, Loc, CodeRegion) {}
797 PassName, Fn, Loc, Msg) {}
800 LLVMContext &Ctx,
const char *
PassName,
const Function &Fn,
801 const DiagnosticLocation &Loc,
const Twine &Msg);
817 const Value *CodeRegion)
819 PassName, RemarkName, Loc, CodeRegion) {}
841 PassName, Fn, Loc, Msg) {}
844 LLVMContext &Ctx,
const char *
PassName,
const Function &Fn,
845 const DiagnosticLocation &Loc,
const Twine &Msg);
897 const Function &Fn,
const DiagnosticLocation &Loc,
910 const DiagnosticLocation &Loc,
923 const DiagnosticLocation &Loc,
936 const char *PassName,
938 const DiagnosticLocation &Loc,
951 const char *PassName,
953 const DiagnosticLocation &Loc,
969 nullptr, Fn, Loc, Msg) {}
978 const Value *CodeRegion);
1018 #endif // LLVM_IR_DIAGNOSTICINFO_H
const char * PassName
Name of the pass that triggers this report.
DiagnosticInfoSampleProfile(StringRef FileName, const Twine &Msg, DiagnosticSeverity Severity=DS_Error)
DiagnosticInfoISelFallback(const Function &Fn, DiagnosticSeverity Severity=DS_Warning)
Diagnostic information for ISel fallback path.
DiagnosticInfoSampleProfile(StringRef FileName, unsigned LineNum, const Twine &Msg, DiagnosticSeverity Severity=DS_Error)
DiagnosticKind
Defines the different supported kind of a diagnostic.
StringRef getFilename() const
This class represents an incoming formal argument to a Function.
Diagnostic information for unsupported feature in backend.
DiagnosticInfoResourceLimit(const Function &Fn, const char *ResourceName, uint64_t ResourceSize, DiagnosticSeverity Severity=DS_Warning, DiagnosticKind Kind=DK_ResourceLimit, uint64_t ResourceLimit=0)
The function that is concerned by this stack size diagnostic.
A Module instance is used to store all the information related to an LLVM module. ...
DiagnosticInfoInlineAsm(const Twine &MsgStr, DiagnosticSeverity Severity=DS_Error)
MsgStr is the message to be reported to the frontend.
Diagnostic information for the PGO profiler.
static bool classof(const DiagnosticInfo *DI)
DiagnosticInfoOptimizationBase & operator<<(StringRef S)
DiagnosticInfoMIRParser(DiagnosticSeverity Severity, const SMDiagnostic &Diagnostic)
Used to set IsVerbose via the stream interface.
Diagnostic information for machine IR parser.
uint64_t getResourceSize() const
DiagnosticLocation()=default
DiagnosticInfoInlineAsm(unsigned LocCookie, const Twine &MsgStr, DiagnosticSeverity Severity=DS_Error)
LocCookie if non-zero gives the line number for this report.
int FirstExtraArgIndex
If positive, the index of the first argument that only appear in the optimization records and not in ...
static bool classof(const DiagnosticInfo *DI)
void emitOptimizationRemarkAnalysisFPCommute(LLVMContext &Ctx, const char *PassName, const Function &Fn, const DiagnosticLocation &Loc, const Twine &Msg)
Legacy interface to emit an optimization analysis remark related to messages about floating-point non...
DiagnosticInfoWithLocationBase(enum DiagnosticKind Kind, enum DiagnosticSeverity Severity, const Function &Fn, const DiagnosticLocation &Loc)
Fn is the function where the diagnostic is being emitted.
StringRef getPassName() const
virtual ~DiagnosticInfo()=default
const Function & getFunction() const
bool isLocationAvailable() const
Return true if location information is available for this diagnostic.
const std::string getLocationStr() const
Return a string with the location information for this diagnostic in the format "file:line:col".
static bool classof(const DiagnosticInfo *DI)
std::string str() const
Return the twine contents as a std::string.
DiagnosticSeverity
Defines the different supported severity of a diagnostic.
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
DiagnosticInfoStackSize(const Function &Fn, uint64_t StackSize, DiagnosticSeverity Severity=DS_Warning, uint64_t StackLimit=0)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Argument(StringRef Key, bool B)
Diagnostic information for optimization failures.
Common features for diagnostics with an associated location.
uint64_t getStackLimit() const
Interface for custom diagnostic printing.
DiagnosticInfo(int Kind, DiagnosticSeverity Severity)
Diagnostic information for stack size etc.
This class should be specialized by any type that needs to be converted to/from a YAML mapping...
static bool classof(const DiagnosticInfo *DI)
DiagnosticInfoOptimizationBase::setExtraArgs setExtraArgs
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...
DiagnosticInfoOptimizationBase::setIsVerbose setIsVerbose
DiagnosticSeverity getSeverity() const
StringRef RemarkName
Textual identifier for the remark (single-word, camel-case).
uint64_t getResourceLimit() const
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.
DiagnosticInfoUnsupported(const Function &Fn, const Twine &Msg, const DiagnosticLocation &Loc=DiagnosticLocation(), DiagnosticSeverity Severity=DS_Error)
Fn is the function where the diagnostic is being emitted.
const Function & getFunction() const
SmallVector< Argument, 4 > Args
Arguments collected via the streaming interface.
void emitOptimizationRemark(LLVMContext &Ctx, const char *PassName, const Function &Fn, const DiagnosticLocation &Loc, const Twine &Msg)
Legacy interface to emit an optimization-applied message.
void emitOptimizationRemarkAnalysisAliasing(LLVMContext &Ctx, const char *PassName, const Function &Fn, const DiagnosticLocation &Loc, const Twine &Msg)
Legacy interface to emit an optimization analysis remark related to messages about pointer aliasing...
This is the base abstract class for diagnostic reporting in the backend.
The instances of the Type class are immutable: once they are created, they are never changed...
const Twine & getMsg() const
static bool classof(const DiagnosticInfo *DI)
DiagnosticInfoPGOProfile(const char *FileName, const Twine &Msg, DiagnosticSeverity Severity=DS_Error)
Common features for diagnostics dealing with optimization remarks that are used by IR passes...
const Twine & getMsg() const
const char * getFileName() const
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.
unsigned getColumn() const
const Instruction * getInstruction() const
Used in the streaming interface as the general argument type.
static bool classof(const DiagnosticInfo *DI)
struct LLVMOpaqueDiagnosticInfo * LLVMDiagnosticInfoRef
Diagnostic information for inline asm reporting.
void emitOptimizationRemarkMissed(LLVMContext &Ctx, const char *PassName, const Function &Fn, const DiagnosticLocation &Loc, const Twine &Msg)
Legacy interface to emit an optimization-missed message.
virtual void print(DiagnosticPrinter &DP) const =0
Print using the given DP a user-friendly message.
bool IsVerbose
The remark is expected to be noisy.
void print(DiagnosticPrinter &DP) const override
Print using the given DP a user-friendly message.
DiagnosticLocation getLocation() const
unsigned getLocCookie() const
static bool classof(const DiagnosticInfo *DI)
Common features for diagnostics dealing with optimization remarks that are used by both IR and MIR pa...
static bool classof(const DiagnosticInfo *DI)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
unsigned getLineNum() const
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
Optional< uint64_t > getHotness() const
int getNextAvailablePluginDiagnosticKind()
Get the next available kind ID for a plugin diagnostic.
void print(DiagnosticPrinter &DP) const override
void print(DiagnosticPrinter &DP) const override
Print using the given DP a user-friendly message.
std::string getMsg() const
const char * getResourceName() const
void print(DiagnosticPrinter &DP) const override
const Twine & getMessage() const
DiagnosticInfoSampleProfile(const Twine &Msg, DiagnosticSeverity Severity=DS_Error)
static bool classof(const DiagnosticInfo *DI)
void print(DiagnosticPrinter &DP) const override
static bool classof(const DiagnosticInfo *DI)
static bool isEnabled(StringRef Feature)
Return true if enable flag; '+'.
void emitOptimizationRemarkAnalysis(LLVMContext &Ctx, const char *PassName, const Function &Fn, const DiagnosticLocation &Loc, const Twine &Msg)
Legacy interface to emit an optimization analysis remark message.
const Twine & getMsgStr() const
const Value * getCodeRegion() const
LLVM Value Representation.
const Function & getFunction() const
Optional< uint64_t > Hotness
If profile information is available, this is the number of times the corresponding code was executed ...
void print(DiagnosticPrinter &DP) const override
const SMDiagnostic & getDiagnostic() const
Argument(StringRef Str="")
void setHotness(Optional< uint64_t > H)
StringRef - Represent a constant reference to a string, i.e.
void print(DiagnosticPrinter &DP) const override
Diagnostic information for the sample profiler.
void print(DiagnosticPrinter &DP) const override
Print using the given DP a user-friendly message.
std::function< void(const DiagnosticInfo &)> DiagnosticHandlerFunction
static bool classof(const DiagnosticInfo *DI)
StringRef getFileName() const
virtual bool isEnabled() const =0
Return true if this optimization remark is enabled by one of of the LLVM command line flags (-pass-re...
uint64_t getStackSize() const
DiagnosticInfoIROptimization(enum DiagnosticKind Kind, enum DiagnosticSeverity Severity, const char *PassName, const Function &Fn, const DiagnosticLocation &Loc, const Twine &Msg)
Legacy interface.
DiagnosticInfoOptimizationFailure(const Function &Fn, const DiagnosticLocation &Loc, const Twine &Msg)
Fn is the function where the diagnostic is being emitted.
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...