On Thu, 2024-08-15 at 14:32 -0700, Yonghong Song wrote: [...] > > +__success > > +/* program entry for main(), regular function prologue */ > > +__jit_x86(" endbr64") > > +__jit_x86(" nopl (%rax,%rax)") > > +__jit_x86(" xorq %rax, %rax") > > +__jit_x86(" pushq %rbp") > > +__jit_x86(" movq %rsp, %rbp") > > How do we hanble multi architectures (x86, arm64, riscv64)? > > Do we support the following? > > __jit_x86(...) > __jit_x86(...) > ... > > __jit_arm64(...) > __jit_arm64(...) > ... > > __jit_riscv64(...) > __jit_riscv64(...) > ... ^^^^ I was thinking about this variant (and this is how things are now implemented). Whenever there would be a need for that, just add one more arch specific macro. > > Or we can use macro like > > #ifdef __TARGET_ARCH_x86 > __jit(...) > ... > #elif defined(__TARGET_ARCH_arm64) > __jit(...) > ... > #elif defined(...) > > Or we can have > > __arch_x86_64 > __jit(...) // code for x86 > ... > > __arch_arm64 > __jit(...) // code for arm64 > ... > > __arch_riscv > __jit(...) // code for riscv > ... This also looks good, and will work better with "*_next" and "*_not" variants if we are going to borrow from llvm-lit/FileCheck. > For xlated, different archs could share the same code. > Bot for jited code, different arch has different encoding, > so we need to figure out a format suitable for multiple > archs. I'll go with whatever way mailing list likes better. [...]