LLVM API Documentation

Public Types | Public Member Functions | Public Attributes | Friends
llvm::LLVMContext Class Reference

#include <LLVMContext.h>

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

List of all members.

Public Types

enum  {
  MD_dbg = 0, MD_tbaa = 1, MD_prof = 2, MD_fpmath = 3,
  MD_range = 4, MD_tbaa_struct = 5, MD_invariant_load = 6
}
typedef void(* InlineAsmDiagHandlerTy )(const SMDiagnostic &, void *Context, unsigned LocCookie)
typedef void(* DiagnosticHandlerTy )(const DiagnosticInfo &DI, void *Context)

Public Member Functions

 LLVMContext ()
 ~LLVMContext ()
unsigned getMDKindID (StringRef Name) const
 getMDKindID - Return a unique non-zero ID for the specified metadata kind.
void getMDKindNames (SmallVectorImpl< StringRef > &Result) const
void setInlineAsmDiagnosticHandler (InlineAsmDiagHandlerTy DiagHandler, void *DiagContext=nullptr)
InlineAsmDiagHandlerTy getInlineAsmDiagnosticHandler () const
void * getInlineAsmDiagnosticContext () const
void setDiagnosticHandler (DiagnosticHandlerTy DiagHandler, void *DiagContext=nullptr)
DiagnosticHandlerTy getDiagnosticHandler () const
void * getDiagnosticContext () const
void diagnose (const DiagnosticInfo &DI)
void emitError (unsigned LocCookie, const Twine &ErrorStr)
void emitError (const Instruction *I, const Twine &ErrorStr)
void emitError (const Twine &ErrorStr)
void emitOptimizationRemark (const char *PassName, const Function &Fn, const DebugLoc &DLoc, const Twine &Msg)

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 40 of file LLVMContext.h.


Member Typedef Documentation

typedef void(* llvm::LLVMContext::DiagnosticHandlerTy)(const DiagnosticInfo &DI, void *Context)

Defines the type of a diagnostic handler.

See also:
LLVMContext::setDiagnosticHandler.
LLVMContext::diagnose.

Definition at line 73 of file LLVMContext.h.

typedef void(* llvm::LLVMContext::InlineAsmDiagHandlerTy)(const SMDiagnostic &, void *Context, unsigned LocCookie)

Definition at line 67 of file LLVMContext.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
MD_dbg 
MD_tbaa 
MD_prof 
MD_fpmath 
MD_range 
MD_tbaa_struct 
MD_invariant_load 

Definition at line 48 of file LLVMContext.h.


Constructor & Destructor Documentation

Definition at line 70 of file LLVMContext.cpp.

References pImpl.


Member Function Documentation

diagnose - Report a message to the currently installed diagnostic handler. This function returns, in particular in the case of error reporting (DI.Severity == RS_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 RS_Error, "warning: " for RS_Warning, and "note: " for RS_Note.

Definition at line 127 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::DiagnosticContext, llvm::LLVMContextImpl::DiagnosticHandler, llvm::DK_OptimizationRemark, llvm::DS_Error, llvm::DS_Note, llvm::DS_Remark, llvm::DS_Warning, llvm::errs(), llvm::raw_ostream::flush(), llvm::DiagnosticInfo::getKind(), llvm::DiagnosticInfo::getSeverity(), llvm::LLVMContextImpl::optimizationRemarksEnabledFor(), pImpl, and llvm::DiagnosticInfo::print().

Referenced by emitError(), emitOptimizationRemark(), llvm::PEI::runOnMachineFunction(), and llvm::UpgradeDebugInfo().

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

References diagnose().

Referenced by diagnosePossiblyInvalidConstraint(), EmitGCCInlineAsmStr(), EmitMSInlineAsmStr(), and llvm::TargetLowering::verifyReturnAddressArgumentIsConstant().

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

Definition at line 122 of file LLVMContext.cpp.

References diagnose().

void LLVMContext::emitError ( const Twine ErrorStr)

Definition at line 118 of file LLVMContext.cpp.

References diagnose().

void LLVMContext::emitOptimizationRemark ( const char *  PassName,
const Function Fn,
const DebugLoc DLoc,
const Twine Msg 
)

emitOptimizationRemark - Emit an optimization remark message. PassName is the name of the pass emitting the message. If -Rpass= is given and PassName matches the regular expression in -Rpass, then the remark will be emitted. Fn is the function triggering the remark, DLoc is the debug location where the diagnostic is generated. Msg is the message string to use.

Definition at line 169 of file LLVMContext.cpp.

References diagnose().

Referenced by llvm::Inliner::runOnSCC().

getDiagnosticContext - Return the diagnostic context set by setDiagnosticContext.

Definition at line 114 of file LLVMContext.cpp.

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

getDiagnosticHandler - Return the diagnostic handler set by setDiagnosticHandler.

Definition at line 110 of file LLVMContext.cpp.

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

getInlineAsmDiagnosticContext - Return the diagnostic context set by setInlineAsmDiagnosticHandler.

Definition at line 100 of file LLVMContext.cpp.

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

getInlineAsmDiagnosticHandler - Return the diagnostic handler set by setInlineAsmDiagnosticHandler.

Definition at line 94 of file LLVMContext.cpp.

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

getMDKindID - Return a unique non-zero ID for the specified metadata kind.

getMDKindID - Return a unique non-zero ID for the specified metadata kind. This ID is uniqued across modules in the current LLVMContext.

Definition at line 200 of file LLVMContext.cpp.

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

Referenced by llvm::Module::getMDKindID(), LLVMContext(), and LLVMGetMDKindIDInContext().

getMDKindNames - Populate client supplied SmallVector with the name for custom metadata IDs registered in this LLVMContext.

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

Definition at line 211 of file LLVMContext.cpp.

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

Referenced by llvm::Module::getMDKindNames(), and llvm::AssemblyWriter::printInstruction().

void LLVMContext::setDiagnosticHandler ( DiagnosticHandlerTy  DiagHandler,
void *  DiagContext = nullptr 
)

setDiagnosticHandler - This method sets a handler 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.

LLVMContext doesn't take ownership or interpret either of these pointers.

Definition at line 104 of file LLVMContext.cpp.

References llvm::LLVMContextImpl::DiagnosticContext, llvm::LLVMContextImpl::DiagnosticHandler, and pImpl.

Referenced by LLVMContextSetDiagnosticHandler().

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

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


Friends And Related Function Documentation

friend class Module [friend]

Definition at line 151 of file LLVMContext.h.


Member Data Documentation

Definition at line 42 of file LLVMContext.h.

Referenced by clearGarbage(), llvm::DILocation::computeNewDiscriminator(), llvm::StructType::create(), llvm::MDNode::deleteTemporary(), llvm::ConstantAggregateZero::destroyConstant(), llvm::ConstantArray::destroyConstant(), llvm::ConstantStruct::destroyConstant(), llvm::ConstantVector::destroyConstant(), llvm::ConstantPointerNull::destroyConstant(), llvm::ConstantDataSequential::destroyConstant(), llvm::BlockAddress::destroyConstant(), llvm::ConstantExpr::destroyConstant(), llvm::UndefValue::destroyConstant(), diagnose(), llvm::Instruction::dropUnknownMetadata(), llvm::MDString::get(), llvm::IntegerType::get(), llvm::DebugLoc::get(), llvm::InlineAsm::get(), llvm::ConstantInt::get(), llvm::FunctionType::get(), llvm::Attribute::get(), llvm::AttributeSetNode::get(), llvm::StructType::get(), llvm::ConstantFP::get(), llvm::ConstantAggregateZero::get(), llvm::ArrayType::get(), llvm::ConstantArray::get(), llvm::VectorType::get(), llvm::ConstantStruct::get(), llvm::PointerType::get(), llvm::ConstantPointerNull::get(), llvm::BlockAddress::get(), llvm::ConstantExpr::get(), llvm::UndefValue::get(), getDiagnosticContext(), getDiagnosticHandler(), llvm::Type::getDoubleTy(), llvm::ConstantExpr::getExtractElement(), llvm::ConstantExpr::getExtractValue(), llvm::ConstantInt::getFalse(), llvm::ConstantExpr::getFCmp(), llvm::Type::getFloatTy(), getFoldedCast(), llvm::Type::getFP128Ty(), llvm::ConstantExpr::getGetElementPtr(), llvm::Type::getHalfTy(), llvm::ConstantExpr::getICmp(), llvm::ConstantDataSequential::getImpl(), getInlineAsmDiagnosticContext(), getInlineAsmDiagnosticHandler(), llvm::DebugLoc::getInlinedAt(), llvm::ConstantExpr::getInsertElement(), llvm::ConstantExpr::getInsertValue(), llvm::Type::getInt16Ty(), llvm::Type::getInt1Ty(), llvm::Type::getInt32Ty(), llvm::Type::getInt64Ty(), llvm::Type::getInt8Ty(), llvm::Function::getIntrinsicID(), llvm::Type::getLabelTy(), getMDKindID(), getMDKindNames(), llvm::Type::getMetadataTy(), llvm::Type::getPPC_FP128Ty(), llvm::Function::getPrefixData(), llvm::DebugLoc::getScope(), llvm::DebugLoc::getScopeAndInlinedAt(), llvm::ConstantExpr::getSelect(), llvm::ConstantExpr::getShuffleVector(), llvm::ConstantInt::getTrue(), llvm::Module::getTypeByName(), llvm::Type::getVoidTy(), llvm::Type::getX86_FP80Ty(), llvm::Type::getX86_MMXTy(), llvm::BlockAddress::lookup(), llvm::ConstantArray::replaceUsesOfWithOnConstant(), llvm::ConstantStruct::replaceUsesOfWithOnConstant(), llvm::BlockAddress::replaceUsesOfWithOnConstant(), llvm::StructType::setBody(), setDiagnosticHandler(), setInlineAsmDiagnosticHandler(), llvm::Instruction::setMetadata(), llvm::Value::setName(), llvm::StructType::setName(), llvm::Function::setPrefixData(), llvm::ValueHandleBase::ValueIsDeleted(), llvm::ValueHandleBase::ValueIsRAUWd(), llvm::Function::~Function(), and ~LLVMContext().


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