1
2
3
4
5
6 #include <cmajor/cmllvm/Interface.hpp>
7 #include <cmajor/cmllvm/EmittingContext.hpp>
8 #include <cmajor/cmllvm/Emitter.hpp>
9
10 extern "C" cmajor::ir::EmittingContext* CmllvmCreateEmittingContext(int optimizationLevel)
11 {
12 return new cmllvm::EmittingContext(optimizationLevel);
13 }
14
15 extern "C" void CmllvmDestroyEmittingContext(cmajor::ir::EmittingContext* emittingContext)
16 {
17 delete emittingContext;
18 }
19
20 extern "C" cmajor::ir::Emitter* CmllvmCreateEmitter(void* emittingContextHandle)
21 {
22 cmllvm::EmittingContext* emittingContext = static_cast<cmllvm::EmittingContext*>(emittingContextHandle);
23 cmllvm::Emitter* emitter = new cmllvm::Emitter(emittingContext->Context(), *emittingContext);
24 return emitter;
25 }
26
27 extern "C" void CmllvmDestroyEmitter(cmajor::ir::Emitter* emitterHandle)
28 {
29 cmllvm::Emitter* emitter = static_cast<cmllvm::Emitter*>(emitterHandle);
30 delete emitter;
31 }