Xbyak - AshokBhat/notes GitHub Wiki

About

  • Xbyak is a C++ header library that enables dynamically to assemble x86(IA32), x64(AMD64, x86-64) mnemonic.

FAQ

  • What is Xbyak?
  • Why is it called a JIT?
  • How is it used in OneDNN?

Project

Example use

Inherit Xbyak::CodeGenerator class and make the class method.

#include <xbyak/xbyak.h>

struct Code : Xbyak::CodeGenerator {
    Code(int x)
    {
        mov(eax, x);
        ret();
    }
};

Make an instance of the class and get the function pointer by calling getCode() and call it.

Code c(5);
int (*f)() = c.getCode<int (*)()>();
printf("ret=%d\n", f()); // ret = 5

See also

⚠️ **GitHub.com Fallback** ⚠️