1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
use super::prelude::*;
use super::target::LLVMTargetDataRef;
use super::target_machine::{LLVMTargetMachineRef, LLVMCodeModel};
pub enum LLVMOpaqueGenericValue {}
pub enum LLVMOpaqueExecutionEngine {}
pub enum LLVMOpaqueMCJITMemoryManager {}
pub type LLVMGenericValueRef = *mut LLVMOpaqueGenericValue;
pub type LLVMExecutionEngineRef = *mut LLVMOpaqueExecutionEngine;
pub type LLVMMCJITMemoryManagerRef = *mut LLVMOpaqueMCJITMemoryManager;
#[repr(C)]
#[derive(Clone, Copy)]
#[allow(non_snake_case)]
pub struct LLVMMCJITCompilerOptions {
pub OptLevel: ::libc::c_uint,
pub CodeModel: LLVMCodeModel,
pub NoFramePointerElim: LLVMBool,
pub EnableFastISel: LLVMBool,
pub MCJMM: LLVMMCJITMemoryManagerRef,
}
pub type LLVMMemoryManagerAllocateCodeSectionCallback =
extern "C" fn(Opaque: *mut ::libc::c_void,
Size: ::libc::uintptr_t,
Alignment: ::libc::c_uint,
SectionID: ::libc::c_uint,
SectionName: *const ::libc::c_char) -> *mut u8;
pub type LLVMMemoryManagerAllocateDataSectionCallback =
extern "C" fn(Opaque: *mut ::libc::c_void,
Size: ::libc::uintptr_t,
Alignment: ::libc::c_uint,
SectionID: ::libc::c_uint,
SectionName: *const ::libc::c_char,
IsReadOnly: LLVMBool) -> *mut u8;
pub type LLVMMemoryManagerFinalizeMemoryCallback =
extern "C" fn(Opaque: *mut ::libc::c_void,
ErrMsg: *mut *mut ::libc::c_char) -> LLVMBool;
pub type LLVMMemoryManagerDestroyCallback =
extern "C" fn(Opaque: *mut ::libc::c_void) -> ();
extern "C" {
pub fn LLVMLinkInMCJIT() -> ();
pub fn LLVMLinkInInterpreter() -> ();
pub fn LLVMCreateGenericValueOfInt(Ty: LLVMTypeRef,
N: ::libc::c_ulonglong,
IsSigned: LLVMBool) -> LLVMGenericValueRef;
pub fn LLVMCreateGenericValueOfPointer(P: *mut ::libc::c_void) -> LLVMGenericValueRef;
pub fn LLVMCreateGenericValueOfFloat(Ty: LLVMTypeRef, N: ::libc::c_double) -> LLVMGenericValueRef;
pub fn LLVMGenericValueIntWidth(GenValRef: LLVMGenericValueRef) -> ::libc::c_uint;
pub fn LLVMGenericValueToInt(GenVal: LLVMGenericValueRef,
IsSigned: LLVMBool) -> ::libc::c_ulonglong;
pub fn LLVMGenericValueToPointer(GenVal: LLVMGenericValueRef) -> *mut ::libc::c_void;
pub fn LLVMGenericValueToFloat(TyRef: LLVMTypeRef,
GenVal: LLVMGenericValueRef) -> ::libc::c_double;
pub fn LLVMDisposeGenericValue(GenVal: LLVMGenericValueRef) -> ();
pub fn LLVMCreateExecutionEngineForModule(OutEE:
*mut LLVMExecutionEngineRef,
M: LLVMModuleRef,
OutError:
*mut *mut ::libc::c_char)
-> LLVMBool;
pub fn LLVMCreateInterpreterForModule(OutInterp:
*mut LLVMExecutionEngineRef,
M: LLVMModuleRef,
OutError: *mut *mut ::libc::c_char)
-> LLVMBool;
pub fn LLVMCreateJITCompilerForModule(OutJIT: *mut LLVMExecutionEngineRef,
M: LLVMModuleRef,
OptLevel: ::libc::c_uint,
OutError: *mut *mut ::libc::c_char)
-> LLVMBool;
pub fn LLVMInitializeMCJITCompilerOptions(Options:
*mut LLVMMCJITCompilerOptions,
SizeOfOptions: ::libc::size_t) -> ();
pub fn LLVMCreateMCJITCompilerForModule(OutJIT: *mut LLVMExecutionEngineRef,
M: LLVMModuleRef,
Options: *mut LLVMMCJITCompilerOptions,
SizeOfOptions: ::libc::size_t,
OutError: *mut *mut ::libc::c_char) -> LLVMBool;
pub fn LLVMCreateExecutionEngine(OutEE: *mut LLVMExecutionEngineRef,
MP: LLVMModuleProviderRef,
OutError: *mut *mut ::libc::c_char) -> LLVMBool;
pub fn LLVMCreateInterpreter(OutInterp: *mut LLVMExecutionEngineRef,
MP: LLVMModuleProviderRef,
OutError: *mut *mut ::libc::c_char) -> LLVMBool;
pub fn LLVMCreateJITCompiler(OutJIT: *mut LLVMExecutionEngineRef,
MP: LLVMModuleProviderRef,
OptLevel: ::libc::c_uint,
OutError: *mut *mut ::libc::c_char) -> LLVMBool;
pub fn LLVMDisposeExecutionEngine(EE: LLVMExecutionEngineRef) -> ();
pub fn LLVMRunStaticConstructors(EE: LLVMExecutionEngineRef) -> ();
pub fn LLVMRunStaticDestructors(EE: LLVMExecutionEngineRef) -> ();
pub fn LLVMRunFunctionAsMain(EE: LLVMExecutionEngineRef, F: LLVMValueRef,
ArgC: ::libc::c_uint,
ArgV: *const *const ::libc::c_char,
EnvP: *const *const ::libc::c_char) -> ::libc::c_int;
pub fn LLVMRunFunction(EE: LLVMExecutionEngineRef, F: LLVMValueRef,
NumArgs: ::libc::c_uint,
Args: *mut LLVMGenericValueRef) -> LLVMGenericValueRef;
pub fn LLVMFreeMachineCodeForFunction(EE: LLVMExecutionEngineRef,
F: LLVMValueRef) -> ();
pub fn LLVMAddModule(EE: LLVMExecutionEngineRef, M: LLVMModuleRef) -> ();
pub fn LLVMAddModuleProvider(EE: LLVMExecutionEngineRef,
MP: LLVMModuleProviderRef) -> ();
pub fn LLVMRemoveModule(EE: LLVMExecutionEngineRef, M: LLVMModuleRef,
OutMod: *mut LLVMModuleRef,
OutError: *mut *mut ::libc::c_char) -> LLVMBool;
pub fn LLVMRemoveModuleProvider(EE: LLVMExecutionEngineRef,
MP: LLVMModuleProviderRef,
OutMod: *mut LLVMModuleRef,
OutError: *mut *mut ::libc::c_char) -> LLVMBool;
pub fn LLVMFindFunction(EE: LLVMExecutionEngineRef,
Name: *const ::libc::c_char,
OutFn: *mut LLVMValueRef) -> LLVMBool;
pub fn LLVMRecompileAndRelinkFunction(EE: LLVMExecutionEngineRef,
Fn: LLVMValueRef) -> *mut ::libc::c_void;
pub fn LLVMGetExecutionEngineTargetData(EE: LLVMExecutionEngineRef) -> LLVMTargetDataRef;
pub fn LLVMGetExecutionEngineTargetMachine(EE: LLVMExecutionEngineRef) -> LLVMTargetMachineRef;
pub fn LLVMAddGlobalMapping(EE: LLVMExecutionEngineRef,
Global: LLVMValueRef,
Addr: *mut ::libc::c_void) -> ();
pub fn LLVMGetPointerToGlobal(EE: LLVMExecutionEngineRef,
Global: LLVMValueRef) -> *mut ::libc::c_void;
pub fn LLVMGetGlobalValueAddress(EE: LLVMExecutionEngineRef,
Name: *const ::libc::c_char) -> u64;
pub fn LLVMGetFunctionAddress(EE: LLVMExecutionEngineRef,
Name: *const ::libc::c_char) -> u64;
pub fn LLVMCreateSimpleMCJITMemoryManager(Opaque: *mut ::libc::c_void,
AllocateCodeSection: LLVMMemoryManagerAllocateCodeSectionCallback,
AllocateDataSection: LLVMMemoryManagerAllocateDataSectionCallback,
FinalizeMemory: LLVMMemoryManagerFinalizeMemoryCallback,
Destroy: LLVMMemoryManagerDestroyCallback) -> LLVMMCJITMemoryManagerRef;
pub fn LLVMDisposeMCJITMemoryManager(MM: LLVMMCJITMemoryManagerRef) -> ();
}