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

Loading…
Cancel
Save