15 #ifndef LLVM_IR_DIAGNOSTICINFO_H 16 #define LLVM_IR_DIAGNOSTICINFO_H 35 class DiagnosticPrinter;
104 virtual void anchor();
107 : Kind(Kind), Severity(Severity) {}
130 unsigned LocCookie = 0;
181 const char *ResourceName;
184 uint64_t ResourceSize;
187 uint64_t ResourceLimit;
193 uint64_t ResourceSize,
196 uint64_t ResourceLimit = 0)
197 :
DiagnosticInfo(Kind, Severity), Fn(Fn), ResourceName(ResourceName),
198 ResourceSize(ResourceSize), ResourceLimit(ResourceLimit) {}
214 virtual void anchor()
override;
218 uint64_t StackLimit = 0)
237 unsigned MetadataVersion;
245 MetadataVersion(MetadataVersion) {}
287 LineNum(LineNum), Msg(Msg) {}
313 unsigned LineNum = 0;
338 const char *FileName;
356 std::string getAbsolutePath()
const;
365 virtual void anchor()
override;
381 const std::string getLocationStr()
const;
386 unsigned &Column)
const;
389 std::string getAbsolutePath()
const;
447 const char *PassName,
StringRef RemarkName,
451 PassName(PassName), RemarkName(RemarkName) {}
469 std::string getMsg()
const;
516 bool IsVerbose =
false;
521 int FirstExtraArgIndex = -1;
529 template <
class RemarkT>
532 typename std::enable_if<
533 std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
541 template <
class RemarkT>
544 typename std::enable_if<
545 std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
551 template <
class RemarkT>
554 typename std::enable_if<
555 std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
561 template <
class RemarkT>
564 typename std::enable_if<
565 std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
571 template <
class RemarkT>
574 typename std::enable_if<
575 std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
581 template <
class RemarkT>
584 typename std::enable_if<
585 std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
591 template <
class RemarkT>
594 typename std::enable_if<
595 std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
604 virtual void anchor()
override;
616 const char *PassName,
StringRef RemarkName,
619 const Value *CodeRegion =
nullptr)
622 CodeRegion(CodeRegion) {}
636 CodeRegion(Orig.getCodeRegion()) {
651 const char *PassName,
const Function &Fn,
666 const Value *CodeRegion;
725 const Value *CodeRegion);
752 PassName, Fn, Loc, Msg) {}
766 const Value *CodeRegion);
804 const Value *CodeRegion);
819 PassName, Fn, Loc, Msg) {}
825 virtual void anchor();
837 const Value *CodeRegion)
839 PassName, RemarkName, Loc, CodeRegion) {}
861 PassName, Fn, Loc, Msg) {}
867 virtual void anchor();
878 const Value *CodeRegion)
880 PassName, RemarkName, Loc, CodeRegion) {}
902 PassName, Fn, Loc, Msg) {}
958 nullptr, Fn, Loc, Msg) {}
967 const Value *CodeRegion);
1013 #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.
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.
This class represents lattice values for constants.
const Function & getFunction() const
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)
DiagnosticInfoMIRParser(DiagnosticSeverity Severity, const SMDiagnostic &Diagnostic)
const Twine & getMsg() const
Used to set IsVerbose via the stream interface.
Diagnostic information for machine IR parser.
DiagnosticInfoInlineAsm(unsigned LocCookie, const Twine &MsgStr, DiagnosticSeverity Severity=DS_Error)
LocCookie if non-zero gives the line number for this report.
const char * getFileName() const
static bool classof(const DiagnosticInfo *DI)
DiagnosticInfoWithLocationBase(enum DiagnosticKind Kind, enum DiagnosticSeverity Severity, const Function &Fn, const DiagnosticLocation &Loc)
Fn is the function where the diagnostic is being emitted.
const Twine & getMsgStr() const
virtual ~DiagnosticInfo()=default
DiagnosticLocation getLocation() const
static bool classof(const DiagnosticInfo *DI)
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)
uint64_t getStackLimit() const
const Twine & getMsg() const
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Argument(StringRef Key, bool B)
Diagnostic information for optimization failures.
const SMDiagnostic & getDiagnostic() const
Common features for diagnostics with an associated location.
const Function & getFunction() const
Interface for custom diagnostic printing.
DiagnosticInfo(int Kind, DiagnosticSeverity Severity)
Diagnostic information for stack size etc.
static bool classof(const DiagnosticInfo *DI)
uint64_t getResourceLimit() const
const Instruction * getInstruction() const
bool isLocationAvailable() const
Return true if location information is available for 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...
const Twine & getMessage() const
StringRef RemarkName
Textual identifier for the remark (single-word, camel-case).
static Function * getFunction(Constant *C)
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.
uint64_t getStackSize() const
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.
SmallVector< Argument, 4 > Args
Arguments collected via the streaming interface.
const char * getResourceName() const
This is the base abstract class for diagnostic reporting in the backend.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
const Function & getFunction() const
The instances of the Type class are immutable: once they are created, they are never changed...
static bool classof(const DiagnosticInfo *DI)
DiagnosticInfoPGOProfile(const char *FileName, const Twine &Msg, DiagnosticSeverity Severity=DS_Error)
const Value * getCodeRegion() const
Common features for diagnostics dealing with optimization remarks that are used by IR passes...
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 getLocCookie() 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.
uint64_t getResourceSize() 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...
Argument(StringRef Key, const char *S)
int getNextAvailablePluginDiagnosticKind()
Get the next available kind ID for a plugin diagnostic.
StringRef getFileName() const
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
DiagnosticInfoSampleProfile(const Twine &Msg, DiagnosticSeverity Severity=DS_Error)
DiagnosticSeverity getSeverity() const
static bool classof(const DiagnosticInfo *DI)
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
std::string str() const
Return the twine contents as a std::string.
static bool classof(const DiagnosticInfo *DI)
static bool isEnabled(StringRef Feature)
Return true if enable flag; '+'.
Optional< uint64_t > getHotness() const
static MemoryLocation getLocation(Instruction *I, AliasAnalysis *AA)
LLVM Value Representation.
Optional< uint64_t > Hotness
If profile information is available, this is the number of times the corresponding code was executed ...
Argument(StringRef Str="")
void setHotness(Optional< uint64_t > H)
StringRef - Represent a constant reference to a string, i.e.
unsigned getLineNum() const
Diagnostic information for the sample profiler.
OutputIt copy(R &&Range, OutputIt Out)
std::function< void(const DiagnosticInfo &)> DiagnosticHandlerFunction
static bool classof(const DiagnosticInfo *DI)
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
unsigned getColumn() const
DiagnosticInfoIROptimization(enum DiagnosticKind Kind, enum DiagnosticSeverity Severity, const char *PassName, const Function &Fn, const DiagnosticLocation &Loc, const Twine &Msg)
Legacy interface.
StringRef getPassName() const
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...