If argument registers are in incremental order in the global _rvs
vector, the check if a register argument is reversed.
Adapted from a regression found in sparc 64.
* include/lightning/jit_private.h: Add new register classes to
flag float registers and double only registers, required for sparc64
where only low 32 bit fpr registers can be used for single precision
operations.
Add new 128 bit jit_regset_t type for sparc64 register set.
* include/lightning/jit_sparc.h, lib/jit_sparc-cpu.c, lib/jit_sparc-fpu.c,
lib/jit_sparc-sz.c, lib/jit_sparc.c: Update for 64 bits sparc.
* lib/lightning.c: Update for new jit_regset_t required for sparc64.
* check/lightning.c, include/lightning.h: Add the new jit_va_push
interface. That should be called when passing a va_list to a C
function. This is required because on Alpha a va_list is passed
by value, and lightning does not know about data types, so, cannot
understand it is pushing a va_list as argument.
* lib/jit_names.c, lib/lightning.c: Minor changes for the new
jit_code_va_push.
* check/cva_list.c: Update only test case using jit_va_push, to
pass a va_list to a C function.
doc/body.texi: Better documentation of the varargs interface.
* jit_alpha.c, jit_alpha-cpu.c: Update to properly push a
C va_list and correctly calculate varargs offset.
* lib/jit_aarch64-sz.c, lib/jit_aarch64.c, lib/jit_alpha-sz.c,
lib/jit_arm-sz.c, lib/jit_arm.c, lib/jit_hppa-sz.c, lib/jit_hppa.c,
lib/jit_ia64-sz.c, lib/jit_ia64.c, lib/jit_mips-sz.c, lib/jit_mips.c,
lib/jit_ppc-sz.c, lib/jit_ppc.c, lib/jit_s390-sz.c, lib/jit_s390.c,
lib/jit_sparc-sz.c, lib/jit_sparc.c, lib/jit_x86-sz.c, lib/jit_x86.c:
Update for the new jit_va_push interface.
* lib/jit_alpha-cpu.c: Always set t12 to the address of the
current function, to properly work on all systems. Previously
the shortcut did only work on Tru64. For Linux and glibc the
change is required.
* lib/jit_aarch64.c, lib/jit_alpha.c, lib/jit_arm.c,
lib/jit_mips.c, lib/jit_ppc.c, lib/jit_sparc.c, lib/jit_x86.c:
Correct wrong logic in usage of jit_live in jit_retr. The
problem is that if a temporary is required during epilog,
the return register might be allocated, so, jit_live must always
be used.
* lib/jit_mips-cpu.c: Correct frame size and varargs
initialization for the n32 abi.
* lib/jit_mips.c, lib/jit_mips-fpu.c: Correct 32 bit abis
in big-endian.
* include/lightning/jit_private.h, lib/lightning.c: Add a
second pass from start when computing register live ranges.
This should be used temporarily, and is required for certain
loop constructs, with several consecutive blocks not referencing
a live register.
* lib/lightning.c: Correct wrong movr simplification,
remove no longer needed code to set return registers live
and update live register set when reaching a label boundary,
but do not descend if the block has been already visited.
The later need some tuning for complex code generation, where
it will still have issues.
* doc/body.texi: Change documentation to no longer say
it is a variant of the Fibonacci sequence, and document
a proper implementation.
Thanks to Jon Arintok for pointing out that the Fibonacci
sequence generation was incorrect. It was documented, but
still confusing.
* check/fib.tst, check/fib.ok, check/bp.tst, check/bp.ok,
doc/ifib.c, doc/rbif.c: Implement a proper Fibonacci
sequence implementation.
* lib/jit_mips-cpu.c: Correct definition of htonr_ul.
Correct prolog/epilog/va* routines to work on o64 abi.
* lib/jit_mips-fpu.c: Correct load of double literal
argument when not using a data buffer.
Remove alignment correction in vaarg_d if using the
new mips abi.
* lib/jit_mips.c: Correct code to allow creating variadic
jit functions when using the new mips abi.
* lib/jit_rewind.c: Minor adjust for rewind when using
the new mips abi, if there are varargs arguments in
registers.
* lib/jit_ia64-cpu.c: Search backward for the last output
register used, otherwise would stop too early if a float
argument used the slot.
Correct offset of first va_list argument, and use proper
va_list abi.
* lib/jit_ia64-fpu.c: Add new functions to move a gpr
to a fpr register, to counterpart the ones that move a
fpr to a gpr. These are required to properly implement
jit_getarg*_{f,d} on complex prototypes, or variadic
jit functions.
* lib/jit_ia64-sz.c: Update for support to jit variadic
functions.
* lib/jit_ia64.c: Implement proper abi for variadic
jit functions.
* lib/jit_rewind.c: New file implementing generic functions
to "rewind", or rewrite IR code sequences.
* include/lightning.h: Add several new codes, that previously
were a function call, that would synthesize the operation.
Now, there is a code for the operation, and a new flag to
know an operation is synthesized.
* include/lightning/jit_private.h: Add several new macros to
help construct synthesized IR code sequences.
* lib/Makefile.am: Update for lib/jit_rewind.c.
* lib/jit_disasm.c: Update for a small rework on jit_node_t,
so that --enable-devel-disassembler does not need a change
in the layout of jit_node_t.
* lib/jit_names.c: Update for the new codes.
* lib/jit_print.c: Update to print more readable output, and
flag synthesized IR code sequences.
* lib/jit_aarch64-sz.c, lib/jit_aarch64.c,
lib/jit_arm-sz.c, lib/jit_arm.c, lib/jit_x86-sz.c,
lib/jit_x86.c: Update for new synthesized IR code sequences.
* lib/jit_ppc-cpu.c, lib/jit_ppc-fpu., lib/jit_ppc-sz.c,
lib/jit_ppc.c, lib/jit_mips-cpu.c, lib/jit_mips-fpu.c,
lib/jit_mips-sz.c, lib/jit_mips.c, lib/jit_s390-fpu.c,
lib/jit_s390-sz.c, lib/jit_s390.c: Update for new synthesized
IR code sequences and correct bugs in the initial varargs
implementation support.
* lib/jit_alpha-sz.c, lib/jit_alpha.c, lib/jit_hppa-sz.c,
lib/jit_hppa.c, lib/jit_ia64-sz.c, lib/jit_ia64.c,
lib/jit_sparc-sz.c, lib/jit_sparc.c: Add generic, untested
support for the new synthesized IR code sequences. Known
most likely broken right now, and should be corrected once
access to these hosts is available.
* lib/lightning.c: Update for new IR codes, and add support
for not yet existing instructions that change third argument.
* size.c: Change to use different tables for LE and BE PowerPC.
Correct a wrong endif for x32.
* check/cva_list.c: New file implementing a test to ensure
the value returned by jit_va_start is a valid C va_list.
* check/va_list.ok: New simple helper file, as now the
va_list.tst test is enabled.
* check/va_list.tst: Rewritten for an extensive variadic
jit functions test.
* check/Makefile.am: Update for the new tests.
* lib/jit_arm-cpu.c, lib/jit_arm-swf.c, lib/jit_arm-vfp.c,
lib/jit_arm.c: Correct broken software float in a previous
commit. Note that the hard float abi implementation is known
broken at this time, for special cases involving variadic
functions, and should be corrected next.
lib/jit_x86-cpu.c, lib/jit_x86-sz.c, lib/jit_x86.c: Correct
the jit_va_list_t semantics to match C va_list.
* lib/Makefile.am: Bump library major. This is a preparation
for a rework that was due for quite some time, but that is
now required to properly implement variadic jit functions.
The rework is mainly required to know at prolog parsing, if
a function is variadic or not. This will benefit a few
backends, and is mandatory for the hard float arm abi.
The rework was already planned for quite some time, to
be able to use a variable stack framesize, and for leaf
functions optimization where applicable.
The change will be source compatible, but will change
some internals, and jit_code_t values, as some new will
be added.
The only behavior change is that, jit_arg_register_p may
change return value on hard float arm abi, if called before
or after jit_ellipsis. Common sense anyway, would say to
make that call after jit_ellipsis, but documentation
should be updated for it.
* lib/jit_ia64-fpu.c, lib/jit_ia64.c: Correct movi_d_w
and movi_f_w implementation to work when not using a
data buffer. This causes the check varargs.tst to
work when passing "-d" to the lightning test tool.
* lib/jit_mips-cpu.c, lib/jit_mips-fpu.c, lib/jit_mips.c:
Add base support to jit vararg functions to the mips backend.
Currently only supported on the o32 abi, until access to a
n32 system is arranged.
* include/lightning.h, include/lightning/jit_private.h,
lib/jit_names.c, lib/lightning.c: Add initial support
for the new jit_va_start, jit_va_arg, jit_va_arg_d, and
jit_va_end interfaces. The jit_va_start call is supposed
to return a va_list compatible pointer, but not yet
decided if it will be "declared" stdarg compatible,
as for now only x86 support has been added (and should
be compatible), but issues may arise on other backends.
* check/lightning.c: Add wrappers to call the new jit_va_*
interfaces.
* lib/jit_x86-cpu.c, lib/jit_x86.c: Implement the new
jit_va_* for x86.
* lib/jit_x86-sz.c: Add fields, but not yet fully updated,
as this is an intermediate commit.
* lib/jit_aarch64-sz.c, lib/jit_aarch64.c,
lib/jit_alpha-sz.c, lib/jit_alpha.c,
lib/jit_arm-sz.c, lib/jit_arm.c,
lib/jit_hppa-sz.c, lib/jit_hppa.c,
lib/jit_ia64-sz.c, lib/jit_ia64.c,
lib/jit_mips-sz.c, lib/jit_mips.c,
lib/jit_ppc-sz.c, lib/jit_ppc.c,
lib/jit_s390-sz.c, lib/jit_s390.c,
lib/jit_sparc-sz.c, lib/jit_sparc.c: Prepare for the
new jit_va_* interfaces. Not yet implemented, and will
cause an assertion if used.
* check/va_list.tst: Simple early test case, that works
on x86_64, x32, ix86, cygwin, and cygwin64.