LLVM  10.0.0svn
Typedefs | Functions

Contexts are execution states for the core LLVM IR system. More...

Collaboration diagram for Contexts:

Typedefs

typedef void(* LLVMDiagnosticHandler) (LLVMDiagnosticInfoRef, void *)
 
typedef void(* LLVMYieldCallback) (LLVMContextRef, void *)
 

Functions

LLVMContextRef LLVMContextCreate (void)
 Create a new context. More...
 
LLVMContextRef LLVMGetGlobalContext (void)
 Obtain the global context instance. More...
 
void LLVMContextSetDiagnosticHandler (LLVMContextRef C, LLVMDiagnosticHandler Handler, void *DiagnosticContext)
 Set the diagnostic handler for this context. More...
 
LLVMDiagnosticHandler LLVMContextGetDiagnosticHandler (LLVMContextRef C)
 Get the diagnostic handler of this context. More...
 
void * LLVMContextGetDiagnosticContext (LLVMContextRef C)
 Get the diagnostic context of this context. More...
 
void LLVMContextSetYieldCallback (LLVMContextRef C, LLVMYieldCallback Callback, void *OpaqueHandle)
 Set the yield callback function for this context. More...
 
LLVMBool LLVMContextShouldDiscardValueNames (LLVMContextRef C)
 Retrieve whether the given context is set to discard all value names. More...
 
void LLVMContextSetDiscardValueNames (LLVMContextRef C, LLVMBool Discard)
 Set whether the given context discards all value names. More...
 
void LLVMContextDispose (LLVMContextRef C)
 Destroy a context instance. More...
 
charLLVMGetDiagInfoDescription (LLVMDiagnosticInfoRef DI)
 Return a string representation of the DiagnosticInfo. More...
 
LLVMDiagnosticSeverity LLVMGetDiagInfoSeverity (LLVMDiagnosticInfoRef DI)
 Return an enum LLVMDiagnosticSeverity. More...
 
unsigned LLVMGetMDKindIDInContext (LLVMContextRef C, const char *Name, unsigned SLen)
 
unsigned LLVMGetMDKindID (const char *Name, unsigned SLen)
 
unsigned LLVMGetEnumAttributeKindForName (const char *Name, size_t SLen)
 Return an unique id given the name of a enum attribute, or 0 if no attribute by that name exists. More...
 
unsigned LLVMGetLastEnumAttributeKind (void)
 
LLVMAttributeRef LLVMCreateEnumAttribute (LLVMContextRef C, unsigned KindID, uint64_t Val)
 Create an enum attribute. More...
 
unsigned LLVMGetEnumAttributeKind (LLVMAttributeRef A)
 Get the unique id corresponding to the enum attribute passed as argument. More...
 
uint64_t LLVMGetEnumAttributeValue (LLVMAttributeRef A)
 Get the enum attribute's value. More...
 
LLVMAttributeRef LLVMCreateStringAttribute (LLVMContextRef C, const char *K, unsigned KLength, const char *V, unsigned VLength)
 Create a string attribute. More...
 
const charLLVMGetStringAttributeKind (LLVMAttributeRef A, unsigned *Length)
 Get the string attribute's kind. More...
 
const charLLVMGetStringAttributeValue (LLVMAttributeRef A, unsigned *Length)
 Get the string attribute's value. More...
 
LLVMBool LLVMIsEnumAttribute (LLVMAttributeRef A)
 Check for the different types of attributes. More...
 
LLVMBool LLVMIsStringAttribute (LLVMAttributeRef A)
 

Detailed Description

Contexts are execution states for the core LLVM IR system.

Most types are tied to a context instance. Multiple contexts can exist simultaneously. A single context is not thread safe. However, different contexts can execute on different threads simultaneously.

Typedef Documentation

◆ LLVMDiagnosticHandler

typedef void(* LLVMDiagnosticHandler) (LLVMDiagnosticInfoRef, void *)

Definition at line 483 of file Core.h.

◆ LLVMYieldCallback

typedef void(* LLVMYieldCallback) (LLVMContextRef, void *)

Definition at line 484 of file Core.h.

Function Documentation

◆ LLVMContextCreate()

LLVMContextRef LLVMContextCreate ( void  )

Create a new context.

Every call to this function should be paired with a call to LLVMContextDispose() or the context will leak memory.

Definition at line 78 of file Core.cpp.

References llvm::wrap().

◆ LLVMContextDispose()

void LLVMContextDispose ( LLVMContextRef  C)

Destroy a context instance.

This should be called for every call to LLVMContextCreate() or memory will be leaked.

Definition at line 117 of file Core.cpp.

References llvm::unwrap().

◆ LLVMContextGetDiagnosticContext()

void* LLVMContextGetDiagnosticContext ( LLVMContextRef  C)

Get the diagnostic context of this context.

Definition at line 98 of file Core.cpp.

References llvm::unwrap().

◆ LLVMContextGetDiagnosticHandler()

LLVMDiagnosticHandler LLVMContextGetDiagnosticHandler ( LLVMContextRef  C)

Get the diagnostic handler of this context.

Definition at line 93 of file Core.cpp.

References LLVM_EXTENSION, and llvm::unwrap().

◆ LLVMContextSetDiagnosticHandler()

void LLVMContextSetDiagnosticHandler ( LLVMContextRef  C,
LLVMDiagnosticHandler  Handler,
void *  DiagnosticContext 
)

Set the diagnostic handler for this context.

Definition at line 84 of file Core.cpp.

References LLVM_EXTENSION, and llvm::unwrap().

◆ LLVMContextSetDiscardValueNames()

void LLVMContextSetDiscardValueNames ( LLVMContextRef  C,
LLVMBool  Discard 
)

Set whether the given context discards all value names.

If true, only the names of GlobalValue objects will be available in the IR. This can be used to save memory and runtime, especially in release mode.

See also
LLVMContext::setDiscardValueNames()

Definition at line 113 of file Core.cpp.

References llvm::unwrap().

◆ LLVMContextSetYieldCallback()

void LLVMContextSetYieldCallback ( LLVMContextRef  C,
LLVMYieldCallback  Callback,
void *  OpaqueHandle 
)

Set the yield callback function for this context.

See also
LLVMContext::setYieldCallback()

Definition at line 102 of file Core.cpp.

References LLVM_EXTENSION, and llvm::unwrap().

◆ LLVMContextShouldDiscardValueNames()

LLVMBool LLVMContextShouldDiscardValueNames ( LLVMContextRef  C)

Retrieve whether the given context is set to discard all value names.

See also
LLVMContext::shouldDiscardValueNames()

Definition at line 109 of file Core.cpp.

References llvm::unwrap().

◆ LLVMCreateEnumAttribute()

LLVMAttributeRef LLVMCreateEnumAttribute ( LLVMContextRef  C,
unsigned  KindID,
uint64_t  Val 
)

Create an enum attribute.

Definition at line 141 of file Core.cpp.

References llvm::Attribute::get(), llvm::unwrap(), and llvm::wrap().

◆ LLVMCreateStringAttribute()

LLVMAttributeRef LLVMCreateStringAttribute ( LLVMContextRef  C,
const char K,
unsigned  KLength,
const char V,
unsigned  VLength 
)

Create a string attribute.

Definition at line 157 of file Core.cpp.

References llvm::Attribute::get(), llvm::unwrap(), and llvm::wrap().

◆ LLVMGetDiagInfoDescription()

char* LLVMGetDiagInfoDescription ( LLVMDiagnosticInfoRef  DI)

Return a string representation of the DiagnosticInfo.

Use LLVMDisposeMessage to free the string.

See also
DiagnosticInfo::print()

Definition at line 187 of file Core.cpp.

References llvm::raw_ostream::flush(), LLVMCreateMessage(), and llvm::unwrap().

◆ LLVMGetDiagInfoSeverity()

LLVMDiagnosticSeverity LLVMGetDiagInfoSeverity ( LLVMDiagnosticInfoRef  DI)

Return an enum LLVMDiagnosticSeverity.

See also
DiagnosticInfo::getSeverity()

Definition at line 198 of file Core.cpp.

References llvm::DS_Note, llvm::DS_Remark, llvm::DS_Warning, LLVMDSError, LLVMDSNote, LLVMDSRemark, LLVMDSWarning, and llvm::unwrap().

◆ LLVMGetEnumAttributeKind()

unsigned LLVMGetEnumAttributeKind ( LLVMAttributeRef  A)

Get the unique id corresponding to the enum attribute passed as argument.

Definition at line 146 of file Core.cpp.

References llvm::Attribute::getKindAsEnum(), and llvm::unwrap().

◆ LLVMGetEnumAttributeKindForName()

unsigned LLVMGetEnumAttributeKindForName ( const char Name,
size_t  SLen 
)

Return an unique id given the name of a enum attribute, or 0 if no attribute by that name exists.

See http://llvm.org/docs/LangRef.html#parameter-attributes and http://llvm.org/docs/LangRef.html#function-attributes for the list of available attributes.

NB: Attribute names and/or id are subject to change without going through the C API deprecation cycle.

Definition at line 133 of file Core.cpp.

◆ LLVMGetEnumAttributeValue()

uint64_t LLVMGetEnumAttributeValue ( LLVMAttributeRef  A)

Get the enum attribute's value.

0 is returned if none exists.

Definition at line 150 of file Core.cpp.

References llvm::unwrap().

◆ LLVMGetGlobalContext()

LLVMContextRef LLVMGetGlobalContext ( void  )

Obtain the global context instance.

Definition at line 82 of file Core.cpp.

Referenced by LLVMGetBitcodeModule(), LLVMGetBitcodeModule2(), LLVMParseBitcode(), and LLVMParseBitcode2().

◆ LLVMGetLastEnumAttributeKind()

unsigned LLVMGetLastEnumAttributeKind ( void  )

Definition at line 137 of file Core.cpp.

◆ LLVMGetMDKindID()

unsigned LLVMGetMDKindID ( const char Name,
unsigned  SLen 
)

Definition at line 126 of file Core.cpp.

References LLVMGetGlobalContext(), and LLVMGetMDKindIDInContext().

◆ LLVMGetMDKindIDInContext()

unsigned LLVMGetMDKindIDInContext ( LLVMContextRef  C,
const char Name,
unsigned  SLen 
)

Definition at line 121 of file Core.cpp.

References llvm::unwrap().

Referenced by LLVMGetMDKindID().

◆ LLVMGetStringAttributeKind()

const char* LLVMGetStringAttributeKind ( LLVMAttributeRef  A,
unsigned Length 
)

Get the string attribute's kind.

Definition at line 164 of file Core.cpp.

References llvm::Attribute::getKindAsString(), and llvm::unwrap().

◆ LLVMGetStringAttributeValue()

const char* LLVMGetStringAttributeValue ( LLVMAttributeRef  A,
unsigned Length 
)

Get the string attribute's value.

Definition at line 171 of file Core.cpp.

References llvm::Attribute::getValueAsString(), and llvm::unwrap().

◆ LLVMIsEnumAttribute()

LLVMBool LLVMIsEnumAttribute ( LLVMAttributeRef  A)

Check for the different types of attributes.

Definition at line 178 of file Core.cpp.

References llvm::unwrap().

◆ LLVMIsStringAttribute()

LLVMBool LLVMIsStringAttribute ( LLVMAttributeRef  A)

Definition at line 183 of file Core.cpp.

References llvm::Attribute::isStringAttribute(), and llvm::unwrap().