Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
stackframe.cpp
Go to the documentation of this file.
1#define XBYAK_NO_OP_NAMES
2#include <xbyak/xbyak_util.h>
3
4#ifdef XBYAK32
5 #error "this sample is for only 64-bit mode"
6#endif
7
8struct Code : public Xbyak::CodeGenerator {
10 {
11 // see xbyak/sample/sf_test.cpp for how to use other parameter
12 Xbyak::util::StackFrame sf(this, 3);
13 mov(rax, sf.p[0]);
14 add(rax, sf.p[1]);
15 add(rax, sf.p[2]);
16 }
17};
18
19int main()
20{
21 Code c;
22 int (*f)(int, int, int) = c.getCode<int(*) (int, int, int)>();
23 int ret = f(3, 5, 2);
24 if (ret == 3 + 5 + 2) {
25 puts("ok");
26 } else {
27 puts("ng");
28 }
29}
const uint8 * getCode() const
Definition xbyak.h:905
void add(const Operand &op, uint32 imm)
Definition xbyak.h:6
void mov(const Operand &reg1, const Operand &reg2)
Definition xbyak.h:2210
int main()
Definition bench.cpp:18
CK_RV ret