15 #ifndef LLVM_IR_DIAGNOSTICINFO_H
16 #define LLVM_IR_DIAGNOSTICINFO_H
36 class DiagnosticPrinter;
102 : Kind(Kind), Severity(Severity) {}
147 MsgStr(MsgStr), Instr(nullptr) {}
177 const char *ResourceName;
180 uint64_t ResourceSize;
183 uint64_t ResourceLimit;
189 const char *ResourceName,
190 uint64_t ResourceSize,
193 uint64_t ResourceLimit = 0)
196 ResourceName(ResourceName),
197 ResourceSize(ResourceSize),
198 ResourceLimit(ResourceLimit) {}
219 uint64_t StackLimit = 0)
238 unsigned MetadataVersion;
246 MetadataVersion(MetadataVersion) {}
288 LineNum(LineNum), Msg(Msg) {}
292 LineNum(0), Msg(Msg) {}
339 const char *FileName;
416 const char *PassName,
StringRef RemarkName,
418 Value *CodeRegion =
nullptr)
420 PassName(PassName), RemarkName(RemarkName), CodeRegion(CodeRegion) {}
434 PassName(PassName), RemarkName(Orig.RemarkName),
437 std::copy(Orig.Args.begin(), Orig.Args.end(), std::back_inserter(Args));
450 const char *PassName,
const Function &Fn,
454 PassName(PassName), Hotness(Hotness) {
474 std::string
getMsg()
const;
491 const char *PassName;
509 bool IsVerbose =
false;
514 int FirstExtraArgIndex = -1;
534 PassName, Fn, DLoc, Msg, Hotness) {}
572 PassName, Fn, DLoc, Msg, Hotness) {}
610 PassName, Fn, DLoc, Msg, Hotness) {}
677 PassName, Fn, DLoc, Msg, Hotness) {}
690 PassName, RemarkName, DLoc, CodeRegion) {}
715 PassName, Fn, DLoc, Msg, Hotness) {}
727 PassName, RemarkName, DLoc, CodeRegion) {}
810 const char *PassName,
812 const DebugLoc &DLoc,
822 const char *PassName,
824 const DebugLoc &DLoc,
840 nullptr, Fn, DLoc, Msg) {}
882 const DebugLoc &DLoc,
const Twine &Msg);
888 const DebugLoc &DLoc,
const Twine &Msg);
892 #endif // LLVM_IR_DIAGNOSTICINFO_H
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.
LLVM Argument representation.
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.
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.
const Function & getFunction() const
bool isLocationAvailable() const
Return true if location information is available for this 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
DiagnosticInfoInlineAsm(unsigned LocCookie, const Twine &MsgStr, DiagnosticSeverity Severity=DS_Error)
LocCookie if non-zero gives the line number for this report.
static bool classof(const DiagnosticInfo *DI)
const DebugLoc & getDebugLoc() const
void emitOptimizationRemark(LLVMContext &Ctx, const char *PassName, const Function &Fn, const DebugLoc &DLoc, const Twine &Msg)
Emit an optimization-applied message.
StringRef getPassName() const
virtual ~DiagnosticInfo()=default
const Function & getFunction() const
DiagnosticInfoOptimizationFailure(const Function &Fn, const DebugLoc &DLoc, const Twine &Msg)
Fn is the function where the diagnostic is being emitted.
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)
void emitOptimizationRemarkAnalysis(LLVMContext &Ctx, const char *PassName, const Function &Fn, const DebugLoc &DLoc, const Twine &Msg)
Emit an optimization analysis remark message.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Argument(StringRef Key, bool B)
Diagnostic information for optimization failures.
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.
uint64_t getStackLimit() const
Interface for custom diagnostic printing.
DiagnosticInfo(int Kind, DiagnosticSeverity Severity)
Diagnostic information for stack size etc.
void emitOptimizationRemarkMissed(LLVMContext &Ctx, const char *PassName, const Function &Fn, const DebugLoc &DLoc, const Twine &Msg)
Emit an optimization-missed message.
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
static GCRegistry::Add< OcamlGC > B("ocaml","ocaml 3.10-compatible GC")
DiagnosticInfoOptimizationBase::setIsVerbose setIsVerbose
DiagnosticSeverity getSeverity() const
uint64_t getResourceLimit() const
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
DiagnosticInfoWithDebugLocBase(enum DiagnosticKind Kind, enum DiagnosticSeverity Severity, const Function &Fn, const DebugLoc &DLoc)
Fn is the function where the diagnostic is being emitted.
DiagnosticInfoPGOProfile(const char *FileName, const Twine &Msg, DiagnosticSeverity Severity=DS_Error)
const Twine & getMsg() const
const char * getFileName() const
DiagnosticInfoUnsupported(const Function &Fn, const Twine &Msg, DebugLoc DLoc=DebugLoc(), DiagnosticSeverity Severity=DS_Error)
Fn is the function where the diagnostic is being emitted.
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...
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.
virtual void print(DiagnosticPrinter &DP) const =0
Print using the given DP a user-friendly message.
void emitLoopVectorizeWarning(LLVMContext &Ctx, const Function &Fn, const DebugLoc &DLoc, const Twine &Msg)
Emit a warning when loop vectorization is specified but fails.
void print(DiagnosticPrinter &DP) const override
Print using the given DP a user-friendly message.
void emitLoopInterleaveWarning(LLVMContext &Ctx, const Function &Fn, const DebugLoc &DLoc, const Twine &Msg)
Emit a warning when loop interleaving is specified but fails.
unsigned getLocCookie() const
static bool classof(const DiagnosticInfo *DI)
Common features for diagnostics dealing with optimization remarks.
static bool classof(const DiagnosticInfo *DI)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
std::function< void(const DiagnosticInfo &)> DiagnosticHandlerFunction
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.
unsigned getLineNum() const
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
Common features for diagnostics with an associated DebugLoc.
const char * getResourceName() const
void emitOptimizationRemarkAnalysisFPCommute(LLVMContext &Ctx, const char *PassName, const Function &Fn, const DebugLoc &DLoc, const Twine &Msg)
Emit an optimization analysis remark related to messages about floating-point non-commutativity.
void print(DiagnosticPrinter &DP) const override
const std::string getLocationStr() const
Return a string with the location information for this diagnostic in the format "file:line:col".
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)
isEnabled - Return true if enable flag; '+'.
Value * getCodeRegion() const
const Twine & getMsgStr() const
LLVM Value Representation.
const Function & getFunction() const
void emitOptimizationRemarkAnalysisAliasing(LLVMContext &Ctx, const char *PassName, const Function &Fn, const DebugLoc &DLoc, const Twine &Msg)
Emit an optimization analysis remark related to messages about pointer aliasing.
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.
static GCRegistry::Add< ErlangGC > A("erlang","erlang-compatible garbage collector")
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
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...