38 std::pair<unsigned, StringRef> MDKinds[] = {
39 #define LLVM_FIXED_MD_KIND(EnumID, Name, Value) {EnumID, Name}, 40 #include "llvm/IR/FixedMetadataKinds.def" 41 #undef LLVM_FIXED_MD_KIND 44 for (
auto &MDKind : MDKinds) {
46 assert(ID == MDKind.first &&
"metadata kind id drifted");
52 "deopt operand bundle id drifted!");
57 "funclet operand bundle id drifted!");
62 "gc-transition operand bundle id drifted!");
63 (void)GCTransitionEntry;
68 "singlethread synchronization scope ID drifted!");
69 (void)SingleThreadSSID;
74 "system synchronization scope ID drifted!");
80 void LLVMContext::addModule(
Module *M) {
84 void LLVMContext::removeModule(
Module *M) {
114 void *DiagnosticContext,
bool RespectFilters) {
121 bool RespectFilters) {
176 assert (I &&
"Invalid instruction");
188 if (
auto *
Remark = dyn_cast<DiagnosticInfoOptimizationBase>(&DI))
189 return Remark->isEnabled() &&
211 if (
auto *OptDiagBase = dyn_cast<DiagnosticInfoOptimizationBase>(&DI))
213 RS->emit(*OptDiagBase);
256 Names[
I->second] =
I->first();
279 pImpl->
GCNames.insert(std::make_pair(&Fn, std::move(GCName)));
282 It->second = std::move(GCName);
void setDiagnosticHandler(std::unique_ptr< DiagnosticHandler > &&DH, bool RespectFilters=false)
setDiagnosticHandler - This method sets unique_ptr to object of DiagnosticHandler to provide custom d...
This is the base class for diagnostic handling in LLVM.
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
void setRemarkStreamer(std::unique_ptr< RemarkStreamer > RemarkStreamer)
Set the diagnostics output used for optimization diagnostics.
void getOperandBundleTags(SmallVectorImpl< StringRef > &Tags) const
This class represents lattice values for constants.
A Module instance is used to store all the information related to an LLVM module. ...
const std::string & getGC(const Function &Fn)
Return the GC for a function.
Extensions to this class implement mechanisms to disable passes and individual optimizations at compi...
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
RemarkStreamer * getRemarkStreamer()
Return the streamer used by the backend to save remark diagnostics.
std::unique_ptr< DiagnosticHandler > getDiagnosticHandler()
getDiagnosticHandler - transfers owenership of DiagnosticHandler unique_ptr to caller.
void(*)(LLVMContext *Context, void *OpaqueHandle) YieldCallbackTy
Defines the type of a yield callback.
uint32_t getOperandBundleTagID(StringRef Tag) const
void setGC(const Function &Fn, std::string GCName)
Define the GC for a function.
SyncScope::ID getOrInsertSyncScopeID(StringRef SSN)
getOrInsertSyncScopeID - Maps synchronization scope name to synchronization scope ID...
void enableDebugTypeODRUniquing()
void * getInlineAsmDiagnosticContext() const
getInlineAsmDiagnosticContext - Return the diagnostic context set by setInlineAsmDiagnosticHandler.
void setInlineAsmDiagnosticHandler(InlineAsmDiagHandlerTy DiagHandler, void *DiagContext=nullptr)
setInlineAsmDiagnosticHandler - This method sets a handler that is invoked when problems with inline ...
void setYieldCallback(YieldCallbackTy Callback, void *OpaqueHandle)
Registers a yield callback with the given context.
bool RespectDiagnosticFilters
void getSyncScopeNames(SmallVectorImpl< StringRef > &SSNs) const
getSyncScopeNames - Populates client supplied SmallVector with synchronization scope names registered...
void yield()
Calls the yield callback (if applicable).
LLVMContext::InlineAsmDiagHandlerTy InlineAsmDiagHandler
void setDiscardValueNames(bool Discard)
Set the Context runtime configuration to discard all value name (but GlobalValue).
void disableDebugTypeODRUniquing()
unsigned getMDKindID(StringRef Name) const
getMDKindID - Return a unique non-zero ID for the specified metadata kind.
void setDiagnosticsHotnessThreshold(uint64_t Threshold)
Set the minimum hotness value a diagnostic needs in order to be included in optimization diagnostics...
DiagnosticSeverity
Defines the different supported severity of a diagnostic.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
void getMDKindNames(SmallVectorImpl< StringRef > &Result) const
getMDKindNames - Populate client supplied SmallVector with the name for custom metadata IDs registere...
void deleteGC(const Function &Fn)
Remove the GC for a function.
std::unique_ptr< DiagnosticHandler > DiagHandler
bool DiscardValueNames
Flag to indicate if Value (other than GlobalValue) retains their name or not.
static void DiagHandler(const SMDiagnostic &Diag, void *Context)
void emitError(unsigned LocCookie, const Twine &ErrorStr)
emitError - Emit an error message to the currently installed error handler with optional location inf...
OptPassGate & getOptPassGate() const
Access the object which can disable optional passes and individual optimizations at compile time...
void setDiagnosticsHotnessRequested(bool Requested)
Set if a code hotness metric should be included in optimization diagnostics.
void setOptPassGate(OptPassGate &)
Set the object which can disable optional passes and individual optimizations at compile time...
void(*)(const DiagnosticInfo &DI, void *Context) DiagnosticHandlerTy
LLVMContext::YieldCallbackTy YieldCallback
void setDiagnosticHandlerCallBack(DiagnosticHandler::DiagnosticHandlerTy DiagHandler, void *DiagContext=nullptr, bool RespectFilters=false)
setDiagnosticHandlerCallBack - This method sets a handler call back that is invoked when the backend ...
StringMap< unsigned > CustomMDKindNames
CustomMDKindNames - Map to hold the metadata string to ID mapping.
void setOptPassGate(OptPassGate &)
Set the object which can disable optional passes and individual optimizations at compile time...
This is the base abstract class for diagnostic reporting in the backend.
OptPassGate & getOptPassGate() const
Access the object which can disable optional passes and individual optimizations at compile time...
This is an important class for using LLVM in a threaded context.
StringMapEntry< uint32_t > * getOrInsertBundleTag(StringRef Tag)
bool shouldDiscardValueNames() const
Return true if the Context runtime configuration is set to discard all value names.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
void getOperandBundleTags(SmallVectorImpl< StringRef > &Result) const
getOperandBundleTags - Populate client supplied SmallVector with the bundle tags registered in this L...
void getSyncScopeNames(SmallVectorImpl< StringRef > &SSNs) const
getSyncScopeNames - Populates client supplied SmallVector with synchronization scope names registered...
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
uint64_t getDiagnosticsHotnessThreshold() const
Return the minimum hotness value a diagnostic would need in order to be included in optimization diag...
bool getDiagnosticsHotnessRequested() const
Return if a code hotness metric should be included in optimization diagnostics.
bool isODRUniquingDebugTypes() const
Whether there is a string map for uniquing debug info identifiers across the context.
uint64_t DiagnosticsHotnessThreshold
Diagnostic information for inline asm reporting.
virtual void print(DiagnosticPrinter &DP) const =0
Print using the given DP a user-friendly message.
void * InlineAsmDiagContext
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
LLVMContextImpl *const pImpl
bool erase(PtrType Ptr)
erase - If the set contains the specified pointer, remove it and return true, otherwise return false...
Module.h This file contains the declarations for the Module class.
static const char * getDiagnosticMessagePrefix(DiagnosticSeverity Severity)
Get the prefix that should be printed in front of a diagnostic of the given Severity.
bool insert(MapEntryTy *KeyValue)
insert - Insert the specified key/value pair into the map.
SmallPtrSet< Module *, 4 > OwnedModules
OwnedModules - The set of modules instantiated in this context, and which will be automatically delet...
StringMap - This is an unconventional map that is specialized for handling keys that are "strings"...
void(*)(const SMDiagnostic &, void *Context, unsigned LocCookie) InlineAsmDiagHandlerTy
Synchronized with respect to all concurrently executing threads.
static cl::opt< unsigned > Threshold("loop-unswitch-threshold", cl::desc("Max loop size to unswitch"), cl::init(100), cl::Hidden)
SyncScope::ID getOrInsertSyncScopeID(StringRef SSN)
getOrInsertSyncScopeID - Maps synchronization scope name to synchronization scope ID...
Basic diagnostic printer that uses an underlying raw_ostream.
DenseMap< const Function *, std::string > GCNames
Maintain the GC name for each function.
DiagnosticSeverity getSeverity() const
InlineAsmDiagHandlerTy getInlineAsmDiagnosticHandler() const
getInlineAsmDiagnosticHandler - Return the diagnostic handler set by setInlineAsmDiagnosticHandler.
void diagnose(const DiagnosticInfo &DI)
Report a message to the currently installed diagnostic handler.
std::unique_ptr< RemarkStreamer > RemarkDiagStreamer
const DiagnosticHandler * getDiagHandlerPtr() const
getDiagHandlerPtr - Returns const raw pointer of DiagnosticHandler set by setDiagnosticHandler.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool DiagnosticsHotnessRequested
Synchronized with respect to signal handlers executing in the same thread.
StringRef - Represent a constant reference to a string, i.e.
void * getDiagnosticContext() const
getDiagnosticContext - Return the diagnostic context set by setDiagnosticContext. ...
static bool isDiagnosticEnabled(const DiagnosticInfo &DI)
DiagnosticHandler::DiagnosticHandlerTy getDiagnosticHandlerCallBack() const
getDiagnosticHandlerCallBack - Return the diagnostic handler call back set by setDiagnosticHandlerCal...
Optional< DenseMap< const MDString *, DICompositeType * > > DITypeMap
uint32_t getOperandBundleTagID(StringRef Tag) const
getOperandBundleTagID - Maps a bundle tag to an integer ID.