Fabcoin Core  0.16.2
P2P Digital Currency
CompilerHelper.cpp
Go to the documentation of this file.
1 #include "CompilerHelper.h"
2 
4 #include <llvm/IR/Module.h>
6 
7 #include "RuntimeManager.h"
8 
9 namespace dev
10 {
11 namespace eth
12 {
13 namespace jit
14 {
15 
17  m_builder(_builder)
18 {}
19 
21 {
22  assert(m_builder.GetInsertBlock());
23  assert(m_builder.GetInsertBlock()->getParent()); // BB must be in a function
24  return m_builder.GetInsertBlock()->getParent()->getParent();
25 }
26 
28 {
29  // TODO: Rename or change semantics of getMainFunction() function
30  assert(m_builder.GetInsertBlock());
31  auto mainFunc = m_builder.GetInsertBlock()->getParent();
32  assert(mainFunc);
33  if (mainFunc == &mainFunc->getParent()->getFunctionList().front()) // Main function is the first one in module
34  return mainFunc;
35  return nullptr;
36 }
37 
38 
40  CompilerHelper(_runtimeManager.m_builder),
41  m_runtimeManager(_runtimeManager)
42 {}
43 
44 }
45 }
46 }
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.
assert(len-trim+(2 *lenIndices)<=WIDTH)
Base class for compiler helpers like Memory, GasMeter, etc.
llvm::Function * getMainFunction()
Reference to the main module function.
RuntimeHelper(RuntimeManager &_runtimeManager)
CompilerHelper(IRBuilder &_builder)
IRBuilder & m_builder
Reference to parent compiler IR builder.
llvm::IRBuilder<> IRBuilder