Browse Source

Introducing RuntimeHelper - a compiler helper that depends on runtime data [#81470252]

cl-refactor
Paweł Bylica 10 years ago
parent
commit
2b898fc06a
  1. 8
      libevmjit/CompilerHelper.cpp
  2. 17
      libevmjit/CompilerHelper.h

8
libevmjit/CompilerHelper.cpp

@ -3,6 +3,8 @@
#include <llvm/IR/Function.h>
#include "Runtime.h"
namespace dev
{
namespace eth
@ -29,6 +31,12 @@ llvm::Function* CompilerHelper::getMainFunction()
return mainFunc;
}
RuntimeHelper::RuntimeHelper(RuntimeManager& _runtimeManager):
CompilerHelper(_runtimeManager.getBuilder()),
m_runtimeManager(_runtimeManager)
{}
}
}
}

17
libevmjit/CompilerHelper.h

@ -10,6 +10,7 @@ namespace eth
{
namespace jit
{
class RuntimeManager;
/// Base class for compiler helpers like Memory, GasMeter, etc.
class CompilerHelper
@ -28,6 +29,22 @@ protected:
/// Reference to parent compiler IR builder
llvm::IRBuilder<>& m_builder;
llvm::IRBuilder<>& getBuilder() { return m_builder; }
friend class RuntimeHelper;
};
/// Compiler helper that depends on runtime data
class RuntimeHelper : public CompilerHelper
{
protected:
RuntimeHelper(RuntimeManager& _runtimeManager);
RuntimeManager& getRuntimeManager() { return m_runtimeManager; }
private:
RuntimeManager& m_runtimeManager;
};

Loading…
Cancel
Save