Fabcoin Core  0.16.2
P2P Digital Currency
CompilerHelper.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include <llvm/IR/IRBuilder.h>
6 
7 
8 namespace dev
9 {
10 namespace eth
11 {
12 namespace jit
13 {
14 class RuntimeManager;
15 
16 using IRBuilder = llvm::IRBuilder<>;
17 
20 {
21 protected:
22  CompilerHelper(IRBuilder& _builder);
23 
24  CompilerHelper(const CompilerHelper&) = delete;
26 
28  llvm::Module* getModule();
29 
31  llvm::Function* getMainFunction();
32 
35 
36  friend class RuntimeHelper;
37 };
38 
41 {
42 protected:
43  RuntimeHelper(RuntimeManager& _runtimeManager);
44 
45  RuntimeManager& getRuntimeManager() { return m_runtimeManager; }
46 
47 private:
49 };
50 
52 {
53  explicit InsertPointGuard(llvm::IRBuilderBase& _builder): m_builder(_builder), m_insertPoint(_builder.saveIP()) {}
54  ~InsertPointGuard() { m_builder.restoreIP(m_insertPoint); }
55 
56 private:
57  llvm::IRBuilderBase& m_builder;
58  llvm::IRBuilderBase::InsertPoint m_insertPoint;
59 };
60 
61 }
62 }
63 }
llvm::IRBuilderBase::InsertPoint m_insertPoint
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
Definition: Arith256.cpp:15
llvm::Module * getModule()
Reference to the IR module being compiled.
InsertPointGuard(llvm::IRBuilderBase &_builder)
Base class for compiler helpers like Memory, GasMeter, etc.
llvm::IRBuilderBase & m_builder
llvm::Function * getMainFunction()
Reference to the main module function.
RuntimeManager & m_runtimeManager
CompilerHelper & operator=(CompilerHelper)=delete
CompilerHelper(IRBuilder &_builder)
Compiler helper that depends on runtime data.
IRBuilder & m_builder
Reference to parent compiler IR builder.
RuntimeManager & getRuntimeManager()
llvm::IRBuilder<> IRBuilder