Hi list,
I'd like to inform you that AsmJit-1.0 trunk has been refactored. I'd
like to explain my motivation and reasons.
1. AsmJit was split into two parts:
========================
- AsmJit/Core - Backend neutral API, supports all helper classes used
by AsmJit, including base classes used by other backends.
- AsmJit/X86 - x86/x64 backend.
Reason:
I'm planning to work on Arm code generator this year, so I'd like to
abstract API which is platform neutral so it can be shared. In the
future I'd like to write platform agnostic register allocator so it
can be used to alloc Gp/Mm/Xmm registers without knowing about target
(of course it should be possible to inherit it to support platform
specific features).
Goals:
It should be possible to select target architecture at runtime (using
specific BUILD macro) so AsmJit can be used not only as your JIT
backend, but also as assembler which can create object files or which
can patch existing remote code.
2. AsmJit naming conventions changed
============================
- All constants now begin with 'k' prefix and are camelCased, for
example 'kRegCount'.
- All Emittables and 'E' prefixed classes are now CompilerItem's
instead. Platform specific items are prefixed with platform name. For
example there is CompilerFuncDecl and X86CompilerFuncDecl,
CompilerInst and X86CompilerInst, etc. The purpose is to create
backend neutral classes and backend specific classes which derive from
the neutral base.
- All specific code now contains prefix - For example X86Assembler and
X86Compiler.
Reasons:
The UPPERCASE_CONSTANT naming convention is not so great and some
constants (noticably ERROR_) can interfere with platform specific
ones. So to distinguish between macros and constants I decided to use
the 'k' prefix (it's used extensively by MacOS, but this is not a
reason).
Goals:
The purpose is to create an API which will categorize itself. For
example from now it should be able to see which class is related to
Compiler or Assembler, etc. My goal is to make API clear and
non-ambiguous.
3. Conclusion
==========
I just committed the changes. If you want to try the new code-base you
need only to rename some symbols in your code. I'm going to describe
the changes in more detail later.
In short:
- All constants use 'k' prefix and kCamelCase. Platform specific
constants use kPlatformNameValue, for example INST_MOV is now
kX86InstMov. To list all constants type 'k' and use intellisense.
- Assembler/Compiler are base classes, to generate code you need
X86Assembler or X86Compiler. So rename:)
- GPReg/GPVar, MMReg/MMVar, XMMReg, XMMVar was renamed to
GpReg/GpVar, MmReg/MmVar, XmmReg/XmmVar.
- When using Compiler use newGpReg(), newMmReg(), newXmmReg(), and
getGpArg(), getMmArg(), and getXmmArg().
- A little changes in FunctionDefinition, use FuncPrototype and
FuncDecl/X86FuncDecl.
- AsmJit::function_cast<> has been renamed to asmjit_cast<>.
See this diff
http://code.google.com/p/asmjit/source/diff?spec=svn403&r=403&format=side&path=/trunk/AsmJit-1.0/Test/testfunccall1.cpp&old_path=/trunk/AsmJit-1.0/Test/testfunccall1.cpp&old=401
which shows the difference between an old AsmJit API and this new
version.
Thanks, I hope that you will like the new API;)
Best regards
Petr Kobalicek