LLVM
15.0.0git
|
This is an important class for using LLVM in a threaded context. More...
#include "llvm/IR/LLVMContext.h"
Public Types | |
enum | : unsigned |
enum | : unsigned { OB_deopt = 0, OB_funclet = 1, OB_gc_transition = 2, OB_cfguardtarget = 3, OB_preallocated = 4, OB_gc_live = 5, OB_clang_arc_attachedcall = 6, OB_ptrauth = 7 } |
Known operand bundle tag IDs, which always have the same value. More... | |
using | YieldCallbackTy = void(*)(LLVMContext *Context, void *OpaqueHandle) |
Defines the type of a yield callback. More... | |
Public Member Functions | |
LLVMContext () | |
LLVMContext (LLVMContext &)=delete | |
LLVMContext & | operator= (const LLVMContext &)=delete |
~LLVMContext () | |
unsigned | getMDKindID (StringRef Name) const |
getMDKindID - Return a unique non-zero ID for the specified metadata kind. More... | |
void | getMDKindNames (SmallVectorImpl< StringRef > &Result) const |
getMDKindNames - Populate client supplied SmallVector with the name for custom metadata IDs registered in this LLVMContext. More... | |
void | getOperandBundleTags (SmallVectorImpl< StringRef > &Result) const |
getOperandBundleTags - Populate client supplied SmallVector with the bundle tags registered in this LLVMContext. More... | |
StringMapEntry< uint32_t > * | getOrInsertBundleTag (StringRef TagName) const |
getOrInsertBundleTag - Returns the Tag to use for an operand bundle of name TagName. More... | |
uint32_t | getOperandBundleTagID (StringRef Tag) const |
getOperandBundleTagID - Maps a bundle tag to an integer ID. More... | |
SyncScope::ID | getOrInsertSyncScopeID (StringRef SSN) |
getOrInsertSyncScopeID - Maps synchronization scope name to synchronization scope ID. More... | |
void | getSyncScopeNames (SmallVectorImpl< StringRef > &SSNs) const |
getSyncScopeNames - Populates client supplied SmallVector with synchronization scope names registered with LLVMContext. More... | |
void | setGC (const Function &Fn, std::string GCName) |
Define the GC for a function. More... | |
const std::string & | getGC (const Function &Fn) |
Return the GC for a function. More... | |
void | deleteGC (const Function &Fn) |
Remove the GC for a function. More... | |
bool | shouldDiscardValueNames () const |
Return true if the Context runtime configuration is set to discard all value names. More... | |
void | setDiscardValueNames (bool Discard) |
Set the Context runtime configuration to discard all value name (but GlobalValue). More... | |
bool | isODRUniquingDebugTypes () const |
Whether there is a string map for uniquing debug info identifiers across the context. More... | |
void | enableDebugTypeODRUniquing () |
void | disableDebugTypeODRUniquing () |
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 needs to report anything to the user. More... | |
void | setDiagnosticHandler (std::unique_ptr< DiagnosticHandler > &&DH, bool RespectFilters=false) |
setDiagnosticHandler - This method sets unique_ptr to object of DiagnosticHandler to provide custom diagnostic handling. More... | |
DiagnosticHandler::DiagnosticHandlerTy | getDiagnosticHandlerCallBack () const |
getDiagnosticHandlerCallBack - Return the diagnostic handler call back set by setDiagnosticHandlerCallBack. More... | |
void * | getDiagnosticContext () const |
getDiagnosticContext - Return the diagnostic context set by setDiagnosticContext. More... | |
const DiagnosticHandler * | getDiagHandlerPtr () const |
getDiagHandlerPtr - Returns const raw pointer of DiagnosticHandler set by setDiagnosticHandler. More... | |
std::unique_ptr< DiagnosticHandler > | getDiagnosticHandler () |
getDiagnosticHandler - transfers ownership of DiagnosticHandler unique_ptr to caller. More... | |
bool | getDiagnosticsHotnessRequested () const |
Return if a code hotness metric should be included in optimization diagnostics. More... | |
void | setDiagnosticsHotnessRequested (bool Requested) |
Set if a code hotness metric should be included in optimization diagnostics. More... | |
bool | getMisExpectWarningRequested () const |
void | setMisExpectWarningRequested (bool Requested) |
void | setDiagnosticsMisExpectTolerance (Optional< uint64_t > Tolerance) |
uint64_t | getDiagnosticsMisExpectTolerance () const |
uint64_t | getDiagnosticsHotnessThreshold () const |
Return the minimum hotness value a diagnostic would need in order to be included in optimization diagnostics. More... | |
void | setDiagnosticsHotnessThreshold (Optional< uint64_t > Threshold) |
Set the minimum hotness value a diagnostic needs in order to be included in optimization diagnostics. More... | |
bool | isDiagnosticsHotnessThresholdSetFromPSI () const |
Return if hotness threshold is requested from PSI. More... | |
remarks::RemarkStreamer * | getMainRemarkStreamer () |
The "main remark streamer" used by all the specialized remark streamers. More... | |
const remarks::RemarkStreamer * | getMainRemarkStreamer () const |
void | setMainRemarkStreamer (std::unique_ptr< remarks::RemarkStreamer > MainRemarkStreamer) |
LLVMRemarkStreamer * | getLLVMRemarkStreamer () |
The "LLVM remark streamer" used by LLVM to serialize remark diagnostics comming from IR and MIR passes. More... | |
const LLVMRemarkStreamer * | getLLVMRemarkStreamer () const |
void | setLLVMRemarkStreamer (std::unique_ptr< LLVMRemarkStreamer > RemarkStreamer) |
void | diagnose (const DiagnosticInfo &DI) |
Report a message to the currently installed diagnostic handler. More... | |
void | setYieldCallback (YieldCallbackTy Callback, void *OpaqueHandle) |
Registers a yield callback with the given context. More... | |
void | yield () |
Calls the yield callback (if applicable). More... | |
void | emitError (uint64_t LocCookie, const Twine &ErrorStr) |
emitError - Emit an error message to the currently installed error handler with optional location information. More... | |
void | emitError (const Instruction *I, const Twine &ErrorStr) |
void | emitError (const Twine &ErrorStr) |
OptPassGate & | getOptPassGate () const |
Access the object which can disable optional passes and individual optimizations at compile time. More... | |
void | setOptPassGate (OptPassGate &) |
Set the object which can disable optional passes and individual optimizations at compile time. More... | |
bool | hasSetOpaquePointersValue () const |
Whether we've decided on using opaque pointers or typed pointers yet. More... | |
void | setOpaquePointers (bool Enable) const |
Set whether opaque pointers are enabled. More... | |
bool | supportsTypedPointers () const |
Whether typed pointers are supported. If false, all pointers are opaque. More... | |
llvm::Any & | getTargetData () const |
Optionally target-spcific data can be attached to the context for lifetime management and bypassing layering restrictions. More... | |
Static Public Member Functions | |
static const char * | getDiagnosticMessagePrefix (DiagnosticSeverity Severity) |
Get the prefix that should be printed in front of a diagnostic of the given Severity . More... | |
Public Attributes | |
LLVMContextImpl *const | pImpl |
Friends | |
class | Module |
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.
Definition at line 68 of file LLVMContext.h.
using llvm::LLVMContext::YieldCallbackTy = void (*)(LLVMContext *Context, void *OpaqueHandle) |
Defines the type of a yield callback.
Definition at line 159 of file LLVMContext.h.
anonymous enum : unsigned |
Definition at line 78 of file LLVMContext.h.
anonymous enum : unsigned |
Known operand bundle tag IDs, which always have the same value.
All operand bundle tags that LLVM has special knowledge of are listed here. Additionally, this scheme allows LLVM to efficiently check for specific operand bundle tags without comparing strings. Keep this in sync with LLVMContext::LLVMContext().
Enumerator | |
---|---|
OB_deopt | |
OB_funclet | |
OB_gc_transition | |
OB_cfguardtarget | |
OB_preallocated | |
OB_gc_live | |
OB_clang_arc_attachedcall | |
OB_ptrauth |
Definition at line 89 of file LLVMContext.h.
LLVMContext::LLVMContext | ( | ) |
Definition at line 34 of file LLVMContext.cpp.
References assert(), getMDKindID(), llvm::LLVMContextImpl::getOrInsertBundleTag(), llvm::LLVMContextImpl::getOrInsertSyncScopeID(), OB_cfguardtarget, OB_clang_arc_attachedcall, OB_deopt, OB_funclet, OB_gc_live, OB_gc_transition, OB_preallocated, OB_ptrauth, pImpl, llvm::SyncScope::SingleThread, and llvm::SyncScope::System.
|
delete |
LLVMContext::~LLVMContext | ( | ) |
Definition at line 103 of file LLVMContext.cpp.
References pImpl.
Remove the GC for a function.
Definition at line 327 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::GCNames, and pImpl.
Referenced by llvm::Function::clearGC().
void LLVMContext::diagnose | ( | const DiagnosticInfo & | DI | ) |
Report a message to the currently installed diagnostic handler.
This function returns, in particular in the case of error reporting (DI.Severity == 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 DI.getSeverity()
, i.e., "error: " for DS_Error, "warning: " for DS_Warning, and "note: " for DS_Note.
Definition at line 243 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::DiagHandler, DP, llvm::DS_Error, llvm::errs(), exit(), getDiagnosticMessagePrefix(), getLLVMRemarkStreamer(), llvm::DiagnosticInfo::getSeverity(), isDiagnosticEnabled(), pImpl, llvm::DiagnosticInfo::print(), and llvm::LLVMContextImpl::RespectDiagnosticFilters.
Referenced by llvm::SIMachineFunctionInfo::allocateSGPRSpillToVGPR(), llvm::sampleprof::SampleProfileReaderItaniumRemapper::applyRemapping(), llvm::createMIRParser(), llvm::MachineModuleInfoWrapperPass::doInitialization(), llvm::OptimizationRemarkEmitter::emit(), llvm::MachineOptimizationRemarkEmitter::emit(), emitError(), emitNonHSAIntrinsicError(), llvm::RISCVFrameLowering::emitPrologue(), emitRemovedIntrinsicError(), emitSCSEpilogue(), emitSCSPrologue(), llvm::MIRParserImpl::error(), errorUnsupported(), fail(), llvm::RISCVInstrInfo::getVLENFactoredAmount(), llvm::AMDGPULegalizerInfo::legalizeAddrSpaceCast(), llvm::AMDGPULegalizerInfo::legalizeDebugTrapIntrinsic(), llvm::AMDGPULegalizerInfo::legalizeGlobalValue(), llvm::RISCVTargetLowering::LowerCall(), llvm::AMDGPUTargetLowering::LowerDYNAMIC_STACKALLOC(), llvm::SITargetLowering::LowerFormalArguments(), llvm::AMDGPUTargetLowering::LowerGlobalAddress(), llvm::RISCVTargetLowering::LowerReturn(), llvm::AMDGPUTargetLowering::lowerUnhandledCall(), llvm::MIRParserImpl::reportDiagnostic(), llvm::sampleprof::SampleProfileReader::reportError(), reportIllegalCopy(), llvm::SelectionDAGISel::runOnMachineFunction(), and selectExplicitSectionGlobal().
void LLVMContext::disableDebugTypeODRUniquing | ( | ) |
Definition at line 344 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::DITypeMap, and pImpl.
void LLVMContext::emitError | ( | const Instruction * | I, |
const Twine & | ErrorStr | ||
) |
Definition at line 208 of file LLVMContext.cpp.
References assert(), diagnose(), and I.
Definition at line 204 of file LLVMContext.cpp.
References diagnose().
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 ".".
Definition at line 266 of file LLVMContext.cpp.
References diagnose().
Referenced by llvm::RegAllocBase::allocatePhysRegs(), llvm::LTOModule::createFromFile(), llvm::LTOModule::createFromOpenFileSlice(), diagnosePossiblyInvalidConstraint(), llvm::MachineInstr::emitError(), emitErrorMsg(), EmitInlineAsmStr(), llvm::AMDGPU::getIntegerAttribute(), llvm::AMDGPU::getIntegerPairAttribute(), llvm::getTensorSpecFromJSON(), INITIALIZE_PASS(), llvm::loadOutputSpecs(), parseBitcodeFileImpl(), llvm::ReplayInlineAdvisor::ReplayInlineAdvisor(), llvm::RAGreedy::selectOrSplit(), and llvm::TargetLowering::verifyReturnAddressArgumentIsConstant().
void LLVMContext::enableDebugTypeODRUniquing | ( | ) |
Definition at line 337 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::DITypeMap, and pImpl.
Referenced by llvm::LTOCodeGenerator::LTOCodeGenerator(), llvm::lto::LTOLLVMContext::LTOLLVMContext(), and llvm::ThinLTOCodeGenerator::run().
const DiagnosticHandler * LLVMContext::getDiagHandlerPtr | ( | ) | const |
getDiagHandlerPtr - Returns const raw pointer of DiagnosticHandler set by setDiagnosticHandler.
Definition at line 358 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::DiagHandler, and pImpl.
Referenced by llvm::OptimizationRemarkEmitter::allowExtraAnalysis(), llvm::MachineOptimizationRemarkEmitter::allowExtraAnalysis(), llvm::MachineOptimizationRemarkEmitter::emit(), llvm::OptimizationRemarkEmitter::enabled(), getDefaultInlineAdvice(), llvm::MachineOptimizationRemark::isEnabled(), llvm::MachineOptimizationRemarkMissed::isEnabled(), llvm::MachineOptimizationRemarkAnalysis::isEnabled(), llvm::OptimizationRemark::isEnabled(), llvm::OptimizationRemarkMissed::isEnabled(), and llvm::OptimizationRemarkAnalysis::isEnabled().
void * LLVMContext::getDiagnosticContext | ( | ) | const |
getDiagnosticContext - Return the diagnostic context set by setDiagnosticContext.
Definition at line 189 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::DiagHandler, and pImpl.
std::unique_ptr< DiagnosticHandler > LLVMContext::getDiagnosticHandler | ( | ) |
getDiagnosticHandler - transfers ownership of DiagnosticHandler unique_ptr to caller.
Definition at line 362 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::DiagHandler, move, and pImpl.
DiagnosticHandler::DiagnosticHandlerTy LLVMContext::getDiagnosticHandlerCallBack | ( | ) | const |
getDiagnosticHandlerCallBack - Return the diagnostic handler call back set by setDiagnosticHandlerCallBack.
Definition at line 185 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::DiagHandler, and pImpl.
|
static |
Get the prefix that should be printed in front of a diagnostic of the given Severity
.
Definition at line 229 of file LLVMContext.cpp.
References llvm::DS_Error, llvm::DS_Note, llvm::DS_Remark, llvm::DS_Warning, and llvm_unreachable.
Referenced by diagnose().
bool LLVMContext::getDiagnosticsHotnessRequested | ( | ) | const |
Return if a code hotness metric should be included in optimization diagnostics.
Definition at line 134 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::DiagnosticsHotnessRequested, and pImpl.
Referenced by llvm::OptimizationRemarkEmitterAnalysis::run(), llvm::OptimizationRemarkEmitterWrapperPass::runOnFunction(), and llvm::MachineOptimizationRemarkEmitterPass::runOnMachineFunction().
uint64_t LLVMContext::getDiagnosticsHotnessThreshold | ( | ) | const |
Return the minimum hotness value a diagnostic would need in order to be included in optimization diagnostics.
Three possible return values: 0 - threshold is disabled. Everything will be printed out. positive int - threshold is set. UINT64_MAX - threshold is not yet set, and needs to be synced from profile summary. Note that in case of missing profile summary, threshold will be kept at "MAX", effectively suppresses all remarks output.
Definition at line 147 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::DiagnosticsHotnessThreshold, pImpl, UINT64_MAX, and llvm::Optional< T >::value_or().
Referenced by llvm::OptimizationRemarkEmitter::emit(), and llvm::MachineOptimizationRemarkEmitter::emit().
uint64_t LLVMContext::getDiagnosticsMisExpectTolerance | ( | ) | const |
Definition at line 154 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::DiagnosticsMisExpectTolerance, pImpl, and llvm::Optional< T >::value_or().
Return the GC for a function.
Definition at line 323 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::GCNames, and pImpl.
Referenced by llvm::Function::getGC().
const LLVMRemarkStreamer * LLVMContext::getLLVMRemarkStreamer | ( | ) |
The "LLVM remark streamer" used by LLVM to serialize remark diagnostics comming from IR and MIR passes.
If it does not exist, diagnostics are not saved in a file but only emitted via the diagnostic handler.
Definition at line 173 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::LLVMRS, and pImpl.
Referenced by llvm::OptimizationRemarkEmitter::allowExtraAnalysis(), llvm::MachineOptimizationRemarkEmitter::allowExtraAnalysis(), diagnose(), llvm::MachineOptimizationRemarkEmitter::emit(), and llvm::OptimizationRemarkEmitter::enabled().
const LLVMRemarkStreamer* llvm::LLVMContext::getLLVMRemarkStreamer | ( | ) | const |
const remarks::RemarkStreamer * LLVMContext::getMainRemarkStreamer | ( | ) |
The "main remark streamer" used by all the specialized remark streamers.
This streamer keeps generic remark metadata in memory throughout the life of the LLVMContext. This metadata may be emitted in a section in object files depending on the format requirements.
All specialized remark streamers should convert remarks to llvm::remarks::Remark and emit them through this streamer.
Definition at line 162 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::MainRemarkStreamer, and pImpl.
Referenced by llvm::setupLLVMOptimizationRemarks().
const remarks::RemarkStreamer* llvm::LLVMContext::getMainRemarkStreamer | ( | ) | const |
unsigned LLVMContext::getMDKindID | ( | StringRef | Name | ) | const |
getMDKindID - Return a unique non-zero ID for the specified metadata kind.
Return a unique non-zero ID for the specified metadata kind.
This ID is uniqued across modules in the current LLVMContext.
Definition at line 275 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::CustomMDKindNames, llvm::StringMap< ValueTy, AllocatorTy >::insert(), pImpl, and llvm::StringMapImpl::size().
Referenced by llvm::Module::getMDKindID(), insertUniqueBackedgeBlock(), and LLVMContext().
void LLVMContext::getMDKindNames | ( | SmallVectorImpl< StringRef > & | Result | ) | const |
getMDKindNames - Populate client supplied SmallVector with the name for custom metadata IDs registered in this LLVMContext.
getHandlerNames - Populate client-supplied smallvector using custom metadata name and ID.
Definition at line 285 of file LLVMContext.cpp.
References llvm::StringMap< ValueTy, AllocatorTy >::begin(), llvm::LLVMContextImpl::CustomMDKindNames, E, llvm::StringMap< ValueTy, AllocatorTy >::end(), I, pImpl, llvm::SmallVectorImpl< T >::resize(), and llvm::StringMapImpl::size().
Referenced by llvm::Module::getMDKindNames().
bool LLVMContext::getMisExpectWarningRequested | ( | ) | const |
Definition at line 144 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::MisExpectWarningRequested, and pImpl.
getOperandBundleTagID - Maps a bundle tag to an integer ID.
Every bundle tag registered with an LLVMContext has an unique ID.
Definition at line 301 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::getOperandBundleTagID(), and pImpl.
void LLVMContext::getOperandBundleTags | ( | SmallVectorImpl< StringRef > & | Result | ) | const |
getOperandBundleTags - Populate client supplied SmallVector with the bundle tags registered in this LLVMContext.
The bundle tags are ordered by increasing bundle IDs.
Definition at line 292 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::getOperandBundleTags(), and pImpl.
Referenced by llvm::Module::getOperandBundleTags().
OptPassGate & LLVMContext::getOptPassGate | ( | ) | const |
Access the object which can disable optional passes and individual optimizations at compile time.
Definition at line 350 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::getOptPassGate(), and pImpl.
StringMapEntry< uint32_t > * LLVMContext::getOrInsertBundleTag | ( | StringRef | TagName | ) | const |
getOrInsertBundleTag - Returns the Tag to use for an operand bundle of name TagName.
Definition at line 297 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::getOrInsertBundleTag(), and pImpl.
SyncScope::ID LLVMContext::getOrInsertSyncScopeID | ( | StringRef | SSN | ) |
getOrInsertSyncScopeID - Maps synchronization scope name to synchronization scope ID.
Every synchronization scope registered with LLVMContext has unique ID except pre-defined ones.
Definition at line 305 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::getOrInsertSyncScopeID(), and pImpl.
Referenced by llvm::AMDGPUMachineModuleInfo::AMDGPUMachineModuleInfo(), and llvm::SITargetLowering::shouldExpandAtomicRMWInIR().
void LLVMContext::getSyncScopeNames | ( | SmallVectorImpl< StringRef > & | SSNs | ) | const |
getSyncScopeNames - Populates client supplied SmallVector with synchronization scope names registered with LLVMContext.
Synchronization scope names are ordered by increasing synchronization scope IDs.
Definition at line 309 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::getSyncScopeNames(), and pImpl.
Referenced by printSyncScope(), and llvm::SITargetLowering::shouldExpandAtomicRMWInIR().
Any & LLVMContext::getTargetData | ( | ) | const |
Optionally target-spcific data can be attached to the context for lifetime management and bypassing layering restrictions.
Definition at line 378 of file LLVMContext.cpp.
References pImpl, and llvm::LLVMContextImpl::TargetDataStorage.
Referenced by llvm::dxil::TypedPointerType::get().
bool LLVMContext::hasSetOpaquePointersValue | ( | ) | const |
Whether we've decided on using opaque pointers or typed pointers yet.
Definition at line 366 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::hasOpaquePointersValue(), and pImpl.
Referenced by llvm::lto::LTOLLVMContext::LTOLLVMContext(), and llvm::LLParser::Run().
bool LLVMContext::isDiagnosticsHotnessThresholdSetFromPSI | ( | ) | const |
Return if hotness threshold is requested from PSI.
Definition at line 158 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::DiagnosticsHotnessThreshold, llvm::Optional< T >::has_value(), and pImpl.
Referenced by llvm::OptimizationRemarkEmitterAnalysis::run(), and llvm::OptimizationRemarkEmitterWrapperPass::runOnFunction().
bool LLVMContext::isODRUniquingDebugTypes | ( | ) | const |
Whether there is a string map for uniquing debug info identifiers across the context.
Off by default.
Definition at line 335 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::DITypeMap, and pImpl.
Referenced by llvm::DICompositeType::buildODRType(), llvm::DICompositeType::getODRTypeIfExists(), and llvm::lto::thinBackend().
|
delete |
void LLVMContext::setDiagnosticHandler | ( | std::unique_ptr< DiagnosticHandler > && | DH, |
bool | RespectFilters = false |
||
) |
setDiagnosticHandler - This method sets unique_ptr to object of DiagnosticHandler to provide custom diagnostic handling.
The first argument is unique_ptr of object of type DiagnosticHandler or a derived of that. The second argument should be set to true if the handler only expects enabled diagnostics.
Ownership of this pointer is moved to LLVMContextImpl.
Definition at line 125 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::DiagHandler, move, pImpl, and llvm::LLVMContextImpl::RespectDiagnosticFilters.
Referenced by llvm::lto::LTOLLVMContext::LTOLLVMContext(), and llvm::LTOCodeGenerator::setDiagnosticHandler().
void LLVMContext::setDiagnosticHandlerCallBack | ( | DiagnosticHandler::DiagnosticHandlerTy | DiagHandler, |
void * | DiagContext = nullptr , |
||
bool | RespectFilters = false |
||
) |
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.
Definition at line 117 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::DiagHandler, pImpl, and llvm::LLVMContextImpl::RespectDiagnosticFilters.
void LLVMContext::setDiagnosticsHotnessRequested | ( | bool | Requested | ) |
Set if a code hotness metric should be included in optimization diagnostics.
Definition at line 131 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::DiagnosticsHotnessRequested, and pImpl.
Referenced by llvm::setupLLVMOptimizationRemarks().
Set the minimum hotness value a diagnostic needs in order to be included in optimization diagnostics.
Definition at line 138 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::DiagnosticsHotnessThreshold, and pImpl.
Referenced by llvm::OptimizationRemarkEmitterAnalysis::run(), llvm::OptimizationRemarkEmitterWrapperPass::runOnFunction(), and llvm::setupLLVMOptimizationRemarks().
Definition at line 150 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::DiagnosticsMisExpectTolerance, and pImpl.
void LLVMContext::setDiscardValueNames | ( | bool | Discard | ) |
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.
Definition at line 346 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::DiscardValueNames, and pImpl.
Referenced by llvm::LTOCodeGenerator::LTOCodeGenerator(), llvm::lto::LTOLLVMContext::LTOLLVMContext(), and llvm::ThinLTOCodeGenerator::run().
Define the GC for a function.
Definition at line 313 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::GCNames, move, and pImpl.
Referenced by llvm::Function::setGC().
void LLVMContext::setLLVMRemarkStreamer | ( | std::unique_ptr< LLVMRemarkStreamer > | RemarkStreamer | ) |
Definition at line 179 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::LLVMRS, move, and pImpl.
Referenced by llvm::setupLLVMOptimizationRemarks().
void LLVMContext::setMainRemarkStreamer | ( | std::unique_ptr< remarks::RemarkStreamer > | MainRemarkStreamer | ) |
Definition at line 168 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::MainRemarkStreamer, move, and pImpl.
Referenced by llvm::setupLLVMOptimizationRemarks().
void LLVMContext::setMisExpectWarningRequested | ( | bool | Requested | ) |
Definition at line 141 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::MisExpectWarningRequested, and pImpl.
void LLVMContext::setOpaquePointers | ( | bool | Enable | ) | const |
Set whether opaque pointers are enabled.
The method may be called multiple times, but only with the same value. Note that creating a pointer type or otherwise querying the opaque pointer mode performs an implicit set to the default value.
Definition at line 370 of file LLVMContext.cpp.
References Enable, pImpl, and llvm::LLVMContextImpl::setOpaquePointers().
Referenced by llvm::lto::LTOLLVMContext::LTOLLVMContext().
void LLVMContext::setOptPassGate | ( | OptPassGate & | OPG | ) |
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.
Definition at line 354 of file LLVMContext.cpp.
References pImpl, and llvm::LLVMContextImpl::setOptPassGate().
void LLVMContext::setYieldCallback | ( | YieldCallbackTy | Callback, |
void * | OpaqueHandle | ||
) |
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.
Definition at line 193 of file LLVMContext.cpp.
References pImpl, llvm::LLVMContextImpl::YieldCallback, and llvm::LLVMContextImpl::YieldOpaqueHandle.
bool LLVMContext::shouldDiscardValueNames | ( | ) | const |
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.
Definition at line 331 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::DiscardValueNames, and pImpl.
Referenced by llvm::createMIRParser(), and llvm::LLParser::Run().
bool LLVMContext::supportsTypedPointers | ( | ) | const |
Whether typed pointers are supported. If false, all pointers are opaque.
Definition at line 374 of file LLVMContext.cpp.
References llvm::LLVMContextImpl::getOpaquePointers(), and pImpl.
void LLVMContext::yield | ( | ) |
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.
Definition at line 199 of file LLVMContext.cpp.
References pImpl, llvm::LLVMContextImpl::YieldCallback, and llvm::LLVMContextImpl::YieldOpaqueHandle.
|
friend |
Definition at line 332 of file LLVMContext.h.
LLVMContextImpl* const llvm::LLVMContext::pImpl |
Definition at line 70 of file LLVMContext.h.
Referenced by llvm::Value::addMetadata(), llvm::DICompositeType::buildODRType(), llvm::Value::clearMetadata(), llvm::StructType::create(), deleteGC(), diagnose(), disableDebugTypeODRUniquing(), llvm::Module::dropTriviallyDeadConstantArrays(), llvm::Instruction::dropUnknownNonDebugMetadata(), enableDebugTypeODRUniquing(), llvm::Value::eraseMetadata(), llvm::InlineAsm::get(), llvm::ConstantInt::get(), llvm::Attribute::get(), llvm::StructType::get(), llvm::ConstantFP::get(), llvm::ArrayType::get(), llvm::ConstantArray::get(), llvm::ConstantVector::get(), llvm::FixedVectorType::get(), llvm::ScalableVectorType::get(), llvm::MDString::get(), llvm::PointerType::get(), llvm::ConstantTokenNone::get(), llvm::DSOLocalEquivalent::get(), llvm::NoCFIValue::get(), llvm::Value::getAllMetadata(), getDiagHandlerPtr(), getDiagnosticContext(), getDiagnosticHandler(), getDiagnosticHandlerCallBack(), getDiagnosticsHotnessRequested(), getDiagnosticsHotnessThreshold(), getDiagnosticsMisExpectTolerance(), llvm::ConstantExpr::getExtractElement(), llvm::ConstantExpr::getExtractValue(), llvm::ConstantInt::getFalse(), llvm::ConstantExpr::getFCmp(), getFoldedCast(), getGC(), llvm::ConstantExpr::getICmp(), llvm::MetadataAsValue::getIfExists(), llvm::ValueAsMetadata::getIfExists(), llvm::ConstantDataSequential::getImpl(), llvm::ConstantExpr::getInsertElement(), llvm::ConstantExpr::getInsertValue(), getLLVMRemarkStreamer(), getMainRemarkStreamer(), getMDKindID(), getMDKindNames(), llvm::Value::getMetadata(), getMisExpectWarningRequested(), llvm::DICompositeType::getODRTypeIfExists(), getOperandBundleTagID(), getOperandBundleTags(), getOptPassGate(), getOrInsertBundleTag(), getOrInsertSyncScopeID(), llvm::GlobalValue::getPartition(), llvm::GlobalValue::getSanitizerMetadata(), llvm::ConstantExpr::getShuffleVector(), getSyncScopeNames(), getTargetData(), llvm::ConstantInt::getTrue(), llvm::Value::getValueName(), llvm::ValueAsMetadata::handleDeletion(), llvm::ValueAsMetadata::handleRAUW(), hasSetOpaquePointersValue(), isDiagnosticsHotnessThresholdSetFromPSI(), isODRUniquingDebugTypes(), LLVMContext(), llvm::CallBase::populateBundleOperandInfos(), llvm::ValueHandleBase::RemoveFromUseList(), llvm::GlobalValue::removeSanitizerMetadata(), llvm::ReplaceableMetadataImpl::SalvageDebugInfo(), setDiagnosticHandler(), setDiagnosticHandlerCallBack(), setDiagnosticsHotnessRequested(), setDiagnosticsHotnessThreshold(), setDiagnosticsMisExpectTolerance(), setDiscardValueNames(), setGC(), setLLVMRemarkStreamer(), setMainRemarkStreamer(), setMisExpectWarningRequested(), llvm::StructType::setName(), setOpaquePointers(), setOptPassGate(), llvm::GlobalValue::setPartition(), llvm::GlobalValue::setSanitizerMetadata(), llvm::GlobalObject::setSection(), llvm::Value::setValueName(), setYieldCallback(), shouldDiscardValueNames(), llvm::MDNode::storeDistinctInContext(), supportsTypedPointers(), llvm::ValueHandleBase::ValueIsDeleted(), llvm::ValueHandleBase::ValueIsRAUWd(), yield(), ~LLVMContext(), and llvm::MetadataAsValue::~MetadataAsValue().