parent
dc11778ec9
commit
4b221b4da7
@ -0,0 +1,22 @@
|
||||
#include <vm_lifters.hpp>
|
||||
|
||||
namespace vmp2::lifters
|
||||
{
|
||||
// %t1 = %stack[%sp]
|
||||
// add %sp, 8
|
||||
// %vregX = %1
|
||||
lifter_callback_t sregq = [ & ]( 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 ) {
|
||||
auto old_sp =
|
||||
ir_builder->CreateLoad( llvm::IntegerType::get( *rtn->llvm_ctx, 64 ), rtn->stack_ptr, false, "old_sp" );
|
||||
|
||||
auto new_sp = ir_builder->CreateSub(
|
||||
old_sp, llvm::ConstantInt::get( llvm::IntegerType::get( *rtn->llvm_ctx, 64 ), 8 ), "new_sp" );
|
||||
|
||||
ir_builder->CreateStore( new_sp, rtn->stack_ptr );
|
||||
|
||||
auto top_stack =
|
||||
ir_builder->CreateGEP( llvm::ArrayType::get( llvm::IntegerType::get( *rtn->llvm_ctx, 8 ), 1024 ),
|
||||
rtn->virtual_stack, new_sp, "top_stack" );
|
||||
};
|
||||
} // namespace vmp2::lifters
|
Loading…
Reference in new issue