Mercurial > hg > CbC > CbC_llvm
comparison lib/ExecutionEngine/ExecutionEngineBindings.cpp @ 100:7d135dc70f03 LLVM 3.9
LLVM 3.9
author | Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 26 Jan 2016 22:53:40 +0900 |
parents | afa8332a0e37 |
children | 1172e4bd9c6f |
comparison
equal
deleted
inserted
replaced
96:6418606d0ead | 100:7d135dc70f03 |
---|---|
208 } | 208 } |
209 *OutError = strdup(Error.c_str()); | 209 *OutError = strdup(Error.c_str()); |
210 return 1; | 210 return 1; |
211 } | 211 } |
212 | 212 |
213 LLVMBool LLVMCreateExecutionEngine(LLVMExecutionEngineRef *OutEE, | |
214 LLVMModuleProviderRef MP, | |
215 char **OutError) { | |
216 /* The module provider is now actually a module. */ | |
217 return LLVMCreateExecutionEngineForModule(OutEE, | |
218 reinterpret_cast<LLVMModuleRef>(MP), | |
219 OutError); | |
220 } | |
221 | |
222 LLVMBool LLVMCreateInterpreter(LLVMExecutionEngineRef *OutInterp, | |
223 LLVMModuleProviderRef MP, | |
224 char **OutError) { | |
225 /* The module provider is now actually a module. */ | |
226 return LLVMCreateInterpreterForModule(OutInterp, | |
227 reinterpret_cast<LLVMModuleRef>(MP), | |
228 OutError); | |
229 } | |
230 | |
231 LLVMBool LLVMCreateJITCompiler(LLVMExecutionEngineRef *OutJIT, | |
232 LLVMModuleProviderRef MP, | |
233 unsigned OptLevel, | |
234 char **OutError) { | |
235 /* The module provider is now actually a module. */ | |
236 return LLVMCreateJITCompilerForModule(OutJIT, | |
237 reinterpret_cast<LLVMModuleRef>(MP), | |
238 OptLevel, OutError); | |
239 } | |
240 | |
241 | |
242 void LLVMDisposeExecutionEngine(LLVMExecutionEngineRef EE) { | 213 void LLVMDisposeExecutionEngine(LLVMExecutionEngineRef EE) { |
243 delete unwrap(EE); | 214 delete unwrap(EE); |
244 } | 215 } |
245 | 216 |
246 void LLVMRunStaticConstructors(LLVMExecutionEngineRef EE) { | 217 void LLVMRunStaticConstructors(LLVMExecutionEngineRef EE) { |
218 unwrap(EE)->finalizeObject(); | |
247 unwrap(EE)->runStaticConstructorsDestructors(false); | 219 unwrap(EE)->runStaticConstructorsDestructors(false); |
248 } | 220 } |
249 | 221 |
250 void LLVMRunStaticDestructors(LLVMExecutionEngineRef EE) { | 222 void LLVMRunStaticDestructors(LLVMExecutionEngineRef EE) { |
223 unwrap(EE)->finalizeObject(); | |
251 unwrap(EE)->runStaticConstructorsDestructors(true); | 224 unwrap(EE)->runStaticConstructorsDestructors(true); |
252 } | 225 } |
253 | 226 |
254 int LLVMRunFunctionAsMain(LLVMExecutionEngineRef EE, LLVMValueRef F, | 227 int LLVMRunFunctionAsMain(LLVMExecutionEngineRef EE, LLVMValueRef F, |
255 unsigned ArgC, const char * const *ArgV, | 228 unsigned ArgC, const char * const *ArgV, |
278 void LLVMFreeMachineCodeForFunction(LLVMExecutionEngineRef EE, LLVMValueRef F) { | 251 void LLVMFreeMachineCodeForFunction(LLVMExecutionEngineRef EE, LLVMValueRef F) { |
279 } | 252 } |
280 | 253 |
281 void LLVMAddModule(LLVMExecutionEngineRef EE, LLVMModuleRef M){ | 254 void LLVMAddModule(LLVMExecutionEngineRef EE, LLVMModuleRef M){ |
282 unwrap(EE)->addModule(std::unique_ptr<Module>(unwrap(M))); | 255 unwrap(EE)->addModule(std::unique_ptr<Module>(unwrap(M))); |
283 } | |
284 | |
285 void LLVMAddModuleProvider(LLVMExecutionEngineRef EE, LLVMModuleProviderRef MP){ | |
286 /* The module provider is now actually a module. */ | |
287 LLVMAddModule(EE, reinterpret_cast<LLVMModuleRef>(MP)); | |
288 } | 256 } |
289 | 257 |
290 LLVMBool LLVMRemoveModule(LLVMExecutionEngineRef EE, LLVMModuleRef M, | 258 LLVMBool LLVMRemoveModule(LLVMExecutionEngineRef EE, LLVMModuleRef M, |
291 LLVMModuleRef *OutMod, char **OutError) { | 259 LLVMModuleRef *OutMod, char **OutError) { |
292 Module *Mod = unwrap(M); | 260 Module *Mod = unwrap(M); |
293 unwrap(EE)->removeModule(Mod); | 261 unwrap(EE)->removeModule(Mod); |
294 *OutMod = wrap(Mod); | 262 *OutMod = wrap(Mod); |
295 return 0; | 263 return 0; |
296 } | |
297 | |
298 LLVMBool LLVMRemoveModuleProvider(LLVMExecutionEngineRef EE, | |
299 LLVMModuleProviderRef MP, | |
300 LLVMModuleRef *OutMod, char **OutError) { | |
301 /* The module provider is now actually a module. */ | |
302 return LLVMRemoveModule(EE, reinterpret_cast<LLVMModuleRef>(MP), OutMod, | |
303 OutError); | |
304 } | 264 } |
305 | 265 |
306 LLVMBool LLVMFindFunction(LLVMExecutionEngineRef EE, const char *Name, | 266 LLVMBool LLVMFindFunction(LLVMExecutionEngineRef EE, const char *Name, |
307 LLVMValueRef *OutFn) { | 267 LLVMValueRef *OutFn) { |
308 if (Function *F = unwrap(EE)->FindFunctionNamed(Name)) { | 268 if (Function *F = unwrap(EE)->FindFunctionNamed(Name)) { |