LLVM  8.0.1
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
llvm::LLVMContext Class Reference

This is an important class for using LLVM in a threaded context. More...

#include "llvm/IR/LLVMContext.h"

Inheritance diagram for llvm::LLVMContext:
Inheritance graph
[legend]
Collaboration diagram for llvm::LLVMContext:
Collaboration graph
[legend]

Public Types

enum  : unsigned {
  MD_dbg = 0, MD_tbaa = 1, MD_prof = 2, MD_fpmath = 3,
  MD_range = 4, MD_tbaa_struct = 5, MD_invariant_load = 6, MD_alias_scope = 7,
  MD_noalias = 8, MD_nontemporal = 9, MD_mem_parallel_loop_access = 10, MD_nonnull = 11,
  MD_dereferenceable = 12, MD_dereferenceable_or_null = 13, MD_make_implicit = 14, MD_unpredictable = 15,
  MD_invariant_group = 16, MD_align = 17, MD_loop = 18, MD_type = 19,
  MD_section_prefix = 20, MD_absolute_symbol = 21, MD_associated = 22, MD_callees = 23,
  MD_irr_loop = 24, MD_access_group = 25
}
 
enum  : unsigned { OB_deopt = 0, OB_funclet = 1, OB_gc_transition = 2 }
 Known operand bundle tag IDs, which always have the same value. More...
 
using InlineAsmDiagHandlerTy = void(*)(const SMDiagnostic &, void *Context, unsigned LocCookie)
 
using YieldCallbackTy = void(*)(LLVMContext *Context, void *OpaqueHandle)
 Defines the type of a yield callback. More...
 

Public Member Functions

 LLVMContext ()
 
 LLVMContext (LLVMContext &)=delete
 
LLVMContextoperator= (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...
 
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 setInlineAsmDiagnosticHandler (InlineAsmDiagHandlerTy DiagHandler, void *DiagContext=nullptr)
 setInlineAsmDiagnosticHandler - This method sets a handler that is invoked when problems with inline asm are detected by the backend. More...
 
InlineAsmDiagHandlerTy getInlineAsmDiagnosticHandler () const
 getInlineAsmDiagnosticHandler - Return the diagnostic handler set by setInlineAsmDiagnosticHandler. More...
 
void * getInlineAsmDiagnosticContext () const
 getInlineAsmDiagnosticContext - Return the diagnostic context set by setInlineAsmDiagnosticHandler. More...
 
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 DiagnosticHandlergetDiagHandlerPtr () const
 getDiagHandlerPtr - Returns const raw pointer of DiagnosticHandler set by setDiagnosticHandler. More...
 
std::unique_ptr< DiagnosticHandlergetDiagnosticHandler ()
 getDiagnosticHandler - transfers owenership 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...
 
uint64_t getDiagnosticsHotnessThreshold () const
 Return the minimum hotness value a diagnostic would need in order to be included in optimization diagnostics. More...
 
void setDiagnosticsHotnessThreshold (uint64_t Threshold)
 Set the minimum hotness value a diagnostic needs in order to be included in optimization diagnostics. More...
 
yaml::Output * getDiagnosticsOutputFile ()
 Return the YAML file used by the backend to save optimization diagnostics. More...
 
void setDiagnosticsOutputFile (std::unique_ptr< yaml::Output > F)
 Set the diagnostics output file used for optimization diagnostics. More...
 
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 (unsigned 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)
 
template<typename ValT , typename Base , ValTBase::* Mem>
ValT getOption () const
 Query for a debug option's value. More...
 
OptPassGategetOptPassGate () 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...
 

Static Public Member Functions

static const chargetDiagnosticMessagePrefix (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
 

Detailed 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.

Definition at line 69 of file LLVMContext.h.

Member Typedef Documentation

◆ InlineAsmDiagHandlerTy

Definition at line 172 of file LLVMContext.h.

◆ YieldCallbackTy

using llvm::LLVMContext::YieldCallbackTy = void (*)(LLVMContext *Context, void *OpaqueHandle)

Defines the type of a yield callback.

See also
LLVMContext::setYieldCallback.

Definition at line 176 of file LLVMContext.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : unsigned
Enumerator
MD_dbg 
MD_tbaa 
MD_prof 
MD_fpmath 
MD_range 
MD_tbaa_struct 
MD_invariant_load 
MD_alias_scope 
MD_noalias 
MD_nontemporal 
MD_mem_parallel_loop_access 
MD_nonnull 
MD_dereferenceable 
MD_dereferenceable_or_null 
MD_make_implicit 
MD_unpredictable 
MD_invariant_group 
MD_align 
MD_loop 
MD_type 
MD_section_prefix 
MD_absolute_symbol 
MD_associated 
MD_callees 
MD_irr_loop 
MD_access_group 

Definition at line 79 of file LLVMContext.h.

◆ anonymous enum

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.

Enumerator
OB_deopt 
OB_funclet 
OB_gc_transition 

Definition at line 112 of file LLVMContext.h.

Constructor & Destructor Documentation

◆ LLVMContext() [1/2]

LLVMContext::LLVMContext ( )

◆ LLVMContext() [2/2]

llvm::LLVMContext::LLVMContext ( LLVMContext )
delete

◆ ~LLVMContext()

LLVMContext::~LLVMContext ( )

Member Function Documentation

◆ deleteGC()

void LLVMContext::deleteGC ( const Function Fn)

Remove the GC for a function.

Definition at line 313 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::GCNames, and pImpl.

Referenced by llvm::Function::clearGC().

◆ diagnose()

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 230 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::DiagHandler, llvm::DS_Error, llvm::errs(), getDiagnosticMessagePrefix(), getDiagnosticsOutputFile(), llvm::DiagnosticInfo::getSeverity(), isDiagnosticEnabled(), P, pImpl, llvm::DiagnosticInfo::print(), and llvm::LLVMContextImpl::RespectDiagnosticFilters.

Referenced by llvm::createMIRParser(), llvm::OptimizationRemarkEmitter::emit(), llvm::MachineOptimizationRemarkEmitter::emit(), emitError(), llvm::PMDataManager::emitInstrCountChangedRemark(), emitNonHSAIntrinsicError(), emitRemovedIntrinsicError(), llvm::AArch64RegisterInfo::emitReservedArgRegCallError(), llvm::MIRParserImpl::error(), errorUnsupported(), fail(), findUser(), getMinVisibility(), hasAnyNonFlatUseOfReg(), llvm::AMDGPUTargetLowering::LowerDYNAMIC_STACKALLOC(), llvm::SITargetLowering::LowerFormalArguments(), llvm::AMDGPUTargetLowering::LowerGlobalAddress(), llvm::AMDGPUTargetLowering::lowerUnhandledCall(), parseTexFail(), llvm::sampleprof::SampleProfileReaderItaniumRemapper::read(), llvm::MIRParserImpl::reportDiagnostic(), llvm::sampleprof::SampleProfileReader::reportError(), reportIllegalCopy(), llvm::SelectionDAGISel::runOnMachineFunction(), llvm::LTOCodeGenerator::setDiagnosticHandler(), SortCallTargets(), llvm::UpgradeDebugInfo(), and WarnSize().

◆ disableDebugTypeODRUniquing()

void LLVMContext::disableDebugTypeODRUniquing ( )

Definition at line 330 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::DITypeMap, and pImpl.

◆ emitError() [1/3]

void LLVMContext::emitError ( unsigned  LocCookie,
const Twine ErrorStr 
)

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 257 of file LLVMContext.cpp.

References diagnose().

Referenced by llvm::LTOModule::createFromFile(), llvm::LTOModule::createFromOpenFileSlice(), diagnosePossiblyInvalidConstraint(), llvm::MachineInstr::emitError(), EmitGCCInlineAsmStr(), EmitMSInlineAsmStr(), findMatchingInlineAsmOperand(), llvm::AMDGPU::getIntegerAttribute(), llvm::AMDGPU::getIntegerPairAttribute(), llvm::ARMBaseTargetMachine::getSubtargetImpl(), getVariantKind(), parseBitcodeFileImpl(), and llvm::TargetLowering::verifyReturnAddressArgumentIsConstant().

◆ emitError() [2/3]

void LLVMContext::emitError ( const Instruction I,
const Twine ErrorStr 
)

Definition at line 195 of file LLVMContext.cpp.

References assert(), and diagnose().

◆ emitError() [3/3]

void LLVMContext::emitError ( const Twine ErrorStr)

Definition at line 191 of file LLVMContext.cpp.

References diagnose().

◆ enableDebugTypeODRUniquing()

void LLVMContext::enableDebugTypeODRUniquing ( )

◆ getDiagHandlerPtr()

const DiagnosticHandler * LLVMContext::getDiagHandlerPtr ( ) const

◆ getDiagnosticContext()

void * LLVMContext::getDiagnosticContext ( ) const

getDiagnosticContext - Return the diagnostic context set by setDiagnosticContext.

Definition at line 176 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::DiagHandler, and pImpl.

◆ getDiagnosticHandler()

std::unique_ptr< DiagnosticHandler > LLVMContext::getDiagnosticHandler ( )

getDiagnosticHandler - transfers owenership of DiagnosticHandler unique_ptr to caller.

Definition at line 348 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::DiagHandler, and pImpl.

◆ getDiagnosticHandlerCallBack()

DiagnosticHandler::DiagnosticHandlerTy LLVMContext::getDiagnosticHandlerCallBack ( ) const

getDiagnosticHandlerCallBack - Return the diagnostic handler call back set by setDiagnosticHandlerCallBack.

Definition at line 172 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::DiagHandler, and pImpl.

◆ getDiagnosticMessagePrefix()

const char * LLVMContext::getDiagnosticMessagePrefix ( DiagnosticSeverity  Severity)
static

Get the prefix that should be printed in front of a diagnostic of the given Severity.

Definition at line 216 of file LLVMContext.cpp.

References llvm::DS_Error, llvm::DS_Note, llvm::DS_Remark, llvm::DS_Warning, and llvm_unreachable.

Referenced by diagnose().

◆ getDiagnosticsHotnessRequested()

bool LLVMContext::getDiagnosticsHotnessRequested ( ) const

◆ getDiagnosticsHotnessThreshold()

uint64_t LLVMContext::getDiagnosticsHotnessThreshold ( ) const

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.

Definition at line 159 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::DiagnosticsHotnessThreshold, and pImpl.

Referenced by llvm::OptimizationRemarkEmitter::emit(), and llvm::MachineOptimizationRemarkEmitter::emit().

◆ getDiagnosticsOutputFile()

yaml::Output * LLVMContext::getDiagnosticsOutputFile ( )

Return the YAML file used by the backend to save optimization diagnostics.

If null, diagnostics are not saved in a file but only emitted via the diagnostic handler.

Definition at line 163 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::DiagnosticsOutputFile, and pImpl.

Referenced by llvm::OptimizationRemarkEmitter::allowExtraAnalysis(), diagnose(), and llvm::OptimizationRemarkEmitter::emit().

◆ getGC()

const std::string & LLVMContext::getGC ( const Function Fn)

Return the GC for a function.

Definition at line 309 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::GCNames, and pImpl.

Referenced by llvm::Function::getGC().

◆ getInlineAsmDiagnosticContext()

void * LLVMContext::getInlineAsmDiagnosticContext ( ) const

getInlineAsmDiagnosticContext - Return the diagnostic context set by setInlineAsmDiagnosticHandler.

Definition at line 131 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::InlineAsmDiagContext, and pImpl.

Referenced by srcMgrDiagHandler().

◆ getInlineAsmDiagnosticHandler()

LLVMContext::InlineAsmDiagHandlerTy LLVMContext::getInlineAsmDiagnosticHandler ( ) const

getInlineAsmDiagnosticHandler - Return the diagnostic handler set by setInlineAsmDiagnosticHandler.

Definition at line 125 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::InlineAsmDiagHandler, and pImpl.

Referenced by srcMgrDiagHandler().

◆ getMDKindID()

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 266 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::CustomMDKindNames, llvm::StringMap< ValueTy, AllocatorTy >::insert(), pImpl, and llvm::StringMapImpl::size().

Referenced by llvm::objcarc::ARCMDKindCache::get(), llvm::Module::getMDKindID(), insertUniqueBackedgeBlock(), LLVMContext(), llvm::ScalarizerPass::run(), and llvm::TryToSimplifyUncondBranchFromEmptyBlock().

◆ getMDKindNames()

void LLVMContext::getMDKindNames ( SmallVectorImpl< StringRef > &  Names) 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 276 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().

◆ getOperandBundleTagID()

uint32_t LLVMContext::getOperandBundleTagID ( StringRef  Tag) const

getOperandBundleTagID - Maps a bundle tag to an integer ID.

Every bundle tag registered with an LLVMContext has an unique ID.

Definition at line 287 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::getOperandBundleTagID(), and pImpl.

Referenced by emitSignedInt64().

◆ getOperandBundleTags()

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.

See also
LLVMContext::getOperandBundleTagID

Definition at line 283 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::getOperandBundleTags(), and pImpl.

Referenced by llvm::Module::getOperandBundleTags().

◆ getOption()

template<typename ValT , typename Base , ValTBase::* Mem>
ValT llvm::LLVMContext::getOption ( ) const
inline

Query for a debug option's value.

This function returns typed data populated from command line parsing.

Definition at line 315 of file LLVMContext.h.

References llvm::OptionRegistry::instance().

◆ getOptPassGate()

OptPassGate & LLVMContext::getOptPassGate ( ) const

Access the object which can disable optional passes and individual optimizations at compile time.

Definition at line 336 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::getOptPassGate(), and pImpl.

Referenced by llvm::BasicBlockPass::skipBasicBlock(), llvm::FunctionPass::skipFunction(), llvm::LoopPass::skipLoop(), llvm::ModulePass::skipModule(), llvm::RegionPass::skipRegion(), and llvm::CallGraphSCCPass::skipSCC().

◆ getOrInsertSyncScopeID()

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 291 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::getOrInsertSyncScopeID(), and pImpl.

Referenced by llvm::AMDGPUMachineModuleInfo::AMDGPUMachineModuleInfo(), and parseOptionalLinkageAux().

◆ getSyncScopeNames()

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 295 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::getSyncScopeNames(), and pImpl.

Referenced by printSyncScope().

◆ isODRUniquingDebugTypes()

bool LLVMContext::isODRUniquingDebugTypes ( ) const

Whether there is a string map for uniquing debug info identifiers across the context.

Off by default.

Definition at line 321 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::DITypeMap, and pImpl.

Referenced by llvm::DICompositeType::buildODRType(), llvm::DICompositeType::getODRTypeIfExists(), getSubprogram(), and llvm::lto::thinBackend().

◆ operator=()

LLVMContext& llvm::LLVMContext::operator= ( const LLVMContext )
delete

◆ setDiagnosticHandler()

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 third argument should be set to true if the handler only expects enabled diagnostics.

Ownership of this pointer is moved to LLVMContextImpl.

Definition at line 143 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::DiagHandler, pImpl, and llvm::LLVMContextImpl::RespectDiagnosticFilters.

Referenced by llvm::LTOCodeGenerator::setDiagnosticHandler().

◆ setDiagnosticHandlerCallBack()

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 135 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::DiagHandler, pImpl, and llvm::LLVMContextImpl::RespectDiagnosticFilters.

◆ setDiagnosticsHotnessRequested()

void LLVMContext::setDiagnosticsHotnessRequested ( bool  Requested)

Set if a code hotness metric should be included in optimization diagnostics.

Definition at line 149 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::DiagnosticsHotnessRequested, and pImpl.

Referenced by llvm::lto::setupOptimizationRemarks().

◆ setDiagnosticsHotnessThreshold()

void LLVMContext::setDiagnosticsHotnessThreshold ( uint64_t  Threshold)

Set the minimum hotness value a diagnostic needs in order to be included in optimization diagnostics.

Definition at line 156 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::DiagnosticsHotnessThreshold, pImpl, and Threshold.

◆ setDiagnosticsOutputFile()

void LLVMContext::setDiagnosticsOutputFile ( std::unique_ptr< yaml::Output >  F)

Set the diagnostics output file used for optimization diagnostics.

By default or if invoked with null, diagnostics are not saved in a file but only emitted via the diagnostic handler. Even if an output file is set, the handler is invoked for each diagnostic message.

Definition at line 167 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::DiagnosticsOutputFile, and pImpl.

Referenced by llvm::lto::setupOptimizationRemarks().

◆ setDiscardValueNames()

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 332 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::DiscardValueNames, and pImpl.

Referenced by llvm::LTOCodeGenerator::LTOCodeGenerator(), and llvm::ThinLTOCodeGenerator::run().

◆ setGC()

void LLVMContext::setGC ( const Function Fn,
std::string  GCName 
)

Define the GC for a function.

Definition at line 299 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::GCNames, and pImpl.

Referenced by llvm::Function::setGC().

◆ setInlineAsmDiagnosticHandler()

void LLVMContext::setInlineAsmDiagnosticHandler ( InlineAsmDiagHandlerTy  DiagHandler,
void *  DiagContext = nullptr 
)

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.

Definition at line 116 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::InlineAsmDiagContext, llvm::LLVMContextImpl::InlineAsmDiagHandler, and pImpl.

Referenced by ~LLVMContext().

◆ setOptPassGate()

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 340 of file LLVMContext.cpp.

References pImpl, and llvm::LLVMContextImpl::setOptPassGate().

◆ setYieldCallback()

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 180 of file LLVMContext.cpp.

References pImpl, llvm::LLVMContextImpl::YieldCallback, and llvm::LLVMContextImpl::YieldOpaqueHandle.

◆ shouldDiscardValueNames()

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 317 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::DiscardValueNames, and pImpl.

Referenced by llvm::createMIRParser(), and llvm::LLParser::Run().

◆ yield()

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 186 of file LLVMContext.cpp.

References pImpl, llvm::LLVMContextImpl::YieldCallback, and llvm::LLVMContextImpl::YieldOpaqueHandle.

Referenced by llvm::legacy::FunctionPassManagerImpl::run(), llvm::legacy::PassManagerImpl::run(), and llvm::LPPassManager::runOnFunction().

Friends And Related Function Documentation

◆ Module

friend class Module
friend

Definition at line 332 of file LLVMContext.h.

Member Data Documentation

◆ pImpl

LLVMContextImpl* const llvm::LLVMContext::pImpl

Definition at line 71 of file LLVMContext.h.

Referenced by llvm::GlobalObject::addMetadata(), adjustColumn(), llvm::DICompositeType::buildODRType(), llvm::GlobalObject::clearMetadata(), llvm::StructType::create(), createImportedModule(), deleteGC(), diagnose(), disableDebugTypeODRUniquing(), llvm::Module::dropTriviallyDeadConstantArrays(), llvm::Instruction::dropUnknownNonDebugMetadata(), llvm::AttributeListImpl::dump(), enableDebugTypeODRUniquing(), llvm::GlobalObject::eraseMetadata(), llvm::Instruction::extractProfTotalWeight(), llvm::InlineAsm::get(), llvm::IntegerType::get(), llvm::Attribute::get(), llvm::FunctionType::get(), llvm::ConstantInt::get(), llvm::AttributeSetNode::get(), llvm::MetadataAsValue::get(), llvm::StructType::get(), llvm::ConstantFP::get(), llvm::ConstantAggregateZero::get(), llvm::ValueAsMetadata::get(), llvm::ArrayType::get(), llvm::VectorType::get(), llvm::ConstantArray::get(), llvm::ConstantStruct::get(), llvm::PointerType::get(), llvm::ConstantVector::get(), llvm::ConstantPointerNull::get(), llvm::MDString::get(), llvm::ConstantTokenNone::get(), llvm::BlockAddress::get(), llvm::ConstantExpr::get(), llvm::UndefValue::get(), llvm::GlobalObject::getAllMetadata(), llvm::ConstantExpr::getBinOpAbsorber(), llvm::GlobalValue::getComdat(), getDiagHandlerPtr(), getDiagnosticContext(), getDiagnosticHandler(), getDiagnosticHandlerCallBack(), getDiagnosticsHotnessRequested(), getDiagnosticsHotnessThreshold(), getDiagnosticsOutputFile(), llvm::Type::getDoubleTy(), llvm::ConstantExpr::getExtractElement(), llvm::ConstantExpr::getExtractValue(), llvm::ConstantInt::getFalse(), llvm::ConstantExpr::getFCmp(), llvm::Type::getFloatTy(), getFoldedCast(), llvm::Type::getFP128Ty(), getGC(), llvm::ConstantExpr::getGetElementPtr(), llvm::Type::getHalfTy(), llvm::ConstantExpr::getICmp(), llvm::MetadataAsValue::getIfExists(), llvm::ValueAsMetadata::getIfExists(), llvm::ConstantDataSequential::getImpl(), getInlineAsmDiagnosticContext(), getInlineAsmDiagnosticHandler(), llvm::ConstantExpr::getInsertElement(), llvm::ConstantExpr::getInsertValue(), llvm::Type::getInt128Ty(), llvm::Type::getInt16Ty(), llvm::Type::getInt1Ty(), llvm::Type::getInt32Ty(), llvm::Type::getInt64Ty(), llvm::Type::getInt8Ty(), llvm::Type::getLabelTy(), getMDKindID(), getMDKindNames(), llvm::GlobalObject::getMetadata(), llvm::Type::getMetadataTy(), llvm::DICompositeType::getODRTypeIfExists(), getOperandBundleTagID(), getOperandBundleTags(), getOptPassGate(), getOrInsertSyncScopeID(), llvm::Type::getPPC_FP128Ty(), llvm::ConstantExpr::getSelect(), llvm::ConstantExpr::getShuffleVector(), getSyncScopeNames(), llvm::Type::getTokenTy(), llvm::ConstantInt::getTrue(), llvm::Module::getTypeByName(), llvm::Value::getValueName(), llvm::Type::getVoidTy(), llvm::Type::getX86_FP80Ty(), llvm::Type::getX86_MMXTy(), llvm::ValueAsMetadata::handleDeletion(), llvm::Constant::handleOperandChange(), isCanonical(), isODRUniquingDebugTypes(), LLVMContext(), llvm::BlockAddress::lookup(), llvm::CallBase::populateBundleOperandInfos(), llvm::Instruction::setAAMetadata(), setDiagnosticHandler(), setDiagnosticHandlerCallBack(), setDiagnosticsHotnessRequested(), setDiagnosticsHotnessThreshold(), setDiagnosticsOutputFile(), setDiscardValueNames(), setGC(), setInlineAsmDiagnosticHandler(), llvm::StructType::setName(), setOptPassGate(), llvm::GlobalObject::setSection(), llvm::Value::setValueName(), setYieldCallback(), shouldDiscardValueNames(), llvm::MDNode::storeDistinctInContext(), llvm::ValueHandleBase::ValueIsDeleted(), llvm::ValueHandleBase::ValueIsRAUWd(), yield(), and ~LLVMContext().


The documentation for this class was generated from the following files: