add StackFrame class
This commit is contained in:
parent
497be937d9
commit
31feec56a2
3 changed files with 162 additions and 64 deletions
26
sample/stackframe.cpp
Normal file
26
sample/stackframe.cpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
#define XBYAK_NO_OP_NAMES
|
||||
#include <xbyak/xbyak_util.h>
|
||||
|
||||
#ifdef XBYAK32
|
||||
#error "this sample is for only 64-bit mode"
|
||||
#endif
|
||||
|
||||
struct Code : public Xbyak::CodeGenerator {
|
||||
Code()
|
||||
{
|
||||
Xbyak::util::StackFrame sf(this, 4);
|
||||
mov(rax, sf.p(0));
|
||||
add(rax, sf.p(1));
|
||||
add(rax, sf.p(2));
|
||||
add(rax, sf.p(3));
|
||||
ret();
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
Code c;
|
||||
int (*f)(int, int, int, int) = c.getCode<int(*) (int, int, int, int)>();
|
||||
printf("%d\n", f(3, 5, 2, 9));
|
||||
puts("ok");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue