3 #pragma warning(disable : 4100)
4 #include "AsmJit/AsmJit.h"
5 #pragma warning(default : 4100)
6 #include "../Include/Macro.h"
16 BLACKBONE_API
AsmStackAllocator( asmjit::X86Assembler* pAsm, intptr_t baseval = 0x28 )
18 , disp_ofst(
sizeof(
size_t) )
32 BLACKBONE_API asmjit::Mem
AllocVar( intptr_t size )
35 size = Align( size,
sizeof(
size_t) );
38 auto val = asmjit::Mem( _pAsm->zsp, static_cast<int32_t>(disp_ofst), static_cast<int32_t>(size) );
40 auto val = asmjit::Mem( _pAsm->zbp, -disp_ofst - size, size );
53 BLACKBONE_API
bool AllocArray( asmjit::Mem arr[],
int count, intptr_t size )
55 for (
int i = 0; i < count; i++)
58 arr[i] = asmjit::Mem( _pAsm->zsp, static_cast<int32_t>(disp_ofst), static_cast<int32_t>(size) );
60 arr[i] = asmjit::Mem( _pAsm->zbp, -disp_ofst - size, size );
72 BLACKBONE_API
inline intptr_t
getTotalSize()
const {
return disp_ofst; };
75 asmjit::X86Assembler* _pAsm;
82 #define ALLOC_STACK_VAR(worker, name, type) asmjit::Mem name( worker.AllocVar( sizeof(type) ) );
83 #define ALLOC_STACK_VAR_S(worker, name, size) asmjit::Mem name( worker.AllocVar( size ) );
85 #define ALLOC_STACK_ARRAY(worker, name, type, count) \
86 asmjit::Mem name[count]; \
87 worker.AllocArray( name, count, sizeof(type) );
BLACKBONE_API asmjit::Mem AllocVar(intptr_t size)
Allocate stack variable
Definition: AsmStack.hpp:32
Definition: AsmStack.hpp:13
BLACKBONE_API bool AllocArray(asmjit::Mem arr[], int count, intptr_t size)
Allocate array of stack variables
Definition: AsmStack.hpp:53
BLACKBONE_API intptr_t getTotalSize() const
Get total size of all stack variables
Definition: AsmStack.hpp:72
Definition: AsmHelper32.cpp:6