40ade7a28aeae3e9238c09551349ef7d9b3d7dce
[pcsx_rearmed.git] / deps / lightning / ChangeLog
1 2022-10-12 Paulo Andrade <pcpa@gnu.org>
2
3         * include/lightning/jit_loongarch.h, lib/jit_loongarch-cpu.c,
4         lib/jit_loongarch-fpu.c, lib/jit_loongarch-sz.c, lib/jit_loongarch.c:
5         New files implementing the first version of the new loongarch port.
6         * check/float.tst: Add preprocessor checks for NaN and +-Inf
7         values converted to integers for loongarch.
8         * configure.ac: Add check and conditionals for new architecture.
9         * include/lightning.h.in, check/lightning.c,
10         include/lightning/Makefile.am, include/lightning/jit_private.h,
11         lib/Makefile.am, lib/jit_size.c, lib/lightning.c: Update for new
12         port.
13
14 2022-10-05 Paulo Andrade <pcpa@gnu.org>
15
16         * check/lightning.c: Remove -Dmacro=value from usage and attempt
17         to parse it. It was buggy and not properly implemented. Now
18         it pass any extra options to the generated jit. To pass any
19         option starting with '-' need to also use '--'.
20         * check/collatz.e: New sample file showing an example of jit
21         generation.
22
23 2022-10-04 Paulo Andrade <pcpa@gnu.org>
24
25         * include/lightning/jit_private.h: Add new flag to jit_block_t.
26         * lib/lightning.c: Rewrite register liveness and state at block
27         entry code to avoid a very expensive and non scaling code path.
28         Now it attempts to do as few as possible recomputations when
29         merging state of adjacent blocks, still doing one extra nop pass
30         (in the sense that it will not find any changes) to make sure the
31         logic is correct.
32
33 2022-09-30 Paulo Andrade <pcpa@gnu.org>
34
35         * include/lightning/jit_private.h: Implement new data structures
36         specific to riscv.
37         * lib/jit_disasm.c: Extra disassemble code for riscv constant pool.
38         * lib/jit_riscv-cpu.c: Modify movi to use constant pool if 3 or
39         more instructions are required to construct constant and modify
40         movi_p to use a pc relative load from a constant pool.
41         lib/jit_riscv-sz.c: Update for new constant pool code. Most
42         instructions that need 64 bit constants are significantly reduced.
43         * lib/jit_riscv.c: Implement most of the constant pool code.
44         * lib/jit_size.c: Update for estimate of code generation size.
45         * lib/lightning.c: Update for riscv specific code, and also make
46         sure to mprotect the constant pool as executable.
47
48 2022-09-08 Paulo Andrade <pcpa@gnu.org>
49
50         * lib/jit_fallback.c: Implement fallback compare and swap with
51         pthreads.
52         * check/Makefile.am: Update for new cas{r,i} simple test.
53         * check/catomic.c, check/catomic.ok: New test case for
54         simple compare and swap atomic operation.
55         * check/lightning.c: Add entries to be able to use
56         the new compare and swap atomic operation. Still missing
57         a general test, only the basic C version.
58         * include/lightning.h.in: Include pthread.h, even if not
59         needing a fallback compare and swap.
60         * include/lightning/jit_private.h: Add support for a register pair
61         in second argument. Required by the new casr and casi operations.
62         * lib/jit_aarch64-cpu.c, lib/jit_aarch64-sz.c, lib/jit_aarch64.c,
63         lib/jit_ppc-cpu.c, lib/jit_ppc-sz.c, lib/jit_ppc.c, lib/jit_x86-cpu.c,
64         lib/jit_x86-sz.c, lib/jit_x86.c: Implement inline code for compare
65         and swap.
66         * lib/jit_arm-cpu.c, lib/jit_arm-sz.c, lib/jit_arm.c: Implement
67         inline code for compare and swap if cpu is armv7, otherwise, use
68         a fallback with pthreads.
69         * lib/jit_alpha-cpu.c, lib/jit_alpha-sz.c, lib/jit_alpha.c,
70         lib/jit_hppa-cpu.c, lib/jit_hppa-sz.c, lib/jit_hppa.c,
71         lib/jit_ia64-cpu.c, lib/jit_ia64-sz.c, lib/jit_ia64.c,
72         lib/jit_mips-cpu.c, lib/jit_mips-sz.c, lib/jit_mips.c,
73         lib/jit_riscv-cpu.c, lib/jit_riscv-sz.c, lib/jit_riscv.c,
74         lib/jit_s390-cpu.c, lib/jit_s390-sz.c, lib/jit_s390.c,
75         lib/jit_sparc-cpu.c, lib/jit_sparc-sz.c, lib/jit_sparc.c: Implement
76         fallback compare and swap with pthreads. At least some of these
77         should be updated for inline code generation.
78         * lib/jit_names.c, lib/jit_print.c: lib/lightning.c: Update for the
79         new compare and swap operation.
80         * doc/body.texi: Add simple documentation of the compare and swap
81         new operation.
82
83 2022-08-12  Marc Nieper-Wißkirchen  <marc@nieper-wisskirchen.de>
84
85         Document jit_align.
86         * doc/body.texi: Add documentation for jit_align.
87
88 2022-05-14 Paulo Andrade <pcpa@gnu.org>
89
90         * include/lightning.h.in: Reorder jit_mov{n,z}r in instruction list.
91         * lib/jit_alpha.c, lib/jit_alpha-cpu.c, lib/jit_hppa.c,
92         lib/jit_hppa-cpu.c, lib/jit_ia64.c, lib/jit_ia64-cpu.c,
93         lib/jit_riscv.c, lib/jit_riscv-cpu.c, lib/jit_s390.c,
94         lib/jit_s390-cpu.c, lib/jit_sparc.c, lib/jit_sparc-cpu.c:
95         Implement fallback jit_mov{n,z}r. These are a somewhat cheap
96         implementation, but should be reviewed for the arches that already
97         have a proper conditional move.
98         * lib/jit_arm-sz.c, lib/jit_mips-sz.c: Add missing maximum size
99         estimative and reorder.
100         * lib/jit_aarch64-sz.c, lib/jit_x86-sz.c, lib/jit_ppc-sz.c:
101         Reorder entry to match definition order.
102         * lib/jit_aarch64-sz.c, lib/jit_alpha-sz.c, lib/jit_hppa-sz.c,
103         lib/jit_ia64-sz.c, lib/jit_riscv-sz.c, lib/jit_s390-sz.c,
104         lib/jit_sparc-sz.c: Add heuristic value, basically the sum of
105         the cost of a movr + beqr.
106         * lib/jit_names.c: Add entries for debug output of mov{n,z}r.
107         * lib/lightning.c: Use proper bitmask in jit_classify.
108
109 2021-04-03  Marc Nieper-Wißkirchen  <marc@nieper-wisskirchen.de>
110
111         * check/Makefile.am: Add test for the live instruction.
112         * check/live.ok: New file.
113         * check/live.tst: New file.
114         * doc/body.texi: Add documentation for the live instruction and
115         for jit_get_reg/jit_get_unreg.  Fix menu entries.
116         * include/lightning.h.in (jit_get_reg, jit_unget_reg): Expose the
117         macros in the public header file.
118         * include/lightning/jit_private.h (jit_get_reg, jit_unget_reg):
119         Remove the macros from the private header file.
120
121 2021-04-03  Marc Nieper-Wißkirchen  <marc@nieper-wisskirchen.de>
122
123         * Makefile.am, check/Makefile.am, doc/Makefile.am,
124         lib/Makefile.am: Include $(top_builddir)/include in include paths
125         for the autoconf-generated header file lightning.h.
126
127 2021-04-03  Marc Nieper-Wißkirchen  <marc@nieper-wisskirchen.de>
128
129         * doc/.gitignore: Add version.texi to list of ignored files.
130         * doc/version.texi: Remove file from version control.
131
132 2020-18-04 Paulo Andrade <pcpa@gnu.org>
133
134         * lib/jit_x86-cpu.c, lib/jit_x86.c: Implement %rip relative
135         calls and jumps on x86_64. Currently very conservative, assuming
136         a jit block can be larger than 2G, so, if a jump or call is in
137         the same jit generation, but target is unknown, use an indirect
138         branch (could have an option to assume a jit code block is
139         never larger than 2G). Also a deoptimization is that now does
140         not always generate ip relative jmpi; previously implicitly
141         assumed jmpi would never be larger than 2G. Overall still an
142         optimization.
143
144 2020-23-01 Paulo Andrade <pcpa@gnu.org>
145
146         * lib/lightning.c: Add a proper fix to the condition of considering
147         a register dead at entry of a block when it modifies the register
148         !after! a branch to a target where it is live.
149         The correction is just to split blocks on branches. It uses an
150         extra label per branch, but makes following the code simpler and
151         avoid costly searches.
152
153 2020-22-01 Paulo Andrade <pcpa@gnu.org>
154
155         * lib/lightning.c: Correct a special condition of a register
156         only assigned in a block, and incorrectly marked as dead before
157         a jump where the register is live.
158
159 2019-10-04 Paulo Andrade <pcpa@gnu.org>
160
161         * check/lightning.c, include/lightning/jit_private.h,
162         include/lightning/jit_x86.h, lib/jit_x86-cpu.c, lib/jit_x86-sz.c,
163         lib/jit_x86.c: Correct issues with MinGW64 that defines _WIN32
164         and needs long long for jit_word_t.
165
166 2019-09-16 Paulo Andrade <pcpa@gnu.org>
167
168         * lib/lightning.c: Do not add registers that are never modified
169         to the set of registers to scan for live range, what might
170         consume a lot of cpu time, doing nothing.
171
172 2019-09-16 Marc Nieper-Wißkirchen <marc@nieper-wisskirchen.de>
173
174         * include/lightning/jit_x86.h, lib/jit_x86.c: Correct x86_64
175         backend, made %r12 a callee-save register as dictated by the
176         System V AMD64 ABI.
177
178 2019-09-16 Paulo Andrade <pcpa@gnu.org>
179
180         * Makefile.am: Do not force CFLAGS for the get_jit_size target.
181         * check/lightning.c: Drop __ppc__ check.
182         * include/lightning.h.in: Drop __ppc__ check. Add new
183         jit_flag_vararg flag, for special case in powerpc 32 bit using
184          the SYSV abi, and need to pass an extra argument during code
185         generation.
186         * include/lightning/jit_ppc.c: Drop __ppc_ check. Remove the
187         ABI_ELFv2 macro, as it now directly checks for the _CALL_ELF
188         value when/if appropriate.
189         * include/lightning/jit_private.h: Drop __ppc_ check. Check for
190         _CALL_AIXDESC to define extra data to handle function
191         descriptors.
192         * lib/jit_ppc-cpu.c: Update to check for _CALL_SYSV; assume
193         !_CALL_SYSV == (_CALL_AIX || _CALL_LINUX). Significant code
194         rework for the SYSV abi.
195         * lib/jit_ppc-sz.c: Update for the SYSV abi.
196         * lib/jit_ppc.c: Update for the SYSV abi. Add matching va_list
197         type. Drop __ppc__ check.
198         * lib/jit_size.c: Drop __ppc_ check.
199         * lib/lightning.c: Drop __ppc__ check. Add proper check for
200         __powerpc__ and _CALL_AIXDESC to manage function descriptors.
201         * lib/size.c: Update to drop __pppc_ check and SYSV abi.
202
203 2019-08-30 Paulo Andrade <pcpa@gnu.org>
204
205         * lib/jit_mips-cpu.c: Use JALR to get the same effect as JR, as
206         in mips32r6 JR generates an illegal instruction. Thanks to
207         Bruno Haible for providing a patch and the information, reported at
208         https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=925129
209         * THANKS: update.
210
211 2019-08-29 Marc Nieper-Wißkirchen <marc@nieper-wisskirchen.de>
212
213         * include/lightning/jit_private.h: Move definition of offsetof
214         from the public header file here.
215
216         * configure.ac, include/Makefile.am, include/lightning.h,
217         include/lightning.h.in: Generate lightning.h from lightning.in.h
218         and remove the dependence on config.h from the public header file.
219
220 2019-06-04 Paulo Andrade <pcpa@gnu.org>
221
222         * include/lightning/jit_riscv.h, lib/jit_riscv-cpu.c,
223         lib/jit_riscv-fpu.c, lib/jit_riscv-sz.c, lib/jit_riscv.c:
224         Implement riscv port. Only 64 bit Linux supported. Built on
225         Fedora 28 image.
226
227         * check/all.tst, check/float.tst, configure.ac, include/lightning.h,
228         include/lightning/Makefile.am, include/lightning/jit_private.h,
229         lib/Makefile.am, lib/jit_disasm.c, lib/jit_size.c, lib/lightning.c:
230         Minor updates for the new riscv port.
231
232 2019-06-04 Paulo Andrade <pcpa@gnu.org>
233
234         * lib/jit_alpha.c lib/jit_ia64.c lib/jit_mips.c lib/jit_sparc.c:
235         Correct assertion of _jitc->regarg after emiting an instruction.
236         jit_carry may be set, but not an argument to the current instruction.
237
238 2019-06-01 Paulo Andrade <pcpa@gnu.org>
239
240         * lib/lightning.c: Correct assertion on jit_unget_reg when the
241         argument is jit_carry, and jit_carry was not used in the
242         instruction.
243
244 2019-06-01 Paulo Andrade <pcpa@gnu.org>
245
246         * include/lightning/jit_private.h: Remove no longer need
247         setmask field of jit_block_t and blockmask from jit_compiler_t.
248
249         * lib/lightning.c: Rework of register live and unknown state
250         information during jit generation. It no longer recurses nor
251         do dangerous bit unset of registers in unknown state. The
252         only pitfall known, that must be taken care now is that jmpr
253         (or jmpi to not a jit node) is treated as a function call, as
254         otherwise it would need to consider all registers live, and
255         spill/reload during all jit generation.
256
257 2018-12-28 Paulo Andrade <pcpa@gnu.org>
258
259         * lib/jit_disasm.c: Release bfd handle. Thanks for patch to
260         Marc Nieper-Wißkirchen.
261
262 2018-08-30 Paulo Andrade <pcpa@gnu.org>
263
264         * lib/jit_disasm.c: Add hints to select hppa disassembler.
265
266         * lib/jit_hppa-cpu.c: Correct address of vastart when all
267         argument registers were used as non vararg arguments.
268
269         * lib/jit_hppa-fpu.c: Disable load/store of rv,ix,rb where
270         rv is the value, ix is an register or integer offset and rb
271         is a base register. These should be better tested, as they do
272         not work on all environments (fail on qemu-hppa).
273
274 2018-04-20 Paulo Andrade <pcpa@gnu.org>
275
276         * include/lightning/jit_private.h: Add new register classes to
277         flag float registers and double only registers, required for sparc64
278         where only low 32 bit fpr registers can be used for single precision
279         operations.
280         Add new 128 bit jit_regset_t type for sparc64 register set.
281
282         * include/lightning/jit_sparc.h, lib/jit_sparc-cpu.c, lib/jit_sparc-fpu.c,
283         lib/jit_sparc-sz.c, lib/jit_sparc.c: Update for 64 bits sparc.
284
285         * lib/lightning.c: Update for new jit_regset_t required for sparc64.
286
287 2018-02-26 Paulo Andrade <pcpa@gnu.org>
288
289         * check/lightning.c, include/lightning.h: Add the new jit_va_push
290         interface. That should be called when passing a va_list to a C
291         function. This is required because on Alpha a va_list is passed
292         by value, and lightning does not know about data types, so, cannot
293         understand it is pushing a va_list as argument.
294
295         * lib/jit_names.c, lib/lightning.c: Minor changes for the new
296         jit_code_va_push.
297
298         * check/cva_list.c: Update only test case using jit_va_push, to
299         pass a va_list to a C function.
300
301         doc/body.texi: Better documentation of the varargs interface.
302
303         * jit_alpha.c, jit_alpha-cpu.c: Update to properly push a
304         C va_list and correctly calculate varargs offset.
305
306         * lib/jit_aarch64-sz.c, lib/jit_aarch64.c, lib/jit_alpha-sz.c,
307         lib/jit_arm-sz.c, lib/jit_arm.c, lib/jit_hppa-sz.c, lib/jit_hppa.c,
308         lib/jit_ia64-sz.c, lib/jit_ia64.c, lib/jit_mips-sz.c, lib/jit_mips.c,
309         lib/jit_ppc-sz.c, lib/jit_ppc.c, lib/jit_s390-sz.c, lib/jit_s390.c,
310         lib/jit_sparc-sz.c, lib/jit_sparc.c, lib/jit_x86-sz.c, lib/jit_x86.c:
311         Update for the new jit_va_push interface.
312
313 2018-02-22 Paulo Andrade <pcpa@gnu.org>
314
315         * lib/jit_alpha-cpu.c: Always set t12 to the address of the
316         current function, to properly work on all systems. Previously
317         the shortcut did only work on Tru64. For Linux and glibc the
318         change is required.
319
320 2018-02-22 Paulo Andrade <pcpa@gnu.org>
321
322         * lib/jit_aarch64.c, lib/jit_alpha.c, lib/jit_arm.c,
323         lib/jit_mips.c, lib/jit_ppc.c, lib/jit_sparc.c, lib/jit_x86.c:
324         Correct wrong logic in usage of jit_live in jit_retr. The
325         problem is that if a temporary is required during epilog,
326         the return register might be allocated, so, jit_live must always
327         be used.
328
329 2018-01-31 Paulo Andrade <pcpa@gnu.org>
330
331         * lib/lightning.c: Avoid deep recursions when computing live
332         register ranges.
333
334 2018-01-31 Paulo Andrade <pcpa@gnu.org>
335
336         * lib/jit_mips-cpu.c: Correct frame size and varargs
337         initialization for the n32 abi.
338         * lib/jit_mips.c, lib/jit_mips-fpu.c: Correct 32 bit abis
339         in big-endian.
340
341 2017-09-13 Paulo Andrade <pcpa@gnu.org>
342
343         * configure.ac: Add check for binutils 2.29 prototype to the
344         disassembler function.
345         * lib/jit_disasm.c: Adapt for binutils 2.29 change.
346
347 2017-06-09 Paulo Andrade <pcpa@gnu.org>
348
349         * include/lightning/jit_private.h, lib/lightning.c: Add a
350         second pass from start when computing register live ranges.
351         This should be used temporarily, and is required for certain
352         loop constructs, with several consecutive blocks not referencing
353         a live register.
354
355 2016-05-05 Paulo Andrade <pcpa@gnu.org>
356
357         * lib/lightning.c: Correct wrong movr simplification,
358         remove no longer needed code to set return registers live
359         and update live register set when reaching a label boundary,
360         but do not descend if the block has been already visited.
361         The later need some tuning for complex code generation, where
362         it will still have issues.
363
364 2015-11-30 Paulo Andrade <pcpa@gnu.org>
365
366         * doc/body.texi: Change documentation to no longer say
367         it is a variant of the Fibonacci sequence, and document
368         a proper implementation.
369         Thanks to Jon Arintok for pointing out that the Fibonacci
370         sequence generation was incorrect. It was documented, but
371         still confusing.
372
373         * check/fib.tst, check/fib.ok, check/bp.tst, check/bp.ok,
374         doc/ifib.c, doc/rbif.c: Implement a proper Fibonacci
375         sequence implementation.
376
377 2015-07-03 Paulo Andrade <pcpa@gnu.org>
378
379         * lib/jit_mips-cpu.c: Correct definition of htonr_ul.
380         Correct prolog/epilog/va* routines to work on o64 abi.
381
382         * lib/jit_mips-fpu.c: Correct load of double literal
383         argument when not using a data buffer.
384         Remove alignment correction in vaarg_d if using the
385         new mips abi.
386
387         * lib/jit_mips.c: Correct code to allow creating variadic
388         jit functions when using the new mips abi.
389
390         * lib/jit_rewind.c: Minor adjust for rewind when using
391         the new mips abi, if there are varargs arguments in
392         registers.
393
394 2015-06-06 Paulo Andrade <pcpa@gnu.org>
395
396         * lib/jit_ia64-cpu.c: Search backward for the last output
397         register used, otherwise would stop too early if a float
398         argument used the slot.
399         Correct offset of first va_list argument, and use proper
400         va_list abi.
401
402         * lib/jit_ia64-fpu.c: Add new functions to move a gpr
403         to a fpr register, to counterpart the ones that move a
404         fpr to a gpr. These are required to properly implement
405         jit_getarg*_{f,d} on complex prototypes, or variadic
406         jit functions.
407
408         * lib/jit_ia64-sz.c: Update for support to jit variadic
409         functions.
410
411         * lib/jit_ia64.c: Implement proper abi for variadic
412         jit functions.
413
414 2015-06-04 Paulo Andrade <pcpa@gnu.org>
415
416         * lib/jit_rewind.c: New file implementing generic functions
417         to "rewind", or rewrite IR code sequences.
418
419         * include/lightning.h: Add several new codes, that previously
420         were a function call, that would synthesize the operation.
421         Now, there is a code for the operation, and a new flag to
422         know an operation is synthesized.
423
424         * include/lightning/jit_private.h: Add several new macros to
425         help construct synthesized IR code sequences.
426
427         * lib/Makefile.am: Update for lib/jit_rewind.c.
428
429         * lib/jit_disasm.c: Update for a small rework on jit_node_t,
430         so that --enable-devel-disassembler does not need a change
431         in the layout of jit_node_t.
432
433         * lib/jit_names.c: Update for the new codes.
434
435         * lib/jit_print.c: Update to print more readable output, and
436         flag synthesized IR code sequences.
437
438         * lib/jit_aarch64-sz.c, lib/jit_aarch64.c,
439         lib/jit_arm-sz.c, lib/jit_arm.c, lib/jit_x86-sz.c,
440         lib/jit_x86.c: Update for new synthesized IR code sequences.
441
442         * lib/jit_ppc-cpu.c, lib/jit_ppc-fpu., lib/jit_ppc-sz.c,
443         lib/jit_ppc.c, lib/jit_mips-cpu.c, lib/jit_mips-fpu.c,
444         lib/jit_mips-sz.c, lib/jit_mips.c, lib/jit_s390-fpu.c,
445         lib/jit_s390-sz.c, lib/jit_s390.c: Update for new synthesized
446         IR code sequences and correct bugs in the initial varargs
447         implementation support.
448
449         * lib/jit_alpha-sz.c, lib/jit_alpha.c, lib/jit_hppa-sz.c,
450         lib/jit_hppa.c, lib/jit_ia64-sz.c, lib/jit_ia64.c,
451         lib/jit_sparc-sz.c, lib/jit_sparc.c: Add generic, untested
452         support for the new synthesized IR code sequences. Known
453         most likely broken right now, and should be corrected once
454         access to these hosts is available.
455
456         * lib/lightning.c: Update for new IR codes, and add support
457         for not yet existing instructions that change third argument.
458
459         * size.c: Change to use different tables for LE and BE PowerPC.
460         Correct a wrong endif for x32.
461
462 2015-05-25 Paulo Andrade <pcpa@gnu.org>
463
464         * check/cva_list.c: New file implementing a test to ensure
465         the value returned by jit_va_start is a valid C va_list.
466
467         * check/va_list.ok: New simple helper file, as now the
468         va_list.tst test is enabled.
469
470         * check/va_list.tst: Rewritten for an extensive variadic
471         jit functions test.
472
473         * check/Makefile.am: Update for the new tests.
474
475         * lib/jit_arm-cpu.c, lib/jit_arm-swf.c, lib/jit_arm-vfp.c,
476         lib/jit_arm.c: Correct broken software float in a previous
477         commit. Note that the hard float abi implementation is known
478         broken at this time, for special cases involving variadic
479         functions, and should be corrected next.
480
481         lib/jit_x86-cpu.c, lib/jit_x86-sz.c, lib/jit_x86.c: Correct
482         the jit_va_list_t semantics to match C va_list.
483
484 2015-05-24 Paulo Andrade <pcpa@gnu.org>
485
486         * lib/Makefile.am: Bump library major. This is a preparation
487         for a rework that was due for quite some time, but that is
488         now required to properly implement variadic jit functions.
489         The rework is mainly required to know at prolog parsing, if
490         a function is variadic or not. This will benefit a few
491         backends, and is mandatory for the hard float arm abi.
492         The rework was already planned for quite some time, to
493         be able to use a variable stack framesize, and for leaf
494         functions optimization where applicable.
495         The change will be source compatible, but will change
496         some internals, and jit_code_t values, as some new will
497         be added.
498         The only behavior change is that, jit_arg_register_p may
499         change return value on hard float arm abi, if called before
500         or after jit_ellipsis. Common sense anyway, would say to
501         make that call after jit_ellipsis, but documentation
502         should be updated for it.
503
504 2015-05-24 Paulo Andrade <pcpa@gnu.org>
505
506         * lib/jit_aarch64-fpu.c, lib/jit_aarch64.c: Correct base
507         aarch64 varargs code.
508
509 2015-05-24 Paulo Andrade <pcpa@gnu.org>
510
511         * check/lightning.c: Clearly run check if clang is the system
512         compiler.
513
514 2015-05-20 Paulo Andrade <pcpa@gnu.org>
515
516         * lib/jit_sparc-cpu.c, lib/jit_sparc-fpu.c, lib/jit_sparc.c:
517         Add base support to jit vararg functions to the sparc backend.
518
519 2015-05-20 Paulo Andrade <pcpa@gnu.org>
520
521         * lib/jit_alpha-cpu.c, lib/jit_alpha-fpu.c, lib/jit_alpha.c:
522         Add base support to jit vararg functions to the alpha backend.
523
524 2015-05-19 Paulo Andrade <pcpa@gnu.org>
525
526         * lib/jit_hppa-cpu.c, lib/jit_hppa-fpu.c, lib/jit_hppa.c:
527         Add base support to jit vararg functions to the hppa backend.
528
529 2015-05-10 Paulo Andrade <pcpa@gnu.org>
530
531         * lib/jit_ia64-cpu.c, lib/jit_ia64-fpu.c, lib/jit_ia64.c:
532         Add base support to jit vararg functions to the ia64 backend.
533
534 2015-05-10 Paulo Andrade <pcpa@gnu.org>
535
536         * lib/jit_ia64-fpu.c, lib/jit_ia64.c: Correct movi_d_w
537         and movi_f_w implementation to work when not using a
538         data buffer. This causes the check varargs.tst to
539         work when passing "-d" to the lightning test tool.
540
541 2015-05-10 Paulo Andrade <pcpa@gnu.org>
542
543         * lib/jit_ia64.c: Implement inline assembly cache flush,
544         required on multiprocessor systems.
545
546 2015-05-06 Paulo Andrade <pcpa@gnu.org>
547
548         * lib/jit_mips-cpu.c, lib/jit_mips-fpu.c, lib/jit_mips.c:
549         Add base support to jit vararg functions to the mips backend.
550         Currently only supported on the o32 abi, until access to a
551         n32 system is arranged.
552
553 2015-05-05 Paulo Andrade <pcpa@gnu.org>
554
555         * lib/jit_ppc-cpu.c, lib/jit_ppc-fpu.c, lib/jit_ppc.c:
556         Add base support to jit vararg functions to the PowerPC backend.
557
558 2015-05-02 Paulo Andrade <pcpa@gnu.org>
559
560         * lib/jit_s390-cpu.c, lib/jit_s390-fpu.c, lib/jit_s390.c:
561         Add base support to jit vararg functions to the s390 backend.
562
563 2015-05-01 Paulo Andrade <pcpa@gnu.org>
564
565         * lib/jit_arm-cpu.c, lib/jit_arm-swf.c, lib/jit_arm-vfp.c,
566         lib/jit_arm.c: Add base support to jit vararg
567         functions to the arm backend.
568
569 2015-04-30 Paulo Andrade <pcpa@gnu.org>
570
571         * lib/jit_aarch64-cpu.c, lib/jit_aarch64-fpu.c,
572         lib/jit_aarch64.c: Add base support to jit vararg
573         functions to the aarch64 backend.
574
575 2015-04-27 Paulo Andrade <pcpa@gnu.org>
576
577         * include/lightning.h, include/lightning/jit_private.h,
578         lib/jit_names.c, lib/lightning.c: Add initial support
579         for the new jit_va_start, jit_va_arg, jit_va_arg_d, and
580         jit_va_end interfaces. The jit_va_start call is supposed
581         to return a va_list compatible pointer, but not yet
582         decided if it will be "declared" stdarg compatible,
583         as for now only x86 support has been added (and should
584         be compatible), but issues may arise on other backends.
585
586         * check/lightning.c: Add wrappers to call the new jit_va_*
587         interfaces.
588
589         * lib/jit_x86-cpu.c, lib/jit_x86.c: Implement the new
590         jit_va_* for x86.
591
592         * lib/jit_x86-sz.c: Add fields, but not yet fully updated,
593         as this is an intermediate commit.
594
595         * lib/jit_aarch64-sz.c, lib/jit_aarch64.c,
596         lib/jit_alpha-sz.c, lib/jit_alpha.c,
597         lib/jit_arm-sz.c, lib/jit_arm.c,
598         lib/jit_hppa-sz.c, lib/jit_hppa.c,
599         lib/jit_ia64-sz.c, lib/jit_ia64.c,
600         lib/jit_mips-sz.c, lib/jit_mips.c,
601         lib/jit_ppc-sz.c, lib/jit_ppc.c,
602         lib/jit_s390-sz.c, lib/jit_s390.c,
603         lib/jit_sparc-sz.c, lib/jit_sparc.c: Prepare for the
604         new jit_va_* interfaces. Not yet implemented, and will
605         cause an assertion if used.
606
607         * check/va_list.tst: Simple early test case, that works
608         on x86_64, x32, ix86, cygwin, and cygwin64.
609
610 2015-02-17 Paulo Andrade <pcpa@gnu.org>
611
612         * include/lightning.h, include/lightning/jit_private.h,
613         lib/jit_aarch64-cpu.c, lib/jit_aarch64.c,
614         lib/jit_alpha-cpu.c, lib/jit_alpha.c,
615         lib/jit_arm-cpu.c, lib/jit_arm.c,
616         lib/jit_hppa-cpu.c, lib/jit_hppa.c,
617         lib/jit_ia64-cpu.c, lib/jit_ia64.c,
618         lib/jit_mips-cpu.c, lib/jit_mips.c,
619         lib/jit_ppc-cpu.c, lib/jit_ppc.c,
620         lib/jit_s390-cpu.c, lib/jit_s390.c,
621         lib/jit_sparc-cpu.c, lib/jit_sparc.c,
622         lib/jit_x86-cpu.c, lib/jit_x86.c: Implement the new
623         jit_allocar(offs, size) interface, that receives
624         two integer registers arguments, allocates space
625         dynamically in the stack, returns the offset in
626         the first argument, and uses the second argument
627         for the size in bytes of the memory to be allocated.
628
629         * check/allocar.ok, check/allocar.tst: New files
630         implementing test cases for the new jit_allocar
631         interface.
632
633         * check/Makefile.am, check/lightning.c: Update for
634         the new test case and interface.
635
636         * doc/body.texi: Add documentation of the new
637         interface.
638
639 2015-02-17 Paulo Andrade <pcpa@gnu.org>
640
641         * include/lightning/jit_x86.h, lib/jit_x86-cpu.c,
642         lib/jit_x86-x87.c: No longer make st(7) available.
643         Need to keep one x87 slots empty to avoid exceptions.
644         This has the side effect of no longer needing the
645         hackish emms instruction before a function call.
646
647 2015-02-16 Paulo Andrade <pcpa@gnu.org>
648
649         * lib/lightning.c: Remove the jit_regno_patch bitfield
650         register fields before actual emit, as it is only really
651         used before emit, otherwise, on special conditions it
652         may consider live registers as dead during code emit.
653
654 2015-02-15 Paulo Andrade <pcpa@gnu.org>
655
656         * lib/jit_x86-cpu.c, lib/jit_x86-sse.c, lib/jit_x86-x87.c:
657         Correct encoding of ldxr* stxr* in the x32 abi. If the
658         displacement register is negative, it would generate
659         a 64 bit instruction with a 32 bit unsigned displacement.
660
661         * check/ranger.tst, check/ranger.ok: New files, implementing
662         a test case for negative loads and stores. This is range.tst
663         converted to use registers instead of immediate offsets.
664
665         check/Makefile.am: Update for the new test case.
666
667 2015-02-07 Paulo Andrade <pcpa@gnu.org>
668
669         * lib/jit_size.c: Preventively use at least 144 bytes
670         if JIT_INSTR_MAX is less than it. The logic is not
671         guaranteed to be 100% precise, it is mostly heuristics
672         to allocate a buffer with as close as possible size,
673         but a wrong value may cause code generation to write
674         past the end of the buffer.
675
676 2015-02-03 Paulo Andrade <pcpa@gnu.org>
677
678         * lib/lightning.c: Correct the reason the bug in
679         simplify_stxi was not triggered before, it was due to
680         incorrectly resetting the value->code field, what was
681         causing it to never properly optimize:
682                 stxi Im0 Rb0 Rt0
683                 ldxi Rt1 Rb1 Im1
684         when Rb0 == Rb1, Rt0 == Rt1 and Im0 == Im1
685         There was another possible issue, that has been also
686         addressed in this commit, that would be the case of
687         Rbn == Rtn, where no redundancy removal is possible.
688
689 2015-02-03 Paulo Andrade <pcpa@gnu.org>
690
691         * lib/lightning.c: Correct wrong check in simplify_stxi.
692         The test was incorrectly comparing the target register
693         and the displacement offset. This was a time bomb bug,
694         that would trigger in code like:
695                 stxi Im0 Rb0 Rt0
696                 stxi Im1 Rb1 Rt1
697         if Rb0 == Rb1 && Rt0 == Rt1 && Im0 == Rt1, that is,
698         the wrong check was Im0 == Rt1, instead of the supposed
699         Im0 == Imm1 (that was what the code mean't to do). It
700         was removing the second stxi assuming it was redundantly
701         generated; as that is not uncommon pattern on
702         translators generating jit.
703
704 2015-02-02 Paulo Andrade <pcpa@gnu.org>
705
706         * configure.ac, include/lightning/jit_private.h,
707         lib/jit_aarch64.c, lib/jit_alpha.c, lib/jit_arm.c,
708         lib/jit_disasm.c, lib/jit_hppa.c, lib/jit_ia64.c,
709         lib/jit_mips.c, lib/jit_ppc.c, lib/jit_print.c,
710         lib/jit_s390.c, lib/jit_sparc.c, lib/jit_x86.c: Add a new
711         --enable-devel-disassembler option, that should be used
712         during development, or lightning debug. This option
713         intermixes previous jit_print and jit_disassemble
714         output, making it easier to visualize what lightning
715         call was used, and what code was generated.
716
717 2015-01-31 Paulo Andrade <pcpa@gnu.org>
718
719         * lib/jit_arm-cpu.c, lib/jit_arm.c: Only limit to 24 bit
720         displacement non conditional jump in the same jit_state_t.
721
722 2015-01-19 Paulo Andrade <pcpa@gnu.org>
723
724         * doc/body.texi: Reorder documentation, making jit_frame
725         and jit_tramp the lightning response to the need of
726         trampolines, continuations and tail call optimizations.
727         A pseudo code example of a factorial function was added.
728         Also added a section for description of the available
729         predicates.
730
731         * doc/fact.c: New file, implementing a simple example of
732         a translation of a trivial, recursive, tail call optimization
733         into lightning calls. This is the conversion to functional C
734         code of the example in doc/body.texi.
735
736         * doc/Makefile.am: Update for the next test case.
737
738 2015-01-17 Paulo Andrade <pcpa@gnu.org>
739
740         * include/lightning.h, lib/jit_aarch64.c,
741         lib/jit_alpha.c, lib/jit_arm-vfp.c, lib/jit_arm.c,
742         lib/jit_hppa.c, lib/jit_ia64.c, lib/jit_mips.c,
743         lib/jit_ppc.c, lib/jit_s390.c, lib/jit_sparc.c,
744         lib/jit_x86.c: Add the new jit_arg_register_p predicate.
745         The predicate is expected to be used to know if an
746         argument is in a register, what would need special
747         handling if code that can overwrite non callee save
748         registers is executed.
749
750         * check/carg.c: New test case to check consistency and
751         expected usage of jit_arg_register_p.
752
753         * check/Makefile.am: Update for new test case.
754
755 2015-01-17 Paulo Andrade <pcpa@gnu.org>
756
757         * include/lightning/jit_aarch64.h,
758         include/lightning/jit_alpha.h,
759         include/lightning/jit_arm.h,
760         include/lightning/jit_hppa.h,
761         include/lightning/jit_mips.h,
762          include/lightning/jit_ppc.h,
763         include/lightning/jit_s390.h,
764         include/lightning/jit_sparc.h,
765         include/lightning/jit_x86.h,
766         lib/jit_aarch64.c, lib/jit_alpha.c,
767         lib/jit_arm.c, lib/jit_hppa.c,
768         lib/jit_ia64.c, lib/jit_mips.c,
769         lib/jit_ppc.c, lib/jit_s390.c,
770         lib/jit_sparc.c, lib/jit_x86.c: Remove jit_arg_reg_p and
771         jit_arg_f_reg_p from a public header, and define it only
772         on port specific files where an integer offset is used
773         to qualify an argument identifier. Exported code expects
774         an opaque pointer (but of jit_node_t* type) to "qualify"
775         an argument identifier.
776         This patch, and the code review/simplification done during
777         it also corrected some bugs:
778         o Inconsistent jit_arg_d value of double argument after 3
779           integer arguments in arm for jit_functions; tested, C
780           functions were being properly called.
781         o Inconsistent use of getarg_{f,d} and putarg*_{f,d} on
782           s390 (32-bit) that happened to not have a proper test
783           case, as it would only happen for jit functions, and
784           tested, called C functions had proper arguments.
785         o Corrected a "last minute" correction that did not go
786           to the committed version, and would not compile on hppa,
787           due to bad _jit_putargi_d prototype definition.
788
789 2015-01-17 Paulo Andrade <pcpa@gnu.org>
790
791         * doc/body.texi: Correct wrong/outdated information for
792         hton*, pusharg* and ret*, and add missing documentation
793         for rsb*, qmul*, qdvi* and putarg*.
794
795 2015-01-15 Paulo Andrade <pcpa@gnu.org>
796
797         * configure.ac, lib/jit_disasm.c: Rewrite workaround
798         to apparent problem to initialize powerpc disassembler.
799
800 2015-01-15 Paulo Andrade <pcpa@gnu.org>
801
802         * include/lightning.h, lib/jit_aarch64.c,
803         lib/jit_alpha.c, lib/jit_arm.c, lib/jit_hppa.c,
804         lib/jit_ia64.c, lib/jit_mips.c, lib/jit_ppc.c,
805         lib/jit_s390.c, lib/jit_sparc.c, lib/jit_x86.c:
806         Implement jit_putarg*. It works as a mix of jit_getarg*
807         and jit_pusharg*, in the way that the first argument is
808         a register or immediate, and the second is a pointer
809         returned by jit_arg*. The use of the interface is to change
810         values of arguments to the current jit function.
811
812         * check/put.ok, check/put.tst: New test cases exercising
813         the new jit_putarg* interface.
814
815         * check/Makefile.am, check/lightning.c: Update for the
816         new test case and interface.
817
818 2015-01-08 Paulo Andrade <pcpa@gnu.org>
819
820         * include/lightning/jit_s390.h, lib/jit_s390-cpu.c,
821         lib/jit_s390-fpu.c, lib/jit_s390-sz.c, lib/jit_s390.c:
822         Renamed s390x* files to s390*.
823
824         * check/float.tst, check/lightning.c, configure.ac,
825         include/lightning.h, include/lightning/Makefile.am,
826         lib/Makefile.am, lib/jit_s390.c, lib/jit_size.c,
827         lib/lightning.c: Update for renamed files.
828
829 2015-01-08 Paulo Andrade <pcpa@gnu.org>
830
831         * include/lightning.h, include/lightning/jit_private.h,
832         include/lightning/jit_s390x.h, lib/jit_disasm.c,
833         lib/jit_s390x-cpu.c, lib/jit_s390x-fpu.c, lib/jit_s390x-sz.c,
834         lib/jit_s390x.c, lib/jit_size.c, lib/lightning.c:
835         Add support for generating jit for s390 32 bit. This change
836         also removed %f15 from the list of temporaries fpr registers;
837         it was not being used, but if were, it would corrupt the
838         stack frame because the spill address would overwrite grp
839         offsets.
840
841 2014-12-26 Paulo Andrade <pcpa@gnu.org>
842
843         * lib/jit_ppc-cpu.c, lib/jit_ppc.c: Correct some endianess issues
844         on the powerpc le backend.
845
846 2014-12-26 Paulo Andrade <pcpa@gnu.org>
847
848         * lib/jit_ppc-cpu.c: Add mcrxr instruction emulation,
849         as this instruction has been phased out, and should be
850         implemented as a kernel trap.
851
852 2014-12-26 Paulo Andrade <pcpa@gnu.org>
853
854         * lib/jit_arm.c: Better check for need to flush constants
855         before the pool being no longer reachable.
856
857 2014-12-25 Paulo Andrade <pcpa@gnu.org>
858
859         * include/lightning.h: Split jit_htonr in the new 3 interfaces
860         jit_htonr_us, jit_htonr_ui and jit_htonr_ul, the later only
861         available on 64 bit. The plain/untyped jit_htonr macro call
862         maps to the wordsize one.
863         * lib/jit_aarch64-cpu.c,  lib/jit_aarch64-sz.c, lib/jit_aarch64.c,
864         lib/jit_alpha-cpu.c, lib/jit_alpha-sz.c, lib/jit_alpha.c,
865         lib/jit_arm-cpu.c, lib/jit_arm-sz.c, lib/jit_arm.c,
866         lib/jit_hppa-cpu.c, lib/jit_hppa-sz.c, lib/jit_hppa.c,
867         lib/jit_ia64-cpu.c, lib/jit_ia64-sz.c, lib/jit_ia64.c,
868         lib/jit_mips-cpu.c, lib/jit_mips-sz.c, lib/jit_mips.c,
869         lib/jit_ppc-cpu.c, lib/jit_ppc-sz.c, lib/jit_ppc.c,
870         lib/jit_s390x-cpu.c, lib/jit_s390x-sz.c, lib/jit_s390x.c,
871         lib/jit_sparc-cpu.c, lib/jit_sparc-sz.c, lib/jit_sparc.c,
872         lib/jit_x86-cpu.c, lib/jit_x86-sz.c, lib/jit_x86.c:
873         Update backends for the new jit_htonr*.
874         * check/lightning.c, lib/jit_names.c, lib/lightning.c:
875         Update for the new jit_htonr* interfaces.
876         * check/Makefile.am: Update for new test cases.
877         * check/hton.ok, check/hton.tst: New test cases.
878
879 2014-12-24 Paulo Andrade <pcpa@gnu.org>
880
881         * include/lightning/jit_private.h, include/lightning/jit_x86.h,
882         lib/jit_disasm.c, lib/jit_x86-cpu.c, lib/jit_x86-sse.c,
883         lib/jit_x86-sz.c, lib/jit_x86-x87.c, lib/jit_x86.c,
884         size.c: Implement support for the x32 abi. Built and
885         tested on Gentoo default/linux/amd64/13.0/x32 profile.
886
887 2014-12-24 Paulo Andrade <pcpa@gnu.org>
888
889         * lib/jit_names.c: Add missing rsbi_f and rsbi_d strings.
890
891 2014-12-21 Paulo Andrade <pcpa@gnu.org>
892
893         * lib/jit_arm.c: Call __clear_cache for every page.
894         This should only be required for older boards or
895         toolchain setup, but has been reported to be required
896         for lightning at some point.
897
898 2014-12-21 Paulo Andrade <pcpa@gnu.org>
899
900         * lib/jit_arm.c: Correct check to guard overflow of index
901         of constants from program counter.
902
903 2014-11-24 Paulo Andrade <pcpa@gnu.org>
904
905         * lib/lightning.c: Remove an optimization to calee save
906         registers that may incorrectly remove a jit_movr under
907         special conditions.
908
909 2014-11-20 Paulo Andrade <pcpa@gnu.org>
910
911         * include/lightning/jit_ppc.h, lib/jit_ppc-cpu.c,
912         lib/jit_ppc.c: Add initial powerpc le support.
913
914 2014-11-20 Paulo Andrade <pcpa@gnu.org>
915
916         * lib/jit_disasm.c: Change thumb or arm disassemble based on
917         jit code before disassembly.
918
919         * lib/jit_arm-cpu.c: Correct reversed arguments to LDRD and
920         STRD instructions, and correct checking for support of those.
921
922         * lib/jit_arm-swf.c: Correct wrong use of LDRD and STRD and
923         only use those if the register is even.
924
925         * check/check.arm.swf.sh, check/check.arm4.swf.sh: New files
926         to test LDRD and STRD, as well as the alternate code path
927         when those are not available, in the .arm4. test case.
928
929         * check/Makefile.am: Update for the new test cases.
930
931 2014-11-08 Paulo Andrade <pcpa@gnu.org>
932
933         * include/lightning/jit_private.h, lib/jit_aarch64.c,
934         lib/jit_alpha.c, lib/jit_arm.c, lib/jit_hppa.c,
935         lib/jit_ia64.c, lib/jit_mips.c, lib/jit_ppc.c,
936         lib/jit_s390x.c, lib/jit_sparc.c, lib/jit_x86.c:
937         Implement a private jit_flush call, that flushes
938         the cache, if applicable, aligning down to the
939         previous and up to the next page boundary.
940
941 2014-11-08 Paulo Andrade <pcpa@gnu.org>
942
943         * check/ctramp.c: New file. It just repeats the test
944         of tramp.tst, but using two jit_state_t, what should
945         test possible issues with two contexts, and also validate
946         jit_tramp works on backends with function descriptions.
947
948         * check/Makefile.am: Update for new test case.
949
950 2014-11-03 Paulo Andrade <pcpa@gnu.org>
951
952         * include/lightning/jit_mips.h: Do not make the t9 register
953         JIT_R11 (or JIT_R7 for n32 or n64 abi) available. Previously
954         it cause problems if one expects it to not be changed in a
955         function call. For example, calling a jit function, where it
956         really does not need to be changed.
957
958 2014-10-26 Paulo Andrade <pcpa@gnu.org>
959
960         * lib/jit_aarch64.c, lib/jit_alpha.c, lib/jit_arm.c,
961         lib/jit_hppa.c, lib/jit_ia64.c, lib/jit_mips.c, lib/jit_ppc.c,
962         lib/jit_s390x.c, lib/jit_sparc.c, lib/jit_x86.c: Add an
963         assertion to all code generation "drivers" to ensure
964         _jitc->regarg is empty or in an expected state, after
965         translation of a lightning instruction to native code.
966         This change was a brute force test to find out other cases
967         of a temporary not being release (like was happening with
968         _bmsi and _bmci on x86), but no other case was found,
969         after running make check, with assertions enabled, on all
970         backends.
971
972 2014-10-26 Paulo Andrade <pcpa@gnu.org>
973
974         * lib/jit_x86-cpu.c: Correct a register allocation leak in
975         _bmsi and _bmci.
976
977 2014-10-25 Paulo Andrade <pcpa@gnu.org>
978
979         * lib/jit_disasm.c: Do not cause an fatal error if init_jit
980         fails in the jit_init_debug call.
981
982 2014-10-24 Paulo Andrade <pcpa@gnu.org>
983
984         * lib/jit_ia64.c, lib/jit_ppc.c: Correct handling of function
985         descriptor when first prolog is a jit_tramp prolog. The
986         test case was using the same jit_context_t, so was not
987         triggering this condition.
988
989         * lib/jit_ppc-cpu.c: Properly handle jump displacements that
990         do not fit on 24 powerpc. This required changing from previous
991         "mtlr reg, blr" to "mtctr reg, bctr" to properly handle
992         the logic to "hide" function descriptors, but that would
993         also be required as the proper jit_jmpr when/if implementing
994         optimizations to leaf functions (was working with blr because
995         it is saved/reloaded in prolog/epilog).
996
997 2014-10-21 Paulo Andrade <pcpa@gnu.org>
998
999         * include/lightning.h, lib/lightning.c: Add three predicates
1000         to query information about labels. jit_forward_p(label)
1001         will return non zero if the label is "forward", that is
1002         need a call to jit_link(label), jit_indirect_p(label)
1003         that returns non zero if the label was created with the
1004         jit_indirect() call, and jit_target_p(label) that will
1005         return non zero if there is at least one jump patched
1006         to land at that label.
1007
1008 2014-10-18 Paulo Andrade <pcpa@gnu.org>
1009
1010         * check/range.ok, check/range.tst: New test case designed
1011         to catch incorrect code generation, usually due to incorrect
1012         test of immediate size. The test checks a large amount of
1013         encodings in "power of two" boundaries. This test exorcises
1014         a significant amount of code paths that was previously not
1015         tested.
1016
1017         * check/Makefile.am: Add range test to make check target.
1018
1019         * lib/jit_aarch64-cpu.c: Correct wrong address calculation
1020         for stxi_c, stxi_s, stxi_i and stxi_l when the offset is
1021         too large.
1022
1023         * lib/jit_mips-fpu.c: Correct wrong size test to check if
1024         an immediate can be encoded in a float or double store.
1025
1026         * lib/jit_s390x-cpu.c: Correct inverted encoding to stxi_s
1027         when the offset cannot be encoded, and fallbacks to an
1028         alternate encoding in 2 instructions.
1029
1030 2014-10-17 Paulo Andrade <pcpa@gnu.org>
1031
1032         * check/alu_rsb.ok, check/alu_rsb.tst: New files implementing
1033         tests for jit_rsb*.
1034
1035         * check/Makefile.am, check/lightning.c, include/lightning.h,
1036         lib/jit_aarch64-cpu.c, lib/jit_aarch64-fpu.c, lib/jit_aarch64-sz.c,
1037         lib/jit_aarch64.c, lib/jit_alpha-cpu.c, lib/jit_alpha-fpu.c,
1038         lib/jit_alpha-sz.c, lib/jit_alpha.c, lib/jit_arm-cpu.c,
1039         lib/jit_arm-swf.c, lib/jit_arm-sz.c, lib/jit_arm-vfp.c,
1040         lib/jit_arm.c, lib/jit_hppa-cpu.c, lib/jit_hppa-fpu.c,
1041         lib/jit_hppa-sz.c, lib/jit_hppa.c, lib/jit_ia64-cpu.c,
1042         lib/jit_ia64-fpu.c, lib/jit_ia64-sz.c, lib/jit_ia64.c,
1043         lib/jit_mips-cpu.c, lib/jit_mips-fpu.c, lib/jit_mips-sz.c,
1044         lib/jit_mips.c, lib/jit_names.c, lib/jit_ppc-cpu.c,
1045         lib/jit_ppc-fpu.c, lib/jit_ppc-sz.c, lib/jit_ppc.c,
1046         lib/jit_s390x-cpu.c, lib/jit_s390x-fpu.c, lib/jit_s390x-sz.c,
1047         lib/jit_s390x.c, lib/jit_sparc-cpu.c, lib/jit_sparc-fpu.c,
1048         lib/jit_sparc-sz.c, lib/jit_sparc.c, lib/jit_x86-cpu.c,
1049         lib/jit_x86-sse.c, lib/jit_x86-sz.c, lib/jit_x86-x87.c,
1050         lib/jit_x86.c, lib/lightning.c: Implement jit_rsb*. This
1051         was a missing lightning 1.x interface, that on most
1052         backends is synthesized, but on a few backends (hppa and ia64),
1053         it can generate better code as on those there is, or the
1054         only instruction with an immediate is in "rsb" format
1055         (left operand).
1056
1057 2014-10-17 Paulo Andrade <pcpa@gnu.org>
1058
1059         * lib/jit_names.c: New file with single definition of string
1060         representation of lightning IR codes.
1061
1062         * size.c: Modified to append the code name in a C comment
1063         after the maximum instruction size.
1064
1065         * lib/jit_print.c: Minor change to not duplicate jit_names.c
1066         contents.
1067
1068         * lib/jit_aarch64-sz.c, lib/jit_alpha-sz.c, lib/jit_arm-sz.c,
1069         lib/jit_hppa-sz.c, lib/jit_ia64-sz.c, lib/jit_mips-sz.c,
1070         lib/jit_ppc-sz.c, lib/jit_s390x-sz.c, lib/jit_sparc-sz.c,
1071         lib/jit_x86-sz.c: Rewritten to add string representation of
1072         IR codes in a C comment.
1073
1074 2014-10-14 Paulo Andrade <pcpa@gnu.org>
1075
1076         * lib/jit_aarch64-cpu.c, lib/jit_alpha-cpu.c, lib/jit_arm-cpu.c,
1077         lib/jit_hppa-cpu.c, lib/jit_mips-cpu.c, lib/jit_ppc-cpu.c,
1078         lib/jit_sparc-cpu.c: Implement or correct the internal
1079         nop(count) call that receives an argument that tells the
1080         modulo bytes to align the code for the next instruction.
1081
1082         * include/lightning.h, lib/lightning.c, lib/jit_aarch64.c,
1083         lib/jit_alpha.c, lib/jit_arm.c, lib/jit_hppa.c, lib/jit_ia64.c,
1084         lib/jit_mips.c, lib/jit_ppc.c, lib/jit_s390x.c, lib/jit_sparc.c,
1085         lib/jit_x86.c: Implement the new jit_align() call that receive
1086         an argument, that tells the modulo, in bytes, to align the
1087         next instruction. In most backends the only value that makes
1088         a difference is a value that matches sizeof(void*), as all
1089         other values usually are already automatically aligned in
1090         labels, but not guaranteed to be aligned at word size bytes.
1091
1092         * check/align.ok, check/align.tst: New files, implementing
1093         a simple test for the new jit_align() interface.
1094
1095         * check/Makefile.am, check/lightning.c, lib/jit_aarch64-sz.c,
1096         lib/jit_alpha-sz.c, lib/jit_arm-sz.c, lib/jit_hppa-sz.c,
1097         lib/jit_ia64-sz.c, lib/jit_mips-sz.c, lib/jit_ppc-sz.c,
1098         lib/jit_print.c, lib/jit_s390x-sz.c, lib/jit_sparc-sz.c,
1099         lib/jit_x86-sz.c: Update for the new jit_code_align code and
1100         the jit_align() interface.
1101
1102 2014-10-13 Paulo Andrade <pcpa@gnu.org>
1103
1104         * include/lightning.h, lib/jit_size.c, size.c: Use a
1105         symbolic value for the last IR code.
1106
1107 2014-10-12 Paulo Andrade <pcpa@gnu.org>
1108
1109         * include/lightning.h, include/lightning/jit_private.h,
1110         lib/jit_aarch64-cpu.c, lib/jit_alpha-cpu.c, lib/jit_arm-cpu.c,
1111         lib/jit_hppa-cpu.c, lib/jit_ia64-cpu.c, lib/jit_mips-cpu.c,
1112         lib/jit_ppc-cpu.c, lib/jit_s390x-cpu.c, lib/jit_sparc-cpu.c,
1113         lib/jit_x86-cpu.c, lib/lightning.c: Implement the new
1114         jit_frame and jit_tramp interfaces, that allow writing
1115         trampoline like calls, where a single dispatcher jit buffer
1116         is written, and later other jit buffers are created, with
1117         the same stack frame layout as the dispatcher. This is the
1118         logic that GNU Smalltalk used in lightning 1.x, and is required
1119         to make a sane port for lighting 2.x.
1120
1121         * jit_ia64-cpu.c: Implement support for jit_frame and jit_tramp,
1122         and also correct wrong encoding for B4 instructions, that
1123         implement jmpr, as well as correct reverse logic in _jmpr,
1124         that was moving the branch register to the jump register,
1125         and not vice-versa.
1126         Also, if a stack frame is to be assumed, always assume it may
1127         call a function with up to 8 arguments, regardless of the
1128         hint frame argument.
1129
1130         * lib/jit_arm.c: Add a new must_align_p() interface to ensure
1131         function prologs are always aligned. This condition was
1132         previously always true, somewhat by accident, but with
1133         jit_tramp it is not guaranteed.
1134
1135         * jit_ia64-cpu.c: lib/jit_ppc.c: Add minor special handling
1136         required to implement jit_tramp, where a function descriptor
1137         should not be added before a prolog, as jit_tramp means omit
1138         prolog.
1139
1140         * check/lightning.c: Update test driver for the new interfaces.
1141
1142         * check/Makefile.am, check/tramp.tst, check/tramp.ok: Add
1143         a simple test and example of the jit_frame and jit_tramp
1144         usage implementing a simple Fibonacci function using a
1145         simulation of an interpreter stack and how it would handle
1146         state in language specific variables.
1147
1148         * doc/body.texi: Add documentation for jit_frame and
1149         jit_tramp.
1150
1151 2014-09-29 Paulo Andrade <pcpa@gnu.org>
1152
1153         * lib/jit_aarch64.c, lib/jit_alpha.c, lib/jit_arm.c,
1154         lib/jit_hppa.c, lib/jit_ia64.c, lib/jit_mips.c,
1155         lib/jit_ppc.c, lib/jit_s390x.c, lib/jit_sparc.c,
1156         lib/jit_x86.c, lib/lightning.c: Allow jit_jmpi on a
1157         target that is not a node. This may lead to hard to
1158         debug code generation, but is a required feature for
1159         certain generators, like the ones that used lightning
1160         1.2x. Note that previously, but not really well
1161         documented, it was instructed to use:
1162         jit_movi(rn, addr); jit_jmpr(rn);
1163         but now, plain:
1164         jit_patch_abs(jit_jmpi(), addr);
1165         should also work.
1166
1167 2014-09-24 Paulo Andrade <pcpa@gnu.org>
1168
1169         * lib/jit_x86-sz.c: Generate information about instruction
1170         lengths for more precise calculation of buffer size on
1171         Windows x64. This change is specially important because
1172         the maximum instruction length is larger than other
1173         systems, what could cause an out of bounds write on
1174         special conditions without this update.
1175
1176 2014-09-24 Paulo Andrade <pcpa@gnu.org>
1177
1178         * check/lightning.c: Add workaround to conflicting global
1179         optind variable in cygwin binutils that have an internal
1180         getopt* implementation.
1181
1182         * lib/jit_x86-cpu.c: Add a simple define ffsl ffs if building
1183         for 32 bit and there is no ffsl function.
1184
1185 2014-09-24 Paulo Andrade <pcpa@gnu.org>
1186
1187         * check/lightning.c: Add a hopefully temporary kludge to not use
1188         sprintf and sscanf returned by dlsym. This is required to pass
1189         the varargs test.
1190
1191         * include/lightning/jit_private.h: Use symbolic name for first
1192         integer register argument, as this is different in sysv and
1193         win64 abi.
1194
1195         * include/lightning/jit_x86.h: Add conditionals and definitions
1196         for Windows x64 (under __CYGWIN__ preprocessor conditional).
1197
1198         * lib/jit_x86-cpu.c: Correct one instruction encoding bug, that
1199         was working by accident. Only use rax to rdx for some byte
1200         operations to work on compatibility mode (that is, to generate
1201         the proper encoding, instead of actually generating encoding
1202         for high byte registers, e.g. %bh).
1203         Add proper prolog and epilog for windows x64.
1204
1205         * lib/jit_x86-sse.c: Correct a swapped rex prefix for float
1206         operations.
1207
1208         * lib/jit_x86.c: Adjust to support Windows x64 abi.
1209
1210         * check/check.x87.nodata.sh: New file, previously used but that
1211         was missing git.
1212
1213 2014-09-07 Paulo Andrade <pcpa@gnu.org>
1214
1215         * lib/lightning.c: Mark all registers advertised as live, as
1216         per jit_callee_save_p as live whenever reaching a jump that
1217         cannot be tracked. This is a rethink of the previous commit,
1218         and is a better approach, otherwise there would not be much
1219         sense on relying on jit_callee_save_p if it could not be
1220         trusted.
1221
1222         * check/jmpr.tst, check/jmpr.ok: New files implementing a very
1223         simple test case, that would actually cause an assertion on
1224         code before the change to only mark as live when reaching a
1225         jump that could not tracked, the actually advertised as callee
1226         save registers.
1227
1228         check/Makefile.am: Update for new jmpr test case.
1229
1230 2014-09-01 Paulo Andrade <pcpa@gnu.org>
1231
1232         * lib/lightning.c: Do not mark all registers in unknown state
1233         as live on jit_jmpr, or jit_jmpi to an absolute address. Instead,
1234         treat it as a function call, and only consider JIT_Vn registers
1235         as possibly live.
1236
1237 2014-08-29 Paulo Andrade <pcpa@gnu.org>
1238
1239         * doc/body.texi: Add a proper info menu entry for
1240         GNU lightning.
1241
1242         * doc/version.texi: Regenerate.
1243
1244 2014-08-16 Paulo Andrade <pcpa@gnu.org>
1245
1246         * lib/jit_aarch64-cpu.c, lib/jit_aarch64-fpu.c,
1247         lib/jit_arm-cpu.c, lib/jit_arm-vfp.c,
1248         lib/jit_hppa-cpu.c, lib/jit_hppa-fpu.c,
1249         lib/jit_ia64-cpu.c, lib/jit_ia64-fpu.c,
1250         lib/jit_mips-cpu.c, lib/jit_mips-fpu.c,
1251         lib/jit_ppc-cpu.c, lib/jit_ppc-fpu.c,
1252         lib/jit_s390x-cpu.c, lib/jit_s390x-fpu.c,
1253         lib/jit_s390x.c, lib/jit_sparc-cpu.c,
1254         lib/jit_x86-cpu.c, lib/jit_x86-sse.c,
1255         lib/jit_x86-x87.c: Review generation of all branch
1256         instructions and always adds the jit_class_nospill
1257         bitfield for temporary registers that cannot be spilled
1258         because the reload would be after a conditional jump; the
1259         patch only adds an extra assertion. These conditions do
1260         not happen on documented lightning usage, but can happen
1261         if one uses the not exported jit_get_reg and jit_unget_reg
1262         calls and cause enough register starvation.
1263
1264 2014-08-16 Paulo Andrade <pcpa@gnu.org>
1265
1266         * lib/jit_alpha.c: Correct wrong bitmask of most argument
1267         float register arguments, that were being set as callee
1268         save instead of argument registers class.
1269
1270 2014-08-16 Paulo Andrade <pcpa@gnu.org>
1271
1272         * lib/jit_arm-sz.c: Regenerate table of known maximum
1273         instruction sizes for the software float fallback,
1274         that implements "virtual" float registers in the stack
1275         and operations as calls to libgcc.
1276
1277         * size.c: Correct typo in the generated jit_arm-sz.c file.
1278
1279 2014-08-10 Paulo Andrade <pcpa@gnu.org>
1280
1281         * include/lightning/jit_alpha.h, lib/jit_alpha-cpu.c,
1282         lib/jit_alpha-fpu.c, lib/jit_alpha-sz.c, lib/jit_alpha.c:
1283         New files implementing a lightning Alpha port. Thanks
1284         to Trent Nelson and snakebit.net staff for providing access
1285         to an Alpha system.
1286
1287         * check/float.tst, check/lightning.c, configure.ac,
1288         include/lightning.h, include/lightning/Makefile.am,
1289         include/lightning/jit_private.h, lib/Makefile.am,
1290         lib/jit_disasm.c, lib/jit_size.c, lib/lightning.c:
1291         Minor changes to adapt for the new Alpha port.
1292
1293 2014-08-10 Paulo Andrade <pcpa@gnu.org>
1294
1295         * lib/lightning.c: Always mark JIT_RET and JIT_FRET as
1296         live in a function epilog. This is required because
1297         on some ports a complex sequence, allocating one or more
1298         registers, may be required to jump from a ret* to the
1299         epilog, and the lightning api does not have annotations
1300         to know if a function returns a value, or the type of
1301         the return value.
1302
1303 2014-08-10 Paulo Andrade <pcpa@gnu.org>
1304
1305         * lib/lightning.c: Change the correct live bitmask of
1306         return registers after a function call in jit_update.
1307
1308 2014-08-10 Paulo Andrade <pcpa@gnu.org>
1309
1310         * lib/lightning.c: Change assertions to have an int
1311         result and correct a bad bit mask assertion.
1312
1313 2014-08-10 Paulo Andrade <pcpa@gnu.org>
1314
1315         * lib/jit_aarch64.c: Correct bad setup for assertion
1316         of consistency before a patch.
1317
1318 2014-08-10 Paulo Andrade <pcpa@gnu.org>
1319
1320         * lib/jit_mips-cpu.c: Correct typo in the jit_bmsr
1321         implementation that was using the wrong test result
1322         register.
1323
1324 2014-07-28 Paulo Andrade <pcpa@gnu.org>
1325
1326         * lib/jit_memory.c: Do not call free on NULL pointers.
1327
1328         * include/lightning/jit_private.h, lib/jit_note.c,
1329         lib/lightning.c: Add a wrapper to memcpy and memmove
1330         to not actually call those functions with a zero size
1331         argument, and likely also a null src or dst.
1332
1333 2014-07-27 Paulo Andrade <pcpa@gnu.org>
1334
1335         * include/lightning/jit_private.h, lib/jit_disasm.c,
1336         lib/lightning.c: Remove the global jit_progname variable.
1337         It was being only used in jit_init_debug, that is called
1338         from init_jit, so, just pass an argument.
1339
1340 2014-07-27 Paulo Andrade <pcpa@gnu.org>
1341
1342         * doc/body.texi: Add note that jit_set_memory_functions
1343         should be called before init_jit, because init_jit
1344         itself may call the memory wrappers.
1345
1346 2014-04-22 Paulo Andrade <pcpa@gnu.org>
1347
1348         * lib/jit_arm.c: Do not get confused with default settings
1349         if /proc is not mounted on Linux specific code path.
1350
1351 2014-04-09 Paulo Andrade <pcpa@gnu.org>
1352
1353         * include/lightning/jit_aarch64.h, include/lightning/jit_arm.h,
1354         include/lightning/jit_hppa.h, include/lightning/jit_ia64.h,
1355         include/lightning/jit_mips.h, include/lightning/jit_ppc.h,
1356         include/lightning/jit_private.h, include/lightning/jit_s390x.h,
1357         include/lightning/jit_sparc.h, include/lightning/jit_x86.h:
1358         Do not add jit_regset_t, JIT_RA0, and JIT_FA0 to the installed
1359         header file. These types and definitions are supposed to be
1360         only used internally.
1361
1362 2014-04-05 Paulo Andrade <pcpa@gnu.org>
1363
1364         * lib/jit_arm-cpu.c: Only adjust stack pointer in prolog if
1365         need stack space, that is, do not emit a nop instruction
1366         subtracting zero from the stack pointer.
1367
1368 2014-04-04 Paulo Andrade <pcpa@gnu.org>
1369
1370         * lib/jit_disasm.c: Correct a crash in the doc/printf example
1371         on arm due to releasing the data_info information in
1372         jit_clear_state. This is a special case for arm only, and
1373         actually, only armv5 or older uses the data_info buffer,
1374         or when forcing arm instruction set mode besides thumb
1375         available.
1376
1377 2014-12-03 Paulo Andrade <pcpa@gnu.org>
1378
1379         * doc/body.texi: Write detailed description and examples for
1380         jit_get_memory_functions, jit_set_memory_functions,
1381         jit_get_code, jit_set_code, jit_get_data and jit_set_data.
1382
1383 2014-12-03 Paulo Andrade <pcpa@gnu.org>
1384
1385         * include/lightning.h, include/lightning/jit_private.h,
1386         lib/lightning.c: Implement the new jit_set_data() interface,
1387         and the new jit_get_data() helper. Like jit_set_code(),
1388         jit_realize() should be called before jit_set_data().
1389         The most common usage should be jit_set_data(JIT_DISABLE_DATA
1390         | JIT_DISABLE_NOTE), to force synthesize any float/double
1391         constant in the stack and not generate any debug information.
1392
1393         * lib/jit_note.c: Minor change to debug note generation as
1394         now it uses an alternate temporary data buffer during constants
1395         and debug generation to accommodate the possibility of the user
1396         setting an alternate data buffer.
1397
1398         * lib/jit_hppa-fpu.c, lib/jit_s390x.c, lib/jit_s390x-cpu.c,
1399         lib/jit_s390x-fpu.c, lib/jit_sparc.c, lib/jit_sparc-fpu.c,
1400         lib/jit_x86-sse.c, lib/jit_x86-x87.c: Implement jit_set_data.
1401
1402         * lib/jit_hppa-sz.c, lib/jit_sparc-sz.c, lib/jit_x86-sz.c,
1403         lib/jit_s390x-sz.c: Update for several instructions that now
1404         have a different maximum length due to jit_set_data.
1405
1406         * lib/jit_mips-fpu.c: Implement jit_set_data, but missing
1407         validation on n32 and n64 abis (and/or big endian).
1408
1409         * lib/jit_mips-sz.c: Update for changes in o32.
1410
1411         * lib/jit_ppc-fpu.c: Implement jit_set_data, but missing
1412         validation on Darwin PPC.
1413
1414         * lib/jit_ppc-sz.c: Update for changes in powerpc 32 and
1415         64 bit.
1416
1417         * lib/jit_ia64-fpu.c: Implement untested jit_set_data.
1418
1419         * TODO: Add note to list ports that were not tested for the
1420         new jit_set_data() feature, due to no longer having access
1421         to them.
1422
1423         * check/nodata.c: New file implementing a simple test exercising
1424         several different conditions created by jit_set_data().
1425
1426         * check/check.nodata.sh: New file implementing a wrapper
1427         over the existing *.tst files, that runs all tests without
1428         using a data buffer for constants; only meaningful (and
1429         enabled) on architectures that used to store float/double
1430         constants on a read only data buffer.
1431
1432         * configure.ac, check/Makefile.am: Update for the new test
1433         cases.
1434
1435         * check/lightning.c: Implement the new "-d" option that
1436         sets an internal flag to call jit_set_data() disable
1437         constants and debug, that is, using only a pure code
1438         buffer.
1439
1440 2014-11-03 Paulo Andrade <pcpa@gnu.org>
1441
1442         * include/lightning.h, include/lightning/jit_private.h,
1443         lib/lightning.c: Implement the new jit_set_code() interface,
1444         that allows instructing lightning to use an alternate code
1445         buffer. The new jit_realize() function should be called
1446         before jit_set_code(), and usually call jit_get_code()
1447         to query the amount of bytes expected to be required for
1448         the code.
1449
1450         * lib/jit_size.c: Minor update to have less chances of
1451         miscalculating the code buffer by starting the counter
1452         with the size of the longest instruction instead of zero,
1453         as code emit fails if at any moment less than the longest
1454         instruction bytes are available.
1455
1456         * check/setcode.c: New file implementing some basic tests
1457         of the new jit_set_code() interface.
1458
1459         * check/Makefile.am: Update for newer test case.
1460
1461 2014-06-03 Paulo Andrade <pcpa@gnu.org>
1462
1463         * include/lightning.h, lib/lightning.c: Add the new
1464         jit_indirect() call, that returns a special label node,
1465         and tells lightning that the label may be the target of
1466         an indirect jump.
1467
1468         * doc/body.texi: Document the new jit_indirect() call, and
1469         add examples of different ways to create labels and branches.
1470
1471 2014-23-02 Paulo Andrade <pcpa@gnu.org>
1472
1473         *  lib/jit_x86.c: Rewrite previous patch to inline save/restore
1474         because clobbering %ebx in x86 is treated as an error
1475         (jit_x86.c:239:5: error: PIC register clobbered by 'ebx' in 'asm').
1476
1477 2014-19-02 Paulo Andrade <pcpa@gnu.org>
1478
1479         * lib/jit_x86.c: Rewrite incorrect inline assembly that could
1480         truncate a variable in a callee save register. Now it simply
1481         tells gcc that the register is clobbered, instead of using a
1482         *32 bit* swap with a temporary variable. The problem only
1483         happens when compiling with optimization.
1484
1485 2014-19-02 Paulo Andrade <pcpa@gnu.org>
1486
1487         * include/lightning/jit_aarch64.h, include/lightning/jit_arm.h,
1488         include/lightning/jit_hppa.h, include/lightning/jit_ia64.h,
1489         include/lightning/jit_mips.h, include/lightning/jit_ppc.h,
1490         include/lightning/jit_s390x.h, include/lightning/jit_sparc.h,
1491         include/lightning/jit_x86.h: Change jit_regset_t to an
1492         unsigned type, to allow safe right shift.
1493
1494         * lib/lightning.c: Rewrite jit_regset_scan1 to allow easier
1495         compiler optimization.
1496
1497 2013-12-03 Paulo Andrade <pcpa@gnu.org>
1498
1499         * lib/jit_x86-x87.c: Correct wrong optimization when
1500         loading the log(2) constant.
1501
1502 2013-12-03 Paulo Andrade <pcpa@gnu.org>
1503
1504         * lib/jit_x86-cpu.c: Use the emms instruction before
1505         calling any function. This is particularly important
1506         when using c99 complex functions as it can easily
1507         overflow the x87 stack due to the way lightning uses
1508         the x87 stack as a flat register file.
1509
1510 2013-12-02 Paulo Andrade <pcpa@gnu.org>
1511
1512         * lib/jit_x86-x87.c: Correct wrong code generation due
1513         to comparing the base and not the value register with
1514         %st(0) in stxi_f.
1515
1516 2013-12-02 Paulo Andrade <pcpa@gnu.org>
1517
1518         * lib/jit_x86-x87.c, lib/jit_x86.c: Use 8 bytes aligned
1519         stack offset for float/double x87 to/from sse move.
1520
1521 2013-11-27 Paulo Andrade <pcpa@gnu.org>
1522
1523         * configure.ac, lib/jit_arm-swf.c, lib/jit_arm.c: Add
1524         changes that should at least allow building lightning
1525         on Apple iOS7.
1526
1527 2013-10-08 Paulo Andrade <pcpa@gnu.org>
1528
1529         * lib/jit_ppc-cpu.c: Correct wrong shortcut for ldxi_l with
1530         a zero offset, that was calling ldr_i instead of ldr_l.
1531
1532 2013-10-08 Paulo Andrade <pcpa@gnu.org>
1533
1534         * include/lightning/jit_arm.h, lib/jit_arm-cpu.c: Do not use
1535         by default load/store instructions that map to ldrt/strt.
1536         There is already the long displacement version for positive
1537         offsets, and when using a (shorter) negative offset it does
1538         not map to ldrt/strt. At least on qemu strt may cause
1539         reproducible, but unexpected SIGILL.
1540
1541 2013-10-08 Paulo Andrade <pcpa@gnu.org>
1542
1543         * lib/jit_arm-vfp.c: Correct wrong load/store offset
1544         calculation when the displacement is constant but too
1545         large to use an instruction with an immediate offset.
1546
1547 2013-10-07 Paulo Andrade <pcpa@gnu.org>
1548
1549         * check/self.c: Extend tests to validate jit_callee_save_p
1550         does not cause an assertion on valid arguments, and test
1551         extra registers defined on some backends.
1552
1553         * configure.ac: Do not ignore environment CFLAGS when
1554         checking if need to test runtime configurable options,
1555         like use x87 when sse2 is available, arm instruction set
1556         instead of thumb, etc.
1557
1558         * include/lightning/jit_arm.h: Correct wrong jit_f macro
1559         definition.
1560
1561         * include/lightning/jit_ia64.h, include/lightning/jit_ppc.h:
1562         Correct wrong jit_r macro definition.
1563
1564         * lib/jit_x86-x87.c, lib/jit_x86.c: Actually use the
1565         reserved stack space for integer to/from float conversion.
1566         The stack space was also changed to ensure it is 8 bytes
1567         aligned. Also, for Solaris x86 in 32 bit mode, an alternate
1568         truncr_d was implemented because for some reason it is
1569         failing with SIGILL if using the "fisttpl" instructions,
1570         that must be available on p6 or newer, but for the sake of
1571         making all tests pass, implement a 486 or newer sequence
1572         if "sun" is defined.
1573
1574 2013-10-03 Paulo Andrade <pcpa@gnu.org>
1575
1576         * include/lightning/jit_mips.h, lib/jit_mips-cpu.c,
1577         lib/jit_mips-sz.c, lib/jit_mips.c, size: Build and
1578         pass all test cases on Irix big endian mips using
1579         the 64 bit abi.
1580
1581 2013-10-02 Paulo Andrade <pcpa@gnu.org>
1582
1583         * include/lightning/jit_mips.h: Add proper mips abi detection.
1584
1585 2013-09-30 Paulo Andrade <pcpa@gnu.org>
1586
1587         * lib/jit_print.c: Do not crash if calling jit_print from
1588         gdb before actually emitting code.
1589
1590         * lib/lightning.c: Correct misplaced check for already
1591         visited blocks on conditional branches, what was preventing
1592         proper merge live bit masks of forward blocks.
1593
1594 2013-09-30 Paulo Andrade <pcpa@gnu.org>
1595
1596         * lib/jit_x86-cpu.c: Correct not properly tested case of using
1597         %r12 as index register, what was causing an invalid assertion.
1598         %r12 is mapped to the "extra" JIT_R3 register, and test cases
1599         only test "standard" lightning registers.
1600
1601 2013-09-28 Paulo Andrade <pcpa@gnu.org>
1602
1603         * lib/jit_ia64.c: Minor change to force collecting the maximum
1604         instruction length in the --enable-devel-get-jit-size build
1605         mode. The actual generated file did not change because the
1606         sampling was large enough that it had already collected proper
1607         information in the previously slightly buggy code (not forcing
1608         a sync of the instructions that could be combined).
1609
1610 2013-09-27 Paulo Andrade <pcpa@gnu.org>
1611
1612         * lib/jit_arm.c: Correct build when disassembler is
1613         disabled.
1614
1615 2013-09-25 Paulo Andrade <pcpa@gnu.org>
1616
1617         * lib/jit_ia64-cpu.c, lib/jit_ia64-fpu.c: Correct some
1618         off by one range checks (that were only accepting values
1619         one less than the maximum allowed) and an invalid test
1620         condition check that was forcing it to always use
1621         indirect jumps even when reachable with an immediate
1622         displacement.
1623
1624 2013-09-24 Paulo Andrade <pcpa@gnu.org>
1625
1626         * lib/jit_aarch64-sz.c, lib/jit_arm-sz.c, lib/jit_hppa-sz.c,
1627         lib/jit_ia64-sz.c, lib/jit_mips-sz.c, lib/jit_ppc-sz.c,
1628         lib/jit_s390x-sz.c, lib/jit_size.c, lib/jit_sparc-sz.c,
1629         lib/jit_x86-sz.c: New files implementing static tables
1630         with longest known instructions length generated to match
1631         a lightning instruction. These tables should make it easier
1632         to make it very unlikely to ever miscalculate, or by too
1633         much, the size of a code buffer.
1634
1635         * lib/jit_size.c: New file that aids to either collect
1636         jit code size information, or use the information depending
1637         on build options.
1638
1639         * size.c: New helper file that parses input for, and create
1640         an initial jit_$arch-sz.c file, that needs some minor edit
1641         for arches with multiple configurations.
1642
1643         * configure.ac, Makefile.am: Add the new, devel mode only
1644         --enable-devel-get-jit-size configure option, that sets
1645         compile time flags to collect jit code size information,
1646         that will be used as input for the "noinst size program".
1647
1648         * lib/jit_aarch64.c, lib/jit_arm.c, lib/jit_disasm.c,
1649         lib/jit_hppa.c, lib/jit_ia64.c, lib/jit_memory.c,
1650         lib/jit_mips.c, lib/jit_ppc.c, lib/jit_s390x.c,
1651         lib/jit_sparc.c, lib/jit_x86.c, lib/lightning.c: Minor
1652         changes for the --enable-devel-get-jit-size build mode,
1653         as well as the "production build mode" with jit code
1654         size information.
1655
1656 2013-09-14 Paulo Andrade <pcpa@gnu.org>
1657
1658         * include/lightning.h, lib/lightning.c: Add the new
1659         jit_pointer_p interface, that returns a boolean value
1660         telling if the pointer argument is inside the jit
1661         code buffer. This is useful to avoid the need to add
1662         extra labels and calls to jit_address to figure bounds
1663         of code buffer, and still keep internal data private.
1664
1665 2013-09-13 Paulo Andrade <pcpa@gnu.org>
1666
1667         * include/lightning.h, include/lightning/jit_private.h,
1668         lib/jit_note.c: Change the code argument of jit_get_note
1669         to a jit_pointer_t and make jit_get_note a public interface.
1670         It was intended so since start, as a way to map an offset
1671         in the code to a function name, file name and line number
1672         mapping.
1673
1674 2013-09-11 Paulo Andrade <pcpa@gnu.org>
1675
1676         * doc/body.texi: Correct reversed arguments in example of
1677         usage in a (possibly) multi threaded, multiple jit_state_t
1678         environments.
1679
1680         * include/lightning/jit_arm.h, include/lightning/jit_private.h,
1681         lib/jit_arm-cpu.c, lib/jit_arm.c: Make a previously, non
1682         documented, global state private to the related jit_state_t
1683         generating code.
1684
1685 2013-09-10 Paulo Andrade <pcpa@gnu.org>
1686
1687         * check/self.c, check/self.ok: New files implementing simple
1688         consistency check assertions. At first validating some macros
1689         that use values from different sources agree.
1690
1691         * check/Makefile.am: Update for the new test case.
1692
1693         * include/lightning.h,  lib/lightning.c: Add the new
1694         jit_callee_save_p() call, that is intended to be used when
1695         writing complex code using lightning, so that one does not
1696         need to verify what backend is being used, or have access to
1697         private data, to query if a register is callee save or not;
1698         on several backends the scratch registers are actually callee
1699         save.
1700
1701         * include/lightning/jit_aarch64.h, include/lightning/jit_arm.h,
1702         include/lightning/jit_hppa.h, include/lightning/jit_mips.h,
1703         include/lightning/jit_ppc.h, include/lightning/jit_sparc.h,
1704         include/lightning/jit_x86.h: Add an explicit definition for
1705         JIT_R3-JIT_Rn, JIT_V3-JIT_Vn and JIT_F6-JIT_Fn when applicable.
1706         This allows one to write code based on "#if defined(JIT_XN)"
1707         and therefore, not need to check what is the current backend
1708         or have access to private data structures. This is particularly
1709         useful when writing virtual machines with several specialized,
1710         global registers.
1711
1712         * lib/jit_ia64.c: Properly flag the callee save general
1713         purpose registers as such, so that jit_callee_save_p() works
1714         as intended.
1715
1716 2013-09-10 Paulo Andrade <pcpa@gnu.org>
1717
1718         * check/lightning.c, configure.ac: Conditionally use the
1719         code written to workaround a bug in the Hercules emulator,
1720         as isnan and isinf are not available at least on HP-UX ia64.
1721
1722 2013-09-10 Paulo Andrade <pcpa@gnu.org>
1723
1724         * lib/jit_s390x-cpu.c: Spill/reload correct callee save
1725         float registers.
1726
1727 2013-09-10 Paulo Andrade <pcpa@gnu.org>
1728
1729         * lib/jit_hppa-cpu.c: Correct code to call a function stored
1730         in a register or a patched function address.
1731
1732 2013-09-10 Paulo Andrade <pcpa@gnu.org>
1733
1734         * lib/jit_ia64-cpu.c: Correct incorrect logic when restoring
1735         the value of the "r2" callee save register.
1736
1737 2013-08-29 Paulo Andrade <pcpa@gnu.org>
1738
1739         * lib/jit_arm-cpu.c, lib/jit_arm.c: Correct wrong test and update
1740         of the thumb offset information, when checking if needing to
1741         patch a jump from arm to thumb mode. The problem would happen when
1742         remapping the code buffer, and the new address being lower than
1743         the previous one.
1744
1745 2013-08-26 Paulo Andrade <pcpa@gnu.org>
1746
1747         * configure.ac: Extend FreeBSD test to also handle NetBSD.
1748
1749         * lib/jit_x86-cpu.c: Correct wrongly defined offset type of
1750         ldxi_ui. Problem detected when building on NetBSD.
1751
1752         * lib/lightning.c: Adjust code to handle NetBSD mremap,
1753         where arguments do not match Linux mremap.
1754
1755 2013-08-26 Paulo Andrade <pcpa@gnu.org>
1756
1757         * lib/jit_ppc.c: Correct C sequence point problem miscalculating
1758         the actual function address in a function descriptor. Problem
1759         happens with gcc 4.8.1 at least.
1760
1761 2013-08-11 Paulo Andrade <pcpa@gnu.org>
1762
1763         * lib/jit_s390x-cpu.c: Correct code checking if immediate
1764         fits instruction, but using the negated value.
1765
1766 2013-07-28 Paulo Andrade <pcpa@gnu.org>
1767
1768         * include/lightning/jit_s390x.h, lib/jit_s390x-cpu.c,
1769         lib/jit_s390x-fpu.c, lib/jit_s390x.c: New files
1770         implementing the new s390x port.
1771
1772         * configure.ac, include/lightning.h,
1773         include/lightning/Makefile.am,
1774         include/lightning/jit_private.h,
1775         lib/Makefile.am, lib/jit_disasm.c, lib/lightning.c:
1776         Minor adaptation for the new s390x backend.
1777
1778         * check/float.tst: Update for the s390x result of
1779         truncating +Inf to integer.
1780
1781         * check/qalu_mul.tst: Add extra test cases to better test
1782         high word of signed multiplication as the result is
1783         adjust from unsigned multiplication on s390x.
1784
1785 2013-07-28 Paulo Andrade <pcpa@gnu.org>
1786
1787         * check/lightning.c: Do not assume casting a double NaN or
1788         Inf to float will produce the expected float NaN or Inf.
1789         This is not true at least under s390x.
1790
1791 2013-07-28 Paulo Andrade <pcpa@gnu.org>
1792
1793         * check/check.arm.sh, check/check.sh, check/check.swf.sh,
1794         check/check.x87.sh: Properly check test programs output,
1795         not just rely on the test program self testing the results
1796         and not crashing.
1797
1798 2013-07-28 Paulo Andrade <pcpa@gnu.org>
1799
1800         * lib/jit_aarch64.c: Remove unused macros left from cut&paste
1801         of jit_arm.c.
1802
1803 2013-07-16 Paulo Andrade <pcpa@gnu.org>
1804
1805         * include/lightning/jit_aarch64.h, lib/jit_aarch64-cpu.c,
1806         lib/jit_aarch64-fpu.c, lib/jit_aarch64.c: New files
1807         implementing the new aarch64 port, as a new architecture,
1808         not as an expansion of the existing armv[4-7] port.
1809
1810         * check/lightning.c: Add aarch64 support and a small
1811         change to recognize character constants as immediate
1812         values.
1813
1814         * check/float.tst: Add aarch64 preprocessor conditionals
1815         to select proper expected value when converting [+-]Inf
1816         and NaN to integer.
1817
1818         * include/lightning/jit_arm.h, lib/jit_arm.c: Minor changes
1819         to better match the new aarch64 files.
1820
1821         * configure.ac, include/lightning.h,
1822         include/lightning/Makefile.am, include/lightning/jit_private.h,
1823         lib/Makefile.am, lib/lightning.c: Minor adjustments
1824         for the aarch64 port.
1825
1826 2013-07-08 Paulo Andrade <pcpa@gnu.org>
1827
1828         * NEWS, THANKS, configure.ac, doc/version.texi: Update for
1829         the 1.99a second alpha release.
1830
1831 2013-06-25 Paulo Andrade <pcpa@gnu.org>
1832
1833         * lib/jit_mips.c: Correct cut&paste error that caused wrong
1834         stack offset calculation for double arguments in stack in
1835         the o32 abi.
1836         Correct typo in the __LITTLE_ENDIAN macro name, that came
1837         from cut&paste error in the original typo in lib/jit_ppc.c.
1838
1839         * lib/jit_ia64.c, lib/jit_ppc.c: Correct typo in the
1840         __LITTLE_ENDIAN macro name.
1841
1842 2013-06-22 Paulo Andrade <pcpa@gnu.org>
1843
1844         * check/lightning.c, configure.ac, include/lightning.h,
1845         lib/lightning.c: Add tests and quirks to build/detect
1846         and/or work on Irix.
1847
1848         * include/lightning/jit_mips.h, lib/jit_mips-cpu.c,
1849         lib/jit_mips-fpu.c, lib/jit_mips.c: Adapt code to run
1850         in big endian mips, using the n32 abi.
1851
1852 2013-06-18 Paulo Andrade <pcpa@gnu.org>
1853
1854         * include/lightning.h: Minor extra preprocessor testing
1855         to "detect" byte order on x86 solaris, that now builds
1856         and pass all test cases.
1857
1858 2013-06-18 Paulo Andrade <pcpa@gnu.org>
1859
1860         * lib/jit_sparc-cpu.c: Correct compiler warning of value
1861         used before assignment. The usage is bogus as the api
1862         requires always patching jumps, but the random value used
1863         could cause an assertion due to invalid displacement.
1864
1865         * lib/jit_sparc.c: Always load and store double arguments
1866         in stack as 2 float loads or stores, for safety, as unaligned
1867         access is not allowed in Sparc Solaris.
1868
1869 2013-06-14 Paulo Andrade <pcpa@gnu.org>
1870
1871         * configure.ac: Force -mlp64 to CFLAGS on HP-UX ia64 port.
1872         It is the only supported mode, and expects gcc as C compiler.
1873
1874         * include/lightning.h, lib/jit_ia64-cpu.c, lib/jit_ia64.c:
1875         Correct ia64 port to work on HP-UX that runs it in big endian
1876         mode.
1877
1878 2013-06-10 Paulo Andrade <pcpa@gnu.org>
1879
1880         * lib/jit_hppa.c: Sanitize the cache synchronization inline
1881         assembly code that was doing twice the work and redundantly
1882         flushing the end address every loop iteration.
1883
1884 2013-06-09 Paulo Andrade <pcpa@gnu.org>
1885
1886         * configure.ac, check/Makefile.am, doc/Makefile.am: Do not
1887         explicitly link to -ldl, but instead autodetect the library
1888         with dlopen, dlsym, etc.
1889
1890         * check/lightning.c: Add workaround to apparently buggy
1891         getopt in HP-UX that sets optind to the wrong index, and
1892         use RTLD_NEXT on HP-UX instead of RTLD_DEFAULT to dlsym
1893         global symbols.
1894
1895         * include/lightning.h: Rework definitions of wordsize and
1896         byte order to detect proper values on HP-UX.
1897
1898         * lib/lightning.c: Minor correction to use MAP_ANONYMOUS
1899         instead of MAP_ANON on HP-UX.
1900
1901         * lib/jit_hppa.c: Float arguments must be passed on integer
1902         registers on HP-UX, not only for varargs functions.
1903           Add code to properly clear instruction cache. This was
1904         not required on Debian hppa port, but may have been working
1905         by accident.
1906
1907         * lib/jit_hppa-cpu.c: Follow pattern of HP-UX binaries and
1908         use bve,n instead of bv,n to return from functions.
1909
1910         * lib/jit_hppa-fpu.c: For some reason "fst? frX,rX,(rY)" did
1911         not work on the tested computer (HP-UX B.11.23 U 9000/785 HP-UX)
1912         so the code was changed, at first for __hpux only to add the
1913         base and offset register and use the instruction with an
1914         immediate (zero) offset.
1915
1916 2013-06-07 Paulo Andrade <pcpa@gnu.org>
1917
1918         * check/lightning.c, lib/jit_disasm.c, lib/jit_ppc-cpu.c,
1919         lib/jit_ppc-fpu.c, lib/jit_ppc.c, include/lightning.h,
1920         include/lightning/jit_ppc.h, include/lightning/jit_private.h:
1921         Adapt code to work on 32 bit AIX ppc using gcc. Most changes
1922         are basically to adapt the elf64 logic to 32 bit, as it does
1923         not use the same convention of 32 bit Darwin ppc.
1924
1925         * check/stack.tst: Add a fake memcpy function to the test
1926         case if running under AIX, as it is not available to dlsym.
1927
1928         * configure.ac: Check for getopt.h header, not available in
1929         AIX.
1930
1931 2013-06-01 Paulo Andrade <pcpa@gnu.org>
1932
1933         * include/lightning/jit_hppa.h, lib/jit_hppa-cpu.c,
1934         lib/jit_hppa-fpu.c, lib/jit_hppa.c: New files implementing
1935         the hppa port. Built on Debian Linux PA-RISC 2.0, 32 bit.
1936
1937         * check/float.tst: Add preprocessor for hppa expected
1938         values when converting NaN and +-Inf to an integer.
1939
1940         * check/ldst.inc: Ensure double load/store tests use an
1941         8 byte aligned address by default.
1942
1943         * lib/lightning.c: Correct a bug found during tests in
1944         the new port, where qmul* and qdiv* were not properly
1945         setting one of the result registers as modified in the
1946         function, what would be a problem if the only "write"
1947         usage were the qmul* or qdiv*.
1948
1949         * check/varargs.tst, check/varargs.ok: Add one extra
1950         interleaved integer/double test to validate proper code
1951         generation in the extra case.
1952
1953         * check/lightning.c, configure.ac, include/lightning.h,
1954         include/lightning/Makefile.am,
1955         include/lightning/jit_private.h, lib/Makefile.am,
1956         lib/jit_disasm.c: Update for the hppa port.
1957
1958 2013-04-27 Paulo Andrade <pcpa@gnu.org>
1959
1960         * check/varargs.tst: Correct misplaced .align directive
1961         that was causing the double buffer to not be aligned at
1962         8 bytes.
1963         * lib/jit_ia64-cpu.c:
1964           Properly implement abi for excess arguments passed on
1965         stack.
1966           Simplify load/store with immediate displacement argument
1967         with zero value.
1968           Simplify some calls to "subi" changing to "addi" with
1969         a negative argument.
1970           Remove some #if 0'ed code, that could be useful in
1971         special conditions, but the most useful one would be
1972         to "optimize" "static" jit functions, but for the sake
1973         of simplicity, jit functions are implemented in a way
1974         that can be passed back to C code as C function pointers.
1975           Add an attribute to prototypes of several unused functions.
1976         These functions are defined for the sake of implementing all
1977         Itanium documented instructions, but a significant amount of
1978         them is not used by lightning.
1979         * lib/jit_ia64-fpu.c: Simplify load/store with zero immediate
1980         displacement and add unused attribute for functions not used
1981         by lightning, but required to provide macros implementing all
1982         Itanium documented instructions.
1983         * lib/jit_ia64.c: Update for the properly implemented abi
1984         for stack arguments.
1985         * lib/lightning.c: Mark an unused function as such.
1986
1987 2013-04-27 Paulo Andrade <pcpa@gnu.org>
1988
1989         lib/jit_ia64-cpu.c:
1990           Correct immediate range check of integer comparisons when
1991         inverting arguments.
1992           Correct gei_u that was not decrementing immediate when
1993         inverting arguments.
1994           Correct b?add* and b?sub* that were not properly updating
1995         the result register.
1996
1997 2013-04-27 Paulo Andrade <pcpa@gnu.org>
1998
1999         * lib/jit_ia64-cpu.c: Correct wrong mapping of 2 instructions
2000         in "M-, stop, M-, stop" translation, that was ignoring the
2001         last stop (implemented as a nop I- stop).
2002
2003         * lib/jit_ia64-fpu.c: Properly implement fnorm.s and fnorm.d,
2004         as well as the proper integer to float or double conversion.
2005
2006 2013-04-27 Paulo Andrade <pcpa@gnu.org>
2007
2008         * lib/jit_ia64-cpu.c: Correct bogus implementation of ldr_T
2009         for signed integers, that was using ld1.s, ld2.s and ld4.s.
2010         The ".s" stands for speculative load, not sign extend.
2011
2012         * lib/jit_ia64-fpu.c: Correct bogus implementation of ldxr_T
2013         for float and double. The third (actually, second) argument
2014         is indeed added to the base register, but the base register
2015         is modified. The actual M7 implementation was already correct,
2016         just the ldxr_f and ldxr_d implementation that was kept in
2017         a prototype state, misinterpreting what M7 does.
2018
2019 2013-04-27 Paulo Andrade <pcpa@gnu.org>
2020
2021         * lib/jit_ia64-cpu.c: Correct X2 pattern matching by preventing
2022         it to attempt to require a stop between the L and the X
2023         instruction; that is, check the registers and predicates
2024         before emitting the L instruction, not after.
2025
2026         * lib/jit_ia64-fpu.c: Slightly simplify and correct
2027         divr_f and divrd_d implementation.
2028
2029         * check/lightning.c: Add __ia64__ preprocessor define
2030         on Itanium.
2031
2032         * check/alu.inc, check/clobber.tst, check/float.tst: Define
2033         several macros conditionally to __ia64__. This is required
2034         because __ia64__ jit generation can use way too many memory,
2035         due to not implementing instruction reordering to avoid
2036         as much as possible "stops", what causes way too many nops
2037         to be generated, as well as the fact that division and
2038         remainder requires function calls, and float division
2039         requires significant code to implement.
2040
2041 2013-04-27 Paulo Andrade <pcpa@gnu.org>
2042
2043         * include/lightning.h: Add new backend specific movr_w_d,
2044         movr_d_w and movi_d_w codes as helpers to ia64 varargs
2045         functions arguments.
2046
2047         * lib/jit_ia64-cpu.c:
2048           Correct wrong encoding of A5 small integers.
2049           Correct define of "mux" instruction modifiers.
2050           Correct ordering of arguments and predicates of cmp_xy
2051         implementation with immediate arguments; like most other
2052         codes with an immediate, the immediate is the second, not
2053         the third argument.
2054
2055         * lib/jit_ia64-fpu.c: Actual implementation of the code
2056         to move to/from gpr to/from fpr, to implement varargs abi.
2057
2058         * lib/jit_ia64.c: Make fpr argument registers not allocatable
2059         as temporaries, no need for the extra checks when there are
2060         plenty registers.
2061
2062         * lib/jit_print.c, lib/lightning.c: Minor updates for the
2063         new movr_w_d, movr_d_w and movi_d_w codes.
2064
2065 2013-04-26 Paulo Andrade <pcpa@gnu.org>
2066
2067         * lib/jit_ia64-cpu.c, lib/jit_ia64-fpu.c: Correct code to
2068         also insert a stop to break an instruction group if a
2069         register is written more than once in the same group.
2070         This may happen if a register is argument and result of
2071         some lightning call (not a real instruction). The most
2072         common case should be code in the pattern:
2073                 movl rn=largenum
2074                 ...
2075                 mov rn=smallnum
2076         where "rn" would end up holding "largenum".
2077         But the problem possibly could happen in other circumstances.
2078
2079 2013-04-26 Paulo Andrade <pcpa@gnu.org>
2080
2081         * include/lightning/jit_ia64.h, lib/jit_ia64-cpu.c,
2082         lib/jit_ia64-fpu.c, lib/jit_ia64.c:
2083           Relocate JIT_Rn registers to the local registers, as, like
2084         float registers, div/rem and sqrt are implemented as function
2085         calls, and may overwrite non saved scratch registers.
2086           Change patch_at to receive a jit_code_t instead of a
2087         jit_node_t, so that it is easier to "inline" patches when
2088         some instruction requires complex code to implement, e.g.
2089         uneq and ltgt.
2090           Correct arguments to FMA and FMA like instructions that,
2091         due to a cut&paste error were passing the wrong argument
2092         to the related F- implementation function.
2093           Rewrite ltgt to return the proper result if one (or both)
2094         of the arguments is unordered.
2095
2096 2013-04-26 Paulo Andrade <pcpa@gnu.org>
2097
2098         * include/lightning/jit_ia64.h, include/lightning/jit_private.h,
2099         lib/jit_ia64-cpu.c, lib/jit_ia64-fpu.c, lib/jit_ia64.c,
2100         lib/lightning.c: Rework code to detect need of a "stop" to
2101         also handle predicates, as if a predicate is written, it
2102         cannot be read in the same instruction group.
2103           Use a single jit_regset_t variable for all registers when
2104         checking need for a stop (increment value by 128 for
2105         float registers).
2106           Correct wrong "subi" implementation, as the code executed
2107         is r0=im-r1, not r0=r1-im.
2108           Use standard lightning 6 fpr registers, and rework to
2109         use callee save float registers, that may be spill/reloaded
2110         in prolog/epilog. This is required because some jit
2111         instructions implementations need to call functions; currently
2112         integer div/mod and float sqrt, what may change the value of
2113         scratch float registers.
2114           Rework point of "sync" of branches that need to return a
2115         patch'able address, because the need for a "stop" before a
2116         predicate read causes all branches to be the instruction
2117         in slot 0, as there is no template to "stop" and branch
2118         in the same instruction "bundle".
2119
2120 2013-04-25 Paulo Andrade <pcpa@gnu.org>
2121
2122         * include/lightning/jit_ia64.h, lib/jit_ia64-cpu.c,
2123         lib/jit_ia64-fpu.c, lib/jit_ia64.c: New files implementing
2124         the basic infrastructure of an Itanium port. The code
2125         compiles and can generate jit for basic hello world like
2126         functions.
2127
2128         * check/lightning.c, configure.ac, include/lightning.h,
2129         include/lightning/Makefile.am, include/lightning/jit_private.h,
2130         lib/Makefile.am, lib/lightning.c: Update for the Itanium
2131         port.
2132
2133         * lib/jit_mips-cpu.c, lib/jit_mips.c: Correct typo and
2134         make the jit_carry register local to the jit_state_t.
2135         This matches code reviewed in the Itanium port, that
2136         should use the same base logic to handle carry/borrow.
2137
2138 2013-04-10 Paulo Andrade <pcpa@gnu.org>
2139
2140         * include/lightning/jit_private.h, lib/jit_arm.c,
2141         lib/jit_mips-cpu.c, lib/jit_mips.c, lib/jit_ppc-cpu.c,
2142         lib/jit_ppc.c, lib/jit_print.c, lib/jit_sparc-cpu.c,
2143         lib/jit_sparc.c, lib/jit_x86-cpu.c, lib/jit_x86.c,
2144         lib/lightning.c: Change all jit_regset macros to take
2145         a pointer argument, to avoid structure copies when
2146         adding a port to an architecture with more than 64
2147         registers.
2148
2149 2013-04-08 Paulo Andrade <pcpa@gnu.org>
2150
2151         * lib/jit_arm.c, lib/jit_ppc.c: Do not rely on __clear_cache
2152         aligning to the next page boundary the end argument. It may
2153         actually truncate it.
2154
2155 2013-03-29 Paulo Andrade <pcpa@gnu.org>
2156
2157         * include/lightning/jit_private.h, lib/jit_arm.c, lib/jit_memory.c,
2158         lib/jit_mips.c, lib/jit_ppc.c, lib/jit_sparc.c, lib/jit_x86.c,
2159         lib/lightning.c: Do not start over jit generation if can grow
2160         the code buffer with mremap without moving the base pointer.
2161
2162 2013-03-29 Paulo Andrade <pcpa@gnu.org>
2163
2164         * lib/jit_memory.c: Implement a simple memory allocation wrapper
2165         to allow overriding calls to malloc/calloc/realloc/free, as well
2166         as ensuring all memory containing pointers is zero or points to
2167         allocated memory.
2168
2169         * include/lightning.h, include/lightning/jit_private.h: Definitions
2170         for the memory allocation wrapper.
2171
2172         * lib/Makefile.am: Update for new jit_memory.c file.
2173
2174         * lib/jit_arm.c, lib/jit_disasm.c, lib/jit_mips.c, lib/jit_note.c,
2175         lib/jit_ppc.c, lib/jit_sparc.c, lib/jit_x86.c, lib/lightning.c:
2176         Use the new memory allocation wrapper code.
2177
2178 2013-03-22 Paulo Andrade <pcpa@gnu.org>
2179
2180         * configure.ac, include/lightning/jit_private.h, lib/lightning.c:
2181         Remove dependency on gmp. Only a simple bitmap was required, and
2182         that was not enough reason to force linking to gmp and possible
2183         complications caused by it.
2184
2185 2013-03-10 Paulo Andrade <pcpa@gnu.org>
2186
2187         * include/lightning.h: Add check for __powerpc__ defined
2188         in Linux, while Darwin defines __ppc__.
2189
2190         * include/lightning/jit_ppc.h: Adjust register definitions
2191         for Darwin 32 bit and Linux 64 bit ppc usage and/or ABI.
2192
2193         * include/lightning/jit_private.h: Add proper check for
2194         Linux __powerpc__ and an data definition for an workaround
2195         to properly handle code that starts with a jump to a "main"
2196         label.
2197
2198         * lib/jit_disasm.c: Add extra disassembler initialization
2199         for __powerpc64__.
2200
2201         * lib/jit_ppc-cpu.c: Add extra macros and functions, and
2202         correct/adapt previous ones to handle powerpc64.
2203
2204         * lib/jit_ppc-fpu.c: Adapt for 64 bit wordsize. Basically
2205         add conversion from/to int32/int64 and proper handling of
2206         load/store offsets too large for 32 bit.
2207
2208         * lib/jit_ppc.c: Add calls to 64 bit codes and adaptation
2209         for the PowerPC 64 bit Linux ABI.
2210
2211         * lib/jit_arm.c, lib/jit_mips.c, lib/jit_sparc, lib/jit_x86.c,
2212         lib/lightning.c: Correct off by one error when restarting jit
2213         of a function due to finding too late that needs to spill/reload
2214         some register. Problem was found by accident on a very special
2215         condition during PowerPC 64 code adaptation.
2216
2217 2013-03-08 Paulo Andrade <pcpa@gnu.org>
2218
2219         * check/lightning.c: Add missing ppc preprocessor definition.
2220
2221 2013-03-06 Paulo Andrade <pcpa@gnu.org>
2222
2223         * check/float.tst: Comment out the int to negative infinity
2224         test in mips for the moment because not all Loongson agrees
2225         on the result.
2226
2227         * lib/jit_disasm.c: Add a test instead of an assertion
2228         when loading symbols for disassembly due to a failure with
2229         a simple binutils build in Debian mipsel64.
2230
2231 2013-03-06 Paulo Andrade <pcpa@gnu.org>
2232
2233         * include/lightning/jit_private.h, lib/jit_arm-cpu.c,
2234         lib/jit_arm.c, lib/jit_disasm.c, lib/jit_mips-cpu.c,
2235         lib/jit_mips.c, lib/jit_note.c, lib/jit_ppc-cpu.c,
2236         lib/jit_ppc.c, lib/jit_print.c, lib/jit_sparc-cpu.c,
2237         lib/jit_sparc.c, lib/jit_x86-cpu.c, lib/jit_x86.c,
2238         lib/lightning.c: Add an extra structure for data storage
2239         during jit generation, and release it after generating
2240         jit, to reduce a bit memory usage, and also to make it
2241         easier to understand what data is available during
2242         jit runtime.
2243
2244 2013-03-06 Paulo Andrade <pcpa@gnu.org>
2245
2246         * lib/lightning.c: Make data and code buffer readonly.
2247
2248 2013-02-20 Paulo Andrade <pcpa@gnu.org>
2249
2250         * doc/body.texi: Fool proof validate the examples of what
2251         an assembly-language programmer would write and correct the
2252         wrong sparc example.
2253
2254 2013-02-19 Paulo Andrade <pcpa@gnu.org>
2255
2256         * doc/body.texi: Add back the SPARC code generation example.
2257
2258 2013-02-19 Paulo Andrade <pcpa@gnu.org>
2259
2260         * check/lightning.c: Remove state flag to work with partial
2261         sparc port, by just disassembling if there was incomplete
2262         code generation.
2263
2264         * jit_sparc-cpu.c: Correct wrong range check for immediate
2265         integer constants (off by one bit shift).
2266           Correct macro implementing equivalent "rd %y, rd" assembly.
2267           Implement qmul* and qdiv*.
2268
2269         * jit_sparc.c: Update for qmul* and qdiv* and remove logic
2270         to handle incomplete code generation during sparc port.
2271
2272 2013-02-18 Paulo Andrade <pcpa@gnu.org>
2273
2274         * check/float.tst: Add sparc to list of known NaN and +-Inf
2275         to integer conversion.
2276
2277         * check/lightning.c: Define __sparc__ to preprocessor in
2278         the sparc backend.
2279
2280         * include/lightning/jit_private.h: Correct wrong definition
2281         of emit_stxi_d, that has lived for a long time, but would
2282         cause problems whenever needing to spill/reload a float
2283         register.
2284
2285         * include/lightning/jit_sparc.h: Can only use %g2,%g3,%g4
2286         for scratch variables, as other "global" registers are
2287         reserved for the system, e.g. libc.
2288           Reorder float register naming to make it easier to
2289         access odd float registers, so that generating code for
2290         pusharg and getarg is easier for the IR.
2291
2292         * lib/jit_mips-cpu.c, lib/jit_ppc-cpu.c: Update to match
2293         new code in jit_sparc-cpu.c. It must call jit_get_reg
2294         with jit_class_nospill if using the register to move
2295         an unconditional branch address to it, as the reload
2296         will not happen (actually could happen in the delay
2297         slot...)
2298
2299         * lib/jit_sparc-cpu.c: Correct wrong macro definition for
2300         ldxr_s.
2301           Properly implement div* and implement rem. Div* needs
2302         to use the y register, and rem* needs to be synthesized.
2303           Correct b?sub* macro definitions.
2304
2305         * lib/jit_sparc-fpu.c: Correct reversed float to/from double
2306         conversion.
2307           Correct wrong jit_get_reg call asking for a gpr and then
2308         using the fpr with that number.
2309           Correct wrong branch displacement computation for
2310         conditional branches.
2311
2312         * lib/jit_sparc.c: Correct getarg_d and pushargi_d implementation.
2313           Add rem* entries to the switch converting IR to machine code.
2314
2315         * lib/lightning.c: Correct a problem detected when adding
2316         the jit_class_nospill flag to jit_get_reg, that was caused
2317         when having a branch to an "epilog" node, what would cause
2318         the code to think all registers in unknown state were live,
2319         while in truth, all registers in unknown state in the
2320         "just after return" point are actually dead.
2321
2322 2013-02-17 Paulo Andrade <pcpa@gnu.org>
2323
2324         * include/lightning/jit_sparc.h, lib/jit_sparc-cpu.c,
2325         lib/jit_sparc-fpu.c, lib/jit_sparc.c: New files implementing
2326         the basic framework of the sparc port.
2327
2328         * configure.ac, include/lightning.h, include/lightning/Makefile.am,
2329         include/lightning/jit_private.h, lib/jit_disasm.c: Update
2330         for the sparc port framework.
2331
2332         * lib/jit_mips.c: Correct reversed retr/reti logic.
2333
2334         * lib/jit_ppc.c: Correct misspelled __LITTLE_ENDIAN.
2335
2336         * lib/lightning.c: Always do byte hashing in hash_data, because
2337         the logic to "compress" strings causes large pointers to not
2338         be guaranteed aligned at 4 byte boundaries.
2339           Update for the sparc port framework.
2340
2341 2013-02-11 Paulo Andrade <pcpa@gnu.org>
2342
2343         * lib/jit_arm.c: Correct jit_pushargi_f in the arm hardfp abi.
2344         Most of the logic uses even numbered register numbers, so that
2345         a float and a double can be used in the same register, but
2346         the abi requires packing the float arguments, so jit_pushargi_f
2347         needs to allocate a temporary register to modify only the
2348         proper register argument (or be very smart to push two
2349         immediate arguments if applicable).
2350
2351 2013-02-11 Paulo Andrade <pcpa@gnu.org>
2352
2353         * include/lightning.h, lib/lightning.c: Implement the new
2354         jit_clear_state and jit_destroy_state calls. jit_clear_state
2355         releases all memory not required during jit_execution; that
2356         is, leaves only the mmap'ed data and code buffers allocated.
2357         jit_destroy_state releases the mmap'ed buffers as well as
2358         the jit_state_t object itself, that holds pointers to the
2359         code and data buffers, as well as annotation pointers (for
2360         disassembly or backtrace) in the data buffer.
2361
2362         * lib/jit_note.c: Correct invalid vector offset access.
2363
2364         * check/ccall.c, check/lightning.c, doc/ifib.c, doc/incr.c,
2365         doc/printf.c, doc/rfib.c, doc/rpn.c: Use the new jit_clear_state
2366         and jit_destroy_state calls, to demonstrate the new code to
2367         release all jit memory.
2368
2369         * doc/body.texi: Add basic documentation and usage description
2370         of jit_clear_state and jit_destroy_state.
2371
2372 2013-02-11 Paulo Andrade <pcpa@gnu.org>
2373
2374         * include/lightning/jit_private.h, lib/jit_note.c, lib/lightning.c:
2375           Store all annotation information in the mmap'ed area reserved for
2376         read only data. This adds code to not allocate memory for jit_note_t
2377         objects, and to relocate jit_line_t objects and its contents after
2378         calculating annotation information. The jit_line_t objects are
2379         relocated because it is not possible to always calculate before
2380         hand data layout because note information may be extended or
2381         redundant entries removed, as well as allowed to be added in
2382         non sequential order.
2383           A bug was also corrected in _jit_set_note, that was causing it
2384         to allocate new jit_line_t objects when not needed. It was still
2385         working correctly, but allocating way more memory than required.
2386
2387 2013-02-05 Paulo Andrade <pcpa@gnu.org>
2388
2389         *include/lightning.h, lib/lightning.c: Add the new jit_live code
2390         to explicitly mark a register as live. It is required to avoid
2391         assuming functions always return a value in the gpr and fpr return
2392         register, and to avoid the need of some very specialized codes
2393         that vary too much from backend to backend, to instruct the
2394         optimization code the return register is live.
2395
2396         * lib/jit_arm.c, lib/jit_mips.c, lib/jit_ppc.c, lib/jit_print.c,
2397         lib/jit_x86.c: Update for the new jit_live code.
2398
2399         * check/ret.ok, check/ret.tst: New files implementing a simple
2400         test case that would previously fail at least in ix86/x86_64.
2401
2402         * check/Makefile.am: Update for new "ret" test case.
2403
2404 2013-02-05 Paulo Andrade <pcpa@gnu.org>
2405
2406         * lib/jit_ppc-cpu.c, lib/jit_ppc.c: Validate and correct
2407         problems in the qmul and qdiv ppc implementation.
2408
2409 2013-02-04 Paulo Andrade <pcpa@gnu.org>
2410
2411         * include/lightning.h, include/lightning/jit_private.h,
2412         lib/jit_arm-cpu.c, lib/jit_arm.c, lib/jit_mips-cpu.c,
2413         lib/jit_mips.c, lib/jit_ppc-cpu.c, lib/jit_ppc.c,
2414         lib/jit_x86-cpu.c, lib/jit_x86.c, lib/lightning.c:
2415         Implement the new qmul and qdiv instructions that return signed
2416         and unsigned lo/hi multiplication result and div/rem division result.
2417         These should be useful for jit translation of code that needs to
2418         know if a multiplication overflows (no branch opcode added) or if
2419         a division is exact (easy check if remainder is zero).
2420
2421         * check/lightning.c, lib/jit_print.c, check/Makefile.am,
2422         check/all.tst: Update for the new qmul and qdiv instructions.
2423
2424         * check/qalu.inc, check/qalu_div.ok, check/qalu_div.tst,
2425         check/qalu_mul.ok, check/qalu_mul.tst: New files implementing
2426         simple test cases for qmul and qdiv.
2427
2428 2013-01-30 Paulo Andrade <pcpa@gnu.org>
2429
2430         * doc/body.texi: Correct "jmpi" description that incorrectly
2431         told it was possible to pass any address as jump target. The
2432         only way to do that is "movi+jmpr".
2433
2434 2013-01-30 Paulo Andrade <pcpa@gnu.org>
2435
2436         * lib/jit_x86-cpu.c: Correct undefined behavior code.
2437         http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56143
2438
2439 2013-01-29 Paulo Andrade <pcpa@gnu.org>
2440
2441         * configure.ac: Use AC_CONFIG_HEADERS instead of AC_CONFIG_HEADER
2442         to have HAVE_CONFIG_H defined with latest aclocal.
2443
2444         * include/lightning/jit_private.h, lib/lightning.c: Add new
2445         abstraction to use an heuristic to calculate amount of space
2446         required for jit generation, and code to reallocate buffer if
2447         did miscalculate it.
2448
2449         * lib/jit_arm.c, lib/jit_mips.c, lib/jit_ppc.c, lib/jit_x86.c:
2450         Update to use new code to estimate and resize of required buffer
2451         for jit code.
2452
2453         * lib/jit_x86-cpu.c: Minor cosmetic change to avoid adding a
2454         non required rex prefix when calling a function pointer stored
2455         in a register.
2456
2457 2013-01-24 Paulo Andrade <pcpa@gnu.org>
2458
2459         * check/Makefile.am: "make debug" target should pass only
2460         the main test tool program as argument for running gdb
2461
2462         * configure.ac: Add the --enable-assertions options.
2463
2464         * doc/Makefile.am, doc/body.texi, doc/lightning.texi:
2465         Major rewrite of the documentation to match the current
2466         implementation.
2467
2468         * doc/version.texi: Automatic date update.
2469
2470         * doc/ifib.c, doc/incr.c, doc/printf.c, doc/rfib.c, doc/rpn.c:
2471         Implementation of the documentation examples, that are also
2472         compiled during a normal build.
2473
2474         * doc/p-lightning.texi, doc/porting.texi, doc/toc.texi,
2475         doc/u-lightning.texi, doc/using.texi: These files were
2476         renamed in the documentation rewrite, as the documentation
2477         was significantly trimmed due to full removal of the porting
2478         chapters. Better porting documentation should be added but
2479         for the moment it was just removed the documentation not
2480         matching the implementation.
2481
2482 2013-01-18 Paulo Andrade <pcpa@gnu.org>
2483
2484         * lib/jit_note.c: Correct bounds check and wrong code keeping
2485         a pointer that could be changed after a realloc call.
2486
2487 2013-01-18 Paulo Andrade <pcpa@gnu.org>
2488
2489         * check/3to2.tst, check/add.tst, check/allocai.tst, check/bp.tst,
2490         check/call.tst, check/ccall.c, check/clobber.tst, check/divi.tst,
2491         check/fib.tst, check/ldsti.tst, check/ldstr-c.tst, check/ldstr.tst,
2492         check/ldstxi-c.tst, check/ldstxi.tst, check/ldstxr-c.tst,
2493         check/ldstxr.tst, check/lightning.c, check/rpn.tst, check/stack.tst,
2494         check/varargs.tst, include/lightning.h,
2495         include/lightning/jit_private.h, lib/jit_arm.c, lib/jit_disasm.c,
2496         lib/jit_mips.c, lib/jit_note.c, lib/jit_ppc.c, lib/jit_print.c,
2497         lib/jit_x86.c, lib/lightning.c: Extend the "jit_note" abstraction
2498         with the new "jit_name" call, that receives a string argument, and
2499         should usually be called to mark boundaries of functions of code
2500         generating jit (that is, it is not expected that the language
2501         generating jit map its functions to jit functions).
2502
2503 2013-01-17 Paulo Andrade <pcpa@gnu.org>
2504
2505         * check/add.tst, check/allocai.tst, check/bp.tst, check/divi.tst,
2506         check/fib.tst, check/lightning.c, include/lightning/jit_arm.h,
2507         include/lightning/jit_mips.h, include/lightning/jit_ppc.h,
2508         include/lightning/jit_private.h, include/lightning/jit_x86.h:
2509         Make JIT_RET, JIT_FRET and JIT_SP private. These should not be
2510         used in any operations due to frequently having special
2511         constraints (usually JIT_FRET). JIT_FP must be made available
2512         because it must be used as the base register to access stack
2513         space allocated with jit_allocai.
2514
2515 2013-01-14 Paulo Andrade <pcpa@gnu.org>
2516
2517         * include/lightning.h, lib/lightning.c: Add an extra align
2518         argument to the jit_data call (that should be made private),
2519         so that it should not align strings at 8 bytes.
2520           Correct the jit_note call to include the null ending byte
2521         when adding label/note names to the "jit data section".
2522
2523 2013-01-11 Paulo Andrade <pcpa@gnu.org>
2524
2525         * lib/jit_note.c: New file implementing a simple string+integer
2526         annotation, that should be used to map filename and line number
2527         to offsets in the generated jit.
2528
2529         * include/lightning.h, lib/lightning.c: Update for the new
2530         note code.
2531           Add an extra mandatory argument to init_jit, that is used
2532         as argument to bfd_openr.
2533           Change from generic void* to char* the argument to jit_note
2534         and add an extra integer argument, to map to filename and
2535         line number.
2536
2537         * check/ccall.c, check/lightning.c, include/lightning/jit_private.h,
2538         lib/jit_arm.c, lib/jit_disasm.c, lib/jit_mips.c, lib/jit_ppc.c,
2539         lib/jit_print.c, lib/jit_x86.c: lib/Makefile.am: Update for the
2540         new annotation code.
2541
2542         * configure.ac, check/Makefile.am: Update to work with latest
2543         automake.
2544
2545 2013-01-09 Paulo Andrade <pcpa@gnu.org>
2546
2547         * include/lightning.h, lib/jit_arm.c, jit_mips-fpu.c,
2548         lib/jit_mips.c, lib/jit_print.c, lib/jit_x86.c, lib/lightning.c:
2549         Remove the jit_code_getarg_{f,d} and jit_code_pusharg{i,r}_{f,d}
2550         calls, replacing them with the new, internal only, jit_movr_w_f,
2551         jit_mov{r,i}_f_w, jit_movr_ww_d, and jit_mov{i,r}_d_ww, that
2552         better describe the operation being done, and allow removing
2553         the hackish code to detect special conditions for arm when
2554         moving from/to vfp from/to a grp register pair.
2555         Rename jit_code_retval_{f,d} to jit_code_x86_retval_{f,d} as
2556         it is specific to 32 bit x86, and used to move abi return
2557         value in x87 register to a sse register.
2558
2559 2013-01-05 Paulo Andrade <pcpa@gnu.org>
2560
2561         * check/cccall.c, check/ccall.ok: New test case to validate
2562         interleaved calls from/to C code and jit.
2563
2564         * check/Makefile.am: Update for the new ccall test case.
2565
2566         * include/lightning.h, lib/lightning.c: Add the new jit_address
2567         call that returns the real/final address of a "note" in the
2568         generated jit. It requires a jit_node_t as returned by the
2569         jit_note call, and is only valid after calling jit_emit.
2570           Add an intermediate solution to properly handle arm
2571         soft and softfp modes that move a double to an integer register
2572         pair. Currently it just adds extra tests for the condition,
2573         but the proper solution should be to have extra lightning
2574         codes for these conditions, codes which should be only used
2575         by the backends that need it, and merged with the existing
2576         jit_pusharg*_{f,d}.
2577
2578         * include/lightning/jit_private.h: Add new jit_state_t flag
2579         to know it finished jit_emit, so that calls to jit_address
2580         are valid.
2581
2582         * lib/jit_mips.c: Correct abi implementation so that the
2583         new ccall test case pass. Major problem was using
2584         _jit->function.self.arg{i,f} as boolean values, but that
2585         would cause lightning.c:patch_registers() to incorrectly
2586         assume only one register was used as argument when calling
2587         jit_regarg_p(); _jit->function.self.arg{i,f} must be the
2588         number of registers used as arguments (in all backends).
2589
2590         * lib/jit_x86.c: Add workaround, by marking %rax as used,
2591         to a special condition, when running out of registers and the
2592         allocator trying to spill and reload %rax, but %rax was used
2593         as a pointer to a function, what would cause the reload to
2594         destroy the return value. This condition can be better
2595         generalized, but the current solution is good enough.
2596
2597         * include/lightning/jit_ppc.h, lib/jit_ppc-cpu.c, lib/jit_ppc.c:
2598         Rewrite logic to handle arguments, as the original code was
2599         written based on a SysV pdf about the generic powerpc ABI,
2600         what did "invent" a new abi for the previous test cases, but
2601         failed in the new ccall test in Darwin PPC. Now it properly
2602         handles 13 float registers for arguments, as well as proper
2603         computation of stack offsets when running out of registers
2604         for arguments.
2605
2606 2013-01-02 Paulo Andrade <pcpa@gnu.org>
2607
2608         * check/float.tst: Correct test case to match ppc also
2609         converting positive infinity to 0x7fffffff.
2610
2611         * lib/jit_arm-swf.c: Correct typos with double underscores.
2612
2613         * lib/lightning.c: Correct remaining wrong reverse jump logic.
2614
2615 2012-12-29 Paulo Andrade <pcpa@gnu.org>
2616
2617         * lib/lightning.c: Correct both, wrong and confusing logic
2618         to compute the reverse of a jump. Now it properly matches
2619         C semantics for "eq" (==) and "ne" (!=) and correct computation
2620         of reverse of "uneq" as "gt".
2621
2622         * check/branch.tst: Update "ne" float branch check that
2623         previously happened to be wrongly tested with a NaN argument.
2624
2625 2012-12-29 Paulo Andrade <pcpa@gnu.org>
2626
2627         * check/float.ok, check/float.tst: New test cases implementing
2628         extensive validation of float comparison and branch code
2629         generation as well as integer conversion, involving NaN and
2630         [+-]Inf.
2631
2632         * lib/jit_arm-swf.c, lib/jit_x86-sse.c, lib/jit_x86-x87.c:
2633         Correct bugs found by new float test case.
2634
2635         * lib/jit_x86.c: Correct cut&paste error added in commit to
2636         convert jit_arg* return value to a jit_node_t*, that would
2637         cause it to not properly handle double arguments in ix86.
2638
2639         * check/Makefile.am: Update for the new test case.
2640
2641 2012-12-28 Paulo Andrade <pcpa@gnu.org>
2642
2643         * check/lightning.c, include/lightning.h, lib/jit_arm.c,
2644         lib/jit_mips.c, lib/jit_ppc.c, lib/jit_print.c, lib/jit_x86.c,
2645         lib/lightning.c: Change return value of jit_arg{,_f,_d} to
2646         a jit_node_t* object, that should be used as argument to
2647         jit_getarg_{c,uc,s,us,i,ui,l,f,d}. This just requires changing
2648         from jit_int32_t to jit_pointer_t (or jit_node_t*) the "handle"
2649         for the getarg calls, with the benefit that it makes it easy
2650         to implement patching of the stack address of non register
2651         arguments, this way allowing to implement variable size stack
2652         frames if applicable; useful if there are too many registers and
2653         jit functions uses only a few callee save registers.
2654
2655 2012-12-27 Paulo Andrade <pcpa@gnu.org>
2656
2657         * lib/jit_arm.c, lib/jit_mips-cpu.c, lib/jit_mips.c: Correct
2658         regressions when patching jit_calli for a forward function.
2659
2660         * lib/jit_ppc-cpu.c: Correct wrong arguments to ANDI opcode
2661         in jit_getarg_u{c,s} implementation.
2662
2663 2012-12-23 Paulo Andrade <pcpa@gnu.org>
2664
2665         * check/call.ok, check/call.tst: New test cases to validate
2666         simple typed argument and return values in function calls.
2667
2668         * check/lightning.c: Properly handle jit_movi of labels for
2669         backward and forward code labels.
2670
2671         * check/Makefile.am: Update for new test case.
2672
2673 2012-12-23 Paulo Andrade <pcpa@gnu.org>
2674
2675         * check/carry.ok, check/carry.tst: New test case to validate
2676         carry condition handling.
2677
2678         * check/Makefile.am: Update for new test case.
2679
2680 2012-12-22 Paulo Andrade <pcpa@gnu.org>
2681
2682         * lib/jit_ppc-cpu.c, lib/jit_ppc.c: Implement logic for
2683         jit_htonr for big endian, so that ppc (big endian) pass the
2684         new clobber.tst test case.
2685
2686 2012-12-22 Paulo Andrade <pcpa@gnu.org>
2687
2688         * lib/jit_arm.c: Correct use of wrong argument offset
2689         variable in armv7l or float/double argument for varargs
2690         function in armv7hl.
2691           Correct jit_getarg* logic in software float mode to
2692         match expected behavior in other backends, that is, if
2693         a function is not called, it is safe to use a few lightning
2694         calls before a next jit_getarg* call, as done in the test
2695         case check/stack.tst. The proper solution should be to
2696         extend the parser in lib/lightning.c to check if there is
2697         some float operation that will call some (libgcc?) function,
2698         but software float arm should be a very uncommon backend for
2699         lightning, so, just load the already in place arguments
2700         saved to stack, assuming the register argument was clobbered
2701         (what should not be the case most times...).
2702
2703 2012-12-22 Paulo Andrade <pcpa@gnu.org>
2704
2705         * check/clobber.ok, check/clobber.tst: New test case doing
2706         extensive validation tests to ensure registers not used in
2707         a operation are not clobbered.
2708
2709         * check/Makefile.am: Update for new test case.
2710
2711 2012-12-21 Paulo Andrade <pcpa@gnu.org>
2712
2713         * lib/lightning.c: Partially rewrite/revert code to compute
2714         initial register live state at the start of a basic block.
2715         The original logic was corrupted when adding optimizations
2716         to do as few computations as possible in jit_update. The
2717         reglive field must be always a known set of live registers
2718         at the start of a basic block. The value that was incorrect
2719         was the regmask field, that must be the set of registers
2720         that are in unknown state, because they are not known live,
2721         neither set (or possibly not set) in the basic block, and
2722         *must* store the state at the start of the basic block.
2723
2724 2012-12-20 Paulo Andrade <pcpa@gnu.org>
2725
2726         * include/lightning/jit_ppc.h: Correct mismatch of JIT_F{1,5}
2727         with enum codes, that were correct, and returned by jit_f().
2728
2729         * lib/jit_ppc-cpu.c, lib/jit_ppc-fpu.c, lib/jit_ppc.c: Properly
2730         implement and better describe values when generating stack
2731         frames.
2732
2733 2012-12-18 Paulo Andrade <pcpa@gnu.org>
2734
2735         * check/stack.ok, check/stack.tst: New files to test data
2736         integrity on a deep chain of stack frames.
2737
2738         * lib/jit_arm.c, lib/jit_arm-cpu.c, lib/jit_mips.c,
2739         lib/jit_mips-cpu.c, lib/jit_ppc.c, lib/jit_ppc-cpu.c,
2740         lib/jit_x86.c, lib/jit_x86-cpu.c: Calculate _jit->function->stack
2741         in the emit stage, otherwise it will calculate it wrong if
2742         need to jit_allocai space to spill registers.
2743
2744         * lib/lightning.c: Correct wrong offset when updating the
2745         "current" jit function pointer in the code that may need to
2746         allocate stack space to spill registers.
2747
2748         * check/lightning.c: Correct off by one data space check.
2749
2750         * check/Makefile.am: Update for new test case.
2751
2752 2012-12-17 Paulo Andrade <pcpa@gnu.org>
2753
2754         * check/fop_abs.ok, check/fop_abs.tst, check/fop_sqrt.ok,
2755         check/fop_sqrt.tst: New files implementing simple test cases
2756         for the extra float operations.
2757
2758         * check/Makefile.am: Update for new test cases.
2759
2760         * check/alu.inc: Add an extra macro to check for unordered
2761         equality on tests where it is expected to use NaN as an
2762         argument.
2763
2764         * check/lightning.c: Minor change for proper/common argument
2765         syntax handling ommiting arguments to options.
2766
2767 2012-12-17 Paulo Andrade <pcpa@gnu.org>
2768
2769         * check/Makefile.am: Automatically generate pattern list
2770         of tests with alternate jit generation options. This should
2771         prevent typos and needing to change multiple places after
2772         a change.
2773
2774 2012-12-14 Paulo Andrade <pcpa@gnu.org>
2775
2776         * check/lightning.c: Remove the ".cpu name value" syntax,
2777         as it was not able to do proper changes before the jit
2778         internal data structure was initialized. Now it supports
2779         several getopt options to force using different jit
2780         generation options, effectively replacing the previous
2781         syntax.
2782
2783         * check/run-test: Add simple extra logic to handle differently
2784         named test scripts, used to test things like x87 coprocessor
2785         in ix86, and arm instruction set or software float in armv7l.
2786
2787         * configure.ac: Add some AC_RUN_IFELSE calls to figure at
2788         compile time if can test different code generation options,
2789         and update Makefile generation accordingly.
2790
2791         * check/Makefile.am, lib/jit_arm.c, lib/jit_x86.c: Update to
2792         properly work with the test tool updating the jit_cpu global
2793         information.
2794
2795         * check/check.arm.sh, check/check.swf.sh, check/check.x87.sh:
2796         New wrapper files passing -mthumb=0, mvfp=0 and -mx87=1 to
2797         the test tool, if applicable, so that it can validate alternate
2798         code generation options on test hosts that support them.
2799
2800 2012-12-14 Paulo Andrade <pcpa@gnu.org>
2801
2802         * lib/jit_x86-x87.c, lib/jit_x86.c: Correct test cases in ix86
2803         when using the x87 coprocessor instead of sse2+.
2804
2805 2012-12-14 Paulo Andrade <pcpa@gnu.org>
2806
2807         * include/lightning.h, include/lightning/jit_private.h,
2808         lib/jit_arm.c, lib/jit_mips.c, lib/jit_ppc.c, lib/jit_x86.c,
2809         lib/lightning.c: Make jit_ellipsis implementation not
2810         backend specific. It is not intended to handle va_list
2811         like objects at runtime, as jit_arg* and jit_getarg*
2812         return constant values resolved at parse time, so, effectively
2813         it is not possible to create printf like jit functions, as
2814         there is no va_start, va_arg, va_end, etc, abstraction. This
2815         limitation should be kept for the sake of making new ports
2816         easier.
2817
2818 2012-12-14 Paulo Andrade <pcpa@gnu.org>
2819
2820         * include/lightning.h, lib/lightning.c: Add two extra wrapper
2821         functions to avoid need for excess pointer to/from word casts.
2822
2823         * check/lightning.c: Only need for pointer to/from word cast
2824         now is jit_movi, update accordingly.
2825
2826 2012-12-13 Paulo Andrade <pcpa@gnu.org>
2827
2828         * check/varargs.ok, check/varargs.tst: New test cases implementing
2829         simple varargs calls with a large amount of arguments to exercise
2830         excess arguments on stack.
2831
2832         * include/lightning.h: Include config.h if HAVE_CONFIG_H is
2833         defined.
2834
2835         * lib/jit_arm.c: Allocate a fpr register, not a gpr one for
2836         temporary when pushing varargs arguments in the stack.
2837
2838         * lib/jit_arm-swf.c: Correct code changing the wrong offset
2839         in jit_absr_d and jit_negr_d in software float.
2840
2841         * lib/jit_mips.c: Correct calculation of offsets of arguments
2842         on stack.
2843
2844         * lib/jit_ppc.c: Correct bogus logic for "next" offset of arguments
2845         on stack and adjust for fixed offset of stack arguments.
2846
2847 2012-12-12 Paulo Andrade <pcpa@gnu.org>
2848
2849         * include/lightning.h, lib/jit_arm.c, lib/jit_mips.c,
2850         lib/jit_ppc.c, lib/jit_x86.c, lib/lightning.c: Change jit_prepare
2851         to no longer receive an argument. If receiving an argument, it
2852         should be an ABI specifier, not a boolean if varargs or not,
2853         and add the new jit_ellipsis call, to specify where the
2854         ellipsis is in the C prototype of the function being called.
2855         Note that currently it is not supported to define varargs
2856         functions and it will be ignored if calling jit_ellipsis not
2857         in a prepare/finish* block, but this should be addressed.
2858
2859         * check/allocai.tst, check/alu_add.tst, check/alu_and.tst,
2860         check/alu_com.tst, check/alu_div.tst, check/alu_lsh.tst,
2861         check/alu_mul.tst, check/alu_neg.tst, check/alu_or.tst,
2862         check/alu_rem.tst, check/alu_rsh.tst, check/alu_sub.tst,
2863         check/alu_xor.tst, check/alux_add.tst, check/alux_sub.tst,
2864         check/bp.tst, check/branch.tst, check/cvt.tst, check/divi.tst,
2865         check/fib.tst, check/ldsti.tst, check/ldstr-c.tst,
2866         check/ldstr.tst, check/ldstxi-c.tst, check/ldstxi.tst,
2867         check/ldstxr-c.tst, check/ldstxr.tst, check/rpn.tst,
2868         check/lightning.c: Update for the change to jit_prepare and
2869         addition of jit_ellipsis.
2870
2871 2012-12-11 Paulo Andrade <pcpa@gnu.org>
2872
2873         * lib/jit_ppc-cpu.c: Make movr a function that checks arguments
2874         so that other code can safely assume it is a noop if src and dst
2875         are the same register.
2876           Implement rem{r,i}{,_u} as a div{,u}/mul/sub.
2877           Correct ANDIS, ORIS and XORIS calls to cast the argument to
2878         unsigned before the shift to avoid an assertion if the argument
2879         had the topmost bit set.
2880           Implement lshi, rshi and rshi_u as functions to test for a
2881         zero argument, that would otherwise trigger an assertion when
2882         computing the shift value.
2883           Do a simple implementation of bm{s,c}{r,i} with a temporary,
2884         "andr" of arguments and jump based on comparison with zero.
2885           Correct typo in ldxi_c.
2886
2887         * lib/jit_ppc-fpu.c: Correct wrong arguments to FDIV* and STF*.
2888
2889         * lib/jit_ppc.c: Correct wrong check for 6 instead of 8 integer
2890         arguments in registers. If calling a varargs function and
2891         passing a float or double argument, also either store the
2892         value in the stack or in integer registers, as varargs functions
2893         do not fetch it from float registers.
2894           Add "case" for new functions and incorrectly missing ones.
2895           Call libgcc's __clear_cache, that should know what to do
2896         if the hardware needs flushing cache before execution.
2897
2898         * lib/lightning.c: Do a simple/trivial logic in jit_regset_scan1,
2899         that should make it easier for the compiler to optimize it, and
2900         that also corrects the previously wrong code for big endian, and
2901         that was causing problems in ppc due to not saving all callee save
2902         registers as it was not "finding" them in the regset due to the
2903         little endian assumption bug.
2904
2905 2012-12-11 Paulo Andrade <pcpa@gnu.org>
2906
2907         * configure.ac: Only default to using the builtin disassembler
2908         if on GNU/Linux. This should be temporary, due to requiring
2909         /proc/self/exe.
2910           Correctly check $target_cpu for powerpc.
2911
2912         * include/lightning/jit_ppc.h: Correctly implement jit_v_num.
2913
2914         * include/lightning/jit_private.h: Declare proper prototype
2915         for jit_init_debug and jit_finish_debug.
2916
2917         * lib/jit_ppc-cpu.c: Remove code to save/restore callee save
2918         float registers, as it is not required since those float
2919         registers are not usable currently.
2920           Change prolog and epilog generation to, at least comparing
2921         code, match what gcc generates in "gcc -O0", but it is still
2922         failing in Darwin PPC, apparently due to the __clear_cache
2923         call not being enough, as frequently it will also fail to
2924         execute, and the code buffer is all zeroes.
2925
2926         * lib/lightning.c: Do not fail in jit_regset_scan1 calls due
2927         to passing 64 as argument on computers with 64 registers.
2928
2929 2012-12-10 Paulo Andrade <pcpa@gnu.org>
2930
2931         * lib/jit_mips-cpu.c: Correct all current test cases.
2932           Call the "xori" not the "XORI" macro for jit_xori implementation,
2933         as the XORI macro handles only 16 bit unsigned values.
2934           Call the "movr" macro, not the "movi" macro in the special
2935         case of adding or subtracting zero.
2936           Use the proper temporary register in the jit_andr implementation.
2937
2938 2012-12-09 Paulo Andrade <pcpa@gnu.org>
2939
2940         * check/alu.inc, check/alu_add.ok, check/alu_add.tst,
2941         check/alu_and.ok, check/alu_and.tst, check/alu_com.ok,
2942         check/alu_com.tst, check/alu_div.ok, check/alu_div.tst,
2943         check/alu_lsh.ok, check/alu_lsh.tst, check/alu_mul.ok,
2944         check/alu_mul.tst, check/alu_neg.ok, check/alu_neg.tst,
2945         check/alu_or.ok, check/alu_or.tst, check/alu_rem.ok,
2946         check/alu_rem.tst, check/alu_rsh.ok, check/alu_rsh.tst,
2947         check/alu_sub.ok, check/alu_sub.tst, check/alu_xor.ok,
2948         check/alu_xor.tst, check/alux_add.ok, check/alux_add.tst,
2949         check/alux_sub.ok, check/alux_sub.tst, check/branch.ok,
2950         check/branch.tst: New test cases for arithmetic and branch
2951         tests.
2952
2953         * check/Makefile.am: Update for new test cases.
2954
2955         * include/lightning/jit_private.h: Make the jit_reg_free_p
2956         macro shared by all backends. Previously was added for the
2957         arm backend, but is useful in the x86_64 backend when checking
2958         state of "special purpose register".
2959         Also add the new jit_class_named register class, that must be
2960         or'ed with the register value if calling jit_get_reg expecting
2961         an specific value, because the specific register value may be
2962         zero, that previously was treated as no register requested.
2963
2964         * lib/jit_arm-cpu.c: Correct argument order for T2_MVN.
2965
2966         * lib/jit_arm-swf.c: Call the proper function for double
2967         divide. The "software float" implementation just calls
2968         libgcc functions.
2969
2970         * lib/jit_arm.c: Return float/double values in the float
2971         register if using the hard float ABI.
2972
2973         * lib/jit_x86-cpu.c: Change the can_sign_extend_int_p macro
2974         to not include -0x80000000L, because there is code that
2975         "abuses" it and thinks it can negate the immediate value
2976         after calling that macro.
2977           Correct implementation of jit_subi that had a wrong code
2978         patch logic doing subtraction with reversed arguments.
2979           Correct REX prefix calculation in the jit_muli implementation.
2980           Correct logic to get/unget %*ax and %*dx registers in divremr
2981         and divremi.
2982           Correct divremi that was using the symbolic, unique %*ax
2983         value in on place (not using the _REGNO name suffix).
2984           Correct cut&paste error causing it to use "xor" instead of
2985         "or" in one code path of the jit_ori implementation.
2986           Correct several flaws when clobbering registers and/or when
2987         one of the arguments was %*cx in the rotshr wrapper function
2988         implementing most shift operations.
2989
2990         * lib/lightning.c: No longer expect that the backend be smart
2991         enough to know what to do when asking for a named register
2992         if that register is already an argument or is live. It fails
2993         if it is an argument, or if register is live, fails if cannot
2994         spill.
2995           No longer incorrectly assume that eqr_{f,d} and ltgr_{f,d} are
2996         safe to inverse value tests in jump thread optimization.
2997
2998 2012-12-05 Paulo Andrade <pcpa@gnu.org>
2999
3000         * check/Makefile.am, check/cvt.ok, check/cvt.tst: Add new
3001         "cvt" test case to test conversion from/to int/float types.
3002
3003         * check/lightning.c: Only define truncr_{f,d}_l in 64 bit mode.
3004
3005         * include/lightning.h: Correct typo that caused it to define
3006         jit_truncr_{f,d}_l in 32 bit mode.
3007
3008         * lib/jit_arm-cpu.c: Avoid assertion failure in the signed/unsigned
3009         extend opcodes generation as it shares an interface for 3 argument
3010         opcode generation.
3011
3012         * lib/jit_x86-cpu.c: Correct wrong argument passed to
3013         jit_unget_reg in the andi implementation and wrong byte
3014         unsigned extend code generation.
3015
3016         * lib/jit_x86-sse.c: Correct conversion from "word" to float or
3017         double as is dependent on wordsize.
3018
3019 2012-12-05 Paulo Andrade <pcpa@gnu.org>
3020
3021         * check/ldstr-c.ok, check/ldstr-c.tst, check/ldstxi-c.ok,
3022         check/ldstxi-c.tst, check/ldstxr-c.ok, check/ldstxr-c.tst:
3023         New test case files testing load clobbering the base and/or
3024         index register;
3025
3026         * check/ldst.inc: New file with common definition for all the
3027         ldst* test cases.
3028
3029         check/Makefile.am, check/ldsti.tst, check/ldstr.tst,
3030         check/ldstxi.tst, check/ldstxr.tst: Update for new common
3031         definitions file and new register clobber ldst tests.
3032
3033 2012-12-05 Paulo Andrade <pcpa@gnu.org>
3034
3035         * lib/jit_mips-fpu.c: Correct wrong register order in stxr_{f,d}
3036         in the mips backend.
3037
3038 2012-12-05 Paulo Andrade <pcpa@gnu.org>
3039
3040         * lib/jit_arm-vfp.c: Correct regression found in armv7l with
3041         latest test cases.
3042
3043 2012-12-05 Paulo Andrade <pcpa@gnu.org>
3044
3045         * check/ldstxi.tst, check/ldstxr.tst: Correct wrong argument
3046         order for 32 bit mode tests.
3047
3048         * configure.ac: Correct check for ix86 target_cpu.
3049
3050 2012-12-05 Paulo Andrade <pcpa@gnu.org>
3051
3052         * check/ldstr.ok, check/ldstr.tst, check/ldsti.ok,
3053         check/ldsti.tst, check/ldstxr.ok, check/ldstxr.tst,
3054         check/ldstxi.ok, check/ldstxi.tst:
3055         New test case files exercising a very large amount of
3056         register combinations to verify load/store implementation.
3057
3058         * check/Makefile.am: Update for new test cases.
3059
3060         * lib/jit_x86-cpu.c: Correct wrong argument order when
3061         computing REX prefix for {ld,st}r_T codes;
3062
3063 2012-12-04 Paulo Andrade <pcpa@gnu.org>
3064
3065         * lib/jit_mips-fpu.c, lib/jit_mips.c: Implement missing mips
3066         jit_sqrtr_{f,d} codes.
3067
3068         * check/all.tst, include/lightning.h, lib/jit_print.c: Change
3069         declaration order and call order in all.tst of {add,sub}c and
3070         {add,sub}x. *c must be called before to set the carry and *x
3071         second to use the carry and keep it set. The wrong call order
3072         was causing all.tst to fail in mips, where a register is
3073         allocated to keep a global carry state.
3074
3075 2012-12-04 Paulo Andrade <pcpa@gnu.org>
3076
3077         * include/lightning/jit_mips.h, lib/jit_mips-cpu.c,
3078         lib/jit_mips-fpu.c, lib/jit_mips.c: Correct float/double
3079         argument handling and make the mips backend pass the initial
3080         test cases.
3081
3082         * include/lightning.h, ib/jit_print.c, lib/lightning.c:
3083         Add extra enum values for argument handling functions that
3084         could not be abstracted to the current codes, that is, when
3085         float values need to move from/to gpr from/to fpr. It would
3086         be more tempting to add such primitives, but they would have
3087         wordsize limitations, and it is not expected to add codes
3088         with one gpr argument for 64 bit and two for 32 bit.
3089
3090         * lib/jit_ppc.c: Check _jit->function before calling jit_epilog()
3091         to avoid a runtime exception.
3092
3093 2012-12-04 Paulo Andrade <pcpa@gnu.org>
3094
3095         * include/lightning/jit_mips.h, lib/jit_mips.c: Update to
3096         make the mips backend compile in a qemu image.
3097
3098         * lib/jit_ppc.c: Minor adaptations to help in having the
3099         ppc backend compilable.
3100
3101 2012-12-03 Paulo Andrade <pcpa@gnu.org>
3102
3103         * configure.ac, include/lightning/jit_private.h, lib/jit_arm-cpu.c,
3104         lib/jit_arm-swf.c, lib/jit_arm.c, check/Makefile.am: Correct
3105         implementation of the arm backend port to build and pass the
3106         current test cases. Tested on armv7 with softfp abi.
3107
3108         * lib/jit_disasm.c: Rename and change prototype of static
3109         disassemble function as in the arm backend it is required
3110         to access state information stored in the jit_state_t object.
3111
3112         * check/3to2.tst, check/add.tst: Correct test case code assuming
3113         JIT_RO and JIT_RET are the same, and even if they are the same,
3114         the logic was incorrect because it must always call jit_retval*
3115         to fetch a function call return before any other instruction.
3116         The arm backend hash a special condition if jit_retval is not
3117         called, because "r0" is not JIT_R0, but is JIT_RET and *also*
3118         the first argument for a called function, so JIT_RET must be
3119         only used as an argument to jit_retval.
3120
3121 2012-12-03 Paulo Andrade <pcpa@gnu.org>
3122
3123         * check/all.tst, check/lightning.c: Only declare or use 64 bit
3124         interfaces on 64 bit builds.
3125
3126         * check/fib.tst: Use simpler logic to not need preprocessor
3127         conditionals for 32 or 64 bit.
3128
3129         * include/lightning.h: Only declare 64 bit macros on a 64 bit
3130         build. Code using lightning must know about wordsize and the
3131         jit generation limitations, also, this way it generates a
3132         compile time failure, not a runtime assertion.
3133
3134         * include/lightning/jit_x86.h: Correct typo in macro name.
3135
3136         * lib/jit_arm.c, lib/jit_arm-cpu.c, lib/jit_mips.c,
3137         lib/jit_mips-cpu.c, lib/jit_ppc.c, lib/jit_ppc-cpu.c,
3138         lib/jit_x86.c, lib/jit_x86-cpu.c: Correct wrong code to get
3139         current jit function pointer.
3140
3141         * lib/lightning.c: Move call to the simplify() optimization
3142         to after register liveness is known. Previous code did work
3143         by accident but now with proper test cases the problem was
3144         noticed.
3145
3146         * lib/jit_disasm.c: Always cast bfd_vma to long long when
3147         passing it as printf argument.
3148
3149 2012-12-03 Paulo Andrade <pcpa@gnu.org>
3150
3151         * configure.ac, check/Makefile.am, check/check.sh,
3152         doc/Makefile.am, include/lightning/Makefile.am,
3153         lib/Makefile.am: Correct make distcheck.
3154
3155 2012-12-02 Paulo Andrade <pcpa@gnu.org>
3156
3157         * lib/jit_ppc.c: Assign copyright ownership to FSF.
3158
3159         * lib/jit_x86-cpu.c: Correct integer multiplication that was
3160         generating code with reversed register arguments.
3161
3162         * check/rpn.ok, check/rpn.tst: New test case file.
3163
3164 2012-12-02 Paulo Andrade <pcpa@gnu.org>
3165
3166         * lib/jit_x86-cpu.c, lib/jit_x86-sse.c, lib/jit_x86-x87.c:
3167         Actually change copyright owner to FSF as avertised.
3168
3169         *  lib/jit_arm-cpu.c,  lib/jit_arm-swf.c,
3170         lib/jit_arm-vfp.c, lib/jit_arm.c,
3171         lib/jit_mips-cpu.c, lib/jit_mips-fpu.c, lib/jit_mips.c,
3172         lib/jit_ppc-cpu.c, lib/jit_ppc-fpu.c, lib/jit_ppc.c: New
3173         files implementing initial code different jit backends.
3174
3175         * include/lightning/jit_private.h: Add extra field to the
3176         private jit_patch_t type, required by the arm port.
3177
3178         * lib/Makefile.am: Update for the new backend implementation
3179         files.
3180
3181 2012-12-02 Paulo Andrade <pcpa@gnu.org>
3182
3183         * check/Makefile.am: Add proper "make clean" rule and missing
3184         check.sh to EXTRA_DIST.
3185
3186 2012-12-02 Paulo Andrade <pcpa@gnu.org>
3187
3188         * .gitignore: Update pattern of ignored files.
3189
3190         * check/Makefile.am: Add rule to build liblightning.la dependency
3191         in case of running "make check" before building the library.
3192
3193 2012-12-02 Paulo Andrade <pcpa@gnu.org>
3194
3195         * lightning/Makefile.am, lightning/asm-common.h,
3196         lightning/core-common.h, lightning/fp-common.h,
3197         lightning/funcs-common.h, lightning/i386/Makefile.frag,
3198         lightning/i386/asm-32.h, lightning/i386/asm-64.h,
3199         lightning/i386/asm.h, lightning/i386/core-32.h,
3200         lightning/i386/core-64.h, lightning/i386/core.h,
3201         lightning/i386/fp-32.h, lightning/i386/fp-64.h,
3202         lightning/i386/fp.h, lightning/i386/funcs.h,
3203         lightning/ppc/asm.h, lightning/ppc/core.h,
3204         lightning/ppc/fp.h, lightning/ppc/funcs.h,
3205         lightning/sparc/asm.h, lightning/sparc/core.h,
3206         lightning/sparc/fp.h, lightning/sparc/funcs.h:
3207         Removed. The core logic is used in the new code, and new mips
3208         and arm ports will be added. At first, sparc will not be
3209         supported as it has not yet been ported to the new engine.
3210
3211 2012-12-02 Paulo Andrade <pcpa@gnu.org>
3212
3213         * tests/Makefile.am, tests/3to2.c, tests/3to2.ok, tests/add.c,
3214         tests/add.ok, tests/allocai.c, tests/allocai.ok, tests/bp.c,
3215         tests/bp.ok, tests/divi.c, tests/divi.ok, tests/fib.c, tests/fib.ok,
3216         tests/fibdelay.c, tests/fibdelay.ok, tests/fibit.c, tests/fibit.ok,
3217         tests/funcfp.c, tests/funcfp.ok, tests/incr.c, tests/incr.ok,
3218         tests/ldst.c, tests/ldst.ok, tests/ldxi.c, tests/ldxi.ok,
3219         tests/modi.c, tests/modi.ok, tests/movi.c, tests/movi.ok,
3220         tests/printf.c, tests/printf.ok, tests/printf2.c, tests/printf2.ok,
3221         tests/ret.c, tests/ret.ok, tests/rpn.c, tests/rpn.ok, tests/rpnfp.c,
3222         tests/rpnfp.ok, tests/sete.c, tests/sete.ok, tests/testfp.c,
3223         tests/testfp.ok, tests-run-test: Removed previous test suite, in
3224         favor of a newer one in the check subdirectory.
3225
3226         * check/3to2.ok, check/3to2.tst, check/add.ok, check/add.tst,
3227         check/allocai.ok, check/allocai.tst, check/bp.ok, check/bp.tst,
3228         check/divi.ok, check/divi.tst, check/fib.ok, check/fib.tst:
3229         New sample input for the new test program, loosely matching
3230         several of the previous test cases.
3231
3232         * check/Makefile.am: New test suite makefile.
3233
3234         * check/check.sh, check/run-test: New wrapper files for the
3235         new test suite.
3236
3237         * check/lightning.c: New file. The main driver of the new test
3238         suite, that compiles to a parser of a very simple assembly like
3239         language, generates jit and executes it.
3240
3241         * check/all.tst: New file. A generic debug and sample test file
3242         with a directive to prevent it from being executed, and useful to
3243         read disassembly of all possible instructions, using a fixed set
3244         of registers.
3245
3246         * include/Makefile.am, include/lightning.h,
3247         include/lightning/Makefile.am, include/lightning/jit_arm.h,
3248         include/lightning/jit_mips.h, include/lightning/jit_ppc.h,
3249         include/lightning/jit_private.h, include/lightning/jit_x86.h,
3250         lib/Makefile.am, lib/jit_disasm.c, lib/jit_print.c,
3251         lib/jit_x86-cpu.c, lib/jit_x86-sse.c, lib/jit_x86-x87.c,
3252         lib/jit_x86.c, lib/lightning.c: New files. These files are
3253         written from scratch, only by <pcpa@gnu.org>, and have now
3254         copyright assignment to the FSF. This is the core of the new
3255         lightning rework. Previously it was integrated in code with
3256         a garbage collector and several custom types like vectors and
3257         hash tables, so this first code merge with lightning converts
3258         that code into a library extracting only the jit bits, and at
3259         first only for x86_64 GNU/Linux.
3260
3261         * lightning.h, m4/lightning.m4: Removed. These are no longer
3262         required in the new lightning code.
3263
3264         .gitignore, Makefile.am, configure.ac: Update for the new
3265         lightning code.
3266
3267 2012-12-02 Paulo Andrade <pcpa@gnu.org>
3268         * .cvsignore: Removed for extra cleanup.
3269
3270         * build-aux: Rename directory to m4.
3271
3272         * m4: Renamed to "default" name and for consistency with merge
3273         with code rework to be imported in lightning.
3274
3275         * .gitignore, configure.ac, Makefile.am, doc/Makefile.am:
3276         Update for build-aux to m4 rename.
3277
3278 2012-12-01 Paulo Andrade <pcpa@gnu.org>
3279
3280         * opcode/Makefile.am, opcode/Makefile.in, opcode/ansidecl.h,
3281         opcode/bfd.h, opcode/dis-asm.h, opcode/dis-buf.c, opcode/disass.c,
3282         opcode/i386-dis.c, opcode/i386.h, opcode/ppc-dis.c, opcode/ppc-opc.c,
3283         opcode/ppc.h, opcode/sparc-dis.c, opcode/sparc-opc.c, opcode/sparc.h,
3284         opcode/sysdep.h: Removed. Do not bundle GNU binutils files.
3285
3286         * aclocal.m4, configure, Makefile.in, config.h.in, doc/Makefile.in,
3287         lightning/Makefile.in, tests/Makefile.in: Removed. Do not maintain
3288         autogenerated files that also generate too much diff noise when
3289         regenerated in git.
3290
3291         * build-aux/help2man, build-aux/texinfo.tex, build-aux/texi2dvi:
3292         Removed. Buildenvironment must have an up to date version from
3293         upstream installed.
3294
3295         * build-aux/config.guess, build-aux/config.sub, build-aux/depcomp,
3296         build-aux/install-sh build-aux/mdate-sh build-aux/missing: Removed.
3297         Do not maintain a copy of automake files in git. Release tarballs
3298         must use an up to date version.
3299
3300         * lightningize.in, doc/lightningize.1: Removed. Do not encourage
3301         bundling lightning in other packages. It should use a system package
3302         or a proper thirdy part subdirectory.
3303
3304         * INSTALL: Removed. Autoreconf removes it and creates a symlink
3305         when regenerating files, so, avoid conflicts in git and let
3306         automake create the symlink.
3307
3308         * .gitignore: Add INSTALL and autogenerated files.
3309
3310         * configure.ac, Makefile.am: Update for removal of opcode subdir,
3311         auto generated files and lightningize.
3312
3313         * tests/Makefile.am, tests/3to2.c, tests/add.c, tests/bp.c,
3314         tests/fib.c, tests/fibdelay.c, tests/fibit.c, tests/funcfp.c,
3315         tests/incr.c, tests/printf.c, tests/rpn.c, tests/rpnfp.c,
3316         tests/sete.c, tests/testfp.c: Update for removal of opcode subdir.
3317
3318         * doc/Makefile.am: Update for removal of lightningize.
3319
3320         * configure.ac, lightning/ppc/funcs.h, lightning/sparc/funcs.h,
3321         lightning/i386/fp.h, lightning/i386/core.h, lightning/i386/asm.h,
3322         tests/3to2.c, tests/add.c, tests/bp.c, tests/fib.c, tests/fibdelay.c,
3323         tests/fibit.c, tests/funcfp.c, tests/incr.c, tests/printf.c,
3324         tests/rpn.c, tests/rpnfp.c, tests/sete.c, tests/testfp.c:
3325         Remove LIGHTNING_CROSS, it is half supported and incomplete.
3326
3327         * tests/3to2.c, tests/funcfp.c, tests/rpnfp.c: Remove preprocessor
3328         check on JIT_FPR. If no hardware registers are available, the backend
3329         must provide an alternative for software float.
3330
3331         * lightning/ppc/core.h, lightning/sparc/core.h, tests/Makefile.am:
3332         Remove JIT_NEED_PUSH_POP. It is absolutely not trivial to implement
3333         properly on some backends due to stack alignment constraints, and
3334         whenever it is required, using jit_allocai and using a properly
3335         aligned stack vector, or a heap buffer, is better.
3336
3337         * tests/push-pop.c, tests/push-pop.ok: Removed due to
3338         JIT_NEED_PUSH_POP no longer available.
3339
3340 2011-02-28  Paolo Bonzini  <bonzini@gnu.org>
3341
3342         * lightning/i386/core-64.h: Add jit_add{c,x}{i,r}_l, jit_mulr_{l,ul}_,
3343         fix jit_mul{i,r}_{l,ul}.
3344
3345 2010-08-20  Paolo Bonzini  <bonzini@gnu.org>
3346
3347         * lightning/i386/fp-64.h: Return patch address from jit_bXYr_{f,d}.
3348         Reported by Paulo César Pereira de Andrade.
3349         * lightning/ppc/fp.h: Likewise.
3350         * lightning/sparc/fp.h: Implement FP branches.
3351
3352 2010-08-18  Paolo Bonzini  <bonzini@gnu.org>
3353
3354         * lightning/i386/fp-64.h: Fix jp in jit_bner_{f,d}.
3355
3356 2010-08-18  Paolo Bonzini  <bonzini@gnu.org>
3357
3358         * lightning/i386/fp-32.h: Fix -D_ASM_SAFETY compilation.
3359         Reported by Paulo César Pereira de Andrade.
3360
3361 2010-08-15  Paolo Bonzini  <bonzini@gnu.org>
3362
3363         * tests/ldst.c: Update.
3364         * tests/Makefile.am: Use -ffloat-store to compile it.
3365
3366 2010-08-15  Paolo Bonzini  <bonzini@gnu.org>
3367
3368         * lightning/i386/core.h (jit_ldr_c, jit_ldxr_c, jit_ldr_s,
3369         jit_ldxr_s): Move...
3370         * lightning/i386/core-32.h: ... here.
3371         * lightning/i386/core-64.h (jit_ldr_c, jit_ldxr_c, jit_ldr_s):
3372         Use movsbq and movswq.
3373
3374 2010-08-10  Paulo César Pereira de Andrade <pcpa@mandriva.com.br>
3375
3376         * lightning/i386/core-32.h (jit_replace): Use MOVLrr, not MOVLir.
3377         (jit_movbrm): Check index register as well.
3378         * lightning/i386/fp-64.h: Add jit_extr_f_d and jit_extr_d_f.
3379         * lightning/fp-common.h: Add jit_extr_f_d and jit_extr_d_f.
3380
3381 2010-07-28  Paolo Bonzini  <bonzini@gnu.org>
3382
3383         * tests/Makefile.am: Add ldst test.
3384         * tests/Makefile.in: Regenerate.
3385         * tests/ldst.c: New.
3386         * tests/ldst.ok: New.
3387
3388 2010-07-28  Paolo Bonzini  <bonzini@gnu.org>
3389
3390         * THANKS: Add Paulo Cesar Pereira de Andrade.
3391         * doc/porting.texi: Fix ordering of arguments in jit_stxi.
3392         * lightning/i386/core-32.h (jit_replace): Remove cmp argument.
3393         * lightning/i386/fp-64.h (jit_movi_f): Fix.
3394
3395 2010-07-26  Paolo Bonzini  <bonzini@gnu.org>
3396
3397         * lightning/i386/core-32.h (jit_replace): Move here (removed
3398         2009-03-01).
3399
3400 2010-07-19  Paolo Bonzini  <bonzini@gnu.org>
3401
3402         * build-aux/lightning.m4: Always set and replace lightning_frag.
3403         * Makefile.in: Regenerate.
3404         * aclocal.m4: Regenerate.
3405         * config.h.in: Regenerate.
3406         * configure: Regenerate.
3407         * doc/Makefile.in: Regenerate.
3408         * doc/lightningize.1: Regenerate.
3409         * doc/version.texi: Regenerate.
3410         * lightning/Makefile.in: Regenerate.
3411         * opcode/Makefile.in: Regenerate.
3412         * tests/Makefile.in: Regenerate.
3413
3414 2009-03-01  Paolo Bonzini  <bonzini@gnu.org>
3415
3416         * lightning/i386/core-64.h: Use Mike's macros for x86-64 too.
3417         * lightning/i386/core.h: Remove jit_replace.
3418
3419         2009-02-27  Mike Spivey  <mike@comlab.ox.ac.uk>
3420
3421         * lightning/i386/core.h: Rewrite shift-handling macros.
3422         * lightning/fp-common.h: Fix jit_extr_{f_d,d_f}.
3423
3424 2009-02-17  Mike Spivey  <mike@comlab.ox.ac.uk>
3425
3426         * lightning/i386/core.h: Fix blunder in operand order.
3427
3428 2009-02-17  Paolo Bonzini  <bonzini@gnu.org>
3429
3430         * lightning/i386/fp-32.h: Another fix to jit_fp_btest.
3431
3432 2009-02-17  Paolo Bonzini  <bonzini@gnu.org>
3433
3434         * lightning/fp-common.h: Define double branches if missing.
3435         * lightning/i386/asm.h: Define JC and JNC mnemonics.
3436         * lightning/i386/fp-32.h: Fix jit_fp_btest.  All reported
3437         by Mike Spivey.
3438
3439 2008-10-09  Paolo Bonzini  <bonzini@gnu.org>
3440
3441         * lightning/ppc/funcs.h (jit_flush_code): Subtract 1 from end.
3442         Reported by Eli Barzilay and Matthew Flatt.
3443
3444 2008-08-23  Nix  <nix@esperi.org.uk>
3445
3446         * lightning/i386/Makefile.frag: fp-32.h and fp-64.h are target files.
3447
3448 2008-07-02  Laurent Michel  <ldm@engr.uconn.edu>
3449
3450         * lightning/ppc/funcs.h (jit_flush_code): modified the computation
3451         of start/end. The pointer arithmetic was done without casting. It
3452         prevented compilation with recent gcc versions.
3453         * lightning/ppc/core.h (jit_pushr_i): The offset for the store was
3454         incorrect. Should have been 4 bytes below SP (not above).
3455         * lightning/ppc/core.h (jit_popr_i): The offset for the load was
3456         incorrect. Should have been 0 (not +8).
3457
3458 2008-06-17  Paolo Bonzini  <bonzini@gnu.org>
3459
3460         * lightning/i386/asm-64.h: Forward IMULQir to IMULQirr,
3461         fix REXQ order for IMULQirr.
3462
3463 2008-06-17  Paolo Bonzini  <bonzini@gnu.org>
3464
3465         * lightning/i386/core.h: Fix _rN vs. _rR.
3466
3467 2008-06-16  Paolo Bonzini  <bonzini@gnu.org>
3468
3469         * lightning/i386/core.h: Use jit_save in jit_replace.  Move JIT_R
3470         definition...
3471         * lightning/i386/core-32.h: ... here; define jit_save so that
3472         the core.h has no effect on the 32-bit backend.
3473         * lightning/i386/core-64.h: Place JIT_R1/JIT_R2 in R10/R11,
3474         place outgoing arguments in the right spot from the beginning,
3475         define jit_save, fix jit_reg8/jit_reg16.
3476
3477 2008-06-15  Paolo Bonzini  <bonzini@gnu.org>
3478
3479         * lightning/i386/core-64.h: Rewrite argument passing to
3480         support up to 6 arguments and generate less code.
3481
3482 2008-06-14  Laurent Michel  <ldm@thorgal.homelinux.org>
3483
3484         * lightning/i386/core-64.h (jit_movi_l): When the operand is 0,
3485         the XOR should be on a quadword.
3486         * lightning/i386/core-64.h (jit_prolog): Keep 16-byte stack
3487         alignment.
3488         (jit_ret): Always use LEAVE.
3489
3490 2008-06-13  Laurent Michel  <ldm@thorgal.homelinux.org>
3491
3492         * lightning/i386/core-64.h: Add (void) casts for C++ compatibility.
3493         * lightning/i386/asm.h: Likewise.
3494
3495 2008-06-12  Paolo Bonzini  <bonzini@gnu.org>
3496
3497         * lightning/i386/core.h: Move JIT_V definition...
3498         * lightning/i386/core-32.h: ... here.
3499         * lightning/i386/core-64.h: ... and here.  Avoid dancing between
3500         RSI/RDI and R12/R13, and place JIT_V1/JIT_V2 in R12/R13.
3501
3502 2008-06-11  Paolo Bonzini  <bonzini@gnu.org>
3503
3504         * build-aux/lightning.m4: Adjust LIGHTNING_BACKENDS, don't
3505         use suffix support to distinguish i386/x86_64.
3506         * lightning/i386/Makefile.frag: Use LIGHTNING_TARGET_FILES
3507         to distribute *-32.h and *-64.h files now.
3508         * lightning/i386/asm-i386: Moved to...
3509         * lightning/i386/asm.h: Include the appropriate subtarget file.
3510         * lightning/i386/core-i386: Moved to...
3511         * lightning/i386/core.h: Include the appropriate subtarget file.
3512         * lightning/i386/fp.h: New, include the appropriate subtarget file.
3513         * lightning/i386/asm-32: Do not include asm-i386.h.
3514         * lightning/i386/asm-64.h: Likewise.
3515         * lightning/i386/core-32: Do not include core-i386.h.
3516         * lightning/i386/core-64.h: Likewise.
3517         * lightning/Makefile.am: Adjust for renamed files.
3518
3519         * configure.ac: Define LIGHTNING_TARGET here.
3520         * opcode/disass.c: Change list of valid LIGHTNING_TARGET values.
3521
3522         * lightningize.in: Robustify against missing subtarget files.
3523
3524 2008-06-11  Paolo Bonzini  <bonzini@gnu.org>
3525
3526         * lightning/i386/core-32.h: Use MOVLir instead of jit_movi_l
3527         to implement jit_movi_p.
3528
3529 2008-06-11  Paolo Bonzini  <bonzini@gnu.org>
3530
3531         * lightning/i386/core-32.h: Use separate __APPLE__ and SysV
3532         prolog/ret macros.  Subtract 12 bytes in __APPLE__ case to
3533         keep stack aligned, and always use LEAVE in the epilog.
3534
3535 2008-06-11  Paolo Bonzini  <bonzini@gnu.org>
3536
3537         * lightning/i386/core-i386.h: Fix C++ incompatibility.
3538
3539 2008-06-10  Laurent Michel  <ldm@engr.uconn.edu>
3540
3541         * lightning/i386/core-i386.h: Fix jit_replace8 for
3542         case when one of the operands is _EAX.
3543
3544 2008-05-19  Paolo Bonzini  <bonzini@gnu.org>
3545
3546         * tests/run-test: Avoid CRLF issues on mingw.
3547
3548 2008-03-21  Paolo Bonzini  <bonzini@gnu.org>
3549
3550         * lightning/i386/core-64.h: Fix jit_{ld,st}{,x}i_{i,l}.
3551         Remove jit_ld{,x}i_ul.
3552         * lightning/core-common.h: Make jit_ld{,x}{i,r}_ul
3553         always a synonym of the _l variant.
3554         * doc/porting.texi: Document this.
3555
3556 2008-03-19  Paolo Bonzini  <bonzini@gnu.org>
3557
3558         * lightning/i386/core-64.h: Fix uses of jit_qop_.
3559
3560 2008-03-19  Paolo Bonzini  <bonzini@gnu.org>
3561
3562         * lightning/i386/core-64.h: Add boolean operations.
3563
3564 2008-03-19  Paolo Bonzini  <bonzini@gnu.org>
3565
3566         * lightning/i386/asm-64.h: Add LEAQmr.
3567
3568 2008-03-19  Paolo Bonzini  <bonzini@gnu.org>
3569
3570         * lightning/i386/core-64.h: Misc bugfixes.
3571
3572 2008-03-19  Paolo Bonzini  <bonzini@gnu.org>
3573
3574         * lightning/i386/core-i386.c: Remove jit_ldr_i, jit_ldxr_i.
3575         * lightning/i386/core-32.h: Add jit_ldr_i, jit_ldxr_i.
3576         * lightning/i386/core-64.h: Add jit_ld{r,xr,i,xi}_{ui,l,ul};
3577         move jit_ldr_i, jit_ldxr_i, jit_str_l, jit_stxr_l with others.
3578
3579 2008-03-19  Paolo Bonzini  <bonzini@gnu.org>
3580
3581         * lightning/asm-common.h: Add _s32P.
3582
3583 2008-03-19  Paolo Bonzini  <bonzini@gnu.org>
3584
3585         * lightning/i386/core-64.h: Implement long mul/div/mod.
3586
3587 2008-03-19  Paolo Bonzini  <bonzini@gnu.org>
3588
3589         * lightning/i386/asm-i386.h: Cast memory address to long for JCCim.
3590
3591 2008-03-15  Paolo Bonzini  <bonzini@gnu.org>
3592
3593         * lightning/asm-common.h: Add underscores around __unused__
3594         attribute.
3595
3596 2008-03-15  Paolo Bonzini  <bonzini@gnu.org>
3597
3598         * lightning/ppc/core.h: Avoid some "value computed is not used"
3599         warnings.
3600         * lightnings/tests/allocai.c: Silence other warnings.
3601
3602 2008-03-14  Paolo Bonzini  <bonzini@gnu.org>
3603
3604         * lightningize.in: Fix some problems (not all).
3605
3606 2008-03-14  Paolo Bonzini  <bonzini@gnu.org>
3607
3608         * lightning/i386/core-32.h: Avoid some "value computed is not used"
3609         warnings; reported by Sam Steingold.
3610
3611 2008-03-08  Paolo Bonzini  <bonzini@gnu.org>
3612
3613         * lightning/i386/core-32.h: Fix stxr_c(_EAX, _EBX, _ESI).
3614
3615 2008-02-13  Paolo Bonzini  <bonzini@gnu.org>
3616
3617         * lightning/i386/asm-32.h: Avoid redefinition of _r1, reported by
3618         Sam Steingold.
3619         * lightning/i386/asm-64.h: Likewise.
3620
3621 2008-02-08  Paolo Bonzini  <bonzini@gnu.org>
3622
3623         * lightning/i386/asm-i386.h: Don't define _VOID, reported
3624         by Reini Urban.
3625
3626 2008-02-03  Paolo Bonzini  <bonzini@gnu.org>
3627
3628         * build-aux/lightning.m4: Add --with-lightning-prefix option, suggested
3629         by Sam Steingold.
3630
3631 2008-01-14  Paolo Bonzini  <bonzini@gnu.org>
3632
3633         * lightning/i386/core-64.h: Use CALLsr, not CALLLsr.
3634
3635 2008-01-13  Paolo Bonzini  <bonzini@gnu.org>
3636
3637         * lightning/i386/core-i386.h: Move jit_calli and jit_callr...
3638         * lightning/i386/core-32.h: ... here.
3639         * lightning/i386/core-64.h: Redefine them.
3640
3641 2008-01-05  Paolo Bonzini  <bonzini@gnu.org>
3642
3643         * lightning/i386/fp-32.h: Fix sub(a,0,a).
3644         * lightning/tests/3to2.c: Add new testcases.
3645         * lightning/tests/3to2.ok: Add new testcases.
3646
3647 2008-01-02  Paolo Bonzini  <bonzini@gnu.org>
3648
3649         * lightning/i386/fp-32.h: Fix sub(a,b,a) with a ~= JIT_FPR0.
3650         * lightning/tests/3to2.c: New.
3651         * lightning/tests/3to2.ok: New.
3652
3653 2007-11-07  Paolo Bonzini  <bonzini@gnu.org>
3654
3655         * opcode/Makefile.am: Fix AM_CPPFLAGS.
3656
3657 2007-08-12  Paolo Bonzini  <bonzini@gnu.org>
3658
3659         * lightning/i386/core-i386.h: Improve encoding of set* instructions.
3660         * lightning/i386/core-64.h: Fix jit_bra_l.
3661         * tests/sete.c: New.
3662         * tests/sete.ok: New.
3663
3664 2007-06-29  Paolo Bonzini  <bonzini@gnu.org>
3665
3666         * tests/bp.c: Upgrade to GPL/LGPLv3.
3667         * lightning/i386/asm-32.h: Upgrade to GPL/LGPLv3.
3668         * lightning/i386/asm-64.h: Upgrade to GPL/LGPLv3.
3669         * lightning/i386/core-32.h: Upgrade to GPL/LGPLv3.
3670         * lightning/i386/core-64.h: Upgrade to GPL/LGPLv3.
3671         * lightning/i386/fp-64.h: Upgrade to GPL/LGPLv3.
3672         * lightning/sparc/asm.h: Upgrade to GPL/LGPLv3.
3673         * lightning/sparc/core.h: Upgrade to GPL/LGPLv3.
3674         * lightning/sparc/fp.h: Upgrade to GPL/LGPLv3.
3675         * lightning/sparc/funcs.h: Upgrade to GPL/LGPLv3.
3676         * lightning/i386/asm-i386.h: Upgrade to GPL/LGPLv3.
3677         * lightning/i386/core-i386.h: Upgrade to GPL/LGPLv3.
3678         * lightning/i386/fp-32.h: Upgrade to GPL/LGPLv3.
3679         * lightning/i386/funcs.h: Upgrade to GPL/LGPLv3.
3680         * lightning/ppc/asm.h: Upgrade to GPL/LGPLv3.
3681         * lightning/ppc/core.h: Upgrade to GPL/LGPLv3.
3682         * lightning/ppc/fp.h: Upgrade to GPL/LGPLv3.
3683         * lightning/ppc/funcs.h: Upgrade to GPL/LGPLv3.
3684         * lightning.h: Upgrade to GPL/LGPLv3.
3685         * tests/add.c: Upgrade to GPL/LGPLv3.
3686         * tests/fib.c: Upgrade to GPL/LGPLv3.
3687         * tests/testfp.c: Upgrade to GPL/LGPLv3.
3688         * tests/fibdelay.c: Upgrade to GPL/LGPLv3.
3689         * tests/fibit.c: Upgrade to GPL/LGPLv3.
3690         * tests/funcfp.c: Upgrade to GPL/LGPLv3.
3691         * tests/incr.c: Upgrade to GPL/LGPLv3.
3692         * tests/printf.c: Upgrade to GPL/LGPLv3.
3693         * tests/printf2.c: Upgrade to GPL/LGPLv3.
3694         * tests/rpn.c: Upgrade to GPL/LGPLv3.
3695         * tests/rpnfp.c: Upgrade to GPL/LGPLv3.
3696         * lightning/asm-common.h: Upgrade to GPL/LGPLv3.
3697         * lightning/core-common.h: Upgrade to GPL/LGPLv3.
3698         * lightning/fp-common.h: Upgrade to GPL/LGPLv3.
3699         * lightning/funcs-common.h: Upgrade to GPL/LGPLv3.
3700         * opcode/dis-buf.c: Upgrade to GPL/LGPLv3.
3701         * opcode/disass.c: Upgrade to GPL/LGPLv3.
3702         * opcode/i386-dis.c: Upgrade to GPL/LGPLv3.
3703         * opcode/sparc-dis.c: Upgrade to GPL/LGPLv3.
3704         * opcode/sparc-opc.c: Upgrade to GPL/LGPLv3.
3705         * lightningize.in: Upgrade to GPL/LGPLv3.
3706         * opcode/bfd.h: Upgrade to GPL/LGPLv3.
3707         * opcode/i386.h: Upgrade to GPL/LGPLv3.
3708         * opcode/sparc.h: Upgrade to GPL/LGPLv3.
3709
3710 2007-01-26  Thomas Girard  <thomas.g.girard@free.fr>
3711
3712         * lightning/Makefile.am: Add clean-local target.
3713
3714 2006-12-02  Paolo Bonzini  <bonzini@gnu.org>
3715
3716         * lightning/i386/asm-i386.h: Add CVTTS?2SIL.
3717         * lightning/i386/asm-64.h: Add CVTTS?2SIQ.
3718         * lightning/i386/fp-64.h: Use it.
3719
3720         * lightning/Makefile.am: Place files in nodist_lightning_HEADERS.
3721
3722 2006-11-23  Paolo Bonzini  <bonzini@gnu.org>
3723
3724         * lightning/core-common.h: Add casts in "*i_p" variants.
3725         * lightning/i386/asm-32.h: Add _r1.
3726         * lightning/i386/asm-64.h: Likewise, and add SSE instructions.
3727         * lightning/i386/asm-i386.h: Merge SSE instructions from Gwenole.
3728         Use short form for 16-bit AX instructions.  Remove _r1
3729         * lightning/i386/core-64.h: Add FP ABI support in its infancy.
3730         * lightning/i386/core-i386.h: Move jit_arg_f and jit_arg_d...
3731         * lightning/i386/core-32.h: ... and jit_prepare_f and jit_prepare_d...
3732         * lightning/i386/fp-32.h: ... here.
3733         * lightning/i386/fp-64.h: Write the code.
3734         * lightning/sparc/fp.h: Fix jit_extr_{f_d,d_f} register order.
3735
3736 2006-11-22  Paolo Bonzini  <bonzini@gnu.org>
3737
3738         * lightning/i386/asm-i386.h: Move x86-64 instructions...
3739         * lightning/i386/asm-64.h: ... here.
3740         * lightning/i386/fp-32.h: Fix bugfixes worked around in froofyJIT.
3741         Add JIT_FPRET.
3742         * lightning/sparc/fp.h: Likewise.
3743         * lightning/ppc/fp.h: Likewise.
3744         * lightning/fp-common.h: Adjust for JIT_FPRET.
3745         * tests/funcfp.c: Adjust for JIT_FPRET.
3746         * tests/rpnfp.c: Adjust for JIT_FPRET.
3747
3748 2006-11-20  Paolo Bonzini  <bonzini@gnu.org>
3749
3750         * lightning/i386/asm-i386.h:  Add an underscore to macros without
3751         a parameter.
3752
3753 2006-11-20  Paolo Bonzini  <bonzini@gnu.org>
3754
3755         * lightning/i386/core-i386.h: Move jit_movip, jit_check8, jit_reg8,
3756         jit_reg16, jit_movbrm...
3757         * lightning/i386/core-32.h: ... here.
3758         * lightning/i386/core-64.h: Redefine them.  Fix other bugs.
3759
3760         * tests/printf.c: Do not do a varargs call.
3761
3762 2006-11-20  Paolo Bonzini  <bonzini@gnu.org>
3763
3764         * lightning/i386/asm-i386.h: Check in rewrite from Basilisk II.
3765         * lightning/i386/asm-32.h: Adjust.
3766         * lightning/i386/asm-64.h: Adjust.
3767         * lightning/i386/fp-32.h: Adjust.
3768
3769         * lightning/i386/core-32.h: Adjust.  Add jit_{ld,ldx,st,stx}i*.
3770         * lightning/i386/core-64.h: Adjust.  Add jit_{ld,ldx,st,stx}i*.
3771         * lightning/i386/core-i386.h: Adjust. Remove these patterns.
3772
3773 2006-11-20  Paolo Bonzini  <bonzini@gnu.org>
3774
3775         * lightning/i386/asm-i386.h: Merge 64-bit cleanliness changes from
3776         mzscheme.
3777         Add SSE.
3778         * lightning/i386/asm-64.h: Likewise.
3779
3780 2006-11-20  Paolo Bonzini  <bonzini@gnu.org>
3781             Ludovic Courtes  <ludo@chbouib.org>
3782
3783         * lightning/i386/core-32.h: Disable jit_push and jit_pop if stack not
3784         needed.
3785         * lightning/i386/core-64.h: Disable jit_push and jit_pop if stack not
3786         needed.
3787         * lightning/sparc/core.h: Merge final implementation of jit_pushr and
3788         jit_popr.
3789         * lightning/ppc/core.h: Fix implementation of jit_pushr and jit_popr to
3790         work (more or less) across function calls.
3791
3792         * tests/push-pop.c, tests/push-pop.ok: New test.
3793         * tests/Makefile.am: Run it.
3794
3795 2006-11-20  Paolo Bonzini  <bonzini@gnu.org>
3796
3797         * lightning/asm-common.h: Make 64-bit safe.
3798         * lightning/i386/funcs.h: Make 64-bit safe.
3799
3800         * lightning/i386/asm-64.h: More merge from mzscheme.
3801         * lightning/i386/asm-i386.h: More merge from mzscheme.
3802         * lightning/i386/core-32.h: More merge from mzscheme.
3803         * lightning/i386/core-64.h: More merge from mzscheme.
3804         * lightning/i386/core-i386.h: More merge from mzscheme.
3805
3806         * tests/rpnfp.c, tests/testfp.c, tests/funcfp.c: Skip if no
3807         floating-point support.
3808
3809 2006-11-04  Paolo Bonzini  <bonzini@gnu.org>
3810
3811         * tests/rpn.c: Remove pushr/popr.
3812
3813 2006-11-04  Paolo Bonzini  <bonzini@gnu.org>
3814
3815         * lightning/ppc/core.h: Implement jit_allocai, define JIT_FP to be R1.
3816         * lightning/ppc/funcs.h: Store frame size into _jitl.  Store R1 before
3817         the STMW, so that the offset is unchanged when we patch the STMW.
3818         * lightning/i386/core.h: Define JIT_FP to be EBP.
3819         * lightning/i386/core-32.h: Implement jit_allocai, put LEAVE in the
3820         epilog if jit_allocai was used.
3821         * lightning/i386/core-64.h: Implement jit_allocai, put LEAVE in the
3822         epilog if jit_allocai was used.
3823
3824 2006-11-04  Ludovic Courtes  <ludo@chbouib.org>
3825
3826         * lightning/sparc/core.h: Implement jit_allocai.
3827         * tests/allocai.c: New.
3828         * tests/Makefile.am: Point to new tests.
3829
3830 2006-11-03  Paolo Bonzini  <bonzini@gnu.org>
3831
3832         * lightning/ppc/core.h: Fix jit_bms using BNE rather than BGT.
3833         "AND." does signed comparisons.
3834
3835 2006-10-31  Paolo Bonzini  <bonzini@gnu.org>
3836
3837         * doc/porting.texi: Rename JIT_FP to JIT_AP.
3838         * lightning/core-common.h: Likewise.
3839         * lightning/i386/core-i386.h: Likewise.
3840         * lightning/fp-common.h: Provide default versions of jit_getarg_[fd].
3841         * lightning/i386/fp-32.h: Don't provide jit_getarg_[fd].
3842         * lightning/ppc/fp.h: Likewise.
3843
3844 2006-10-31  Ludovic Courtes  <ludo@chbouib.org>
3845
3846         * doc/using.texi (The instruction set): Clarified the use of `JIT_RET' and
3847         documented `jit_retval'.
3848         * tests/ret.c (generate_function_proxy): After `jit_finish', use
3849         `jit_retval_i' to move FUNC's return value into the correct register.
3850
3851 2006-10-31  Paolo Bonzini  <bonzini@gnu.org>
3852             Ludovic Courtes  <ludo@chbouib.org>
3853
3854         * tests/divi.c, tests/divi.ok, tests/movi.c, tests/movi.ok: New.
3855         * tests/ldxi.c: Ensure large pointer is generated.
3856         * tests/Makefile.am: Point to new tests.
3857         * lightning.h: Include funcs-common.h before funcs.h.
3858         * lightning/sparc/core.h: Fix bugs in modi/divi.
3859
3860 2006-10-30  Paolo Bonzini  <bonzini@gnu.org>
3861
3862         * lightning/Makefile.am: Use "ln -sf".
3863         * lightning/core-common.h: Define jit_negr_l if necessary.
3864
3865 2006-10-30  Paolo Bonzini  <bonzini@gnu.org>
3866
3867         * lightning/i386/asm.h (MOVS*, MOVZ*): Use correct _r[124] macros.
3868
3869 2006-10-29  Paolo Bonzini  <bonzini@gnu.org>
3870
3871         * configure.ac: Use lightning.m4 macros.
3872         * lightning.m4: Refactor to use common code in configure.ac.  Move...
3873         * build-aux/lightning.m4: ... here.
3874         * lightningize.in: Support suffixes.
3875         * opcode/disass.in: Adapt to changes in configure.ac.
3876
3877         * lightning/ppc/funcs.h: Use __APPLE__ instead of _CALL_DARWIN.
3878         * lightning/i386/core-32.h: Likewise.
3879
3880 2006-10-26  Paolo Bonzini  <bonzini@gnu.org>
3881
3882         * configure.ac: Fix compilation test.
3883         * lightning/Makefile.am: Symlink LIGHTNING_TARGET_FILES in
3884         non-distribution mode.
3885         * lightning/i386/Makefile.frag: Use LIGHTNING_TARGET_FILES.
3886
3887 2006-10-26  Paolo Bonzini  <bonzini@gnu.org>
3888
3889         * configure.ac: Subst cpu.
3890         * lightning/core-common.h: Make tests pass on i386.
3891         * lightning/i386/asm-32.h: Make tests pass on i386.
3892         * lightning/i386/asm-64.h: Make tests pass on i386.
3893         * lightning/i386/asm-i386.h: Make tests pass on i386.
3894         * lightning/i386/core-32.h: Make tests pass on i386.
3895         * lightning/i386/core-64.h: Make tests pass on i386.
3896         * lightning/i386/core-i386.h: Make tests pass on i386.
3897         * tests/Makefile.am: Include files from cpu directory.
3898
3899 2006-10-26  Paolo Bonzini  <bonzini@gnu.org>
3900
3901         * lightning/i386/asm.h: Move to asm-i386.h
3902         * lightning/i386/asm-32.h: New, from Matthew Flatt.
3903         * lightning/i386/asm-64.h: New, from Matthew Flatt.
3904         * lightning/i386/core.h: Move to core-i386.h
3905         * lightning/i386/core-32.h: New, from Matthew Flatt.
3906         * lightning/i386/core-64.h: New, from Matthew Flatt.
3907         * lightning/i386/fp.h: Move to fp-32.h
3908         * lightning/i386/fp-64.h: New, dummy.
3909         * lightning/i386/Makefile.frag: New.
3910         * lightning/Makefile.am: Support per-target Makefile fragments.
3911         * configure.ac: Support per-target Makefile fragments and CPU suffixes.
3912
3913 2006-10-16  Paolo Bonzini  <bonzini@gnu.org>
3914
3915         * lightning/i386/i386.h (jit_flush_code): Fix syntax error. :-(
3916
3917 2006-07-06  Paolo Bonzini  <bonzini@gnu.org>
3918             Ludovic Courtes  <ludovic.courtes@laas.fr>
3919
3920         * doc/using.texi: Clarify "Using autoconf" section
3921         and rename it to "Bundling lightning"
3922         * lightning.m4: Work also if lightning is not bundled.
3923
3924 2006-07-06  Paolo Bonzini  <bonzini@gnu.org>
3925             Ludovic Courtes  <ludovic.courtes@laas.fr>
3926
3927         * lightning/ppc/core.h (_jit_mod): Replace with...
3928         (_jit_mod_big, _jit_mod_small): ... these.
3929         (jit_modi_i, jit_modi_ui): Rewrite.
3930         * tests/modi.c, tests/modi.ok: New tests.
3931
3932 2006-05-18  Matthew Flatt  <mflatt@cs.utah.edu>
3933
3934         * lightning/i386/asm.h: Fix test for extending the mprotect area
3935         towards lower addresses.
3936
3937 2006-05-16  Bruno Haible  <bruno@clisp.org>
3938
3939         * lightning/asm-common.h: Don't use __func__ nor __FUNCTION__ if
3940         not compiling with GNU C.
3941
3942 2006-02-16  Paolo Bonzini  <bonzini@gnu.org>
3943
3944         * lightning/ppc/core.h: Fix jit_ldxi_* with big displacement.
3945
3946 2006-01-23  Paolo Bonzini  <bonzini@gnu.org>
3947
3948         * configure.ac: Fix comments in config.h.in.
3949
3950 2005-11-25  Paolo Bonzini  <bonzini@gnu.org>
3951
3952         * lightning/sparc/fp.h: Fix header comment.
3953         * lightning/ppc/fp.h: Fix header comment.
3954
3955 2005-04-27  Paolo Bonzini  <bonzini@gnu.org>
3956
3957         * lightning/i386/asm.h (JCm, JCSm, JNCm, JNCSm): New.
3958
3959 2004-11-26  Paolo Bonzini  <bonzini@gnu.org>
3960
3961         * lightning/ppc/funcs.h (_jit_epilog): Remove unused variable.
3962
3963 2004-11-13  Paolo Bonzini  <bonzini@gnu.org>
3964
3965         * lightning/i386/funcs.h [__linux__]: Include sys/mman.h.
3966
3967 2004-11-09  Paolo Bonzini  <bonzini@gnu.org>
3968
3969         * lightning/sparc/fp.h: Fix fp-to-integer conversions.
3970         * lightning/ppc/testfp.c: Test fp-to-integer conversions
3971         of integer numbers.
3972         * lightning/ppc/testfp.ok: Adjust for the above.
3973
3974 2004-11-08  Paolo Bonzini  <bonzini@gnu.org>
3975
3976         * lightning/ppc/testfp.c: Always flush code before
3977         testing it.
3978
3979 2004-11-08  Paolo Bonzini  <bonzini@gnu.org>
3980
3981         * lightning/ppc/fp.h: Do not clobber f31.
3982
3983 2004-11-08  Paolo Bonzini  <bonzini@gnu.org>
3984
3985         * lightning.h: New name of...
3986         * lightning-inst.h: ... this file.
3987         * lightning.h.in: Removed.
3988
3989         * opcodes/disass.c: Include config.h.
3990         * tests/add.c: Include config.h.
3991         * tests/bp.c: Include config.h.
3992         * tests/fib.c: Include config.h.
3993         * tests/fibdelay.c: Include config.h.
3994         * tests/fibit.c: Include config.h.
3995         * tests/funcfp.c: Include config.h.
3996         * tests/incr.c: Include config.h.
3997         * tests/printf.c: Include config.h.
3998         * tests/printf2.c: Include config.h.
3999         * tests/rpn.c: Include config.h.
4000         * tests/rpnfp.c: Include config.h.
4001         * tests/testfp.c: Include config.h.
4002
4003 2004-10-12  Paolo Bonzini  <bonzini@gnu.org>
4004
4005         * lightning/i386/fp.h: Fix bugs in conditional branches.
4006
4007 2004-10-10  Paolo Bonzini  <bonzini@gnu.org>
4008
4009         * lightning/i386/funcs.h: Fix pasto in jit_flush_code.
4010
4011 2004-10-08  Paolo Bonzini  <bonzini@gnu.org>
4012
4013         * lightning/ppc/fp.h: Optimized conditional branches.
4014
4015 2004-09-20  Paolo Bonzini  <bonzini@gnu.org>
4016
4017         * lightning/ppc/asm.h: Fix more typos.
4018
4019 2004-09-20  Paolo Bonzini  <bonzini@gnu.org>
4020
4021         * lightning/ppc/asm.h: Fix typos, replace `26' with JIT_AUX.
4022
4023 2004-09-20  Paolo Bonzini  <bonzini@gnu.org>
4024
4025         * lightning/ppc/fp.h: Added conditional branches.
4026
4027 2004-09-18  Laurent Michel  <ldm@thorgal.homelinux.org>
4028
4029         * lightning/ppc/fp.h (jit_unler_d, jit_unltr_d, jit_unger_d,
4030         jit_ungtr_d, jit_ltgt_d, jit_uneq_d): Implemented missing tests
4031         to fully support testfp.
4032         (jit_floorr_d_i, jit_ceilr_d_i, jit_roundr_d_i, jit_truncr_d_i):
4033         New macros.
4034         * lightning/ppc/asm.h: Added missing opcodes FCTIWZ and MTFSFI.
4035         * lightning/ppc/funcs.h (_jit_prolog): Fixed minor mistake in
4036         the initialization of _jitl.nextarg_geti, relying on the
4037         JIT_AUX macro as well to get the register offset.
4038
4039 2004-09-07  Paolo Bonzini  <bonzini@gnu.org>
4040
4041         * lightning/ppc/funcs.h: Fix typo.
4042
4043 2004-09-06  Paolo Bonzini  <bonzini@gnu.org>
4044
4045         * tests/funcfp.c: Use %g.  Remove C99 variable declarations.
4046         * tests/testfp.c: Don't use __builtin_nan.
4047
4048         * lightning/ppc/core.h: Add three V registers.
4049         * lightning/ppc/funcs.h: Adjust.
4050
4051         * lightning/sparc/core.h: Some fixes related to FP argument passing.
4052         Move R0 to %g2, use %o7 for JIT_BIG2.
4053         * lightning/sparc/fp.h: Some fixes related to FP argument passing.
4054
4055 2004-09-02  Paolo Bonzini  <bonzini@gnu.org>
4056
4057         * lightning/sparc/core.h: Add another V register,
4058         move R0 to %o7.
4059
4060 2004-07-15  Paolo Bonzini  <bonzini@gnu.org>
4061
4062         * lightning/i386/funcs.h: Implement jit_flush_code,
4063         in order to support Fedora's exec-shield.
4064
4065 2004-07-14  Paolo Bonzini  <bonzini@gnu.org>
4066
4067         * lightning/core-common.h: Add more jit_extr_*_* macros.
4068         * lightning/doc/using.texi: Be clearer about the order
4069         of arguments in jit_extr_*_*.
4070         * lightning/doc/porting.texi: Add more jit_extr_*_* macros.
4071         * lightning/i386/fp.h: Fix typo in jit_extr_i_d.
4072
4073 2004-07-14  Paolo Bonzini  <bonzini@gnu.org>
4074
4075         * lightning/ppc/funcs.h: Adjust offset of LR into
4076         stack frame if running under the Darwin ABI.
4077
4078 2004-07-13  Paolo Bonzini  <bonzini@gnu.org>
4079
4080         * lightning/i386/fp.h: Rename jit_exti_d to jit_extr_i_d.
4081
4082 2004-07-13  Paolo Bonzini  <bonzini@gnu.org>
4083
4084         * lightning/ppc/core.h: Fix thinko.
4085
4086         * lightning/i386/core.h: Fix jit_lti_ui.
4087         * lightning/core-common.h: Add missing macros.
4088
4089         * lightning/ppc/fp.h: Rename jit_neg_* to jit_negr_*.
4090         * lightning/i386/fp.h: Rename jit_neg_* to jit_negr_*.
4091         * lightning/sparc/fp.h: Rename jit_neg_* to jit_negr_*.
4092         * lightning/fp-common.h: Rename jit_neg_* to jit_negr_*.
4093         * doc/porting.texi: Add undocumented macros.
4094
4095 2004-07-12  Paolo Bonzini  <bonzini@gnu.org>
4096
4097         * doc/porting.texi: Add missing macros.
4098
4099 2004-07-12  Paolo Bonzini  <bonzini@gnu.org>
4100
4101         * lightning/ppc/funcs.h: Don't generate trampolines.
4102         Separate prolog and epilog generation.
4103         * lightning/ppc/core.h: Generate epilog explicitly.
4104         Don't reserve r31 anymore.
4105         * lightning/core-common.h: Remove call to jit_setup_code.
4106
4107 2004-07-09  Paolo Bonzini  <bonzini@gnu.org>
4108
4109         * lightning/lightning.h.in: Avoid preprocessor warnings.
4110         * lightning/lightning-inst.h: Likewise.
4111
4112         * lightning/i386/core.h: Define JIT_R, JIT_R_NUM, JIT_V,
4113         JIT_V_NUM.
4114         * lightning/ppc/core.h: Likewise.
4115         * lightning/sparc/core.h: Likewise.
4116         * lightning/i386/fp.h: Define JIT_FPR, JIT_FPR_NUM.
4117         * lightning/ppc/fp.h: Likewise.
4118         * lightning/sparc/fp.h: Likewise.
4119         * lightning/core-common.h: Define fixed register names.
4120         * lightning/fp-common.h: Likewise for FP regs.
4121
4122 2004-07-09  Paolo Bonzini  <bonzini@gnu.org>
4123
4124         * lightning/ppc/funcs.h: Fix location where return address
4125         is stored.
4126         * lightning/i386/asm.h: Add a trailing _ to opcodes without
4127         any parameter.
4128         * lightning/i386/core.h: Adjust for the above.
4129
4130 2004-04-15  Paolo Bonzini  <bonzini@gnu.org>
4131
4132         * lightning/i386/fp.h: Change "and" to "_and"
4133         to satisfy C++ compilers.
4134
4135 2004-04-14  Paolo Bonzini  <bonzini@gnu.org>
4136
4137         * lightning/sparc/fp.h: Use memcpy to implement jit_movi.
4138         * lightning/ppc/fp.h: Use memcpy to implement jit_movi.
4139         Move floating-point opcodes...
4140         * lightning/ppc/asm.h: ... here.
4141
4142 2004-04-14  Paolo Bonzini  <bonzini@gnu.org>
4143
4144         * lightning/core-common.h: Add jit_finishr.
4145         * lightning/ppc/core.h: Add jit_callr and jit_finishr.
4146         * lightning/i386/core.h: Add jit_callr.
4147         * lightning/sparc/core.h: Add jit_callr.  Fix typo.
4148
4149 2004-04-14  Paolo Bonzini  <bonzini@gnu.org>
4150
4151         * lightning/i386/core.h: Fix pasto in jit_b*_ui.
4152
4153 2004-03-30  Laurent Michel
4154
4155         * lightning/ppc: Implement PowerPC floating point
4156         (ChangeLog entry missing).
4157
4158 2004-03-12  Paolo Bonzini  <bonzini@gnu.org>
4159
4160         * lightning/fp-common.h: Load/store macros are not the
4161         same for floats and doubles anywhere, but jit_retval may be.
4162         * lightning/i386/asm.h: Fix = mistaken for == in ESCrri.
4163         * lightning/i386/core.h: Fix typo in jit_prepare_[fd].
4164         * lightning/i386/fp.h: Rewritten.
4165         * tests/testfp.c: Add tests for unordered comparisons.
4166         * tests/testfp.ok: Add results.
4167
4168 2004-03-15  Paolo Bonzini  <bonzini@gnu.org>
4169
4170         Merge changes from Laurent Michel.
4171
4172         * lightning/asm-common.h: Add _jit_I_noinc.
4173         * lightning/core-common.h: Support jit_init,
4174         jit_setup_code, jit_patch_at.  Return patchable IP from
4175         jit_movi_p.
4176         * lightning/funcs-common.h: Provide defaults
4177         for jit_setup_code, jit_start_pfx, jit_end_pfx
4178         * lightning/i386/core.h: Add jit_patch_at, jit_patch_movi.
4179         * lightning/ppc/core.h: Likewise.
4180         * lightning/sparc/core.h: Likewise.
4181         * lightning/ppc/asm.h: Fix generation of branch destination
4182         displacements in _FB and _BB
4183         * lightning/ppc/core.h: Generate trampolines in the user
4184         area.
4185         * lightning/ppc/funcs.h: Add a few casts.
4186         * tests/bc.c: New testcase.
4187
4188         * lightning/i386/asm.h: Wrap into #ifndef LIGHTNING_DEBUG.
4189         * lightning/ppc/asm.h: Wrap into #ifndef LIGHTNING_DEBUG.
4190         * lightning/sparc/asm.h: Wrap into #ifndef LIGHTNING_DEBUG.
4191
4192
4193 2004-03-09  Paolo Bonzini  <bonzini@gnu.org>
4194
4195         * lightning/sparc/fp.h: Rewrite.  Move macros for
4196         FP code generation...
4197         * lightning/sparc/asm.h: ... here.
4198         * lightning/sparc/core.h: Rename jit_prepare to
4199         jit_prepare_i, jit_retval to jit_retval_i.
4200         * lightning/ppc/core.h: Rename jit_prepare to
4201         jit_prepare_i, jit_retval to jit_retval_i.
4202         * lightning/i386/core.h: Rename jit_prepare to
4203         jit_prepare_i, jit_retval to jit_retval_i.
4204         * lightning/core-common.h: Provide backwards
4205         compatible synonyms for the above.
4206         * lightning/fp-common.h: Rewrite.
4207         * lightning-inst.h: Include fp unconditionally.
4208         * lightning.h.in: Include fp unconditionally.
4209         * tests/Makefile.am: Enable fp tests.
4210         * tests/fib.c: Use jit_retval_i.
4211         * tests/fibit.c: Cast codeBuffer to char *.
4212         * tests/funcfp.c: Use new fp macros.
4213         * tests/printf.c: Use jit_retval_i.
4214         * tests/rpnfp.c: Use new fp macros.
4215         * tests/testfp.c: Use new fp macros.
4216
4217 2004-03-02  Paolo Bonzini  <bonzini@gnu.org>
4218
4219         * lightning/i386/core.h: generate correct code when
4220         doing lt/le/ge/etc. on ESI and EDI.  Use MOVZX/MOVSX
4221         where possible.
4222         * lightning/i386/asm.h: Add macros for MOVZX/MOVSX.
4223         Move macros for x87 here, and add many of them.
4224         * lightning/i386/fp.h: Use new macros for x87.
4225
4226 2004-02-06  Paolo Bonzini  <bonzini@gnu.org>
4227
4228         * lightning/i386/core.h: avoid generating MOV reg, reg.
4229         * lightning/sparc/core.h: fix several bugs.
4230         * lightning/ppc/core.h: fix several bugs.
4231         * tests/rpn.c: rewritten.
4232
4233 2004-01-08  Paolo Bonzini  <bonzini@gnu.org>
4234
4235         * tests/rpnfp.c: new example, suggested by Basile
4236         Starynkevitch.
4237         * tests/rpnfp.ok: new example.
4238
4239 2003-12-12  Paolo Bonzini  <bonzini@gnu.org>
4240
4241         * tests/add.c: new test, suggested by Steve Dekorte.
4242         * tests/add.c: new test.
4243
4244 2003-11-14  Paolo Bonzini  <bonzini@gnu.org>
4245             John Redford <eirenik@hotmail.com>
4246
4247         * lightning/asm-common.h: change the 'pc' field of _jit to
4248         be a union of various data types, because ISO C99 doesn't
4249         permit using ++ on a = cast.  Change the incremented casts of
4250         _jit.pc to be _jit.x.uc_pc, _jit.x.us_pc, etc.
4251         * all files: change all non-cast instances of _jit.pc to be
4252         _jit.x.pc.
4253         * lightning/i386/core.h: remove casts from jit_might.
4254
4255 2003-05-25  Paolo Bonzini  <bonzini@gnu.org>
4256
4257         * lightning/i386/core.h: use JITSORRY in jit_replace
4258         * lightning/asm-common.h: define JITSORRY
4259
4260 2003-05-14  Paolo Bonzini  <bonzini@gnu.org>
4261
4262         * lightning/i386/core.h: fix missing comma in several
4263         load/store macros.
4264         * lightning/core-common.h: fix long/unsigned long/pointer
4265         jit_pushr/jit_popr.
4266         * lightning/ppc/funcs.h: correctly align stack pointer
4267
4268 No changelogs for the assemblers (lightning directory) until 1.0
4269
4270 2003-03-27  Paolo Bonzini  <bonzini@gnu.org>
4271
4272         * tests/printf2.c: new test
4273
4274 2001-05-03  Paolo Bonzini  <bonzini@gnu.org>
4275
4276         * tests/printf.c: made the message platform independent
4277
4278 2001-01-19  Paolo Bonzini  <bonzini@gnu.org>
4279
4280         * configure.in: support cross-assembling
4281
4282         * disass/bfd.h, disass/dis-asm.h, disass/dis-buf.c,
4283         disass/i386-dis.c, disass/i386.h, disass/ppc-dis.c,
4284         disass/ppc.h, disass/ppc-opc.c, disass/sparc-dis.c,
4285         disass/sparc.h, disass/sparc-opc.c: new files, from GDB
4286
4287         * disass/disass.c, disass/Makefile.am: new files
4288
4289         * tests/fib.c, tests/fibit.c, tests/incr.c, tests/printf.c,
4290         tests/rpn.c, tests/testfp.c, tests/Makefile.am: support
4291         disassembling