You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

44 lines
847 B

#include "CompilerHelper.h"
#include <llvm/IR/Function.h>
#include "RuntimeManager.h"
namespace dev
{
namespace eth
{
namespace jit
{
CompilerHelper::CompilerHelper(llvm::IRBuilder<>& _builder) :
m_builder(_builder)
{}
llvm::Module* CompilerHelper::getModule()
{
assert(m_builder.GetInsertBlock());
assert(m_builder.GetInsertBlock()->getParent()); // BB must be in a function
return m_builder.GetInsertBlock()->getParent()->getParent();
}
llvm::Function* CompilerHelper::getMainFunction()
{
assert(m_builder.GetInsertBlock());
auto mainFunc = m_builder.GetInsertBlock()->getParent();
assert(mainFunc);
if (mainFunc->getName() == "main")
return mainFunc;
return nullptr;
}
RuntimeHelper::RuntimeHelper(RuntimeManager& _runtimeManager):
CompilerHelper(_runtimeManager.getBuilder()),
m_runtimeManager(_runtimeManager)
{}
}
}
}