Machine Code Generation for C++
AsmJit provides functionality that can be used to define function signatures and to calculate automatically optimal function frame that can be used directly by a prolog and epilog insertion. This feature was exclusive to AsmJit's Compiler for a very long time, but was abstracted out and is now available for all users regardless of the emitter they use. The following use cases are possible:
The following concepts are used to describe and create functions in AsmJit:
double, and all possible vector types to match ISAs up to AVX512. Type::Id was introduced originally for Compiler, but it's now used by FuncSignature as well.
int func(int, int). FuncSignature contains a function calling convention id, return value type, and function arguments. The signature itself is platform independent and uses Type::Id to describe types of function arguments and function return value(s).
FuncFramedoesn't know anything about function's arguments or return values, it hold only information necessary to create a valid and ABI conforming function prologs and epilogs.
It's a lot of concepts where each represents one step in a function frame calculation. It can be used to create function prologs, epilogs, and also to calculate information necessary to perform function calls.
Function argument index (lo/hi).
Maximum number of function arguments supported by AsmJit.
Extended maximum number of arguments (used internally).
Index to the LO part of function argument (default).
This value is typically omitted and added only if there is HI argument accessed.
Index to the HI part of function argument.
HI part of function argument depends on target architecture. On x86 it's typically used to transfer 64-bit integers (they form a pair of 32-bit integers).