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