LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Public Attributes | Friends | List of all members
llvm::LLVMContext Class Reference

#include <LLVMContext.h>

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

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)
 

Public Member Functions

 LLVMContext ()
 
 ~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
 
void setInlineAsmDiagnosticHandler (InlineAsmDiagHandlerTy DiagHandler, void *DiagContext=0)
 
InlineAsmDiagHandlerTy getInlineAsmDiagnosticHandler () const
 
void * getInlineAsmDiagnosticContext () const
 
void emitError (unsigned LocCookie, const Twine &ErrorStr)
 
void emitError (const Instruction *I, const Twine &ErrorStr)
 
void emitError (const Twine &ErrorStr)
 

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

Member Typedef Documentation

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

Definition at line 64 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 45 of file LLVMContext.h.

Constructor & Destructor Documentation

LLVMContext::LLVMContext ( )
LLVMContext::~LLVMContext ( )

Definition at line 67 of file LLVMContext.cpp.

References pImpl.

Member Function Documentation

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

References llvm::SourceMgr::DK_Error, llvm::errs(), llvm::LLVMContextImpl::InlineAsmDiagContext, llvm::LLVMContextImpl::InlineAsmDiagHandler, pImpl, and llvm::Twine::str().

Referenced by emitError(), EmitGCCInlineAsmStr(), EmitMSInlineAsmStr(), getCopyFromPartsVector(), and getCopyToParts().

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

Definition at line 105 of file LLVMContext.cpp.

References emitError(), and llvm::Instruction::getMetadata().

void LLVMContext::emitError ( const Twine ErrorStr)

Definition at line 101 of file LLVMContext.cpp.

References emitError().

void * LLVMContext::getInlineAsmDiagnosticContext ( ) const

getInlineAsmDiagnosticContext - Return the diagnostic context set by setInlineAsmDiagnosticHandler.

Definition at line 97 of file LLVMContext.cpp.

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

LLVMContext::InlineAsmDiagHandlerTy LLVMContext::getInlineAsmDiagnosticHandler ( ) const

getInlineAsmDiagnosticHandler - Return the diagnostic handler set by setInlineAsmDiagnosticHandler.

Definition at line 91 of file LLVMContext.cpp.

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

unsigned LLVMContext::getMDKindID ( StringRef  Name) const

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 152 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().

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 custome metadata name and ID.

Definition at line 163 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::setInlineAsmDiagnosticHandler ( InlineAsmDiagHandlerTy  DiagHandler,
void *  DiagContext = 0 
)

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

Member Data Documentation

LLVMContextImpl* const llvm::LLVMContext::pImpl

Definition at line 39 of file LLVMContext.h.

Referenced by clearGarbage(), 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(), emitError(), 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(), 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::ConstantArray::replaceUsesOfWithOnConstant(), llvm::ConstantStruct::replaceUsesOfWithOnConstant(), llvm::BlockAddress::replaceUsesOfWithOnConstant(), llvm::StructType::setBody(), 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: