LLVM  mainline
Modules | Typedefs | Functions
LLVM-C: C interface to LLVM

This modules provide an interface to libLLVMCore, which implements the LLVM intermediate representation as well as other related types and utilities. More...

Collaboration diagram for Core:


 Types and Enumerations

Contexts are execution states for the core LLVM IR system.


Modules represent the top-level structure in an LLVM program.


Types represent the type of a value.


The bulk of LLVM's object model consists of values, which comprise a very rich type hierarchy.

 Basic Block

A basic block represents a single entry single exit section of code.


Functions in this group relate to the inspection and manipulation of individual instructions.


typedef void(* LLVMFatalErrorHandler )(const char *Reason)


void LLVMInitializeCore (LLVMPassRegistryRef R)
void LLVMShutdown (void)
 Deallocate and destroy all ManagedStatic variables.
char * LLVMCreateMessage (const char *Message)
void LLVMDisposeMessage (char *Message)
void LLVMInstallFatalErrorHandler (LLVMFatalErrorHandler Handler)
 Install a fatal error handler.
void LLVMResetFatalErrorHandler (void)
 Reset the fatal error handler.
void LLVMEnablePrettyStackTrace (void)
 Enable LLVM's built-in stack trace code.

Detailed Description

This modules provide an interface to libLLVMCore, which implements the LLVM intermediate representation as well as other related types and utilities.

LLVM uses a polymorphic type hierarchy which C cannot represent, therefore parameters must be passed as base types. Despite the declared types, most of the functions provided operate only on branches of the type hierarchy. The declared parameter names are descriptive and specify which type is required. Additionally, each type hierarchy is documented along with the functions that operate upon it. For more detail, refer to LLVM's C++ code. If in doubt, refer to Core.cpp, which performs parameter downcasts in the form unwrap<RequiredType>(Param).

Many exotic languages can interoperate with C code but have a harder time with C++ due to name mangling. So in addition to C, this interface enables tools written in such languages.

Typedef Documentation

typedef void(* LLVMFatalErrorHandler)(const char *Reason)

Definition at line 443 of file Core.h.

Function Documentation

char* LLVMCreateMessage ( const char *  Message)

Definition at line 65 of file Core.cpp.

Referenced by LLVMGetDiagInfoDescription().

void LLVMDisposeMessage ( char *  Message)

Definition at line 69 of file Core.cpp.

void LLVMEnablePrettyStackTrace ( void  )

Enable LLVM's built-in stack trace code.

This intercepts the OS's crash signals and prints which component of LLVM you were in at the time if the crash.

Definition at line 171 of file PrettyStackTrace.cpp.

References llvm::EnablePrettyStackTrace().

Definition at line 55 of file Core.cpp.

Install a fatal error handler.

By default, if LLVM detects a fatal error, it will call exit(1). This may not be appropriate in many contexts. For example, doing exit(1) will bypass many crash reporting/tracing system tools. This function allows you to install a callback that will be invoked prior to the call to exit(1).

Definition at line 132 of file ErrorHandling.cpp.

References bindingsErrorHandler(), llvm::install_fatal_error_handler(), and LLVM_EXTENSION.

void LLVMResetFatalErrorHandler ( void  )

Reset the fatal error handler.

This resets LLVM's fatal error handling behavior to the default.

Definition at line 137 of file ErrorHandling.cpp.

References llvm::remove_fatal_error_handler().

void LLVMShutdown ( void  )

Deallocate and destroy all ManagedStatic variables.

See also:

Definition at line 59 of file Core.cpp.

References llvm::llvm_shutdown().