1//===- llvm/IR/DiagnosticInfo.h - Diagnostic Declaration --------*- C++ -*-===// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7//===----------------------------------------------------------------------===// 9// This file declares the different classes involved in low level diagnostics. 11// Diagnostics reporting is still done as part of the LLVMContext. 12//===----------------------------------------------------------------------===// 14#ifndef LLVM_IR_DIAGNOSTICINFO_H 15#define LLVM_IR_DIAGNOSTICINFO_H 36// Forward declarations. 37classDiagnosticPrinter;
48/// Defines the different supported severity of a diagnostic. 53// A note attaches additional information to one of the previous diagnostic 58/// Defines the different supported kind of a diagnostic. 59/// This enum should be extended with a new ID for each added concrete subclass. 94// getNextAvailablePluginDiagnosticKind 97/// Get the next available kind ID for a plugin diagnostic. 98/// Each time this function is called, it returns a different number. 99/// Therefore, a plugin that wants to "identify" its own classes 100/// with a dynamic identifier, just have to use this method to get a new ID 101/// and assign it to each of its classes. 102/// The returned ID will be greater than or equal to DK_FirstPluginKind. 103/// Thus, the plugin identifiers will not conflict with the 104/// DiagnosticKind values. 107/// This is the base abstract class for diagnostic reporting in 109/// The print method must be overloaded by the subclasses to print a 110/// user-friendly message in the client of the backend (let us call it a 114 /// Kind defines the kind of report this is about. 115const/* DiagnosticKind */int Kind;
116 /// Severity gives the severity of the diagnostic. 122 : Kind(Kind), Severity(Severity) {}
126/* DiagnosticKind */intgetKind()
const{
return Kind; }
129 /// Print using the given \p DP a user-friendly message. 130 /// This is the default message that will be printed to the user. 131 /// It is used when the frontend does not directly take advantage 132 /// of the information contained in fields of the subclasses. 133 /// The printed message must not end with '.' nor start with a severity 145 /// \p MsgStr is the message to be reported to the frontend. 146 /// This class does not copy \p MsgStr, therefore the reference must be valid 147 /// for the whole life time of the Diagnostic. 159 /// \see DiagnosticInfo::print. 167/// Diagnostic information for inline asm reporting. 168/// This is basically a message and an optional location. 171 /// Optional line information. 0 if not set. 173 /// Message to be reported. 175 /// Optional origin of the problem. 179 /// \p LocCookie if non-zero gives the line number for this report. 180 /// \p MsgStr gives the message. 181 /// This class does not copy \p MsgStr, therefore the reference must be valid 182 /// for the whole life time of the Diagnostic. 186 /// \p Instr gives the original instruction that triggered the diagnostic. 187 /// \p MsgStr gives the message. 188 /// This class does not copy \p MsgStr, therefore the reference must be valid 189 /// for the whole life time of the Diagnostic. 198 /// \see DiagnosticInfo::print. 206/// Diagnostic information for debug metadata version reporting. 207/// This is basically a module and a version. 210 /// The module that is concerned by this debug metadata version diagnostic. 212 /// The actual metadata version. 213unsigned MetadataVersion;
216 /// \p The module that is concerned by this debug metadata version diagnostic. 217 /// \p The actual metadata version. 221 MetadataVersion(MetadataVersion) {}
226 /// \see DiagnosticInfo::print. 234/// Diagnostic information for stripping invalid debug metadata. 237 /// The module that is concerned by this debug metadata version diagnostic. 241 /// \p The module that is concerned by this debug metadata version diagnostic. 248 /// \see DiagnosticInfo::print. 256/// Diagnostic information for the sample profiler. 263 LineNum(LineNum), Msg(Msg) {}
272 /// \see DiagnosticInfo::print. 284 /// Name of the input file associated with this diagnostic. 287 /// Line number where the diagnostic occurred. If 0, no line number will 288 /// be emitted in the message. 291 /// Message to report. 295/// Diagnostic information for the PGO profiler. 302 /// \see DiagnosticInfo::print. 313 /// Name of the input file associated with this diagnostic. 316 /// Message to report. 331 /// Return the full path to the file. 333 /// Return the file name relative to the compilation directory. 339/// Common features for diagnostics with an associated location. 341void anchor()
override;
343 /// \p Fn is the function where the diagnostic is being emitted. \p Loc is 344 /// the location information to use in the diagnostic. 351 /// Return true if location information is available for this diagnostic. 354 /// Return a string with the location information for this diagnostic 355 /// in the format "file:line:col". If location information is not available, 356 /// it returns "<unknown>:0:0". 359 /// Return location information for this diagnostic in three parts: 360 /// the relative source file path, line number and column. 362unsigned &Column)
const;
364 /// Return the absolute path tot the file. 371 /// Function where this diagnostic is triggered. 374 /// Debug location where this diagnostic is triggered. 380 /// Message to be reported. 384 /// \p MsgStr is the message to be reported to the frontend. 385 /// This class does not copy \p MsgStr, therefore the reference must be valid 386 /// for the whole life time of the Diagnostic. 395 /// \see DiagnosticInfo::print. 405 /// Message to be reported. 409 /// \p MsgStr is the message to be reported to the frontend. 410 /// This class does not copy \p MsgStr, therefore the reference must be valid 411 /// for the whole life time of the Diagnostic. 421 /// \see DiagnosticInfo::print. 429/// Diagnostic information for stack size etc. reporting. 430/// This is basically a function and a size. 433 /// The function that is concerned by this resource limit diagnostic. 436 /// Description of the resource type (e.g. stack size) 437constchar *ResourceName;
439 /// The computed size usage 446 /// \p The function that is concerned by this stack size diagnostic. 447 /// \p The computed stack size. 458 /// \see DiagnosticInfo::print. 467void anchor()
override;
484/// Common features for diagnostics dealing with optimization remarks 485/// that are used by both IR and MIR passes. 488 /// Used to set IsVerbose via the stream interface. 491 /// When an instance of this is inserted into the stream, the arguments 492 /// following will not appear in the remark printed in the compiler output 493 /// (-Rpass) but only in the optimization record file 494 /// (-fsave-optimization-record). 497 /// Used in the streaming interface as the general argument type. It 498 /// internally converts everything into a key-value pair. 502// If set, the debug location corresponding to the value. 523 /// \p PassName is the name of the pass emitting this diagnostic. \p 524 /// RemarkName is a textual identifier for the remark (single-word, 525 /// camel-case). \p Fn is the function where the diagnostic is being emitted. 526 /// \p Loc is the location information to use in the diagnostic. If line table 527 /// information is available, the diagnostic will include the source code 539voidinsert(setIsVerbose V);
540voidinsert(setExtraArgs EA);
542 /// \see DiagnosticInfo::print. 545 /// Return true if this optimization remark is enabled by one of 546 /// of the LLVM command line flags (-pass-remarks, -pass-remarks-missed, 547 /// or -pass-remarks-analysis). Note that this only handles the LLVM 548 /// flags. We cannot access Clang flags from here (they are handled 549 /// in BackendConsumer::OptimizationRemarkHandler). 585 /// Name of the pass that triggers this report. If this matches the 586 /// regular expression given in -Rpass=regexp, then the remark will 590 /// Textual identifier for the remark (single-word, camel-case). Can be used 591 /// by external tools reading the output file for optimization remarks to 592 /// identify the remark. 595 /// If profile information is available, this is the number of times the 596 /// corresponding code was executed in a profile instrumentation run. 599 /// Arguments collected via the streaming interface. 602 /// The remark is expected to be noisy. 605 /// If positive, the index of the first argument that only appear in 606 /// the optimization records and not in the remark printed in the compiler 611/// Allow the insertion operator to return the actual remark type rather than a 612/// common base class. This allows returning the result of the insertion 613/// directly by value, e.g. return OptimizationRemarkAnalysis(...) << "blah". 614template <
class RemarkT>
618 std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
625/// Also allow r-value for the remark to allow insertion into a 626/// temporarily-constructed remark. 627template <
class RemarkT>
631 std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
638template <
class RemarkT>
642 std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
649template <
class RemarkT>
653 std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
660template <
class RemarkT>
664 std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
671template <
class RemarkT>
675 std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
682template <
class RemarkT>
686 std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
693/// Common features for diagnostics dealing with optimization remarks 694/// that are used by IR passes. 696void anchor()
override;
698 /// \p PassName is the name of the pass emitting this diagnostic. \p 699 /// RemarkName is a textual identifier for the remark (single-word, 700 /// camel-case). \p Fn is the function where the diagnostic is being emitted. 701 /// \p Loc is the location information to use in the diagnostic. If line table 702 /// information is available, the diagnostic will include the source code 703 /// location. \p CodeRegion is IR value (currently basic block) that the 704 /// optimization operates on. This is currently used to provide run-time 705 /// hotness information with PGO. 711constValue *CodeRegion =
nullptr)
714 CodeRegion(CodeRegion) {}
716 /// This is ctor variant allows a pass to build an optimization remark 717 /// from an existing remark. 719 /// This is useful when a transformation pass (e.g LV) wants to emit a remark 720 /// (\p Orig) generated by one of its analyses (e.g. LAA) as its own analysis 721 /// remark. The string \p Prepend will be emitted before the original 730 std::copy(Orig.
Args.begin(), Orig.
Args.end(), std::back_inserter(
Args));
733 /// Legacy interface. 734 /// \p PassName is the name of the pass emitting this diagnostic. 735 /// \p Fn is the function where the diagnostic is being emitted. \p Loc is 736 /// the location information to use in the diagnostic. If line table 737 /// information is available, the diagnostic will include the source code 738 /// location. \p Msg is the message to show. Note that this class does not 739 /// copy this message, so this reference must be valid for the whole life time 740 /// of the diagnostic. 756 /// The IR value (currently basic block) that the optimization operates on. 757 /// This is currently used to provide run-time hotness information with PGO. 758constValue *CodeRegion =
nullptr;
761/// Diagnostic information for applied optimization remarks. 764 /// \p PassName is the name of the pass emitting this diagnostic. If this name 765 /// matches the regular expression given in -Rpass=, then the diagnostic will 766 /// be emitted. \p RemarkName is a textual identifier for the remark (single- 767 /// word, camel-case). \p Loc is the debug location and \p CodeRegion is the 768 /// region that the optimization operates on (currently only block is 773 /// Same as above, but the debug location and code region are derived from \p 778 /// Same as above, but the debug location and code region are derived from \p 787 /// \see DiagnosticInfoOptimizationBase::isEnabled. 791 /// This is deprecated now and only used by the function API below. 792 /// \p PassName is the name of the pass emitting this diagnostic. If 793 /// this name matches the regular expression given in -Rpass=, then the 794 /// diagnostic will be emitted. \p Fn is the function where the diagnostic 795 /// is being emitted. \p Loc is the location information to use in the 796 /// diagnostic. If line table information is available, the diagnostic 797 /// will include the source code location. \p Msg is the message to show. 798 /// Note that this class does not copy this message, so this reference 799 /// must be valid for the whole life time of the diagnostic. 806/// Diagnostic information for missed-optimization remarks. 809 /// \p PassName is the name of the pass emitting this diagnostic. If this name 810 /// matches the regular expression given in -Rpass-missed=, then the 811 /// diagnostic will be emitted. \p RemarkName is a textual identifier for the 812 /// remark (single-word, camel-case). \p Loc is the debug location and \p 813 /// CodeRegion is the region that the optimization operates on (currently only 814 /// block is supported). 817constValue *CodeRegion);
819 /// Same as above but \p Inst is used to derive code region and debug 824 /// Same as above but \p F is used to derive code region and debug 833 /// \see DiagnosticInfoOptimizationBase::isEnabled. 837 /// This is deprecated now and only used by the function API below. 838 /// \p PassName is the name of the pass emitting this diagnostic. If 839 /// this name matches the regular expression given in -Rpass-missed=, then the 840 /// diagnostic will be emitted. \p Fn is the function where the diagnostic 841 /// is being emitted. \p Loc is the location information to use in the 842 /// diagnostic. If line table information is available, the diagnostic 843 /// will include the source code location. \p Msg is the message to show. 844 /// Note that this class does not copy this message, so this reference 845 /// must be valid for the whole life time of the diagnostic. 852/// Diagnostic information for optimization analysis remarks. 855 /// \p PassName is the name of the pass emitting this diagnostic. If this name 856 /// matches the regular expression given in -Rpass-analysis=, then the 857 /// diagnostic will be emitted. \p RemarkName is a textual identifier for the 858 /// remark (single-word, camel-case). \p Loc is the debug location and \p 859 /// CodeRegion is the region that the optimization operates on (currently only 860 /// block is supported). 863constValue *CodeRegion);
865 /// This is ctor variant allows a pass to build an optimization remark 866 /// from an existing remark. 868 /// This is useful when a transformation pass (e.g LV) wants to emit a remark 869 /// (\p Orig) generated by one of its analyses (e.g. LAA) as its own analysis 870 /// remark. The string \p Prepend will be emitted before the original 876 /// Same as above but \p Inst is used to derive code region and debug 881 /// Same as above but \p F is used to derive code region and debug 890 /// \see DiagnosticInfoOptimizationBase::isEnabled. 906constValue *CodeRegion);
909 /// This is deprecated now and only used by the function API below. 910 /// \p PassName is the name of the pass emitting this diagnostic. If 911 /// this name matches the regular expression given in -Rpass-analysis=, then 912 /// the diagnostic will be emitted. \p Fn is the function where the diagnostic 913 /// is being emitted. \p Loc is the location information to use in the 914 /// diagnostic. If line table information is available, the diagnostic will 915 /// include the source code location. \p Msg is the message to show. Note that 916 /// this class does not copy this message, so this reference must be valid for 917 /// the whole life time of the diagnostic. 924/// Diagnostic information for optimization analysis remarks related to 925/// floating-point non-commutativity. 927void anchor()
override;
929 /// \p PassName is the name of the pass emitting this diagnostic. If this name 930 /// matches the regular expression given in -Rpass-analysis=, then the 931 /// diagnostic will be emitted. \p RemarkName is a textual identifier for the 932 /// remark (single-word, camel-case). \p Loc is the debug location and \p 933 /// CodeRegion is the region that the optimization operates on (currently only 934 /// block is supported). The front-end will append its own message related to 935 /// options that address floating-point non-commutativity. 939constValue *CodeRegion)
948 /// This is deprecated now and only used by the function API below. 949 /// \p PassName is the name of the pass emitting this diagnostic. If 950 /// this name matches the regular expression given in -Rpass-analysis=, then 951 /// the diagnostic will be emitted. \p Fn is the function where the diagnostic 952 /// is being emitted. \p Loc is the location information to use in the 953 /// diagnostic. If line table information is available, the diagnostic will 954 /// include the source code location. \p Msg is the message to show. The 955 /// front-end will append its own message related to options that address 956 /// floating-point non-commutativity. Note that this class does not copy this 957 /// message, so this reference must be valid for the whole life time of the 966/// Diagnostic information for optimization analysis remarks related to 969void anchor()
override;
971 /// \p PassName is the name of the pass emitting this diagnostic. If this name 972 /// matches the regular expression given in -Rpass-analysis=, then the 973 /// diagnostic will be emitted. \p RemarkName is a textual identifier for the 974 /// remark (single-word, camel-case). \p Loc is the debug location and \p 975 /// CodeRegion is the region that the optimization operates on (currently only 976 /// block is supported). The front-end will append its own message related to 977 /// options that address pointer aliasing legality. 980constValue *CodeRegion)
989 /// This is deprecated now and only used by the function API below. 990 /// \p PassName is the name of the pass emitting this diagnostic. If 991 /// this name matches the regular expression given in -Rpass-analysis=, then 992 /// the diagnostic will be emitted. \p Fn is the function where the diagnostic 993 /// is being emitted. \p Loc is the location information to use in the 994 /// diagnostic. If line table information is available, the diagnostic will 995 /// include the source code location. \p Msg is the message to show. The 996 /// front-end will append its own message related to options that address 997 /// pointer aliasing legality. Note that this class does not copy this 998 /// message, so this reference must be valid for the whole life time of the 1007/// Diagnostic information for machine IR parser. 1008// FIXME: Remove this, use DiagnosticInfoSrcMgr instead. 1026/// Diagnostic information for IR instrumentation reporting. 1042/// Diagnostic information for ISel fallback path. 1044 /// The function that is concerned by this diagnostic. 1061// Create wrappers for C Binding types (see CBindingWrapping.h). 1064/// Diagnostic information for optimization failures. 1067 /// \p Fn is the function where the diagnostic is being emitted. \p Loc is 1068 /// the location information to use in the diagnostic. If line table 1069 /// information is available, the diagnostic will include the source code 1070 /// location. \p Msg is the message to show. Note that this class does not 1071 /// copy this message, so this reference must be valid for the whole life time 1072 /// of the diagnostic. 1077 nullptr, Fn, Loc, Msg) {}
1079 /// \p PassName is the name of the pass emitting this diagnostic. \p 1080 /// RemarkName is a textual identifier for the remark (single-word, 1081 /// camel-case). \p Loc is the debug location and \p CodeRegion is the 1082 /// region that the optimization operates on (currently basic block is 1086constValue *CodeRegion);
1092 /// \see DiagnosticInfoOptimizationBase::isEnabled. 1093bool isEnabled()
const override;
1096/// Diagnostic information for unsupported feature in backend. 1102 /// \p Fn is the function where the diagnostic is being emitted. \p Loc is 1103 /// the location information to use in the diagnostic. If line table 1104 /// information is available, the diagnostic will include the source code 1105 /// location. \p Msg is the message to show. Note that this class does not 1106 /// copy this message, so this reference must be valid for the whole life time 1107 /// of the diagnostic. 1124/// Diagnostic information for MisExpect analysis. 1129 /// \see DiagnosticInfo::print. 1139 /// Message to report. 1161/// Diagnostic information for SMDiagnostic reporting. 1166// For inlineasm !srcloc translation. 1172bool InlineAsmDiag =
true,
uint64_t LocCookie = 0)
1174 Diagnostic(Diagnostic), ModName(ModName), InlineAsmDiag(InlineAsmDiag),
1175 LocCookie(LocCookie) {}
1199 LocCookie(LocCookie) {}
1209}
// end namespace llvm 1211#endif// LLVM_IR_DIAGNOSTICINFO_H MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
Machine Check Debug Module
This file defines the SmallVector class.
static const char PassName[]
This class represents an incoming formal argument to a Function.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Diagnostic information for debug metadata version reporting.
static bool classof(const DiagnosticInfo *DI)
DiagnosticInfoDebugMetadataVersion(const Module &M, unsigned MetadataVersion, DiagnosticSeverity Severity=DS_Warning)
The module that is concerned by this debug metadata version diagnostic.
const Module & getModule() const
void print(DiagnosticPrinter &DP) const override
unsigned getMetadataVersion() const
StringRef getNote() const
DiagnosticInfoDontCall(StringRef CalleeName, StringRef Note, DiagnosticSeverity DS, uint64_t LocCookie)
static bool classof(const DiagnosticInfo *DI)
uint64_t getLocCookie() const
StringRef getFunctionName() const
void print(DiagnosticPrinter &DP) const override
Print using the given DP a user-friendly message.
void print(DiagnosticPrinter &DP) const override
const Twine & getMsgStr() const
static bool classof(const DiagnosticInfo *DI)
DiagnosticInfoGenericWithLoc(const Twine &MsgStr, const Function &Fn, const DiagnosticLocation &Loc, DiagnosticSeverity Severity=DS_Error)
MsgStr is the message to be reported to the frontend.
static bool classof(const DiagnosticInfo *DI)
DiagnosticInfoGeneric(const Twine &MsgStr, DiagnosticSeverity Severity=DS_Error)
MsgStr is the message to be reported to the frontend.
const Twine & getMsgStr() const
DiagnosticInfoGeneric(const Instruction *I, const Twine &ErrMsg, DiagnosticSeverity Severity=DS_Error)
void print(DiagnosticPrinter &DP) const override
const Instruction * getInstruction() const
Common features for diagnostics dealing with optimization remarks that are used by IR passes.
const Value * getCodeRegion() const
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, StringRef RemarkName, const Function &Fn, const DiagnosticLocation &Loc, const Value *CodeRegion=nullptr)
PassName is the name of the pass emitting this diagnostic.
DiagnosticInfoIROptimization(enum DiagnosticKind Kind, enum DiagnosticSeverity Severity, const char *PassName, const Function &Fn, const DiagnosticLocation &Loc, const Twine &Msg)
Legacy interface.
static bool classof(const DiagnosticInfo *DI)
Diagnostic information for ISel fallback path.
static bool classof(const DiagnosticInfo *DI)
const Function & getFunction() const
void print(DiagnosticPrinter &DP) const override
Print using the given DP a user-friendly message.
DiagnosticInfoISelFallback(const Function &Fn, DiagnosticSeverity Severity=DS_Warning)
Diagnostic information for stripping invalid debug metadata.
DiagnosticInfoIgnoringInvalidDebugMetadata(const Module &M, DiagnosticSeverity Severity=DS_Warning)
The module that is concerned by this debug metadata version diagnostic.
static bool classof(const DiagnosticInfo *DI)
const Module & getModule() const
void print(DiagnosticPrinter &DP) const override
Diagnostic information for inline asm reporting.
static bool classof(const DiagnosticInfo *DI)
const Instruction * getInstruction() const
const Twine & getMsgStr() const
void print(DiagnosticPrinter &DP) const override
uint64_t getLocCookie() const
Diagnostic information for IR instrumentation reporting.
static bool classof(const DiagnosticInfo *DI)
DiagnosticInfoInstrumentation(const Twine &DiagMsg, DiagnosticSeverity Severity=DS_Warning)
void print(DiagnosticPrinter &DP) const override
Print using the given DP a user-friendly message.
Diagnostic information for machine IR parser.
void print(DiagnosticPrinter &DP) const override
Print using the given DP a user-friendly message.
static bool classof(const DiagnosticInfo *DI)
DiagnosticInfoMIRParser(DiagnosticSeverity Severity, const SMDiagnostic &Diagnostic)
const SMDiagnostic & getDiagnostic() const
Diagnostic information for MisExpect analysis.
const Twine & getMsg() const
void print(DiagnosticPrinter &DP) const override
static bool classof(const DiagnosticInfo *DI)
Common features for diagnostics dealing with optimization remarks that are used by both IR and MIR pa...
ArrayRef< Argument > getArgs() const
int FirstExtraArgIndex
If positive, the index of the first argument that only appear in the optimization records and not in ...
const char * PassName
Name of the pass that triggers this report.
StringRef getPassName() const
StringRef RemarkName
Textual identifier for the remark (single-word, camel-case).
std::string getMsg() const
void print(DiagnosticPrinter &DP) const override
bool IsVerbose
The remark is expected to be noisy.
std::optional< uint64_t > Hotness
If profile information is available, this is the number of times the corresponding code was executed ...
SmallVector< Argument, 4 > Args
Arguments collected via the streaming interface.
StringRef getRemarkName() const
void setHotness(std::optional< uint64_t > H)
static bool classof(const DiagnosticInfo *DI)
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.
virtual bool isEnabled() const =0
Return true if this optimization remark is enabled by one of of the LLVM command line flags (-pass-re...
std::optional< uint64_t > getHotness() const
Diagnostic information for optimization failures.
DiagnosticInfoOptimizationFailure(const Function &Fn, const DiagnosticLocation &Loc, const Twine &Msg)
Fn is the function where the diagnostic is being emitted.
static bool classof(const DiagnosticInfo *DI)
Diagnostic information for the PGO profiler.
const char * getFileName() const
DiagnosticInfoPGOProfile(const char *FileName, const Twine &Msg, DiagnosticSeverity Severity=DS_Error)
static bool classof(const DiagnosticInfo *DI)
void print(DiagnosticPrinter &DP) const override
const Twine & getMsg() const
const Twine & getMsgStr() const
void print(DiagnosticPrinter &DP) const override
static bool classof(const DiagnosticInfo *DI)
Diagnostic information for stack size etc.
const Function & getFunction() const
void print(DiagnosticPrinter &DP) const override
const char * getResourceName() const
uint64_t getResourceLimit() const
static bool classof(const DiagnosticInfo *DI)
uint64_t getResourceSize() const
Diagnostic information for the sample profiler.
DiagnosticInfoSampleProfile(StringRef FileName, const Twine &Msg, DiagnosticSeverity Severity=DS_Error)
void print(DiagnosticPrinter &DP) const override
static bool classof(const DiagnosticInfo *DI)
unsigned getLineNum() const
DiagnosticInfoSampleProfile(StringRef FileName, unsigned LineNum, const Twine &Msg, DiagnosticSeverity Severity=DS_Error)
DiagnosticInfoSampleProfile(const Twine &Msg, DiagnosticSeverity Severity=DS_Error)
StringRef getFileName() const
const Twine & getMsg() const
Diagnostic information for SMDiagnostic reporting.
static bool classof(const DiagnosticInfo *DI)
const SMDiagnostic & getSMDiag() const
DiagnosticInfoSrcMgr(const SMDiagnostic &Diagnostic, StringRef ModName, bool InlineAsmDiag=true, uint64_t LocCookie=0)
uint64_t getLocCookie() const
bool isInlineAsmDiag() const
void print(DiagnosticPrinter &DP) const override
Print using the given DP a user-friendly message.
StringRef getModuleName() const
static bool classof(const DiagnosticInfo *DI)
DiagnosticInfoStackSize(const Function &Fn, uint64_t StackSize, uint64_t StackLimit, DiagnosticSeverity Severity=DS_Warning)
uint64_t getStackLimit() const
uint64_t getStackSize() const
Diagnostic information for unsupported feature in backend.
void print(DiagnosticPrinter &DP) const override
Print using the given DP a user-friendly message.
const Twine & getMessage() 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.
static bool classof(const DiagnosticInfo *DI)
Common features for diagnostics with an associated location.
std::string getLocationStr() const
Return a string with the location information for this diagnostic in the format "file:line:col".
std::string getAbsolutePath() const
Return the absolute path tot the file.
bool isLocationAvailable() const
Return true if location information is available for this diagnostic.
const Function & getFunction() const
DiagnosticLocation getLocation() const
DiagnosticInfoWithLocationBase(enum DiagnosticKind Kind, enum DiagnosticSeverity Severity, const Function &Fn, const DiagnosticLocation &Loc)
Fn is the function where the diagnostic is being emitted.
This is the base abstract class for diagnostic reporting in the backend.
DiagnosticSeverity getSeverity() const
DiagnosticInfo(int Kind, DiagnosticSeverity Severity)
virtual ~DiagnosticInfo()=default
virtual void print(DiagnosticPrinter &DP) const =0
Print using the given DP a user-friendly message.
std::string getAbsolutePath() const
Return the full path to the file.
StringRef getRelativePath() const
Return the file name relative to the compilation directory.
unsigned getColumn() const
DiagnosticLocation()=default
Interface for custom diagnostic printing.
A Module instance is used to store all the information related to an LLVM module.
Diagnostic information for optimization analysis remarks related to pointer aliasing.
OptimizationRemarkAnalysisAliasing(const char *PassName, StringRef RemarkName, const DiagnosticLocation &Loc, const Value *CodeRegion)
PassName is the name of the pass emitting this diagnostic.
static bool classof(const DiagnosticInfo *DI)
Diagnostic information for optimization analysis remarks related to floating-point non-commutativity.
static bool classof(const DiagnosticInfo *DI)
OptimizationRemarkAnalysisFPCommute(const char *PassName, StringRef RemarkName, const DiagnosticLocation &Loc, const Value *CodeRegion)
PassName is the name of the pass emitting this diagnostic.
Diagnostic information for optimization analysis remarks.
bool isEnabled() const override
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(enum DiagnosticKind Kind, const char *PassName, const Function &Fn, const DiagnosticLocation &Loc, const Twine &Msg)
static const char * AlwaysPrint
bool shouldAlwaysPrint() const
static bool classof(const DiagnosticInfo *DI)
Diagnostic information for missed-optimization remarks.
static bool classof(const DiagnosticInfo *DI)
bool isEnabled() const override
Diagnostic information for applied optimization remarks.
static bool classof(const DiagnosticInfo *DI)
bool isEnabled() const override
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
std::string str() const
Return the twine contents as a std::string.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
struct LLVMOpaqueDiagnosticInfo * LLVMDiagnosticInfoRef
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
void diagnoseDontCall(const CallInst &CI)
DiagnosticKind
Defines the different supported kind of a diagnostic.
@ DK_DebugMetadataInvalid
@ DK_OptimizationRemarkAnalysis
@ DK_OptimizationRemarkAnalysisAliasing
@ DK_MachineOptimizationRemark
@ DK_OptimizationRemarkMissed
@ DK_MachineOptimizationRemarkAnalysis
@ DK_MachineOptimizationRemarkMissed
@ DK_DebugMetadataVersion
@ DK_OptimizationRemarkAnalysisFPCommute
int getNextAvailablePluginDiagnosticKind()
Get the next available kind ID for a plugin diagnostic.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
DiagnosticSeverity
Defines the different supported severity of a diagnostic.
static DiagnosticSeverity getDiagnosticSeverity(SourceMgr::DiagKind DK)
std::function< void(const DiagnosticInfo &)> DiagnosticHandlerFunction
Used in the streaming interface as the general argument type.
Argument(StringRef Str="")
Argument(StringRef Key, const char *S)
Argument(StringRef Key, bool B)
When an instance of this is inserted into the stream, the arguments following will not appear in the ...
Used to set IsVerbose via the stream interface.