Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
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]

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,
  OB_kcfi = 8,OB_convergencectrl = 9
}
 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.
 

Public Member Functions

 LLVMContext ()
 
 LLVMContext (constLLVMContext &)=delete
 
LLVMContextoperator= (constLLVMContext &)=delete
 
 ~LLVMContext ()
 
unsigned getMDKindID (StringRefName)const
 getMDKindID - Return a unique non-zero ID for the specified metadata kind.
 
void getMDKindNames (SmallVectorImpl<StringRef > &Result)const
 getMDKindNames - Populate client suppliedSmallVector with the name for custom metadata IDs registered in thisLLVMContext.
 
void getOperandBundleTags (SmallVectorImpl<StringRef > &Result)const
 getOperandBundleTags - Populate client suppliedSmallVector with the bundle tags registered in thisLLVMContext.
 
StringMapEntry<uint32_t > * getOrInsertBundleTag (StringRef TagName)const
 getOrInsertBundleTag - Returns the Tag to use for an operand bundle of name TagName.
 
uint32_t getOperandBundleTagID (StringRefTag)const
 getOperandBundleTagID - Maps a bundle tag to an integer ID.
 
SyncScope::ID getOrInsertSyncScopeID (StringRef SSN)
 getOrInsertSyncScopeID - Maps synchronization scope name to synchronization scope ID.
 
void getSyncScopeNames (SmallVectorImpl<StringRef > &SSNs)const
 getSyncScopeNames - Populates client suppliedSmallVector with synchronization scope names registered withLLVMContext.
 
std::optional<StringRefgetSyncScopeName (SyncScope::ID Id)const
 getSyncScopeName - Returns the name of aSyncScope::ID registered withLLVMContext, if any.
 
void setGC (constFunction &Fn, std::string GCName)
 Define the GC for a function.
 
const std::string & getGC (constFunction &Fn)
 Return the GC for a function.
 
void deleteGC (constFunction &Fn)
 Remove the GC for a function.
 
bool shouldDiscardValueNames ()const
 Return true if the Context runtime configuration is set to discard all value names.
 
void setDiscardValueNames (bool Discard)
 Set the Context runtime configuration to discard all value name (butGlobalValue).
 
bool isODRUniquingDebugTypes ()const
 Whether there is a string map for uniquing debug info identifiers across the context.
 
void enableDebugTypeODRUniquing ()
 
void disableDebugTypeODRUniquing ()
 
unsigned generateMachineFunctionNum (Function &)
 generateMachineFunctionNum - Get a unique number forMachineFunction that associated with the givenFunction.
 
void setDiagnosticHandlerCallBack (DiagnosticHandler::DiagnosticHandlerTyDiagHandler, 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.
 
void setDiagnosticHandler (std::unique_ptr<DiagnosticHandler > &&DH,bool RespectFilters=false)
 setDiagnosticHandler - This method sets unique_ptr to object ofDiagnosticHandler to provide custom diagnostic handling.
 
DiagnosticHandler::DiagnosticHandlerTy getDiagnosticHandlerCallBack ()const
 getDiagnosticHandlerCallBack - Return the diagnostic handler call back set by setDiagnosticHandlerCallBack.
 
void * getDiagnosticContext ()const
 getDiagnosticContext - Return the diagnostic context set by setDiagnosticContext.
 
constDiagnosticHandlergetDiagHandlerPtr ()const
 getDiagHandlerPtr - Returns const raw pointer ofDiagnosticHandler set by setDiagnosticHandler.
 
std::unique_ptr<DiagnosticHandlergetDiagnosticHandler ()
 getDiagnosticHandler - transfers ownership ofDiagnosticHandler unique_ptr to caller.
 
bool getDiagnosticsHotnessRequested ()const
 Return if a code hotness metric should be included in optimization diagnostics.
 
void setDiagnosticsHotnessRequested (bool Requested)
 Set if a code hotness metric should be included in optimization diagnostics.
 
bool getMisExpectWarningRequested ()const
 
void setMisExpectWarningRequested (bool Requested)
 
void setDiagnosticsMisExpectTolerance (std::optional<uint32_t > Tolerance)
 
uint32_t getDiagnosticsMisExpectTolerance ()const
 
uint64_t getDiagnosticsHotnessThreshold ()const
 Return the minimum hotness value a diagnostic would need in order to be included in optimization diagnostics.
 
void setDiagnosticsHotnessThreshold (std::optional<uint64_t > Threshold)
 Set the minimum hotness value a diagnostic needs in order to be included in optimization diagnostics.
 
bool isDiagnosticsHotnessThresholdSetFromPSI ()const
 Return if hotness threshold is requested from PSI.
 
remarks::RemarkStreamergetMainRemarkStreamer ()
 The "main remark streamer" used by all the specialized remark streamers.
 
constremarks::RemarkStreamergetMainRemarkStreamer ()const
 
void setMainRemarkStreamer (std::unique_ptr<remarks::RemarkStreamer > MainRemarkStreamer)
 
LLVMRemarkStreamergetLLVMRemarkStreamer ()
 The "LLVM remark streamer" used by LLVM to serialize remark diagnostics comming from IR and MIR passes.
 
constLLVMRemarkStreamergetLLVMRemarkStreamer ()const
 
void setLLVMRemarkStreamer (std::unique_ptr<LLVMRemarkStreamer > RemarkStreamer)
 
void diagnose (constDiagnosticInfo &DI)
 Report a message to the currently installed diagnostic handler.
 
void setYieldCallback (YieldCallbackTy Callback, void *OpaqueHandle)
 Registers a yield callback with the given context.
 
void yield ()
 Calls the yield callback (if applicable).
 
void emitError (constInstruction *I,constTwine &ErrorStr)
 emitError - Emit an error message to the currently installed error handler with optional location information.
 
void emitError (constTwine &ErrorStr)
 
OptPassGategetOptPassGate ()const
 Access the object which can disable optional passes and individual optimizations at compile time.
 
void setOptPassGate (OptPassGate &)
 Set the object which can disable optional passes and individual optimizations at compile time.
 
StringRef getDefaultTargetCPU ()
 Get or set the current "default" target CPU (target-cpu function attribute).
 
void setDefaultTargetCPU (StringRef CPU)
 
StringRef getDefaultTargetFeatures ()
 Similar to {get,set}DefaultTargetCPU() but for default target-features.
 
void setDefaultTargetFeatures (StringRef Features)
 

Static Public Member Functions

staticconstchargetDiagnosticMessagePrefix (DiagnosticSeverity Severity)
 Get the prefix that should be printed in front of a diagnostic of the givenSeverity.
 

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 line67 of fileLLVMContext.h.

Member Typedef Documentation

◆ YieldCallbackTy

usingllvm::LLVMContext::YieldCallbackTy = void (*)(LLVMContext *Context, void *OpaqueHandle)

Defines the type of a yield callback.

See also
LLVMContext::setYieldCallback.

Definition at line168 of fileLLVMContext.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum :unsigned

Definition at line77 of fileLLVMContext.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. Keep this in sync withLLVMContext::LLVMContext().

Enumerator
OB_deopt 
OB_funclet 
OB_gc_transition 
OB_cfguardtarget 
OB_preallocated 
OB_gc_live 
OB_clang_arc_attachedcall 
OB_ptrauth 
OB_kcfi 
OB_convergencectrl 

Definition at line88 of fileLLVMContext.h.

Constructor & Destructor Documentation

◆ LLVMContext()[1/2]

LLVMContext::LLVMContext()

Definition at line63 of fileLLVMContext.cpp.

Referencesassert(),getMDKindID(),llvm::LLVMContextImpl::getOrInsertBundleTag(),llvm::LLVMContextImpl::getOrInsertSyncScopeID(),knownBundleName(),OB_convergencectrl,OB_deopt,pImpl,llvm::SyncScope::SingleThread, andllvm::SyncScope::System.

◆ LLVMContext()[2/2]

llvm::LLVMContext::LLVMContext(constLLVMContext)
delete

◆ ~LLVMContext()

LLVMContext::~LLVMContext()

Definition at line98 of fileLLVMContext.cpp.

ReferencespImpl.

Member Function Documentation

◆ deleteGC()

void LLVMContext::deleteGC(constFunctionFn)

Remove the GC for a function.

Definition at line326 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::GCNames, andpImpl.

◆ diagnose()

void LLVMContext::diagnose(constDiagnosticInfoDI)

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 toDI.getSeverity(), i.e., "error: " forDS_Error, "warning: " forDS_Warning, and "note: " forDS_Note.

Definition at line245 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::DiagHandler,llvm::DS_Error,llvm::errs(),getDiagnosticMessagePrefix(),getLLVMRemarkStreamer(),llvm::DiagnosticInfo::getSeverity(),isDiagnosticEnabled(),pImpl,llvm::DiagnosticInfo::print(), andllvm::LLVMContextImpl::RespectDiagnosticFilters.

Referenced byllvm::sampleprof::SampleProfileReaderItaniumRemapper::applyRemapping(),llvm::GCNSubtarget::checkSubtargetFeatures(),llvm::createMIRParser(),diagnoseInvalidFormatString(),diagnosePossiblyInvalidConstraint(),llvm::MachineModuleInfoWrapperPass::doInitialization(),llvm::OptimizationRemarkEmitter::emit(),llvm::MachineOptimizationRemarkEmitter::emit(),emitError(),llvm::MachineInstr::emitGenericError(),llvm::MachineInstr::emitInlineAsmError(),EmitInlineAsmStr(),emitNonHSAIntrinsicError(),llvm::RISCVFrameLowering::emitPrologue(),emitRemovedIntrinsicError(),emitUnsupportedError(),llvm::MIRParserImpl::error(),errorUnsupported(),fail(),llvm::RegAllocBase::getErrorAssignment(),InstrumentAllFunctions(),llvm::AMDGPULegalizerInfo::legalizeAddrSpaceCast(),llvm::AMDGPULegalizerInfo::legalizeDebugTrap(),llvm::AMDGPULegalizerInfo::legalizeGlobalValue(),llvm::RISCVTargetLowering::LowerCall(),llvm::AMDGPUTargetLowering::LowerDYNAMIC_STACKALLOC(),llvm::NVPTXTargetLowering::LowerDYNAMIC_STACKALLOC(),llvm::SITargetLowering::LowerFormalArguments(),llvm::AMDGPUTargetLowering::LowerGlobalAddress(),llvm::RISCVTargetLowering::LowerReturn(),llvm::NVPTXTargetLowering::LowerSTACKRESTORE(),llvm::NVPTXTargetLowering::LowerSTACKSAVE(),llvm::AMDGPUTargetLowering::lowerUnhandledCall(),llvm::sampleprof::SampleProfileReaderText::readImpl(),llvm::MIRParserImpl::reportDiagnostic(),llvm::sampleprof::SampleProfileReader::reportError(),llvm::KCFIPass::run(),llvm::MachineModuleAnalysis::run(),llvm::SelectionDAGISel::runOnMachineFunction(),selectExplicitSectionGlobal(), andverifyLoadedModule().

◆ disableDebugTypeODRUniquing()

void LLVMContext::disableDebugTypeODRUniquing()

Definition at line343 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::DITypeMap, andpImpl.

◆ emitError()[1/2]

void LLVMContext::emitError(constInstructionI,
constTwineErrorStr 
)

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 line210 of fileLLVMContext.cpp.

Referencesassert(),diagnose(), andI.

Referenced bycheckIntrinsicImmArg(),llvm::LTOModule::createFromFile(),llvm::LTOModule::createFromOpenFileSlice(),diagnosePossiblyInvalidConstraint(),emitErrorAndReplaceIntrinsicResults(),emitErrorMsg(),emitIntrinsicErrorMessage(),emitIntrinsicWithChainErrorMessage(),llvm::errorToErrorCodeAndEmitErrors(),getBBAddrMapFeature(),llvm::AMDGPU::getIntegerPairAttribute(),llvm::AMDGPU::getIntegerVecAttribute(),llvm::getTensorSpecFromJSON(),INITIALIZE_PASS(),llvm::InteractiveModelRunner::InteractiveModelRunner(),legalizeIntrinsicImmArg(),lowerVectorBitClearImm(),lowerVectorBitRevImm(),lowerVectorBitSetImm(),lowerVectorSplatImm(),parseBitcodeFileImpl(),llvm::LoongArchTargetLowering::ReplaceNodeResults(),llvm::ReplayInlineAdvisor::ReplayInlineAdvisor(),llvm::RAGreedy::selectOrSplit(), andllvm::TargetLowering::verifyReturnAddressArgumentIsConstant().

◆ emitError()[2/2]

void LLVMContext::emitError(constTwineErrorStr)

Definition at line206 of fileLLVMContext.cpp.

Referencesdiagnose().

◆ enableDebugTypeODRUniquing()

void LLVMContext::enableDebugTypeODRUniquing()

Definition at line336 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::DITypeMap, andpImpl.

Referenced byllvm::LTOCodeGenerator::LTOCodeGenerator(),llvm::lto::LTOLLVMContext::LTOLLVMContext(), andllvm::ThinLTOCodeGenerator::run().

◆ generateMachineFunctionNum()

unsigned LLVMContext::generateMachineFunctionNum(FunctionF)

generateMachineFunctionNum - Get a unique number forMachineFunction that associated with the givenFunction.

Definition at line109 of fileLLVMContext.cpp.

Referencesassert(),llvm::SmallPtrSetImpl< PtrType >::contains(),F,llvm::LLVMContextImpl::MachineFunctionNums,llvm::LLVMContextImpl::OwnedModules, andpImpl.

◆ getDefaultTargetCPU()

StringRef LLVMContext::getDefaultTargetCPU()

Get or set the current "default" target CPU (target-cpu function attribute).

The intent is that compiler frontends will set this to a value that reflects the attribute that a function would get "by default" without any specific function attributes, and compiler passes will attach the attribute to newly created functions that are not associated with a particular function, such as global initializers.Function::createWithDefaultAttr() will create functions with this attribute. This function should only be called by passes that run at compile time and not by the backend or LTO passes.

Definition at line365 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::DefaultTargetCPU, andpImpl.

◆ getDefaultTargetFeatures()

StringRef LLVMContext::getDefaultTargetFeatures()

Similar to {get,set}DefaultTargetCPU() but for default target-features.

Definition at line373 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::DefaultTargetFeatures, andpImpl.

◆ getDiagHandlerPtr()

constDiagnosticHandler * LLVMContext::getDiagHandlerPtr() const

getDiagHandlerPtr - Returns const raw pointer ofDiagnosticHandler set by setDiagnosticHandler.

Definition at line357 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::DiagHandler, andpImpl.

Referenced byllvm::OptimizationRemarkEmitter::allowExtraAnalysis(),llvm::MachineOptimizationRemarkEmitter::allowExtraAnalysis(),llvm::MachineOptimizationRemarkEmitter::emit(),llvm::OptimizationRemarkEmitter::enabled(),llvm::MachineOptimizationRemark::isEnabled(),llvm::MachineOptimizationRemarkMissed::isEnabled(),llvm::MachineOptimizationRemarkAnalysis::isEnabled(),llvm::OptimizationRemark::isEnabled(),llvm::OptimizationRemarkMissed::isEnabled(), andllvm::OptimizationRemarkAnalysis::isEnabled().

◆ getDiagnosticContext()

void * LLVMContext::getDiagnosticContext() const

getDiagnosticContext - Return the diagnostic context set by setDiagnosticContext.

Definition at line191 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::DiagHandler, andpImpl.

◆ getDiagnosticHandler()

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

getDiagnosticHandler - transfers ownership ofDiagnosticHandler unique_ptr to caller.

Definition at line361 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::DiagHandler, andpImpl.

◆ getDiagnosticHandlerCallBack()

DiagnosticHandler::DiagnosticHandlerTy LLVMContext::getDiagnosticHandlerCallBack() const

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

Definition at line187 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::DiagHandler, andpImpl.

◆ getDiagnosticMessagePrefix()

constchar * LLVMContext::getDiagnosticMessagePrefix(DiagnosticSeverity Severity)
static

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

Definition at line231 of fileLLVMContext.cpp.

Referencesllvm::DS_Error,llvm::DS_Note,llvm::DS_Remark,llvm::DS_Warning, andllvm_unreachable.

Referenced bydiagnose().

◆ getDiagnosticsHotnessRequested()

bool LLVMContext::getDiagnosticsHotnessRequested() const

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

Definition at line136 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::DiagnosticsHotnessRequested, andpImpl.

Referenced byllvm::MachineOptimizationRemarkEmitterAnalysis::run(), andllvm::MachineOptimizationRemarkEmitterPass::runOnMachineFunction().

◆ getDiagnosticsHotnessThreshold()

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 line149 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::DiagnosticsHotnessThreshold,pImpl, andUINT64_MAX.

Referenced byllvm::OptimizationRemarkEmitter::emit(), andllvm::MachineOptimizationRemarkEmitter::emit().

◆ getDiagnosticsMisExpectTolerance()

uint32_t LLVMContext::getDiagnosticsMisExpectTolerance() const

Definition at line156 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::DiagnosticsMisExpectTolerance, andpImpl.

◆ getGC()

const std::string & LLVMContext::getGC(constFunctionFn)

Return the GC for a function.

Definition at line322 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::GCNames, andpImpl.

◆ getLLVMRemarkStreamer()[1/2]

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 line175 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::LLVMRS, andpImpl.

Referenced byllvm::OptimizationRemarkEmitter::allowExtraAnalysis(),llvm::MachineOptimizationRemarkEmitter::allowExtraAnalysis(),diagnose(),llvm::MachineOptimizationRemarkEmitter::emit(),llvm::OptimizationRemarkEmitter::enabled(), andgetLLVMRemarkStreamer().

◆ getLLVMRemarkStreamer()[2/2]

constLLVMRemarkStreamer * LLVMContext::getLLVMRemarkStreamer() const

Definition at line178 of fileLLVMContext.cpp.

ReferencesgetLLVMRemarkStreamer().

◆ getMainRemarkStreamer()[1/2]

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 theLLVMContext. This metadata may be emitted in a section in object files depending on the format requirements.

All specialized remark streamers should convert remarks tollvm::remarks::Remark and emit them through this streamer.

Definition at line164 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::MainRemarkStreamer, andpImpl.

Referenced bygetMainRemarkStreamer(), andllvm::setupLLVMOptimizationRemarks().

◆ getMainRemarkStreamer()[2/2]

constremarks::RemarkStreamer * LLVMContext::getMainRemarkStreamer() const

Definition at line167 of fileLLVMContext.cpp.

ReferencesgetMainRemarkStreamer().

◆ 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 currentLLVMContext.

Definition at line276 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::CustomMDKindNames,llvm::StringMap< ValueTy, AllocatorTy >::insert(),Name,pImpl, andllvm::StringMapImpl::size().

Referenced bycopyMetadataForAtomic(),llvm::Value::getMetadata(), andLLVMContext().

◆ getMDKindNames()

void LLVMContext::getMDKindNames(SmallVectorImpl<StringRef > & Result) const

getMDKindNames - Populate client suppliedSmallVector with the name for custom metadata IDs registered in thisLLVMContext.

getHandlerNames - Populate client-supplied smallvector using custom metadata name and ID.

Definition at line286 of fileLLVMContext.cpp.

Referencesllvm::StringMap< ValueTy, AllocatorTy >::begin(),llvm::LLVMContextImpl::CustomMDKindNames,llvm::StringMap< ValueTy, AllocatorTy >::end(),I,pImpl,llvm::SmallVectorImpl< T >::resize(), andllvm::StringMapImpl::size().

◆ getMisExpectWarningRequested()

bool LLVMContext::getMisExpectWarningRequested() const

Definition at line146 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::MisExpectWarningRequested, andpImpl.

◆ getOperandBundleTagID()

uint32_t LLVMContext::getOperandBundleTagID(StringRef Tag) const

getOperandBundleTagID - Maps a bundle tag to an integer ID.

Every bundle tag registered with anLLVMContext has an unique ID.

Definition at line302 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::getOperandBundleTagID(),pImpl, andllvm::Tag.

◆ getOperandBundleTags()

void LLVMContext::getOperandBundleTags(SmallVectorImpl<StringRef > & Result) const

getOperandBundleTags - Populate client suppliedSmallVector with the bundle tags registered in thisLLVMContext.

The bundle tags are ordered by increasing bundle IDs.

See also
LLVMContext::getOperandBundleTagID

Definition at line293 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::getOperandBundleTags(), andpImpl.

◆ getOptPassGate()

OptPassGate & LLVMContext::getOptPassGate() const

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

Definition at line349 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::getOptPassGate(), andpImpl.

Referenced byllvm::OptPassGateInstrumentation::registerCallbacks(), andllvm::OptPassGateInstrumentation::shouldRun().

◆ getOrInsertBundleTag()

StringMapEntry<uint32_t > * LLVMContext::getOrInsertBundleTag(StringRef TagName) const

getOrInsertBundleTag - Returns the Tag to use for an operand bundle of name TagName.

Definition at line298 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::getOrInsertBundleTag(), andpImpl.

◆ getOrInsertSyncScopeID()

SyncScope::ID LLVMContext::getOrInsertSyncScopeID(StringRef SSN)

getOrInsertSyncScopeID - Maps synchronization scope name to synchronization scope ID.

Every synchronization scope registered withLLVMContext has unique ID except pre-defined ones.

Definition at line306 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::getOrInsertSyncScopeID(), andpImpl.

Referenced byllvm::AMDGPUMachineModuleInfo::AMDGPUMachineModuleInfo(),llvm::getMemScope(),llvm::SITargetLowering::shouldExpandAtomicRMWInIR(), andupgradeAMDGCNIntrinsicCall().

◆ getSyncScopeName()

std::optional<StringRef > LLVMContext::getSyncScopeName(SyncScope::ID Id) const

getSyncScopeName - Returns the name of aSyncScope::ID registered withLLVMContext, if any.

Definition at line314 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::getSyncScopeName(), andpImpl.

Referenced byemitAtomicRMWLegalRemark().

◆ getSyncScopeNames()

void LLVMContext::getSyncScopeNames(SmallVectorImpl<StringRef > & SSNs) const

getSyncScopeNames - Populates client suppliedSmallVector with synchronization scope names registered withLLVMContext.

Synchronization scope names are ordered by increasing synchronization scope IDs.

Definition at line310 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::getSyncScopeNames(), andpImpl.

Referenced byprintSyncScope().

◆ isDiagnosticsHotnessThresholdSetFromPSI()

bool LLVMContext::isDiagnosticsHotnessThresholdSetFromPSI() const

Return if hotness threshold is requested from PSI.

Definition at line160 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::DiagnosticsHotnessThreshold, andpImpl.

◆ isODRUniquingDebugTypes()

bool LLVMContext::isODRUniquingDebugTypes() const

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

Off by default.

Definition at line334 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::DITypeMap, andpImpl.

Referenced byllvm::DICompositeType::buildODRType(), andllvm::DICompositeType::getODRTypeIfExists().

◆ operator=()

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

◆ setDefaultTargetCPU()

void LLVMContext::setDefaultTargetCPU(StringRef CPU)

Definition at line369 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::DefaultTargetCPU, andpImpl.

◆ setDefaultTargetFeatures()

void LLVMContext::setDefaultTargetFeatures(StringRef Features)

Definition at line377 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::DefaultTargetFeatures, andpImpl.

◆ setDiagnosticHandler()

void LLVMContext::setDiagnosticHandler(std::unique_ptr<DiagnosticHandler > && DH,
bool RespectFilters =false 
)

setDiagnosticHandler - This method sets unique_ptr to object ofDiagnosticHandler to provide custom diagnostic handling.

The first argument is unique_ptr of object of typeDiagnosticHandler 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 toLLVMContextImpl.

Definition at line127 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::DiagHandler,pImpl, andllvm::LLVMContextImpl::RespectDiagnosticFilters.

Referenced byllvm::lto::LTOLLVMContext::LTOLLVMContext(), andllvm::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 line119 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::DiagHandler,pImpl, andllvm::LLVMContextImpl::RespectDiagnosticFilters.

◆ setDiagnosticsHotnessRequested()

void LLVMContext::setDiagnosticsHotnessRequested(bool Requested)

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

Definition at line133 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::DiagnosticsHotnessRequested, andpImpl.

Referenced byllvm::setupLLVMOptimizationRemarks().

◆ setDiagnosticsHotnessThreshold()

void LLVMContext::setDiagnosticsHotnessThreshold(std::optional<uint64_tThreshold)

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

Definition at line140 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::DiagnosticsHotnessThreshold, andpImpl.

Referenced byllvm::setupLLVMOptimizationRemarks().

◆ setDiagnosticsMisExpectTolerance()

void LLVMContext::setDiagnosticsMisExpectTolerance(std::optional<uint32_tTolerance)

Definition at line152 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::DiagnosticsMisExpectTolerance, andpImpl.

◆ setDiscardValueNames()

void LLVMContext::setDiscardValueNames(bool Discard)

Set the Context runtime configuration to discard all value name (butGlobalValue).

Clients can use this flag to save memory and runtime, especially in release mode.

Definition at line345 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::DiscardValueNames, andpImpl.

Referenced byllvm::LTOCodeGenerator::LTOCodeGenerator(),llvm::lto::LTOLLVMContext::LTOLLVMContext(),llvm::LTOCodeGenerator::optimize(), andllvm::ThinLTOCodeGenerator::run().

◆ setGC()

void LLVMContext::setGC(constFunctionFn,
std::string GCName 
)

Define the GC for a function.

Definition at line318 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::GCNames, andpImpl.

◆ setLLVMRemarkStreamer()

void LLVMContext::setLLVMRemarkStreamer(std::unique_ptr<LLVMRemarkStreamerRemarkStreamer)

Definition at line181 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::LLVMRS, andpImpl.

Referenced byllvm::setupLLVMOptimizationRemarks().

◆ setMainRemarkStreamer()

void LLVMContext::setMainRemarkStreamer(std::unique_ptr<remarks::RemarkStreamerMainRemarkStreamer)

Definition at line170 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::MainRemarkStreamer, andpImpl.

Referenced byllvm::setupLLVMOptimizationRemarks().

◆ setMisExpectWarningRequested()

void LLVMContext::setMisExpectWarningRequested(bool Requested)

Definition at line143 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::MisExpectWarningRequested, andpImpl.

◆ setOptPassGate()

void LLVMContext::setOptPassGate(OptPassGateOPG)

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 theLLVMContext is used by compilation.

Definition at line353 of fileLLVMContext.cpp.

ReferencespImpl, andllvm::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 line195 of fileLLVMContext.cpp.

ReferencespImpl,llvm::LLVMContextImpl::YieldCallback, andllvm::LLVMContextImpl::YieldOpaqueHandle.

◆ shouldDiscardValueNames()

bool LLVMContext::shouldDiscardValueNames() const

Return true if the Context runtime configuration is set to discard all value names.

When true, onlyGlobalValue names will be available in the IR.

Definition at line330 of fileLLVMContext.cpp.

Referencesllvm::LLVMContextImpl::DiscardValueNames, andpImpl.

Referenced byllvm::createMIRParser(), andllvm::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 line201 of fileLLVMContext.cpp.

ReferencespImpl,llvm::LLVMContextImpl::YieldCallback, andllvm::LLVMContextImpl::YieldOpaqueHandle.

Friends And Related Function Documentation

◆ Module

friend classModule
friend

Definition at line340 of fileLLVMContext.h.

Member Data Documentation

◆ pImpl

LLVMContextImpl*const llvm::LLVMContext::pImpl

Definition at line69 of fileLLVMContext.h.

Referenced byllvm::Value::addMetadata(),llvm::DICompositeType::buildODRType(),llvm::Value::clearMetadata(),deleteGC(),diagnose(),disableDebugTypeODRUniquing(),llvm::Module::dropTriviallyDeadConstantArrays(),enableDebugTypeODRUniquing(),llvm::Value::eraseMetadata(),llvm::Value::eraseMetadataIf(),generateMachineFunctionNum(),llvm::ConstantVector::get(),llvm::ConstantArray::get(),llvm::InlineAsm::get(),llvm::DSOLocalEquivalent::get(),llvm::NoCFIValue::get(),llvm::ConstantTokenNone::get(),llvm::DIArgList::get(),llvm::Attribute::get(),llvm::ConstantFP::get(),llvm::ConstantInt::get(),llvm::MetadataAsValue::get(),llvm::ConstantPointerNull::get(),llvm::ConstantTargetNone::get(),llvm::TypedPointerType::get(),llvm::UndefValue::get(),llvm::PoisonValue::get(),llvm::ConstantAggregateZero::get(),llvm::ConstantExpr::get(),llvm::ValueAsMetadata::get(),llvm::Instruction::getAAMetadata(),llvm::Value::getAllMetadata(),llvm::at::getAssignmentInsts(),getDefaultTargetCPU(),getDefaultTargetFeatures(),getDiagHandlerPtr(),getDiagnosticContext(),getDiagnosticHandler(),getDiagnosticHandlerCallBack(),getDiagnosticsHotnessRequested(),getDiagnosticsHotnessThreshold(),getDiagnosticsMisExpectTolerance(),llvm::ConstantExpr::getExtractElement(),llvm::ConstantInt::getFalse(),getFoldedCast(),getGC(),llvm::MetadataAsValue::getIfExists(),llvm::ConstantDataSequential::getImpl(),llvm::ConstantExpr::getInsertElement(),getLLVMRemarkStreamer(),getMainRemarkStreamer(),getMDKindID(),getMDKindNames(),llvm::Value::getMetadata(),llvm::Value::getMetadataImpl(),getMisExpectWarningRequested(),llvm::DICompositeType::getODRTypeIfExists(),getOperandBundleTagID(),getOperandBundleTags(),getOptPassGate(),getOrInsertBundleTag(),getOrInsertSyncScopeID(),llvm::GlobalValue::getPartition(),llvm::GlobalValue::getSanitizerMetadata(),llvm::ConstantExpr::getShuffleVector(),getSyncScopeName(),getSyncScopeNames(),llvm::ConstantInt::getTrue(),llvm::DIArgList::handleChangedOperand(),llvm::ValueAsMetadata::handleRAUW(),isDiagnosticsHotnessThresholdSetFromPSI(),isODRUniquingDebugTypes(),LLVMContext(),llvm::CallBase::populateBundleOperandInfos(),llvm::GlobalValue::removeSanitizerMetadata(),llvm::ReplaceableMetadataImpl::SalvageDebugInfo(),setDefaultTargetCPU(),setDefaultTargetFeatures(),setDiagnosticHandler(),setDiagnosticHandlerCallBack(),setDiagnosticsHotnessRequested(),setDiagnosticsHotnessThreshold(),setDiagnosticsMisExpectTolerance(),setDiscardValueNames(),setGC(),setLLVMRemarkStreamer(),setMainRemarkStreamer(),llvm::Value::setMetadata(),setMisExpectWarningRequested(),setOptPassGate(),llvm::GlobalValue::setPartition(),llvm::GlobalValue::setSanitizerMetadata(),llvm::GlobalObject::setSection(),setYieldCallback(),shouldDiscardValueNames(),llvm::MDNode::storeDistinctInContext(),yield(),~LLVMContext(), andllvm::MetadataAsValue::~MetadataAsValue().


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

Generated on Sun Jul 20 2025 19:09:35 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp