class LLVMContext
Declaration
class LLVMContext { /* full declaration omitted */ };
Description
This is an important class for using LLVM in a threaded context. It (opaquely) owns and manages the core "global" data of LLVM's core infrastructure, including the type and constant uniquing tables. LLVMContext itself provides no locking guarantees, so you should be careful to have one context per thread.
Declared at: llvm/include/llvm/IR/LLVMContext.h:63
Member Variables
- public llvm::LLVMContextImpl* const pImpl
Method Overview
- public LLVMContext(llvm::LLVMContext &)
- public LLVMContext()
- public void deleteGC(const llvm::Function & Fn)
- public void diagnose(const llvm::DiagnosticInfo & DI)
- public void disableDebugTypeODRUniquing()
- public void emitError(unsigned int LocCookie, const llvm::Twine & ErrorStr)
- public void emitError(const llvm::Instruction * I, const llvm::Twine & ErrorStr)
- public void emitError(const llvm::Twine & ErrorStr)
- public void enableDebugTypeODRUniquing()
- public const llvm::DiagnosticHandler * getDiagHandlerPtr() const
- public void * getDiagnosticContext() const
- public int getDiagnosticHandler()
- public DiagnosticHandler::DiagnosticHandlerTy getDiagnosticHandlerCallBack() const
- public static const char * getDiagnosticMessagePrefix(llvm::DiagnosticSeverity Severity)
- public bool getDiagnosticsHotnessRequested() const
- public uint64_t getDiagnosticsHotnessThreshold() const
- public const std::string & getGC(const llvm::Function & Fn)
- public void * getInlineAsmDiagnosticContext() const
- public llvm::LLVMContext::InlineAsmDiagHandlerTy getInlineAsmDiagnosticHandler() const
- public unsigned int getMDKindID(llvm::StringRef Name) const
- public void getMDKindNames(SmallVectorImpl<llvm::StringRef> & Result) const
- public uint32_t getOperandBundleTagID(llvm::StringRef Tag) const
- public void getOperandBundleTags(SmallVectorImpl<llvm::StringRef> & Result) const
- public llvm::OptPassGate & getOptPassGate() const
- public SyncScope::ID getOrInsertSyncScopeID(llvm::StringRef SSN)
- public const llvm::RemarkStreamer * getRemarkStreamer() const
- public llvm::RemarkStreamer * getRemarkStreamer()
- public void getSyncScopeNames(SmallVectorImpl<llvm::StringRef> & SSNs) const
- public bool isODRUniquingDebugTypes() const
- public void setDiagnosticHandler(int && DH, bool RespectFilters = false)
- public void setDiagnosticHandlerCallBack(DiagnosticHandler::DiagnosticHandlerTy DiagHandler, void * DiagContext = nullptr, bool RespectFilters = false)
- public void setDiagnosticsHotnessRequested(bool Requested)
- public void setDiagnosticsHotnessThreshold(uint64_t Threshold)
- public void setDiscardValueNames(bool Discard)
- public void setGC(const llvm::Function & Fn, std::string GCName)
- public void setInlineAsmDiagnosticHandler(llvm::LLVMContext::InlineAsmDiagHandlerTy DiagHandler, void * DiagContext = nullptr)
- public void setOptPassGate(llvm::OptPassGate &)
- public void setRemarkStreamer(int RemarkStreamer)
- public void setYieldCallback(llvm::LLVMContext::YieldCallbackTy Callback, void * OpaqueHandle)
- public bool shouldDiscardValueNames() const
- public void yield()
- public ~LLVMContext()
Methods
¶LLVMContext(llvm::LLVMContext&)
LLVMContext(llvm::LLVMContext&)
Declared at: llvm/include/llvm/IR/LLVMContext.h:67
Parameters
¶LLVMContext()
LLVMContext()
Declared at: llvm/include/llvm/IR/LLVMContext.h:66
¶void deleteGC(const llvm::Function& Fn)
void deleteGC(const llvm::Function& Fn)
Description
Remove the GC for a function
Declared at: llvm/include/llvm/IR/LLVMContext.h:125
Parameters
- const llvm::Function& Fn
¶void diagnose(const llvm::DiagnosticInfo& DI)
void diagnose(const llvm::DiagnosticInfo& DI)
Description
Report a message to the currently installed diagnostic handler. This function returns, in particular in the case of error reporting (DI.Severity == \a DS_Error), so the caller should leave the compilation process in a self-consistent state, even though the generated code need not be correct. The diagnostic message will be implicitly prefixed with a severity keyword according to \p DI.getSeverity(), i.e., "error: " for \a DS_Error, "warning: " for \a DS_Warning, and "note: " for \a DS_Note.
Declared at: llvm/include/llvm/IR/LLVMContext.h:253
Parameters
- const llvm::DiagnosticInfo& DI
¶void disableDebugTypeODRUniquing()
void disableDebugTypeODRUniquing()
Declared at: llvm/include/llvm/IR/LLVMContext.h:141
¶void emitError(unsigned int LocCookie,
const llvm::Twine& ErrorStr)
void emitError(unsigned int LocCookie,
const llvm::Twine& ErrorStr)
Description
emitError - Emit an error message to the currently installed error handler with optional location information. This function returns, so code should be prepared to drop the erroneous construct on the floor and "not crash". The generated code need not be correct. The error message will be implicitly prefixed with "error: " and should not end with a ".".
Declared at: llvm/include/llvm/IR/LLVMContext.h:286
Parameters
- unsigned int LocCookie
- const llvm::Twine& ErrorStr
¶void emitError(const llvm::Instruction* I,
const llvm::Twine& ErrorStr)
void emitError(const llvm::Instruction* I,
const llvm::Twine& ErrorStr)
Declared at: llvm/include/llvm/IR/LLVMContext.h:287
Parameters
- const llvm::Instruction* I
- const llvm::Twine& ErrorStr
¶void emitError(const llvm::Twine& ErrorStr)
void emitError(const llvm::Twine& ErrorStr)
Declared at: llvm/include/llvm/IR/LLVMContext.h:288
Parameters
- const llvm::Twine& ErrorStr
¶void enableDebugTypeODRUniquing()
void enableDebugTypeODRUniquing()
Declared at: llvm/include/llvm/IR/LLVMContext.h:140
¶const llvm::DiagnosticHandler* getDiagHandlerPtr()
const
const llvm::DiagnosticHandler* getDiagHandlerPtr()
const
Description
getDiagHandlerPtr - Returns const raw pointer of DiagnosticHandler set by setDiagnosticHandler.
Declared at: llvm/include/llvm/IR/LLVMContext.h:199
¶void* getDiagnosticContext() const
void* getDiagnosticContext() const
Description
getDiagnosticContext - Return the diagnostic context set by setDiagnosticContext.
Declared at: llvm/include/llvm/IR/LLVMContext.h:195
¶int getDiagnosticHandler()
int getDiagnosticHandler()
Declared at: llvm/include/llvm/IR/LLVMContext.h:203
¶DiagnosticHandler::DiagnosticHandlerTy
getDiagnosticHandlerCallBack() const
DiagnosticHandler::DiagnosticHandlerTy
getDiagnosticHandlerCallBack() const
Description
getDiagnosticHandlerCallBack - Return the diagnostic handler call back set by setDiagnosticHandlerCallBack.
Declared at: llvm/include/llvm/IR/LLVMContext.h:191
¶static const char* getDiagnosticMessagePrefix(
llvm::DiagnosticSeverity Severity)
static const char* getDiagnosticMessagePrefix(
llvm::DiagnosticSeverity Severity)
Description
Get the prefix that should be printed in front of a diagnostic of the given \p Severity
Declared at: llvm/include/llvm/IR/LLVMContext.h:241
Parameters
- llvm::DiagnosticSeverity Severity
¶bool getDiagnosticsHotnessRequested() const
bool getDiagnosticsHotnessRequested() const
Description
Return if a code hotness metric should be included in optimization diagnostics.
Declared at: llvm/include/llvm/IR/LLVMContext.h:207
¶uint64_t getDiagnosticsHotnessThreshold() const
uint64_t getDiagnosticsHotnessThreshold() const
Description
Return the minimum hotness value a diagnostic would need in order to be included in optimization diagnostics. If there is no minimum, this returns None.
Declared at: llvm/include/llvm/IR/LLVMContext.h:215
¶const std::string& getGC(const llvm::Function& Fn)
const std::string& getGC(const llvm::Function& Fn)
Description
Return the GC for a function
Declared at: llvm/include/llvm/IR/LLVMContext.h:122
Parameters
- const llvm::Function& Fn
¶void* getInlineAsmDiagnosticContext() const
void* getInlineAsmDiagnosticContext() const
Description
getInlineAsmDiagnosticContext - Return the diagnostic context set by setInlineAsmDiagnosticHandler.
Declared at: llvm/include/llvm/IR/LLVMContext.h:166
¶llvm::LLVMContext::InlineAsmDiagHandlerTy
getInlineAsmDiagnosticHandler() const
llvm::LLVMContext::InlineAsmDiagHandlerTy
getInlineAsmDiagnosticHandler() const
Description
getInlineAsmDiagnosticHandler - Return the diagnostic handler set by setInlineAsmDiagnosticHandler.
Declared at: llvm/include/llvm/IR/LLVMContext.h:162
¶unsigned int getMDKindID(
llvm::StringRef Name) const
unsigned int getMDKindID(
llvm::StringRef Name) const
Description
getMDKindID - Return a unique non-zero ID for the specified metadata kind. This ID is uniqued across modules in the current LLVMContext.
Declared at: llvm/include/llvm/IR/LLVMContext.h:92
Parameters
- llvm::StringRef Name
¶void getMDKindNames(
SmallVectorImpl<llvm::StringRef>& Result)
const
void getMDKindNames(
SmallVectorImpl<llvm::StringRef>& Result)
const
Description
getMDKindNames - Populate client supplied SmallVector with the name for custom metadata IDs registered in this LLVMContext.
Declared at: llvm/include/llvm/IR/LLVMContext.h:96
Parameters
- SmallVectorImpl<llvm::StringRef>& Result
¶uint32_t getOperandBundleTagID(
llvm::StringRef Tag) const
uint32_t getOperandBundleTagID(
llvm::StringRef Tag) const
Description
getOperandBundleTagID - Maps a bundle tag to an integer ID. Every bundle tag registered with an LLVMContext has an unique ID.
Declared at: llvm/include/llvm/IR/LLVMContext.h:106
Parameters
- llvm::StringRef Tag
¶void getOperandBundleTags(
SmallVectorImpl<llvm::StringRef>& Result)
const
void getOperandBundleTags(
SmallVectorImpl<llvm::StringRef>& Result)
const
Description
getOperandBundleTags - Populate client supplied SmallVector with the bundle tags registered in this LLVMContext. The bundle tags are ordered by increasing bundle IDs.
Declared at: llvm/include/llvm/IR/LLVMContext.h:102
Parameters
- SmallVectorImpl<llvm::StringRef>& Result
¶llvm::OptPassGate& getOptPassGate() const
llvm::OptPassGate& getOptPassGate() const
Description
Access the object which can disable optional passes and individual optimizations at compile time.
Declared at: llvm/include/llvm/IR/LLVMContext.h:292
¶SyncScope::ID getOrInsertSyncScopeID(
llvm::StringRef SSN)
SyncScope::ID getOrInsertSyncScopeID(
llvm::StringRef SSN)
Description
getOrInsertSyncScopeID - Maps synchronization scope name to synchronization scope ID. Every synchronization scope registered with LLVMContext has unique ID except pre-defined ones.
Declared at: llvm/include/llvm/IR/LLVMContext.h:111
Parameters
- llvm::StringRef SSN
¶const llvm::RemarkStreamer* getRemarkStreamer()
const
const llvm::RemarkStreamer* getRemarkStreamer()
const
Declared at: llvm/include/llvm/IR/LLVMContext.h:225
¶llvm::RemarkStreamer* getRemarkStreamer()
llvm::RemarkStreamer* getRemarkStreamer()
Description
Return the streamer used by the backend to save remark diagnostics. If it does not exist, diagnostics are not saved in a file but only emitted via the diagnostic handler.
Declared at: llvm/include/llvm/IR/LLVMContext.h:224
¶void getSyncScopeNames(
SmallVectorImpl<llvm::StringRef>& SSNs) const
void getSyncScopeNames(
SmallVectorImpl<llvm::StringRef>& SSNs) const
Description
getSyncScopeNames - Populates client supplied SmallVector with synchronization scope names registered with LLVMContext. Synchronization scope names are ordered by increasing synchronization scope IDs.
Declared at: llvm/include/llvm/IR/LLVMContext.h:116
Parameters
- SmallVectorImpl<llvm::StringRef>& SSNs
¶bool isODRUniquingDebugTypes() const
bool isODRUniquingDebugTypes() const
Description
Whether there is a string map for uniquing debug info identifiers across the context. Off by default.
Declared at: llvm/include/llvm/IR/LLVMContext.h:139
¶void setDiagnosticHandler(
int&& DH,
bool RespectFilters = false)
void setDiagnosticHandler(
int&& DH,
bool RespectFilters = false)
Declared at: llvm/include/llvm/IR/LLVMContext.h:186
Parameters
- int&& DH
- bool RespectFilters = false
¶void setDiagnosticHandlerCallBack(
DiagnosticHandler::DiagnosticHandlerTy
DiagHandler,
void* DiagContext = nullptr,
bool RespectFilters = false)
void setDiagnosticHandlerCallBack(
DiagnosticHandler::DiagnosticHandlerTy
DiagHandler,
void* DiagContext = nullptr,
bool RespectFilters = false)
Description
setDiagnosticHandlerCallBack - This method sets a handler call back that is invoked when the backend needs to report anything to the user. The first argument is a function pointer and the second is a context pointer that gets passed into the DiagHandler. The third argument should be set to true if the handler only expects enabled diagnostics. LLVMContext doesn't take ownership or interpret either of these pointers.
Declared at: llvm/include/llvm/IR/LLVMContext.h:176
Parameters
- DiagnosticHandler::DiagnosticHandlerTy DiagHandler
- void* DiagContext = nullptr
- bool RespectFilters = false
¶void setDiagnosticsHotnessRequested(
bool Requested)
void setDiagnosticsHotnessRequested(
bool Requested)
Description
Set if a code hotness metric should be included in optimization diagnostics.
Declared at: llvm/include/llvm/IR/LLVMContext.h:210
Parameters
- bool Requested
¶void setDiagnosticsHotnessThreshold(
uint64_t Threshold)
void setDiagnosticsHotnessThreshold(
uint64_t Threshold)
Description
Set the minimum hotness value a diagnostic needs in order to be included in optimization diagnostics.
Declared at: llvm/include/llvm/IR/LLVMContext.h:219
Parameters
- uint64_t Threshold
¶void setDiscardValueNames(bool Discard)
void setDiscardValueNames(bool Discard)
Description
Set the Context runtime configuration to discard all value name (but GlobalValue). Clients can use this flag to save memory and runtime, especially in release mode.
Declared at: llvm/include/llvm/IR/LLVMContext.h:135
Parameters
- bool Discard
¶void setGC(const llvm::Function& Fn,
std::string GCName)
void setGC(const llvm::Function& Fn,
std::string GCName)
Description
Define the GC for a function
Declared at: llvm/include/llvm/IR/LLVMContext.h:119
Parameters
- const llvm::Function& Fn
- std::string GCName
¶void setInlineAsmDiagnosticHandler(
llvm::LLVMContext::InlineAsmDiagHandlerTy
DiagHandler,
void* DiagContext = nullptr)
void setInlineAsmDiagnosticHandler(
llvm::LLVMContext::InlineAsmDiagHandlerTy
DiagHandler,
void* DiagContext = nullptr)
Description
setInlineAsmDiagnosticHandler - This method sets a handler that is invoked when problems with inline asm are detected by the backend. The first argument is a function pointer and the second is a context pointer that gets passed into the DiagHandler. LLVMContext doesn't take ownership or interpret either of these pointers.
Declared at: llvm/include/llvm/IR/LLVMContext.h:157
Parameters
- llvm::LLVMContext::InlineAsmDiagHandlerTy DiagHandler
- void* DiagContext = nullptr
¶void setOptPassGate(llvm::OptPassGate&)
void setOptPassGate(llvm::OptPassGate&)
Description
Set the object which can disable optional passes and individual optimizations at compile time. The lifetime of the object must be guaranteed to extend as long as the LLVMContext is used by compilation.
Declared at: llvm/include/llvm/IR/LLVMContext.h:299
Parameters
¶void setRemarkStreamer(int RemarkStreamer)
void setRemarkStreamer(int RemarkStreamer)
Declared at: llvm/include/llvm/IR/LLVMContext.h:237
Parameters
- int RemarkStreamer
¶void setYieldCallback(
llvm::LLVMContext::YieldCallbackTy Callback,
void* OpaqueHandle)
void setYieldCallback(
llvm::LLVMContext::YieldCallbackTy Callback,
void* OpaqueHandle)
Description
Registers a yield callback with the given context. The yield callback function may be called by LLVM to transfer control back to the client that invoked the LLVM compilation. This can be used to yield control of the thread, or perform periodic work needed by the client. There is no guaranteed frequency at which callbacks must occur; in fact, the client is not guaranteed to ever receive this callback. It is at the sole discretion of LLVM to do so and only if it can guarantee that suspending the thread won't block any forward progress in other LLVM contexts in the same process. At a suspend point, the state of the current LLVM context is intentionally undefined. No assumptions about it can or should be made. Only LLVM context API calls that explicitly state that they can be used during a yield callback are allowed to be used. Any other API calls into the context are not supported until the yield callback function returns control to LLVM. Other LLVM contexts are unaffected by this restriction.
Declared at: llvm/include/llvm/IR/LLVMContext.h:272
Parameters
- llvm::LLVMContext::YieldCallbackTy Callback
- void* OpaqueHandle
¶bool shouldDiscardValueNames() const
bool shouldDiscardValueNames() const
Description
Return true if the Context runtime configuration is set to discard all value names. When true, only GlobalValue names will be available in the IR.
Declared at: llvm/include/llvm/IR/LLVMContext.h:130
¶void yield()
void yield()
Description
Calls the yield callback (if applicable). This transfers control of the current thread back to the client, which may suspend the current thread. Only call this method when LLVM doesn't hold any global mutex or cannot block the execution in another LLVM context.
Declared at: llvm/include/llvm/IR/LLVMContext.h:279
¶~LLVMContext()
~LLVMContext()
Declared at: llvm/include/llvm/IR/LLVMContext.h:69