|
@@ -15,7 +15,8 @@
|
|
#ifndef LLVM_C_CORE_H
|
|
#ifndef LLVM_C_CORE_H
|
|
#define LLVM_C_CORE_H
|
|
#define LLVM_C_CORE_H
|
|
|
|
|
|
-#include "llvm-c/Support.h"
|
|
|
|
|
|
+#include "llvm-c/ErrorHandling.h"
|
|
|
|
+#include "llvm-c/Types.h"
|
|
|
|
|
|
#ifdef __cplusplus
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
extern "C" {
|
|
@@ -40,15 +41,6 @@ extern "C" {
|
|
* the LLVM intermediate representation as well as other related types
|
|
* the LLVM intermediate representation as well as other related types
|
|
* and utilities.
|
|
* 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
|
|
* 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
|
|
* with C++ due to name mangling. So in addition to C, this interface enables
|
|
* tools written in such languages.
|
|
* tools written in such languages.
|
|
@@ -62,74 +54,6 @@ extern "C" {
|
|
* @{
|
|
* @{
|
|
*/
|
|
*/
|
|
|
|
|
|
-/* Opaque types. */
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * The top-level container for all LLVM global data. See the LLVMContext class.
|
|
|
|
- */
|
|
|
|
-typedef struct LLVMOpaqueContext *LLVMContextRef;
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * The top-level container for all other LLVM Intermediate Representation (IR)
|
|
|
|
- * objects.
|
|
|
|
- *
|
|
|
|
- * @see llvm::Module
|
|
|
|
- */
|
|
|
|
-typedef struct LLVMOpaqueModule *LLVMModuleRef;
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * Each value in the LLVM IR has a type, an LLVMTypeRef.
|
|
|
|
- *
|
|
|
|
- * @see llvm::Type
|
|
|
|
- */
|
|
|
|
-typedef struct LLVMOpaqueType *LLVMTypeRef;
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * Represents an individual value in LLVM IR.
|
|
|
|
- *
|
|
|
|
- * This models llvm::Value.
|
|
|
|
- */
|
|
|
|
-typedef struct LLVMOpaqueValue *LLVMValueRef;
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * Represents a basic block of instructions in LLVM IR.
|
|
|
|
- *
|
|
|
|
- * This models llvm::BasicBlock.
|
|
|
|
- */
|
|
|
|
-typedef struct LLVMOpaqueBasicBlock *LLVMBasicBlockRef;
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * Represents an LLVM basic block builder.
|
|
|
|
- *
|
|
|
|
- * This models llvm::IRBuilder.
|
|
|
|
- */
|
|
|
|
-typedef struct LLVMOpaqueBuilder *LLVMBuilderRef;
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * Interface used to provide a module to JIT or interpreter.
|
|
|
|
- * This is now just a synonym for llvm::Module, but we have to keep using the
|
|
|
|
- * different type to keep binary compatibility.
|
|
|
|
- */
|
|
|
|
-typedef struct LLVMOpaqueModuleProvider *LLVMModuleProviderRef;
|
|
|
|
-
|
|
|
|
-/** @see llvm::PassManagerBase */
|
|
|
|
-typedef struct LLVMOpaquePassManager *LLVMPassManagerRef;
|
|
|
|
-
|
|
|
|
-/** @see llvm::PassRegistry */
|
|
|
|
-typedef struct LLVMOpaquePassRegistry *LLVMPassRegistryRef;
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * Used to get the users and usees of a Value.
|
|
|
|
- *
|
|
|
|
- * @see llvm::Use */
|
|
|
|
-typedef struct LLVMOpaqueUse *LLVMUseRef;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * @see llvm::DiagnosticInfo
|
|
|
|
- */
|
|
|
|
-typedef struct LLVMOpaqueDiagnosticInfo *LLVMDiagnosticInfoRef;
|
|
|
|
-
|
|
|
|
typedef enum {
|
|
typedef enum {
|
|
LLVMZExtAttribute = 1<<0,
|
|
LLVMZExtAttribute = 1<<0,
|
|
LLVMSExtAttribute = 1<<1,
|
|
LLVMSExtAttribute = 1<<1,
|
|
@@ -438,30 +362,6 @@ void LLVMShutdown(void);
|
|
char *LLVMCreateMessage(const char *Message);
|
|
char *LLVMCreateMessage(const char *Message);
|
|
void LLVMDisposeMessage(char *Message);
|
|
void LLVMDisposeMessage(char *Message);
|
|
|
|
|
|
-typedef void (*LLVMFatalErrorHandler)(const char *Reason);
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * 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).
|
|
|
|
- */
|
|
|
|
-void LLVMInstallFatalErrorHandler(LLVMFatalErrorHandler Handler);
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * Reset the fatal error handler. This resets LLVM's fatal error handling
|
|
|
|
- * behavior to the default.
|
|
|
|
- */
|
|
|
|
-void LLVMResetFatalErrorHandler(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.
|
|
|
|
- */
|
|
|
|
-void LLVMEnablePrettyStackTrace(void);
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* @defgroup LLVMCCoreContext Contexts
|
|
* @defgroup LLVMCCoreContext Contexts
|
|
*
|
|
*
|
|
@@ -2438,7 +2338,7 @@ void LLVMInstructionEraseFromParent(LLVMValueRef Inst);
|
|
*
|
|
*
|
|
* @see llvm::Instruction::getOpCode()
|
|
* @see llvm::Instruction::getOpCode()
|
|
*/
|
|
*/
|
|
-LLVMOpcode LLVMGetInstructionOpcode(LLVMValueRef Inst);
|
|
|
|
|
|
+LLVMOpcode LLVMGetInstructionOpcode(LLVMValueRef Inst);
|
|
|
|
|
|
/**
|
|
/**
|
|
* Obtain the predicate of an instruction.
|
|
* Obtain the predicate of an instruction.
|