forked from OSchip/llvm-project
OptDiag: Decouple backend diagnostics from debug info metadata
This creates and uses a DiagnosticLocation type rather than using DebugLoc for this purpose in the backend diagnostics. This is NFC for now, but will allow us to create locations for diagnostics without having to create new metadata nodes when we don't have a DILocation. llvm-svn: 295519
This commit is contained in:
parent
431305927f
commit
d890f95bf6
|
@ -347,19 +347,33 @@ private:
|
||||||
const Twine &Msg;
|
const Twine &Msg;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Common features for diagnostics with an associated DebugLoc
|
class DiagnosticLocation {
|
||||||
|
StringRef Filename;
|
||||||
|
unsigned Line = 0;
|
||||||
|
unsigned Column = 0;
|
||||||
|
public:
|
||||||
|
DiagnosticLocation() {}
|
||||||
|
DiagnosticLocation(const DebugLoc &DL);
|
||||||
|
|
||||||
|
bool isValid() const { return !Filename.empty(); }
|
||||||
|
StringRef getFilename() const { return Filename; }
|
||||||
|
unsigned getLine() const { return Line; }
|
||||||
|
unsigned getColumn() const { return Column; }
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Common features for diagnostics with an associated location.
|
||||||
class DiagnosticInfoWithLocationBase : public DiagnosticInfo {
|
class DiagnosticInfoWithLocationBase : public DiagnosticInfo {
|
||||||
public:
|
public:
|
||||||
/// \p Fn is the function where the diagnostic is being emitted. \p DLoc is
|
/// \p Fn is the function where the diagnostic is being emitted. \p Loc is
|
||||||
/// the location information to use in the diagnostic.
|
/// the location information to use in the diagnostic.
|
||||||
DiagnosticInfoWithLocationBase(enum DiagnosticKind Kind,
|
DiagnosticInfoWithLocationBase(enum DiagnosticKind Kind,
|
||||||
enum DiagnosticSeverity Severity,
|
enum DiagnosticSeverity Severity,
|
||||||
const Function &Fn,
|
const Function &Fn,
|
||||||
const DebugLoc &DLoc)
|
const DiagnosticLocation &Loc)
|
||||||
: DiagnosticInfo(Kind, Severity), Fn(Fn), DLoc(DLoc) {}
|
: DiagnosticInfo(Kind, Severity), Fn(Fn), Loc(Loc) {}
|
||||||
|
|
||||||
/// Return true if location information is available for this diagnostic.
|
/// Return true if location information is available for this diagnostic.
|
||||||
bool isLocationAvailable() const;
|
bool isLocationAvailable() const { return Loc.isValid(); }
|
||||||
|
|
||||||
/// Return a string with the location information for this diagnostic
|
/// Return a string with the location information for this diagnostic
|
||||||
/// in the format "file:line:col". If location information is not available,
|
/// in the format "file:line:col". If location information is not available,
|
||||||
|
@ -371,14 +385,14 @@ public:
|
||||||
void getLocation(StringRef *Filename, unsigned *Line, unsigned *Column) const;
|
void getLocation(StringRef *Filename, unsigned *Line, unsigned *Column) const;
|
||||||
|
|
||||||
const Function &getFunction() const { return Fn; }
|
const Function &getFunction() const { return Fn; }
|
||||||
const DebugLoc &getDebugLoc() const { return DLoc; }
|
DiagnosticLocation getLocation() const { return Loc; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Function where this diagnostic is triggered.
|
/// Function where this diagnostic is triggered.
|
||||||
const Function &Fn;
|
const Function &Fn;
|
||||||
|
|
||||||
/// Debug location where this diagnostic is triggered.
|
/// Debug location where this diagnostic is triggered.
|
||||||
DebugLoc DLoc;
|
DiagnosticLocation Loc;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief Common features for diagnostics dealing with optimization remarks
|
/// \brief Common features for diagnostics dealing with optimization remarks
|
||||||
|
@ -400,7 +414,7 @@ public:
|
||||||
StringRef Key;
|
StringRef Key;
|
||||||
std::string Val;
|
std::string Val;
|
||||||
// If set, the debug location corresponding to the value.
|
// If set, the debug location corresponding to the value.
|
||||||
DebugLoc DLoc;
|
DiagnosticLocation Loc;
|
||||||
|
|
||||||
explicit Argument(StringRef Str = "") : Key("String"), Val(Str) {}
|
explicit Argument(StringRef Str = "") : Key("String"), Val(Str) {}
|
||||||
Argument(StringRef Key, const Value *V);
|
Argument(StringRef Key, const Value *V);
|
||||||
|
@ -412,14 +426,15 @@ public:
|
||||||
|
|
||||||
/// \p PassName is the name of the pass emitting this diagnostic. \p
|
/// \p PassName is the name of the pass emitting this diagnostic. \p
|
||||||
/// RemarkName is a textual identifier for the remark. \p Fn is the function
|
/// RemarkName is a textual identifier for the remark. \p Fn is the function
|
||||||
/// where the diagnostic is being emitted. \p DLoc is the location information
|
/// where the diagnostic is being emitted. \p Loc is the location information
|
||||||
/// to use in the diagnostic. If line table information is available, the
|
/// to use in the diagnostic. If line table information is available, the
|
||||||
/// diagnostic will include the source code location.
|
/// diagnostic will include the source code location.
|
||||||
DiagnosticInfoOptimizationBase(enum DiagnosticKind Kind,
|
DiagnosticInfoOptimizationBase(enum DiagnosticKind Kind,
|
||||||
enum DiagnosticSeverity Severity,
|
enum DiagnosticSeverity Severity,
|
||||||
const char *PassName, StringRef RemarkName,
|
const char *PassName, StringRef RemarkName,
|
||||||
const Function &Fn, const DebugLoc &DLoc)
|
const Function &Fn,
|
||||||
: DiagnosticInfoWithLocationBase(Kind, Severity, Fn, DLoc),
|
const DiagnosticLocation &Loc)
|
||||||
|
: DiagnosticInfoWithLocationBase(Kind, Severity, Fn, Loc),
|
||||||
PassName(PassName), RemarkName(RemarkName) {}
|
PassName(PassName), RemarkName(RemarkName) {}
|
||||||
|
|
||||||
DiagnosticInfoOptimizationBase &operator<<(StringRef S);
|
DiagnosticInfoOptimizationBase &operator<<(StringRef S);
|
||||||
|
@ -500,7 +515,7 @@ class DiagnosticInfoIROptimization : public DiagnosticInfoOptimizationBase {
|
||||||
public:
|
public:
|
||||||
/// \p PassName is the name of the pass emitting this diagnostic. \p
|
/// \p PassName is the name of the pass emitting this diagnostic. \p
|
||||||
/// RemarkName is a textual identifier for the remark. \p Fn is the function
|
/// RemarkName is a textual identifier for the remark. \p Fn is the function
|
||||||
/// where the diagnostic is being emitted. \p DLoc is the location information
|
/// where the diagnostic is being emitted. \p Loc is the location information
|
||||||
/// to use in the diagnostic. If line table information is available, the
|
/// to use in the diagnostic. If line table information is available, the
|
||||||
/// diagnostic will include the source code location. \p CodeRegion is IR
|
/// diagnostic will include the source code location. \p CodeRegion is IR
|
||||||
/// value (currently basic block) that the optimization operates on. This is
|
/// value (currently basic block) that the optimization operates on. This is
|
||||||
|
@ -508,10 +523,11 @@ public:
|
||||||
DiagnosticInfoIROptimization(enum DiagnosticKind Kind,
|
DiagnosticInfoIROptimization(enum DiagnosticKind Kind,
|
||||||
enum DiagnosticSeverity Severity,
|
enum DiagnosticSeverity Severity,
|
||||||
const char *PassName, StringRef RemarkName,
|
const char *PassName, StringRef RemarkName,
|
||||||
const Function &Fn, const DebugLoc &DLoc,
|
const Function &Fn,
|
||||||
|
const DiagnosticLocation &Loc,
|
||||||
Value *CodeRegion = nullptr)
|
Value *CodeRegion = nullptr)
|
||||||
: DiagnosticInfoOptimizationBase(Kind, Severity, PassName, RemarkName, Fn,
|
: DiagnosticInfoOptimizationBase(Kind, Severity, PassName, RemarkName, Fn,
|
||||||
DLoc),
|
Loc),
|
||||||
CodeRegion(CodeRegion) {}
|
CodeRegion(CodeRegion) {}
|
||||||
|
|
||||||
/// \brief This is ctor variant allows a pass to build an optimization remark
|
/// \brief This is ctor variant allows a pass to build an optimization remark
|
||||||
|
@ -525,7 +541,7 @@ public:
|
||||||
const DiagnosticInfoIROptimization &Orig)
|
const DiagnosticInfoIROptimization &Orig)
|
||||||
: DiagnosticInfoOptimizationBase(
|
: DiagnosticInfoOptimizationBase(
|
||||||
(DiagnosticKind)Orig.getKind(), Orig.getSeverity(), PassName,
|
(DiagnosticKind)Orig.getKind(), Orig.getSeverity(), PassName,
|
||||||
Orig.RemarkName, Orig.getFunction(), Orig.getDebugLoc()),
|
Orig.RemarkName, Orig.getFunction(), Orig.getLocation()),
|
||||||
CodeRegion(Orig.getCodeRegion()) {
|
CodeRegion(Orig.getCodeRegion()) {
|
||||||
*this << Prepend;
|
*this << Prepend;
|
||||||
std::copy(Orig.Args.begin(), Orig.Args.end(), std::back_inserter(Args));
|
std::copy(Orig.Args.begin(), Orig.Args.end(), std::back_inserter(Args));
|
||||||
|
@ -533,7 +549,7 @@ public:
|
||||||
|
|
||||||
/// Legacy interface.
|
/// Legacy interface.
|
||||||
/// \p PassName is the name of the pass emitting this diagnostic.
|
/// \p PassName is the name of the pass emitting this diagnostic.
|
||||||
/// \p Fn is the function where the diagnostic is being emitted. \p DLoc is
|
/// \p Fn is the function where the diagnostic is being emitted. \p Loc is
|
||||||
/// the location information to use in the diagnostic. If line table
|
/// the location information to use in the diagnostic. If line table
|
||||||
/// information is available, the diagnostic will include the source code
|
/// information is available, the diagnostic will include the source code
|
||||||
/// location. \p Msg is the message to show. Note that this class does not
|
/// location. \p Msg is the message to show. Note that this class does not
|
||||||
|
@ -542,9 +558,9 @@ public:
|
||||||
DiagnosticInfoIROptimization(enum DiagnosticKind Kind,
|
DiagnosticInfoIROptimization(enum DiagnosticKind Kind,
|
||||||
enum DiagnosticSeverity Severity,
|
enum DiagnosticSeverity Severity,
|
||||||
const char *PassName, const Function &Fn,
|
const char *PassName, const Function &Fn,
|
||||||
const DebugLoc &DLoc, const Twine &Msg,
|
const DiagnosticLocation &Loc, const Twine &Msg,
|
||||||
Optional<uint64_t> Hotness = None)
|
Optional<uint64_t> Hotness = None)
|
||||||
: DiagnosticInfoOptimizationBase(Kind, Severity, PassName, "", Fn, DLoc) {
|
: DiagnosticInfoOptimizationBase(Kind, Severity, PassName, "", Fn, Loc) {
|
||||||
setHotness(Hotness);
|
setHotness(Hotness);
|
||||||
*this << Msg.str();
|
*this << Msg.str();
|
||||||
}
|
}
|
||||||
|
@ -567,24 +583,24 @@ public:
|
||||||
/// \p PassName is the name of the pass emitting this diagnostic. If
|
/// \p PassName is the name of the pass emitting this diagnostic. If
|
||||||
/// this name matches the regular expression given in -Rpass=, then the
|
/// this name matches the regular expression given in -Rpass=, then the
|
||||||
/// diagnostic will be emitted. \p Fn is the function where the diagnostic
|
/// diagnostic will be emitted. \p Fn is the function where the diagnostic
|
||||||
/// is being emitted. \p DLoc is the location information to use in the
|
/// is being emitted. \p Loc is the location information to use in the
|
||||||
/// diagnostic. If line table information is available, the diagnostic
|
/// diagnostic. If line table information is available, the diagnostic
|
||||||
/// will include the source code location. \p Msg is the message to show.
|
/// will include the source code location. \p Msg is the message to show.
|
||||||
/// Note that this class does not copy this message, so this reference
|
/// Note that this class does not copy this message, so this reference
|
||||||
/// must be valid for the whole life time of the diagnostic.
|
/// must be valid for the whole life time of the diagnostic.
|
||||||
OptimizationRemark(const char *PassName, const Function &Fn,
|
OptimizationRemark(const char *PassName, const Function &Fn,
|
||||||
const DebugLoc &DLoc, const Twine &Msg,
|
const DiagnosticLocation &Loc, const Twine &Msg,
|
||||||
Optional<uint64_t> Hotness = None)
|
Optional<uint64_t> Hotness = None)
|
||||||
: DiagnosticInfoIROptimization(DK_OptimizationRemark, DS_Remark, PassName,
|
: DiagnosticInfoIROptimization(DK_OptimizationRemark, DS_Remark, PassName,
|
||||||
Fn, DLoc, Msg, Hotness) {}
|
Fn, Loc, Msg, Hotness) {}
|
||||||
|
|
||||||
/// \p PassName is the name of the pass emitting this diagnostic. If this name
|
/// \p PassName is the name of the pass emitting this diagnostic. If this name
|
||||||
/// matches the regular expression given in -Rpass=, then the diagnostic will
|
/// matches the regular expression given in -Rpass=, then the diagnostic will
|
||||||
/// be emitted. \p RemarkName is a textual identifier for the remark. \p
|
/// be emitted. \p RemarkName is a textual identifier for the remark. \p
|
||||||
/// DLoc is the debug location and \p CodeRegion is the region that the
|
/// Loc is the debug location and \p CodeRegion is the region that the
|
||||||
/// optimization operates on (currently on block is supported).
|
/// optimization operates on (currently on block is supported).
|
||||||
OptimizationRemark(const char *PassName, StringRef RemarkName,
|
OptimizationRemark(const char *PassName, StringRef RemarkName,
|
||||||
const DebugLoc &DLoc, Value *CodeRegion);
|
const DiagnosticLocation &Loc, Value *CodeRegion);
|
||||||
|
|
||||||
/// Same as above but the debug location and code region is derived from \p
|
/// Same as above but the debug location and code region is derived from \p
|
||||||
/// Instr.
|
/// Instr.
|
||||||
|
@ -607,24 +623,24 @@ public:
|
||||||
/// \p PassName is the name of the pass emitting this diagnostic. If
|
/// \p PassName is the name of the pass emitting this diagnostic. If
|
||||||
/// this name matches the regular expression given in -Rpass-missed=, then the
|
/// this name matches the regular expression given in -Rpass-missed=, then the
|
||||||
/// diagnostic will be emitted. \p Fn is the function where the diagnostic
|
/// diagnostic will be emitted. \p Fn is the function where the diagnostic
|
||||||
/// is being emitted. \p DLoc is the location information to use in the
|
/// is being emitted. \p Loc is the location information to use in the
|
||||||
/// diagnostic. If line table information is available, the diagnostic
|
/// diagnostic. If line table information is available, the diagnostic
|
||||||
/// will include the source code location. \p Msg is the message to show.
|
/// will include the source code location. \p Msg is the message to show.
|
||||||
/// Note that this class does not copy this message, so this reference
|
/// Note that this class does not copy this message, so this reference
|
||||||
/// must be valid for the whole life time of the diagnostic.
|
/// must be valid for the whole life time of the diagnostic.
|
||||||
OptimizationRemarkMissed(const char *PassName, const Function &Fn,
|
OptimizationRemarkMissed(const char *PassName, const Function &Fn,
|
||||||
const DebugLoc &DLoc, const Twine &Msg,
|
const DiagnosticLocation &Loc, const Twine &Msg,
|
||||||
Optional<uint64_t> Hotness = None)
|
Optional<uint64_t> Hotness = None)
|
||||||
: DiagnosticInfoIROptimization(DK_OptimizationRemarkMissed, DS_Remark,
|
: DiagnosticInfoIROptimization(DK_OptimizationRemarkMissed, DS_Remark,
|
||||||
PassName, Fn, DLoc, Msg, Hotness) {}
|
PassName, Fn, Loc, Msg, Hotness) {}
|
||||||
|
|
||||||
/// \p PassName is the name of the pass emitting this diagnostic. If this name
|
/// \p PassName is the name of the pass emitting this diagnostic. If this name
|
||||||
/// matches the regular expression given in -Rpass-missed=, then the
|
/// matches the regular expression given in -Rpass-missed=, then the
|
||||||
/// diagnostic will be emitted. \p RemarkName is a textual identifier for the
|
/// diagnostic will be emitted. \p RemarkName is a textual identifier for the
|
||||||
/// remark. \p DLoc is the debug location and \p CodeRegion is the region
|
/// remark. \p Loc is the debug location and \p CodeRegion is the region
|
||||||
/// that the optimization operates on (currently on block is supported).
|
/// that the optimization operates on (currently on block is supported).
|
||||||
OptimizationRemarkMissed(const char *PassName, StringRef RemarkName,
|
OptimizationRemarkMissed(const char *PassName, StringRef RemarkName,
|
||||||
const DebugLoc &DLoc, Value *CodeRegion);
|
const DiagnosticLocation &Loc, Value *CodeRegion);
|
||||||
|
|
||||||
/// \brief Same as above but \p Inst is used to derive code region and debug
|
/// \brief Same as above but \p Inst is used to derive code region and debug
|
||||||
/// location.
|
/// location.
|
||||||
|
@ -647,24 +663,24 @@ public:
|
||||||
/// \p PassName is the name of the pass emitting this diagnostic. If
|
/// \p PassName is the name of the pass emitting this diagnostic. If
|
||||||
/// this name matches the regular expression given in -Rpass-analysis=, then
|
/// this name matches the regular expression given in -Rpass-analysis=, then
|
||||||
/// the diagnostic will be emitted. \p Fn is the function where the diagnostic
|
/// the diagnostic will be emitted. \p Fn is the function where the diagnostic
|
||||||
/// is being emitted. \p DLoc is the location information to use in the
|
/// is being emitted. \p Loc is the location information to use in the
|
||||||
/// diagnostic. If line table information is available, the diagnostic will
|
/// diagnostic. If line table information is available, the diagnostic will
|
||||||
/// include the source code location. \p Msg is the message to show. Note that
|
/// include the source code location. \p Msg is the message to show. Note that
|
||||||
/// this class does not copy this message, so this reference must be valid for
|
/// this class does not copy this message, so this reference must be valid for
|
||||||
/// the whole life time of the diagnostic.
|
/// the whole life time of the diagnostic.
|
||||||
OptimizationRemarkAnalysis(const char *PassName, const Function &Fn,
|
OptimizationRemarkAnalysis(const char *PassName, const Function &Fn,
|
||||||
const DebugLoc &DLoc, const Twine &Msg,
|
const DiagnosticLocation &Loc, const Twine &Msg,
|
||||||
Optional<uint64_t> Hotness = None)
|
Optional<uint64_t> Hotness = None)
|
||||||
: DiagnosticInfoIROptimization(DK_OptimizationRemarkAnalysis, DS_Remark,
|
: DiagnosticInfoIROptimization(DK_OptimizationRemarkAnalysis, DS_Remark,
|
||||||
PassName, Fn, DLoc, Msg, Hotness) {}
|
PassName, Fn, Loc, Msg, Hotness) {}
|
||||||
|
|
||||||
/// \p PassName is the name of the pass emitting this diagnostic. If this name
|
/// \p PassName is the name of the pass emitting this diagnostic. If this name
|
||||||
/// matches the regular expression given in -Rpass-analysis=, then the
|
/// matches the regular expression given in -Rpass-analysis=, then the
|
||||||
/// diagnostic will be emitted. \p RemarkName is a textual identifier for the
|
/// diagnostic will be emitted. \p RemarkName is a textual identifier for the
|
||||||
/// remark. \p DLoc is the debug location and \p CodeRegion is the region
|
/// remark. \p Loc is the debug location and \p CodeRegion is the region
|
||||||
/// that the optimization operates on (currently on block is supported).
|
/// that the optimization operates on (currently on block is supported).
|
||||||
OptimizationRemarkAnalysis(const char *PassName, StringRef RemarkName,
|
OptimizationRemarkAnalysis(const char *PassName, StringRef RemarkName,
|
||||||
const DebugLoc &DLoc, Value *CodeRegion);
|
const DiagnosticLocation &Loc, Value *CodeRegion);
|
||||||
|
|
||||||
/// \brief This is ctor variant allows a pass to build an optimization remark
|
/// \brief This is ctor variant allows a pass to build an optimization remark
|
||||||
/// from an existing remark.
|
/// from an existing remark.
|
||||||
|
@ -699,14 +715,14 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
OptimizationRemarkAnalysis(enum DiagnosticKind Kind, const char *PassName,
|
OptimizationRemarkAnalysis(enum DiagnosticKind Kind, const char *PassName,
|
||||||
const Function &Fn, const DebugLoc &DLoc,
|
const Function &Fn, const DiagnosticLocation &Loc,
|
||||||
const Twine &Msg, Optional<uint64_t> Hotness)
|
const Twine &Msg, Optional<uint64_t> Hotness)
|
||||||
: DiagnosticInfoIROptimization(Kind, DS_Remark, PassName, Fn, DLoc, Msg,
|
: DiagnosticInfoIROptimization(Kind, DS_Remark, PassName, Fn, Loc, Msg,
|
||||||
Hotness) {}
|
Hotness) {}
|
||||||
|
|
||||||
OptimizationRemarkAnalysis(enum DiagnosticKind Kind, const char *PassName,
|
OptimizationRemarkAnalysis(enum DiagnosticKind Kind, const char *PassName,
|
||||||
StringRef RemarkName, const DebugLoc &DLoc,
|
StringRef RemarkName,
|
||||||
Value *CodeRegion);
|
const DiagnosticLocation &Loc, Value *CodeRegion);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Diagnostic information for optimization analysis remarks related to
|
/// Diagnostic information for optimization analysis remarks related to
|
||||||
|
@ -716,7 +732,7 @@ public:
|
||||||
/// \p PassName is the name of the pass emitting this diagnostic. If
|
/// \p PassName is the name of the pass emitting this diagnostic. If
|
||||||
/// this name matches the regular expression given in -Rpass-analysis=, then
|
/// this name matches the regular expression given in -Rpass-analysis=, then
|
||||||
/// the diagnostic will be emitted. \p Fn is the function where the diagnostic
|
/// the diagnostic will be emitted. \p Fn is the function where the diagnostic
|
||||||
/// is being emitted. \p DLoc is the location information to use in the
|
/// is being emitted. \p Loc is the location information to use in the
|
||||||
/// diagnostic. If line table information is available, the diagnostic will
|
/// diagnostic. If line table information is available, the diagnostic will
|
||||||
/// include the source code location. \p Msg is the message to show. The
|
/// include the source code location. \p Msg is the message to show. The
|
||||||
/// front-end will append its own message related to options that address
|
/// front-end will append its own message related to options that address
|
||||||
|
@ -724,23 +740,25 @@ public:
|
||||||
/// message, so this reference must be valid for the whole life time of the
|
/// message, so this reference must be valid for the whole life time of the
|
||||||
/// diagnostic.
|
/// diagnostic.
|
||||||
OptimizationRemarkAnalysisFPCommute(const char *PassName, const Function &Fn,
|
OptimizationRemarkAnalysisFPCommute(const char *PassName, const Function &Fn,
|
||||||
const DebugLoc &DLoc, const Twine &Msg,
|
const DiagnosticLocation &Loc,
|
||||||
|
const Twine &Msg,
|
||||||
Optional<uint64_t> Hotness = None)
|
Optional<uint64_t> Hotness = None)
|
||||||
: OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisFPCommute,
|
: OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisFPCommute,
|
||||||
PassName, Fn, DLoc, Msg, Hotness) {}
|
PassName, Fn, Loc, Msg, Hotness) {}
|
||||||
|
|
||||||
/// \p PassName is the name of the pass emitting this diagnostic. If this name
|
/// \p PassName is the name of the pass emitting this diagnostic. If this name
|
||||||
/// matches the regular expression given in -Rpass-analysis=, then the
|
/// matches the regular expression given in -Rpass-analysis=, then the
|
||||||
/// diagnostic will be emitted. \p RemarkName is a textual identifier for the
|
/// diagnostic will be emitted. \p RemarkName is a textual identifier for the
|
||||||
/// remark. \p DLoc is the debug location and \p CodeRegion is the region
|
/// remark. \p Loc is the debug location and \p CodeRegion is the region
|
||||||
/// that the optimization operates on (currently on block is supported). The
|
/// that the optimization operates on (currently on block is supported). The
|
||||||
/// front-end will append its own message related to options that address
|
/// front-end will append its own message related to options that address
|
||||||
/// floating-point non-commutativity.
|
/// floating-point non-commutativity.
|
||||||
OptimizationRemarkAnalysisFPCommute(const char *PassName,
|
OptimizationRemarkAnalysisFPCommute(const char *PassName,
|
||||||
StringRef RemarkName,
|
StringRef RemarkName,
|
||||||
const DebugLoc &DLoc, Value *CodeRegion)
|
const DiagnosticLocation &Loc,
|
||||||
|
Value *CodeRegion)
|
||||||
: OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisFPCommute,
|
: OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisFPCommute,
|
||||||
PassName, RemarkName, DLoc, CodeRegion) {}
|
PassName, RemarkName, Loc, CodeRegion) {}
|
||||||
|
|
||||||
static bool classof(const DiagnosticInfo *DI) {
|
static bool classof(const DiagnosticInfo *DI) {
|
||||||
return DI->getKind() == DK_OptimizationRemarkAnalysisFPCommute;
|
return DI->getKind() == DK_OptimizationRemarkAnalysisFPCommute;
|
||||||
|
@ -754,7 +772,7 @@ public:
|
||||||
/// \p PassName is the name of the pass emitting this diagnostic. If
|
/// \p PassName is the name of the pass emitting this diagnostic. If
|
||||||
/// this name matches the regular expression given in -Rpass-analysis=, then
|
/// this name matches the regular expression given in -Rpass-analysis=, then
|
||||||
/// the diagnostic will be emitted. \p Fn is the function where the diagnostic
|
/// the diagnostic will be emitted. \p Fn is the function where the diagnostic
|
||||||
/// is being emitted. \p DLoc is the location information to use in the
|
/// is being emitted. \p Loc is the location information to use in the
|
||||||
/// diagnostic. If line table information is available, the diagnostic will
|
/// diagnostic. If line table information is available, the diagnostic will
|
||||||
/// include the source code location. \p Msg is the message to show. The
|
/// include the source code location. \p Msg is the message to show. The
|
||||||
/// front-end will append its own message related to options that address
|
/// front-end will append its own message related to options that address
|
||||||
|
@ -762,22 +780,24 @@ public:
|
||||||
/// message, so this reference must be valid for the whole life time of the
|
/// message, so this reference must be valid for the whole life time of the
|
||||||
/// diagnostic.
|
/// diagnostic.
|
||||||
OptimizationRemarkAnalysisAliasing(const char *PassName, const Function &Fn,
|
OptimizationRemarkAnalysisAliasing(const char *PassName, const Function &Fn,
|
||||||
const DebugLoc &DLoc, const Twine &Msg,
|
const DiagnosticLocation &Loc,
|
||||||
|
const Twine &Msg,
|
||||||
Optional<uint64_t> Hotness = None)
|
Optional<uint64_t> Hotness = None)
|
||||||
: OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisAliasing,
|
: OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisAliasing,
|
||||||
PassName, Fn, DLoc, Msg, Hotness) {}
|
PassName, Fn, Loc, Msg, Hotness) {}
|
||||||
|
|
||||||
/// \p PassName is the name of the pass emitting this diagnostic. If this name
|
/// \p PassName is the name of the pass emitting this diagnostic. If this name
|
||||||
/// matches the regular expression given in -Rpass-analysis=, then the
|
/// matches the regular expression given in -Rpass-analysis=, then the
|
||||||
/// diagnostic will be emitted. \p RemarkName is a textual identifier for the
|
/// diagnostic will be emitted. \p RemarkName is a textual identifier for the
|
||||||
/// remark. \p DLoc is the debug location and \p CodeRegion is the region
|
/// remark. \p Loc is the debug location and \p CodeRegion is the region
|
||||||
/// that the optimization operates on (currently on block is supported). The
|
/// that the optimization operates on (currently on block is supported). The
|
||||||
/// front-end will append its own message related to options that address
|
/// front-end will append its own message related to options that address
|
||||||
/// pointer aliasing legality.
|
/// pointer aliasing legality.
|
||||||
OptimizationRemarkAnalysisAliasing(const char *PassName, StringRef RemarkName,
|
OptimizationRemarkAnalysisAliasing(const char *PassName, StringRef RemarkName,
|
||||||
const DebugLoc &DLoc, Value *CodeRegion)
|
const DiagnosticLocation &Loc,
|
||||||
|
Value *CodeRegion)
|
||||||
: OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisAliasing,
|
: OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisAliasing,
|
||||||
PassName, RemarkName, DLoc, CodeRegion) {}
|
PassName, RemarkName, Loc, CodeRegion) {}
|
||||||
|
|
||||||
static bool classof(const DiagnosticInfo *DI) {
|
static bool classof(const DiagnosticInfo *DI) {
|
||||||
return DI->getKind() == DK_OptimizationRemarkAnalysisAliasing;
|
return DI->getKind() == DK_OptimizationRemarkAnalysisAliasing;
|
||||||
|
@ -827,77 +847,81 @@ DEFINE_SIMPLE_CONVERSION_FUNCTIONS(DiagnosticInfo, LLVMDiagnosticInfoRef)
|
||||||
/// Emit an optimization-applied message. \p PassName is the name of the pass
|
/// Emit an optimization-applied message. \p PassName is the name of the pass
|
||||||
/// emitting the message. If -Rpass= is given and \p PassName matches the
|
/// emitting the message. If -Rpass= is given and \p PassName matches the
|
||||||
/// regular expression in -Rpass, then the remark will be emitted. \p Fn is
|
/// regular expression in -Rpass, then the remark will be emitted. \p Fn is
|
||||||
/// the function triggering the remark, \p DLoc is the debug location where
|
/// the function triggering the remark, \p Loc is the debug location where
|
||||||
/// the diagnostic is generated. \p Msg is the message string to use.
|
/// the diagnostic is generated. \p Msg is the message string to use.
|
||||||
void emitOptimizationRemark(LLVMContext &Ctx, const char *PassName,
|
void emitOptimizationRemark(LLVMContext &Ctx, const char *PassName,
|
||||||
const Function &Fn, const DebugLoc &DLoc,
|
const Function &Fn, const DiagnosticLocation &Loc,
|
||||||
const Twine &Msg);
|
const Twine &Msg);
|
||||||
|
|
||||||
/// Emit an optimization-missed message. \p PassName is the name of the
|
/// Emit an optimization-missed message. \p PassName is the name of the
|
||||||
/// pass emitting the message. If -Rpass-missed= is given and \p PassName
|
/// pass emitting the message. If -Rpass-missed= is given and \p PassName
|
||||||
/// matches the regular expression in -Rpass, then the remark will be
|
/// matches the regular expression in -Rpass, then the remark will be
|
||||||
/// emitted. \p Fn is the function triggering the remark, \p DLoc is the
|
/// emitted. \p Fn is the function triggering the remark, \p Loc is the
|
||||||
/// debug location where the diagnostic is generated. \p Msg is the
|
/// debug location where the diagnostic is generated. \p Msg is the
|
||||||
/// message string to use.
|
/// message string to use.
|
||||||
void emitOptimizationRemarkMissed(LLVMContext &Ctx, const char *PassName,
|
void emitOptimizationRemarkMissed(LLVMContext &Ctx, const char *PassName,
|
||||||
const Function &Fn, const DebugLoc &DLoc,
|
const Function &Fn,
|
||||||
|
const DiagnosticLocation &Loc,
|
||||||
const Twine &Msg);
|
const Twine &Msg);
|
||||||
|
|
||||||
/// Emit an optimization analysis remark message. \p PassName is the name of
|
/// Emit an optimization analysis remark message. \p PassName is the name of
|
||||||
/// the pass emitting the message. If -Rpass-analysis= is given and \p
|
/// the pass emitting the message. If -Rpass-analysis= is given and \p
|
||||||
/// PassName matches the regular expression in -Rpass, then the remark will be
|
/// PassName matches the regular expression in -Rpass, then the remark will be
|
||||||
/// emitted. \p Fn is the function triggering the remark, \p DLoc is the debug
|
/// emitted. \p Fn is the function triggering the remark, \p Loc is the debug
|
||||||
/// location where the diagnostic is generated. \p Msg is the message string
|
/// location where the diagnostic is generated. \p Msg is the message string
|
||||||
/// to use.
|
/// to use.
|
||||||
void emitOptimizationRemarkAnalysis(LLVMContext &Ctx, const char *PassName,
|
void emitOptimizationRemarkAnalysis(LLVMContext &Ctx, const char *PassName,
|
||||||
const Function &Fn, const DebugLoc &DLoc,
|
const Function &Fn,
|
||||||
|
const DiagnosticLocation &Loc,
|
||||||
const Twine &Msg);
|
const Twine &Msg);
|
||||||
|
|
||||||
/// Emit an optimization analysis remark related to messages about
|
/// Emit an optimization analysis remark related to messages about
|
||||||
/// floating-point non-commutativity. \p PassName is the name of the pass
|
/// floating-point non-commutativity. \p PassName is the name of the pass
|
||||||
/// emitting the message. If -Rpass-analysis= is given and \p PassName matches
|
/// emitting the message. If -Rpass-analysis= is given and \p PassName matches
|
||||||
/// the regular expression in -Rpass, then the remark will be emitted. \p Fn is
|
/// the regular expression in -Rpass, then the remark will be emitted. \p Fn is
|
||||||
/// the function triggering the remark, \p DLoc is the debug location where the
|
/// the function triggering the remark, \p Loc is the debug location where the
|
||||||
/// diagnostic is generated. \p Msg is the message string to use.
|
/// diagnostic is generated. \p Msg is the message string to use.
|
||||||
void emitOptimizationRemarkAnalysisFPCommute(LLVMContext &Ctx,
|
void emitOptimizationRemarkAnalysisFPCommute(LLVMContext &Ctx,
|
||||||
const char *PassName,
|
const char *PassName,
|
||||||
const Function &Fn,
|
const Function &Fn,
|
||||||
const DebugLoc &DLoc,
|
const DiagnosticLocation &Loc,
|
||||||
const Twine &Msg);
|
const Twine &Msg);
|
||||||
|
|
||||||
/// Emit an optimization analysis remark related to messages about
|
/// Emit an optimization analysis remark related to messages about
|
||||||
/// pointer aliasing. \p PassName is the name of the pass emitting the message.
|
/// pointer aliasing. \p PassName is the name of the pass emitting the message.
|
||||||
/// If -Rpass-analysis= is given and \p PassName matches the regular expression
|
/// If -Rpass-analysis= is given and \p PassName matches the regular expression
|
||||||
/// in -Rpass, then the remark will be emitted. \p Fn is the function triggering
|
/// in -Rpass, then the remark will be emitted. \p Fn is the function triggering
|
||||||
/// the remark, \p DLoc is the debug location where the diagnostic is generated.
|
/// the remark, \p Loc is the debug location where the diagnostic is generated.
|
||||||
/// \p Msg is the message string to use.
|
/// \p Msg is the message string to use.
|
||||||
void emitOptimizationRemarkAnalysisAliasing(LLVMContext &Ctx,
|
void emitOptimizationRemarkAnalysisAliasing(LLVMContext &Ctx,
|
||||||
const char *PassName,
|
const char *PassName,
|
||||||
const Function &Fn,
|
const Function &Fn,
|
||||||
const DebugLoc &DLoc,
|
const DiagnosticLocation &Loc,
|
||||||
const Twine &Msg);
|
const Twine &Msg);
|
||||||
|
|
||||||
/// Diagnostic information for optimization failures.
|
/// Diagnostic information for optimization failures.
|
||||||
class DiagnosticInfoOptimizationFailure : public DiagnosticInfoIROptimization {
|
class DiagnosticInfoOptimizationFailure : public DiagnosticInfoIROptimization {
|
||||||
public:
|
public:
|
||||||
/// \p Fn is the function where the diagnostic is being emitted. \p DLoc is
|
/// \p Fn is the function where the diagnostic is being emitted. \p Loc is
|
||||||
/// the location information to use in the diagnostic. If line table
|
/// the location information to use in the diagnostic. If line table
|
||||||
/// information is available, the diagnostic will include the source code
|
/// information is available, the diagnostic will include the source code
|
||||||
/// location. \p Msg is the message to show. Note that this class does not
|
/// location. \p Msg is the message to show. Note that this class does not
|
||||||
/// copy this message, so this reference must be valid for the whole life time
|
/// copy this message, so this reference must be valid for the whole life time
|
||||||
/// of the diagnostic.
|
/// of the diagnostic.
|
||||||
DiagnosticInfoOptimizationFailure(const Function &Fn, const DebugLoc &DLoc,
|
DiagnosticInfoOptimizationFailure(const Function &Fn,
|
||||||
|
const DiagnosticLocation &Loc,
|
||||||
const Twine &Msg)
|
const Twine &Msg)
|
||||||
: DiagnosticInfoIROptimization(DK_OptimizationFailure, DS_Warning,
|
: DiagnosticInfoIROptimization(DK_OptimizationFailure, DS_Warning,
|
||||||
nullptr, Fn, DLoc, Msg) {}
|
nullptr, Fn, Loc, Msg) {}
|
||||||
|
|
||||||
/// \p PassName is the name of the pass emitting this diagnostic. \p
|
/// \p PassName is the name of the pass emitting this diagnostic. \p
|
||||||
/// RemarkName is a textual identifier for the remark (single-word,
|
/// RemarkName is a textual identifier for the remark (single-word,
|
||||||
/// camel-case). \p DLoc is the debug location and \p CodeRegion is the
|
/// camel-case). \p Loc is the debug location and \p CodeRegion is the
|
||||||
/// region that the optimization operates on (currently basic block is
|
/// region that the optimization operates on (currently basic block is
|
||||||
/// supported).
|
/// supported).
|
||||||
DiagnosticInfoOptimizationFailure(const char *PassName, StringRef RemarkName,
|
DiagnosticInfoOptimizationFailure(const char *PassName, StringRef RemarkName,
|
||||||
const DebugLoc &DLoc, Value *CodeRegion);
|
const DiagnosticLocation &Loc,
|
||||||
|
Value *CodeRegion);
|
||||||
|
|
||||||
static bool classof(const DiagnosticInfo *DI) {
|
static bool classof(const DiagnosticInfo *DI) {
|
||||||
return DI->getKind() == DK_OptimizationFailure;
|
return DI->getKind() == DK_OptimizationFailure;
|
||||||
|
@ -913,16 +937,17 @@ private:
|
||||||
Twine Msg;
|
Twine Msg;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// \p Fn is the function where the diagnostic is being emitted. \p DLoc is
|
/// \p Fn is the function where the diagnostic is being emitted. \p Loc is
|
||||||
/// the location information to use in the diagnostic. If line table
|
/// the location information to use in the diagnostic. If line table
|
||||||
/// information is available, the diagnostic will include the source code
|
/// information is available, the diagnostic will include the source code
|
||||||
/// location. \p Msg is the message to show. Note that this class does not
|
/// location. \p Msg is the message to show. Note that this class does not
|
||||||
/// copy this message, so this reference must be valid for the whole life time
|
/// copy this message, so this reference must be valid for the whole life time
|
||||||
/// of the diagnostic.
|
/// of the diagnostic.
|
||||||
DiagnosticInfoUnsupported(const Function &Fn, const Twine &Msg,
|
DiagnosticInfoUnsupported(
|
||||||
DebugLoc DLoc = DebugLoc(),
|
const Function &Fn, const Twine &Msg,
|
||||||
|
const DiagnosticLocation &Loc = DiagnosticLocation(),
|
||||||
DiagnosticSeverity Severity = DS_Error)
|
DiagnosticSeverity Severity = DS_Error)
|
||||||
: DiagnosticInfoWithLocationBase(DK_Unsupported, Severity, Fn, DLoc),
|
: DiagnosticInfoWithLocationBase(DK_Unsupported, Severity, Fn, Loc),
|
||||||
Msg(Msg) {}
|
Msg(Msg) {}
|
||||||
|
|
||||||
static bool classof(const DiagnosticInfo *DI) {
|
static bool classof(const DiagnosticInfo *DI) {
|
||||||
|
|
|
@ -99,28 +99,27 @@ void MappingTraits<DiagnosticInfoOptimizationBase *>::mapping(
|
||||||
llvm_unreachable("Unknown remark type");
|
llvm_unreachable("Unknown remark type");
|
||||||
|
|
||||||
// These are read-only for now.
|
// These are read-only for now.
|
||||||
DebugLoc DL = OptDiag->getDebugLoc();
|
DiagnosticLocation DL = OptDiag->getLocation();
|
||||||
StringRef FN =
|
StringRef FN =
|
||||||
GlobalValue::getRealLinkageName(OptDiag->getFunction().getName());
|
GlobalValue::getRealLinkageName(OptDiag->getFunction().getName());
|
||||||
|
|
||||||
StringRef PassName(OptDiag->PassName);
|
StringRef PassName(OptDiag->PassName);
|
||||||
io.mapRequired("Pass", PassName);
|
io.mapRequired("Pass", PassName);
|
||||||
io.mapRequired("Name", OptDiag->RemarkName);
|
io.mapRequired("Name", OptDiag->RemarkName);
|
||||||
if (!io.outputting() || DL)
|
if (!io.outputting() || DL.isValid())
|
||||||
io.mapOptional("DebugLoc", DL);
|
io.mapOptional("DebugLoc", DL);
|
||||||
io.mapRequired("Function", FN);
|
io.mapRequired("Function", FN);
|
||||||
io.mapOptional("Hotness", OptDiag->Hotness);
|
io.mapOptional("Hotness", OptDiag->Hotness);
|
||||||
io.mapOptional("Args", OptDiag->Args);
|
io.mapOptional("Args", OptDiag->Args);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <> struct MappingTraits<DebugLoc> {
|
template <> struct MappingTraits<DiagnosticLocation> {
|
||||||
static void mapping(IO &io, DebugLoc &DL) {
|
static void mapping(IO &io, DiagnosticLocation &DL) {
|
||||||
assert(io.outputting() && "input not yet implemented");
|
assert(io.outputting() && "input not yet implemented");
|
||||||
|
|
||||||
auto *Scope = cast<DIScope>(DL.getScope());
|
StringRef File = DL.getFilename();
|
||||||
StringRef File = Scope->getFilename();
|
|
||||||
unsigned Line = DL.getLine();
|
unsigned Line = DL.getLine();
|
||||||
unsigned Col = DL.getCol();
|
unsigned Col = DL.getColumn();
|
||||||
|
|
||||||
io.mapRequired("File", File);
|
io.mapRequired("File", File);
|
||||||
io.mapRequired("Line", Line);
|
io.mapRequired("Line", Line);
|
||||||
|
@ -135,8 +134,8 @@ template <> struct MappingTraits<DiagnosticInfoOptimizationBase::Argument> {
|
||||||
static void mapping(IO &io, DiagnosticInfoOptimizationBase::Argument &A) {
|
static void mapping(IO &io, DiagnosticInfoOptimizationBase::Argument &A) {
|
||||||
assert(io.outputting() && "input not yet implemented");
|
assert(io.outputting() && "input not yet implemented");
|
||||||
io.mapRequired(A.Key.data(), A.Val);
|
io.mapRequired(A.Key.data(), A.Val);
|
||||||
if (A.DLoc)
|
if (A.Loc.isValid())
|
||||||
io.mapOptional("DebugLoc", A.DLoc);
|
io.mapOptional("DebugLoc", A.Loc);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -148,18 +148,20 @@ void DiagnosticInfoPGOProfile::print(DiagnosticPrinter &DP) const {
|
||||||
DP << getMsg();
|
DP << getMsg();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DiagnosticInfoWithLocationBase::isLocationAvailable() const {
|
DiagnosticLocation::DiagnosticLocation(const DebugLoc &DL) {
|
||||||
return getDebugLoc();
|
if (!DL)
|
||||||
|
return;
|
||||||
|
Filename = DL->getFilename();
|
||||||
|
Line = DL->getLine();
|
||||||
|
Column = DL->getColumn();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiagnosticInfoWithLocationBase::getLocation(StringRef *Filename,
|
void DiagnosticInfoWithLocationBase::getLocation(StringRef *Filename,
|
||||||
unsigned *Line,
|
unsigned *Line,
|
||||||
unsigned *Column) const {
|
unsigned *Column) const {
|
||||||
DILocation *L = getDebugLoc();
|
*Filename = Loc.getFilename();
|
||||||
assert(L != nullptr && "debug location is invalid");
|
*Line = Loc.getLine();
|
||||||
*Filename = L->getFilename();
|
*Column = Loc.getColumn();
|
||||||
*Line = L->getLine();
|
|
||||||
*Column = L->getColumn();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string DiagnosticInfoWithLocationBase::getLocationStr() const {
|
const std::string DiagnosticInfoWithLocationBase::getLocationStr() const {
|
||||||
|
@ -175,10 +177,10 @@ DiagnosticInfoOptimizationBase::Argument::Argument(StringRef Key, const Value *V
|
||||||
: Key(Key) {
|
: Key(Key) {
|
||||||
if (auto *F = dyn_cast<Function>(V)) {
|
if (auto *F = dyn_cast<Function>(V)) {
|
||||||
if (DISubprogram *SP = F->getSubprogram())
|
if (DISubprogram *SP = F->getSubprogram())
|
||||||
DLoc = DebugLoc::get(SP->getScopeLine(), 0, SP);
|
Loc = DebugLoc::get(SP->getScopeLine(), 0, SP);
|
||||||
}
|
}
|
||||||
else if (auto *I = dyn_cast<Instruction>(V))
|
else if (auto *I = dyn_cast<Instruction>(V))
|
||||||
DLoc = I->getDebugLoc();
|
Loc = I->getDebugLoc();
|
||||||
|
|
||||||
// Only include names that correspond to user variables. FIXME: we should use
|
// Only include names that correspond to user variables. FIXME: we should use
|
||||||
// debug info if available to get the name of the user variable.
|
// debug info if available to get the name of the user variable.
|
||||||
|
@ -211,10 +213,11 @@ void DiagnosticInfoOptimizationBase::print(DiagnosticPrinter &DP) const {
|
||||||
|
|
||||||
OptimizationRemark::OptimizationRemark(const char *PassName,
|
OptimizationRemark::OptimizationRemark(const char *PassName,
|
||||||
StringRef RemarkName,
|
StringRef RemarkName,
|
||||||
const DebugLoc &DLoc, Value *CodeRegion)
|
const DiagnosticLocation &Loc,
|
||||||
|
Value *CodeRegion)
|
||||||
: DiagnosticInfoIROptimization(
|
: DiagnosticInfoIROptimization(
|
||||||
DK_OptimizationRemark, DS_Remark, PassName, RemarkName,
|
DK_OptimizationRemark, DS_Remark, PassName, RemarkName,
|
||||||
*cast<BasicBlock>(CodeRegion)->getParent(), DLoc, CodeRegion) {}
|
*cast<BasicBlock>(CodeRegion)->getParent(), Loc, CodeRegion) {}
|
||||||
|
|
||||||
OptimizationRemark::OptimizationRemark(const char *PassName,
|
OptimizationRemark::OptimizationRemark(const char *PassName,
|
||||||
StringRef RemarkName, Instruction *Inst)
|
StringRef RemarkName, Instruction *Inst)
|
||||||
|
@ -227,13 +230,12 @@ bool OptimizationRemark::isEnabled(StringRef PassName) {
|
||||||
PassRemarksOptLoc.Pattern->match(PassName);
|
PassRemarksOptLoc.Pattern->match(PassName);
|
||||||
}
|
}
|
||||||
|
|
||||||
OptimizationRemarkMissed::OptimizationRemarkMissed(const char *PassName,
|
OptimizationRemarkMissed::OptimizationRemarkMissed(
|
||||||
StringRef RemarkName,
|
const char *PassName, StringRef RemarkName, const DiagnosticLocation &Loc,
|
||||||
const DebugLoc &DLoc,
|
|
||||||
Value *CodeRegion)
|
Value *CodeRegion)
|
||||||
: DiagnosticInfoIROptimization(
|
: DiagnosticInfoIROptimization(
|
||||||
DK_OptimizationRemarkMissed, DS_Remark, PassName, RemarkName,
|
DK_OptimizationRemarkMissed, DS_Remark, PassName, RemarkName,
|
||||||
*cast<BasicBlock>(CodeRegion)->getParent(), DLoc, CodeRegion) {}
|
*cast<BasicBlock>(CodeRegion)->getParent(), Loc, CodeRegion) {}
|
||||||
|
|
||||||
OptimizationRemarkMissed::OptimizationRemarkMissed(const char *PassName,
|
OptimizationRemarkMissed::OptimizationRemarkMissed(const char *PassName,
|
||||||
StringRef RemarkName,
|
StringRef RemarkName,
|
||||||
|
@ -248,13 +250,12 @@ bool OptimizationRemarkMissed::isEnabled(StringRef PassName) {
|
||||||
PassRemarksMissedOptLoc.Pattern->match(PassName);
|
PassRemarksMissedOptLoc.Pattern->match(PassName);
|
||||||
}
|
}
|
||||||
|
|
||||||
OptimizationRemarkAnalysis::OptimizationRemarkAnalysis(const char *PassName,
|
OptimizationRemarkAnalysis::OptimizationRemarkAnalysis(
|
||||||
StringRef RemarkName,
|
const char *PassName, StringRef RemarkName, const DiagnosticLocation &Loc,
|
||||||
const DebugLoc &DLoc,
|
|
||||||
Value *CodeRegion)
|
Value *CodeRegion)
|
||||||
: DiagnosticInfoIROptimization(
|
: DiagnosticInfoIROptimization(
|
||||||
DK_OptimizationRemarkAnalysis, DS_Remark, PassName, RemarkName,
|
DK_OptimizationRemarkAnalysis, DS_Remark, PassName, RemarkName,
|
||||||
*cast<BasicBlock>(CodeRegion)->getParent(), DLoc, CodeRegion) {}
|
*cast<BasicBlock>(CodeRegion)->getParent(), Loc, CodeRegion) {}
|
||||||
|
|
||||||
OptimizationRemarkAnalysis::OptimizationRemarkAnalysis(const char *PassName,
|
OptimizationRemarkAnalysis::OptimizationRemarkAnalysis(const char *PassName,
|
||||||
StringRef RemarkName,
|
StringRef RemarkName,
|
||||||
|
@ -264,14 +265,12 @@ OptimizationRemarkAnalysis::OptimizationRemarkAnalysis(const char *PassName,
|
||||||
*Inst->getParent()->getParent(),
|
*Inst->getParent()->getParent(),
|
||||||
Inst->getDebugLoc(), Inst->getParent()) {}
|
Inst->getDebugLoc(), Inst->getParent()) {}
|
||||||
|
|
||||||
OptimizationRemarkAnalysis::OptimizationRemarkAnalysis(enum DiagnosticKind Kind,
|
OptimizationRemarkAnalysis::OptimizationRemarkAnalysis(
|
||||||
const char *PassName,
|
enum DiagnosticKind Kind, const char *PassName, StringRef RemarkName,
|
||||||
StringRef RemarkName,
|
const DiagnosticLocation &Loc, Value *CodeRegion)
|
||||||
const DebugLoc &DLoc,
|
|
||||||
Value *CodeRegion)
|
|
||||||
: DiagnosticInfoIROptimization(Kind, DS_Remark, PassName, RemarkName,
|
: DiagnosticInfoIROptimization(Kind, DS_Remark, PassName, RemarkName,
|
||||||
*cast<BasicBlock>(CodeRegion)->getParent(),
|
*cast<BasicBlock>(CodeRegion)->getParent(),
|
||||||
DLoc, CodeRegion) {}
|
Loc, CodeRegion) {}
|
||||||
|
|
||||||
bool OptimizationRemarkAnalysis::isEnabled(StringRef PassName) {
|
bool OptimizationRemarkAnalysis::isEnabled(StringRef PassName) {
|
||||||
return PassRemarksAnalysisOptLoc.Pattern &&
|
return PassRemarksAnalysisOptLoc.Pattern &&
|
||||||
|
@ -283,48 +282,47 @@ void DiagnosticInfoMIRParser::print(DiagnosticPrinter &DP) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void llvm::emitOptimizationRemark(LLVMContext &Ctx, const char *PassName,
|
void llvm::emitOptimizationRemark(LLVMContext &Ctx, const char *PassName,
|
||||||
const Function &Fn, const DebugLoc &DLoc,
|
const Function &Fn,
|
||||||
|
const DiagnosticLocation &Loc,
|
||||||
const Twine &Msg) {
|
const Twine &Msg) {
|
||||||
Ctx.diagnose(OptimizationRemark(PassName, Fn, DLoc, Msg));
|
Ctx.diagnose(OptimizationRemark(PassName, Fn, Loc, Msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
void llvm::emitOptimizationRemarkMissed(LLVMContext &Ctx, const char *PassName,
|
void llvm::emitOptimizationRemarkMissed(LLVMContext &Ctx, const char *PassName,
|
||||||
const Function &Fn,
|
const Function &Fn,
|
||||||
const DebugLoc &DLoc,
|
const DiagnosticLocation &Loc,
|
||||||
const Twine &Msg) {
|
const Twine &Msg) {
|
||||||
Ctx.diagnose(OptimizationRemarkMissed(PassName, Fn, DLoc, Msg));
|
Ctx.diagnose(OptimizationRemarkMissed(PassName, Fn, Loc, Msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
void llvm::emitOptimizationRemarkAnalysis(LLVMContext &Ctx,
|
void llvm::emitOptimizationRemarkAnalysis(LLVMContext &Ctx,
|
||||||
const char *PassName,
|
const char *PassName,
|
||||||
const Function &Fn,
|
const Function &Fn,
|
||||||
const DebugLoc &DLoc,
|
const DiagnosticLocation &Loc,
|
||||||
const Twine &Msg) {
|
const Twine &Msg) {
|
||||||
Ctx.diagnose(OptimizationRemarkAnalysis(PassName, Fn, DLoc, Msg));
|
Ctx.diagnose(OptimizationRemarkAnalysis(PassName, Fn, Loc, Msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
void llvm::emitOptimizationRemarkAnalysisFPCommute(LLVMContext &Ctx,
|
void llvm::emitOptimizationRemarkAnalysisFPCommute(
|
||||||
const char *PassName,
|
LLVMContext &Ctx, const char *PassName, const Function &Fn,
|
||||||
const Function &Fn,
|
const DiagnosticLocation &Loc, const Twine &Msg) {
|
||||||
const DebugLoc &DLoc,
|
Ctx.diagnose(OptimizationRemarkAnalysisFPCommute(PassName, Fn, Loc, Msg));
|
||||||
const Twine &Msg) {
|
|
||||||
Ctx.diagnose(OptimizationRemarkAnalysisFPCommute(PassName, Fn, DLoc, Msg));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void llvm::emitOptimizationRemarkAnalysisAliasing(LLVMContext &Ctx,
|
void llvm::emitOptimizationRemarkAnalysisAliasing(LLVMContext &Ctx,
|
||||||
const char *PassName,
|
const char *PassName,
|
||||||
const Function &Fn,
|
const Function &Fn,
|
||||||
const DebugLoc &DLoc,
|
const DiagnosticLocation &Loc,
|
||||||
const Twine &Msg) {
|
const Twine &Msg) {
|
||||||
Ctx.diagnose(OptimizationRemarkAnalysisAliasing(PassName, Fn, DLoc, Msg));
|
Ctx.diagnose(OptimizationRemarkAnalysisAliasing(PassName, Fn, Loc, Msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
DiagnosticInfoOptimizationFailure::DiagnosticInfoOptimizationFailure(
|
DiagnosticInfoOptimizationFailure::DiagnosticInfoOptimizationFailure(
|
||||||
const char *PassName, StringRef RemarkName, const DebugLoc &DLoc,
|
const char *PassName, StringRef RemarkName, const DiagnosticLocation &Loc,
|
||||||
Value *CodeRegion)
|
Value *CodeRegion)
|
||||||
: DiagnosticInfoIROptimization(
|
: DiagnosticInfoIROptimization(
|
||||||
DK_OptimizationFailure, DS_Warning, PassName, RemarkName,
|
DK_OptimizationFailure, DS_Warning, PassName, RemarkName,
|
||||||
*cast<BasicBlock>(CodeRegion)->getParent(), DLoc, CodeRegion) {}
|
*cast<BasicBlock>(CodeRegion)->getParent(), Loc, CodeRegion) {}
|
||||||
|
|
||||||
bool DiagnosticInfoOptimizationFailure::isEnabled() const {
|
bool DiagnosticInfoOptimizationFailure::isEnabled() const {
|
||||||
// Only print warnings.
|
// Only print warnings.
|
||||||
|
|
Loading…
Reference in New Issue