1
2
3
4
5
6 #ifndef CMAJOR_MID_BACK_END_INCLUDED
7 #define CMAJOR_MID_BACK_END_INCLUDED
8 #include <cmajor/ir/Emitter.hpp>
9 #include <cmajor/ir/EmittingContext.hpp>
10
11 namespace cmajor { namespace mid {
12
13 enum class BackEndKind : int
14 {
15 llvmBackEnd= 0, cmsxBackEnd= 1, cmcppBackEnd= 2
16 };
17
18 class BackEnd
19 {
20 public:
21 virtual ~BackEnd();
22 virtual void Init() = 0;
23 virtual void Done() = 0;
24 virtual cmajor::ir::EmittingContext* CreateEmittingContext(int optimizationLevel) = 0;
25 virtual void DestroyEmittingContext(cmajor::ir::EmittingContext* emittingContext) = 0;
26 virtual cmajor::ir::Emitter* CreateEmitter(cmajor::ir::EmittingContext* emittingContext) = 0;
27 virtual void DestroyEmitter(cmajor::ir::Emitter* emitter) = 0;
28 virtual BackEndKind GetBackEndKind() = 0;
29 };
30
31 void SetBackEnd(BackEndKind backEndKind);
32 BackEndKind GetBackEnd();
33
34 extern BackEnd* backEnd;
35
36 } }
37
38 #endif // CMAJOR_MID_BACK_END_INCLUDED