added 21 arguments...

merge-requests/4/head
_xeroxz 3 years ago
parent 77ae31b1b6
commit fbce0ffd59

@ -0,0 +1,8 @@
#include <vm_lifters.hpp>
namespace vm
{
lifters_t::lifter_callback_t lifters_t::vmexit =
[ & ]( vm::vmp_rtn_t *rtn, const vm::instrs::code_block_t &vm_code_block,
const vm::instrs::virt_instr_t &vinstr, llvm::IRBuilder<> *ir_builder ) { ir_builder->CreateRetVoid(); };
}

@ -15,8 +15,12 @@ namespace vm
flags = ir_builder->CreateAlloca( ir_builder->getInt64Ty(), nullptr, "flags" ); flags = ir_builder->CreateAlloca( ir_builder->getInt64Ty(), nullptr, "flags" );
create_virtual_stack(); create_virtual_stack();
// TODO: copy arg1 (array) onto the local stack... for ( auto idx = 0u; idx < 21; ++idx )
// ir_builder->CreateMemCpy(... {
auto val = ir_builder->CreateLoad( llvm_fptr->getArg( idx ) );
val->setAlignment( llvm::Align( 1 ) );
push( 8, val );
}
create_virtual_registers(); create_virtual_registers();
} }
@ -31,11 +35,11 @@ namespace vm
void vmp_rtn_t::create_routine( void ) void vmp_rtn_t::create_routine( void )
{ {
// function has no arguments and returns void... maybe change this in the future as i learn std::vector< llvm::Type * > arg_types;
// more and more LLVM... for ( auto idx = 0u; idx < 21; ++idx )
auto func_ty = arg_types.push_back( llvm::PointerType::get( llvm::IntegerType::get( *llvm_ctx, 64 ), 0ull ) );
llvm::FunctionType::get( llvm::Type::getVoidTy( *llvm_ctx ),
{ llvm::ArrayType::get( llvm::IntegerType::get( *llvm_ctx, 64 ), 21 ) }, false ); auto func_ty = llvm::FunctionType::get( llvm::Type::getVoidTy( *llvm_ctx ), arg_types, false );
// convert the rtn_begin address to a hex string and prepend "rtn_" to it... // convert the rtn_begin address to a hex string and prepend "rtn_" to it...
std::stringstream rtn_name; std::stringstream rtn_name;

Loading…
Cancel
Save