Add CreateLifetimeStart and CreateLifetimeEnd to the IRBuilder, with plans to
[llvm/stm8.git] / include / llvm-c / ExecutionEngine.h
blobf5f40619ef0d8fb0cc395ecfac8f949220d21e85
1 /*===-- llvm-c/ExecutionEngine.h - ExecutionEngine Lib C Iface --*- C++ -*-===*\
2 |* *|
3 |* The LLVM Compiler Infrastructure *|
4 |* *|
5 |* This file is distributed under the University of Illinois Open Source *|
6 |* License. See LICENSE.TXT for details. *|
7 |* *|
8 |*===----------------------------------------------------------------------===*|
9 |* *|
10 |* This header declares the C interface to libLLVMExecutionEngine.o, which *|
11 |* implements various analyses of the LLVM IR. *|
12 |* *|
13 |* Many exotic languages can interoperate with C code but have a harder time *|
14 |* with C++ due to name mangling. So in addition to C, this interface enables *|
15 |* tools written in such languages. *|
16 |* *|
17 \*===----------------------------------------------------------------------===*/
19 #ifndef LLVM_C_EXECUTIONENGINE_H
20 #define LLVM_C_EXECUTIONENGINE_H
22 #include "llvm-c/Core.h"
23 #include "llvm-c/Target.h"
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
29 void LLVMLinkInJIT(void);
30 void LLVMLinkInInterpreter(void);
32 typedef struct LLVMOpaqueGenericValue *LLVMGenericValueRef;
33 typedef struct LLVMOpaqueExecutionEngine *LLVMExecutionEngineRef;
35 /*===-- Operations on generic values --------------------------------------===*/
37 LLVMGenericValueRef LLVMCreateGenericValueOfInt(LLVMTypeRef Ty,
38 unsigned long long N,
39 LLVMBool IsSigned);
41 LLVMGenericValueRef LLVMCreateGenericValueOfPointer(void *P);
43 LLVMGenericValueRef LLVMCreateGenericValueOfFloat(LLVMTypeRef Ty, double N);
45 unsigned LLVMGenericValueIntWidth(LLVMGenericValueRef GenValRef);
47 unsigned long long LLVMGenericValueToInt(LLVMGenericValueRef GenVal,
48 LLVMBool IsSigned);
50 void *LLVMGenericValueToPointer(LLVMGenericValueRef GenVal);
52 double LLVMGenericValueToFloat(LLVMTypeRef TyRef, LLVMGenericValueRef GenVal);
54 void LLVMDisposeGenericValue(LLVMGenericValueRef GenVal);
56 /*===-- Operations on execution engines -----------------------------------===*/
58 LLVMBool LLVMCreateExecutionEngineForModule(LLVMExecutionEngineRef *OutEE,
59 LLVMModuleRef M,
60 char **OutError);
62 LLVMBool LLVMCreateInterpreterForModule(LLVMExecutionEngineRef *OutInterp,
63 LLVMModuleRef M,
64 char **OutError);
66 LLVMBool LLVMCreateJITCompilerForModule(LLVMExecutionEngineRef *OutJIT,
67 LLVMModuleRef M,
68 unsigned OptLevel,
69 char **OutError);
71 /** Deprecated: Use LLVMCreateExecutionEngineForModule instead. */
72 LLVMBool LLVMCreateExecutionEngine(LLVMExecutionEngineRef *OutEE,
73 LLVMModuleProviderRef MP,
74 char **OutError);
76 /** Deprecated: Use LLVMCreateInterpreterForModule instead. */
77 LLVMBool LLVMCreateInterpreter(LLVMExecutionEngineRef *OutInterp,
78 LLVMModuleProviderRef MP,
79 char **OutError);
81 /** Deprecated: Use LLVMCreateJITCompilerForModule instead. */
82 LLVMBool LLVMCreateJITCompiler(LLVMExecutionEngineRef *OutJIT,
83 LLVMModuleProviderRef MP,
84 unsigned OptLevel,
85 char **OutError);
87 void LLVMDisposeExecutionEngine(LLVMExecutionEngineRef EE);
89 void LLVMRunStaticConstructors(LLVMExecutionEngineRef EE);
91 void LLVMRunStaticDestructors(LLVMExecutionEngineRef EE);
93 int LLVMRunFunctionAsMain(LLVMExecutionEngineRef EE, LLVMValueRef F,
94 unsigned ArgC, const char * const *ArgV,
95 const char * const *EnvP);
97 LLVMGenericValueRef LLVMRunFunction(LLVMExecutionEngineRef EE, LLVMValueRef F,
98 unsigned NumArgs,
99 LLVMGenericValueRef *Args);
101 void LLVMFreeMachineCodeForFunction(LLVMExecutionEngineRef EE, LLVMValueRef F);
103 void LLVMAddModule(LLVMExecutionEngineRef EE, LLVMModuleRef M);
105 /** Deprecated: Use LLVMAddModule instead. */
106 void LLVMAddModuleProvider(LLVMExecutionEngineRef EE, LLVMModuleProviderRef MP);
108 LLVMBool LLVMRemoveModule(LLVMExecutionEngineRef EE, LLVMModuleRef M,
109 LLVMModuleRef *OutMod, char **OutError);
111 /** Deprecated: Use LLVMRemoveModule instead. */
112 LLVMBool LLVMRemoveModuleProvider(LLVMExecutionEngineRef EE,
113 LLVMModuleProviderRef MP,
114 LLVMModuleRef *OutMod, char **OutError);
116 LLVMBool LLVMFindFunction(LLVMExecutionEngineRef EE, const char *Name,
117 LLVMValueRef *OutFn);
119 void *LLVMRecompileAndRelinkFunction(LLVMExecutionEngineRef EE, LLVMValueRef Fn);
121 LLVMTargetDataRef LLVMGetExecutionEngineTargetData(LLVMExecutionEngineRef EE);
123 void LLVMAddGlobalMapping(LLVMExecutionEngineRef EE, LLVMValueRef Global,
124 void* Addr);
126 void *LLVMGetPointerToGlobal(LLVMExecutionEngineRef EE, LLVMValueRef Global);
128 #ifdef __cplusplus
131 namespace llvm {
132 struct GenericValue;
133 class ExecutionEngine;
135 #define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref) \
136 inline ty *unwrap(ref P) { \
137 return reinterpret_cast<ty*>(P); \
140 inline ref wrap(const ty *P) { \
141 return reinterpret_cast<ref>(const_cast<ty*>(P)); \
144 DEFINE_SIMPLE_CONVERSION_FUNCTIONS(GenericValue, LLVMGenericValueRef )
145 DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ExecutionEngine, LLVMExecutionEngineRef)
147 #undef DEFINE_SIMPLE_CONVERSION_FUNCTIONS
150 #endif /* defined(__cplusplus) */
152 #endif