48 return ++PluginKindID;
58 if (SrcLoc->getNumOperands() != 0)
60 mdconst::dyn_extract<ConstantInt>(SrcLoc->getOperand(0)))
61 LocCookie = CI->getZExtValue();
72 DP << getResourceName() <<
" limit";
74 if (getResourceLimit() != 0)
75 DP <<
" of " << getResourceLimit();
77 DP <<
" exceeded (" << getResourceSize() <<
") in " <<
getFunction();
81 DP <<
"ignoring debug info with an invalid version (" << getMetadataVersion()
82 <<
") in " << getModule();
87 DP <<
"ignoring invalid debug info in " << getModule().getModuleIdentifier();
91 if (!FileName.empty()) {
94 DP <<
":" << getLineNum();
106 void DiagnosticInfo::anchor() {}
107 void DiagnosticInfoStackSize::anchor() {}
108 void DiagnosticInfoWithLocationBase::anchor() {}
109 void DiagnosticInfoIROptimization::anchor() {}
114 File = DL->getFile();
115 Line = DL->getLine();
116 Column = DL->getColumn();
124 Line = SP->getScopeLine();
129 return File->getFilename();
143 return Loc.getAbsolutePath();
148 unsigned &Column)
const {
149 RelativePath = Loc.getRelativePath();
150 Line = Loc.getLine();
151 Column = Loc.getColumn();
158 if (isLocationAvailable())
160 return (Filename +
":" +
Twine(Line) +
":" +
Twine(Column)).str();
165 if (
auto *
F = dyn_cast<Function>(V)) {
169 else if (
auto *
I = dyn_cast<Instruction>(V))
170 Loc =
I->getDebugLoc();
174 if (isa<llvm::Argument>(V) || isa<GlobalValue>(V))
176 else if (isa<Constant>(V)) {
179 }
else if (
auto *
I = dyn_cast<Instruction>(V))
180 Val =
I->getOpcodeName();
190 : Key(Key),
Val(S.str()) {}
212 unsigned long long N)
216 : Key(Key), Loc(Loc) {
221 Val =
"<UNKNOWN LOCATION>";
228 DP <<
" (hotness: " << *
Hotness <<
")";
234 const Value *CodeRegion)
249 assert(!Func->
empty() &&
"Function does not have a body");
250 return Func->
front();
268 const Value *CodeRegion)
277 PassName, RemarkName,
289 const Value *CodeRegion)
298 PassName, RemarkName,
322 const Value *CodeRegion)
343 DP <<
"Instruction selection used fallback path for " <<
getFunction();
347 Args.emplace_back(S);
351 Args.push_back(std::move(A));
384 void OptimizationRemarkAnalysisFPCommute::anchor() {}
385 void OptimizationRemarkAnalysisAliasing::anchor() {}
const char * PassName
Name of the pass that triggers this report.
DiagnosticKind
Defines the different supported kind of a diagnostic.
std::string getAbsolutePath() const
Return the absolute path tot the file.
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
This class represents lattice values for constants.
DiagnosticInfoInlineAsm(const Twine &MsgStr, DiagnosticSeverity Severity=DS_Error)
MsgStr is the message to be reported to the frontend.
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
Used to set IsVerbose via the stream interface.
DiagnosticLocation()=default
int FirstExtraArgIndex
If positive, the index of the first argument that only appear in the optimization records and not in ...
StringRef remove_leading_dotslash(StringRef path, Style style=Style::native)
Remove redundant leading "./" pieces and consecutive separators.
const Twine & getMsgStr() const
DiagnosticLocation getLocation() const
const Twine & getMsg() const
void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
DiagnosticSeverity
Defines the different supported severity of a diagnostic.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
bool is_absolute(const Twine &path, Style style=Style::native)
Is path absolute?
Common features for diagnostics with an associated location.
Interface for custom diagnostic printing.
bool isEnabled() const override
DiagnosticInfoMisExpect(const Instruction *Inst, Twine &Msg)
std::string itostr(int64_t X)
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
StringRef RemarkName
Textual identifier for the remark (single-word, camel-case).
static Function * getFunction(Constant *C)
std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type cast(const Y &Val)
SmallVector< Argument, 4 > Args
Arguments collected via the streaming interface.
static Expected< StringRef > getFileName(const DebugStringTableSubsectionRef &Strings, const DebugChecksumsSubsectionRef &Checksums, uint32_t FileID)
This is the base abstract class for diagnostic reporting in the backend.
const Function & getFunction() const
void print(DiagnosticPrinter &DP) const override
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
Instrumentation for Order File
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Common features for diagnostics dealing with optimization remarks that are used by IR passes...
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
static const BasicBlock & getFirstFunctionBlock(const Function *Func)
unsigned getLocCookie() const
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
Used in the streaming interface as the general argument type.
virtual bool isMissedOptRemarkEnabled(StringRef PassName) const
Return true if missed optimization remarks are enabled, override to provide different implementation...
static DISubprogram * getSubprogram(bool IsDistinct, Ts &&... Args)
void printAsOperand(raw_ostream &O, bool PrintType=true, const Module *M=nullptr) const
Print the name of this Value out to the specified raw_ostream.
std::string & str()
Flushes the stream contents to the target string and returns the string's reference.
bool IsVerbose
The remark is expected to be noisy.
void print(DiagnosticPrinter &DP) const override
Print using the given DP a user-friendly message.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
std::string getMsg() const
virtual bool isPassedOptRemarkEnabled(StringRef PassName) const
Return true if passed optimization remarks are enabled, override to provide different implementation...
Module.h This file contains the declarations for the Module class.
StringRef getRelativePath() const
Return the file name relative to the compilation directory.
std::string utostr(uint64_t X, bool isNeg=false)
FunctionType * getFunctionType() const
Returns the FunctionType for me.
static StringRef dropLLVMManglingEscape(StringRef Name)
If the given string begins with the GlobalValue name mangling escape character '\1', drop it.
int getNextAvailablePluginDiagnosticKind()
Get the next available kind ID for a plugin diagnostic.
void print(DiagnosticPrinter &DP) const override
void print(DiagnosticPrinter &DP) const override
Print using the given DP a user-friendly message.
virtual bool isAnalysisRemarkEnabled(StringRef PassName) const
Return true if analysis remarks are enabled, override to provide different implementation.
static DebugLoc getDebugLoc(MachineBasicBlock::instr_iterator FirstMI, MachineBasicBlock::instr_iterator LastMI)
Return the first found DebugLoc that has a DILocation, given a range of instructions.
void print(DiagnosticPrinter &DP) const override
StringRef getName() const
Return a constant reference to the value's name.
DiagnosticSeverity getSeverity() const
void print(DiagnosticPrinter &DP) const override
const std::string to_string(const T &Value)
const DiagnosticHandler * getDiagHandlerPtr() const
getDiagHandlerPtr - Returns const raw pointer of DiagnosticHandler set by setDiagnosticHandler.
static MemoryLocation getLocation(Instruction *I, AliasAnalysis *AA)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const BasicBlock & front() const
A raw_ostream that writes to an std::string.
LLVM Value Representation.
Optional< uint64_t > Hotness
If profile information is available, this is the number of times the corresponding code was executed ...
static const Function * getParent(const Value *V)
void print(DiagnosticPrinter &DP) const override
const std::string getLocationStr() const
Return a string with the location information for this diagnostic in the format "file:line:col".
Argument(StringRef Str="")
StringRef - Represent a constant reference to a string, i.e.
void print(DiagnosticPrinter &DP) const override
void print(DiagnosticPrinter &DP) const override
Print using the given DP a user-friendly message.
std::string getAbsolutePath() const
Return the full path to the file.
StringRef getPassName() const
DiagnosticInfoOptimizationFailure(const Function &Fn, const DiagnosticLocation &Loc, const Twine &Msg)
Fn is the function where the diagnostic is being emitted.