|
|
@ -113,6 +113,8 @@ bytesConstRef Runtime::getReturnData() const |
|
|
|
RuntimeManager::RuntimeManager(llvm::IRBuilder<>& _builder): CompilerHelper(_builder) |
|
|
|
{ |
|
|
|
m_dataPtr = new llvm::GlobalVariable(*getModule(), Type::RuntimePtr, false, llvm::GlobalVariable::PrivateLinkage, llvm::UndefValue::get(Type::RuntimePtr), "rt"); |
|
|
|
llvm::Type* args[] = {Type::BytePtr, m_builder.getInt32Ty()}; |
|
|
|
m_longjmp = llvm::Function::Create(llvm::FunctionType::get(Type::Void, args, false), llvm::Function::ExternalLinkage, "longjmp", getModule()); |
|
|
|
|
|
|
|
// Export data
|
|
|
|
auto mainFunc = getMainFunction(); |
|
|
@ -149,6 +151,11 @@ void RuntimeManager::registerReturnData(llvm::Value* _offset, llvm::Value* _size |
|
|
|
set(RuntimeData::ReturnDataSize, _size); |
|
|
|
} |
|
|
|
|
|
|
|
void RuntimeManager::raiseException(ReturnCode _returnCode) |
|
|
|
{ |
|
|
|
m_builder.CreateCall2(m_longjmp, getJmpBuf(), Constant::get(_returnCode)); |
|
|
|
} |
|
|
|
|
|
|
|
llvm::Value* RuntimeManager::get(Instruction _inst) |
|
|
|
{ |
|
|
|
switch (_inst) |
|
|
|