* 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.
* include/lightning/jit_aarch64.h,
include/lightning/jit_alpha.h,
include/lightning/jit_arm.h,
include/lightning/jit_hppa.h,
include/lightning/jit_mips.h,
include/lightning/jit_ppc.h,
include/lightning/jit_s390.h,
include/lightning/jit_sparc.h,
include/lightning/jit_x86.h,
lib/jit_aarch64.c, lib/jit_alpha.c,
lib/jit_arm.c, lib/jit_hppa.c,
lib/jit_ia64.c, lib/jit_mips.c,
lib/jit_ppc.c, lib/jit_s390.c,
lib/jit_sparc.c, lib/jit_x86.c: Remove jit_arg_reg_p and
jit_arg_f_reg_p from a public header, and define it only
on port specific files where an integer offset is used
to qualify an argument identifier. Exported code expects
an opaque pointer (but of jit_node_t* type) to "qualify"
an argument identifier.
This patch, and the code review/simplification done during
it also corrected some bugs:
o Inconsistent jit_arg_d value of double argument after 3
integer arguments in arm for jit_functions; tested, C
functions were being properly called.
o Inconsistent use of getarg_{f,d} and putarg*_{f,d} on
s390 (32-bit) that happened to not have a proper test
case, as it would only happen for jit functions, and
tested, called C functions had proper arguments.
o Corrected a "last minute" correction that did not go
to the committed version, and would not compile on hppa,
due to bad _jit_putargi_d prototype definition.
* include/lightning/jit_aarch64.h, include/lightning/jit_arm.h,
include/lightning/jit_hppa.h, include/lightning/jit_ia64.h,
include/lightning/jit_mips.h, include/lightning/jit_ppc.h,
include/lightning/jit_private.h, include/lightning/jit_s390x.h,
include/lightning/jit_sparc.h, include/lightning/jit_x86.h:
Do not add jit_regset_t, JIT_RA0, and JIT_FA0 to the installed
header file. These types and definitions are supposed to be
only used internally.
* check/self.c, check/self.ok: New files implementing simple
consistency check assertions. At first validating some macros
that use values from different sources agree.
* check/Makefile.am: Update for the new test case.
* include/lightning.h, lib/lightning.c: Add the new
jit_callee_save_p() call, that is intended to be used when
writing complex code using lightning, so that one does not
need to verify what backend is being used, or have access to
private data, to query if a register is callee save or not;
on several backends the scratch registers are actually callee
save.
* include/lightning/jit_aarch64.h, include/lightning/jit_arm.h,
include/lightning/jit_hppa.h, include/lightning/jit_mips.h,
include/lightning/jit_ppc.h, include/lightning/jit_sparc.h,
include/lightning/jit_x86.h: Add an explicit definition for
JIT_R3-JIT_Rn, JIT_V3-JIT_Vn and JIT_F6-JIT_Fn when applicable.
This allows one to write code based on "#if defined(JIT_XN)"
and therefore, not need to check what is the current backend
or have access to private data structures. This is particularly
useful when writing virtual machines with several specialized,
global registers.
* lib/jit_ia64.c: Properly flag the callee save general
purpose registers as such, so that jit_callee_save_p() works
as intended.
* check/float.tst: Add sparc to list of known NaN and +-Inf
to integer conversion.
* check/lightning.c: Define __sparc__ to preprocessor in
the sparc backend.
* include/lightning/jit_private.h: Correct wrong definition
of emit_stxi_d, that has lived for a long time, but would
cause problems whenever needing to spill/reload a float
register.
* include/lightning/jit_sparc.h: Can only use %g2,%g3,%g4
for scratch variables, as other "global" registers are
reserved for the system, e.g. libc.
Reorder float register naming to make it easier to
access odd float registers, so that generating code for
pusharg and getarg is easier for the IR.
* lib/jit_mips-cpu.c, lib/jit_ppc-cpu.c: Update to match
new code in jit_sparc-cpu.c. It must call jit_get_reg
with jit_class_nospill if using the register to move
an unconditional branch address to it, as the reload
will not happen (actually could happen in the delay
slot...)
* lib/jit_sparc-cpu.c: Correct wrong macro definition for
ldxr_s.
Properly implement div* and implement rem. Div* needs
to use the y register, and rem* needs to be synthesized.
Correct b?sub* macro definitions.
* lib/jit_sparc-fpu.c: Correct reversed float to/from double
conversion.
Correct wrong jit_get_reg call asking for a gpr and then
using the fpr with that number.
Correct wrong branch displacement computation for
conditional branches.
* lib/jit_sparc.c: Correct getarg_d and pushargi_d implementation.
Add rem* entries to the switch converting IR to machine code.
* lib/lightning.c: Correct a problem detected when adding
the jit_class_nospill flag to jit_get_reg, that was caused
when having a branch to an "epilog" node, what would cause
the code to think all registers in unknown state were live,
while in truth, all registers in unknown state in the
"just after return" point are actually dead.
* include/lightning/jit_sparc.h, lib/jit_sparc-cpu.c,
lib/jit_sparc-fpu.c, lib/jit_sparc.c: New files implementing
the basic framework of the sparc port.
* configure.ac, include/lightning.h, include/lightning/Makefile.am,
include/lightning/jit_private.h, lib/jit_disasm.c: Update
for the sparc port framework.
* lib/jit_mips.c: Correct reversed retr/reti logic.
* lib/jit_ppc.c: Correct misspelled __LITTLE_ENDIAN.
* lib/lightning.c: Always do byte hashing in hash_data, because
the logic to "compress" strings causes large pointers to not
be guaranteed aligned at 4 byte boundaries.
Update for the sparc port framework.