1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 23:29:39 +00:00
Commit Graph

94 Commits

Author SHA1 Message Date
acqn
96d55e3703 Fixed optimization for char-size bitwise XOR/OR/AND when the rhs operand is complicated. 2024-02-02 19:00:33 +08:00
acqn
8b6d78a075 Added Opt_a_tosbitwise for 8-bit bitwise operations. 2021-03-01 22:11:22 +08:00
acqn
6617a017fa Added Opt_a_tossub for 8-bit subtraction. 2021-02-05 17:29:49 +08:00
bbbradsmith
4e411e8526 Opt_a_tosicmp likely has a bug which will incorrectly migrate a label on a replaced op in one case. 2023-02-18 00:13:34 -05:00
bbbradsmith
78263cd24b Fix OptStackOps label migration case for toscmpbool, add test case 2023-02-17 23:48:32 -05:00
mrdudz
5bda57de87 add extra underscore to _bzero, add a test for bzero/memset 2022-08-29 23:20:48 +02:00
acqn
eeaa111835 Fixed crash in Opt_a_toscmpbool caused by wrong order of condition checks. 2021-09-28 17:02:37 +02:00
acqn
4d5fe38540 Fixed OptStackOps when the stuff pushed on stack top is accessed before the op. 2021-06-03 12:03:53 +02:00
acqn
55ae350fed Fixed 'Opt_staxspidx' for the invariant of 'staxspidx'. 2021-02-17 07:03:11 -05:00
Greg King
b2c1a77bb3 Fixed the cc65 code that optimizes 16-bit compares when the high bytes are known to be equal.
Only the low bytes are compared.  Originally, signed 16-bit compares were optimized into signed 8-bit compares.  But, the sign bits are in the high bytes; and, they're equal.  Therefore, the low bytes always must be compared as unsigned numbers.
Fixes #1348.
2020-12-24 12:27:09 -05:00
Polluks
bd6e5927c4 Fixed #1341 2020-11-18 10:28:19 +01:00
acqn
f3771a465d Fixed various issues in the usage-tracking code.
Added some utility functions.
2020-09-27 12:22:05 +02:00
acqn
d379affc4b Moved some reusable code from cc65/coptstop.c into new files. 2020-09-27 12:22:05 +02:00
acqn
66c5faeb9a Added processor flags usage tracking.
Added ZNRegs for tracking what register(s) Z/N flags currently reflect.
Added utility functions to check if the specified processor state is known to be a certain value.
2020-09-13 13:50:35 +02:00
acqn
fe3f267233 Added new runtime sub bcasta/bcastax/bcasteax opposing to bnega/bnegax/bnegeax. 2020-09-11 13:33:54 +02:00
acqn
41cee0eb44 Extended support for more addressing modes in tos* optimizations. 2020-09-08 14:19:48 +02:00
acqn
7553b60ef0 Improved OptStackOps for optimizating further when operands have equal hi-bytes. 2020-09-08 14:19:48 +02:00
acqn
539924249b More complete fix for Issue #1071. 2020-07-07 18:28:56 +02:00
acqn
286da30a26 Quick fix for Issue #1071. 2020-07-07 18:28:56 +02:00
acqn
53eb6a948d No more duplicated stores by Opt_tosshift which could result in worse optimizations. 2020-06-22 23:23:39 +02:00
acqn
49c5cfd65b Improved fix for Issues #167 and #784 and somehow #781. 2020-06-22 23:23:39 +02:00
acqn
48d3578c24 Fixed Issue #784. 2020-06-22 23:23:39 +02:00
acqn
a7a8426a90 Just keep Lhs loads in OptStackOps and leave them to OptUnusedLoads,
whilst Rhs loads must be removed for OptStackOps to work right.
Fixed Issue #167 as well as similar issues with tosshift.
2020-06-22 23:23:39 +02:00
IrgendwerA8
37f80534c9 Fix for #830 supplied by UvB 2019-04-25 15:19:53 +02:00
IrgendwerA8
dcbe03f23b Adjusted to the current multiline-comment style. 2019-04-02 16:34:22 +02:00
IrgendwerA8
1530020a1f Fix for multiplication optimization issue #367 2019-04-02 16:34:22 +02:00
Piotr Fusik
b31ae57be1 Make some arrays const. 2017-06-28 20:43:31 +02:00
Oliver Schmidt
d0e0b98b43 Revert "Equality problem (Ullrich von Bassewitz)".
Uz classifies his own fix as broken:

http://www.cc65.org/mailarchive/2015-01/11721.html

Although the original issue fixed seemed rather significant looking
back now the regression caused by the (broken) fix seems even more
significant :-(

(reverted from commit 55815ea10c)

======================================================================

Equality problem (Ullrich von Bassewitz)

Neil Stockbridge reported a problem with equality comparisons on
cc65.org's mailing list:

http://www.cc65.org/mailarchive/2014-10/11680.html

Uz provided a fix for it:

http://www.cc65.org/mailarchive/2014-10/11683.html

This pull request ask to add the fix to cc65 on github.
2015-06-27 01:09:20 +02:00
Spiro Trikaliotis
55815ea10c Equality problem (Ullrich von Bassewitz)
Neil Stockbridge reported a problem with equality comparisons on
cc65.org's mailing list:

http://www.cc65.org/mailarchive/2014-10/11680.html

Uz provided a fix for it:

http://www.cc65.org/mailarchive/2014-10/11683.html

This pull request ask to add the fix to cc65 on github.
2014-10-14 13:41:17 +02:00
Greg King
0390c34e88 Changed multi-line C comments into another style.
The left side doesn't look unbalanced.
2014-06-30 16:51:07 -04:00
Oliver Schmidt
4185caf855 Normalized code. 2014-03-04 01:11:19 +01:00
Oliver Schmidt
f3d74cd166 Added optimizer fix originating from Ullrich von Bassewitz prepared by Greg King. 2013-10-09 21:56:05 +02:00
Oliver Schmidt
85885001b1 Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
uz
eef430e45a Fixed a problem with the optimizations for shifts.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5783 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-07-12 21:12:50 +00:00
uz
44f965c462 Enable optimization for arithmetic right shift. NOTE: There's a bug lingering
in the shift code optimization which needs fixing.


git-svn-id: svn://svn.cc65.org/cc65/trunk@5780 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-07-11 20:58:29 +00:00
uz
859236615e Ignore a few more "harmless" functions when optimizing.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5767 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-07-07 17:36:15 +00:00
uz
cd4f87b2cc Fixed compiler warnings.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5765 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-07-06 20:02:43 +00:00
uz
e50649af2c Transform tosshlax and friends into a sequence that doesn't use the stack if
possible.


git-svn-id: svn://svn.cc65.org/cc65/trunk@5764 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-07-06 20:01:46 +00:00
uz
ec900bc200 Centralize generation of register infos for a code segment. This means that
all optimizer functions can rely on it.


git-svn-id: svn://svn.cc65.org/cc65/trunk@5733 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-06-23 17:33:31 +00:00
uz
61c1f6b270 Added more to the list of "harmless" calls that do not interrupt a
pushax/stackop sequence.


git-svn-id: svn://svn.cc65.org/cc65/trunk@5690 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-06-06 21:52:54 +00:00
uz
77bfcc1ff0 Change the OptStackOps function so that it adjusts the instruction pointer
after changing code. Without this correction, the insn pointer may be wrong
after one of the subfunctions has changed code, which may cause a valid
sequence not to be detected. This change (when proven good) may also go into
2.13.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4649 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-04-25 21:51:59 +00:00
uz
5175f95341 Fixed a problem in the optimizer function that rewrites ops that use the
stack. Useless instructions (duplicate loads or transfers) within the sequence
are left intact and may cause problems because the interfere with the
replacement code. A run of OptRemoveUnusedLoads and friends should fix the
problem, bit this step may be disabled, so the routine has to check for this
condition and avoid it (by not doing the replacement).


git-svn-id: svn://svn.cc65.org/cc65/trunk@4551 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-01-20 19:47:44 +00:00
uz
fa3a7930d7 Fixed a problem with load tracking in OptStackOps.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4147 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-11 16:36:17 +00:00
uz
18d865e609 Fixed another problem with OptStackOps: Load tracking will not work across
branches - if we find a label, just forget all information we had before.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4116 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-04 19:54:29 +00:00
uz
d85e6f9124 Replacement code for ule and ugt was wrong and did not cover values that were
equal.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4112 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-03 11:58:11 +00:00
uz
7cd92c82fa Added code replacements for several missing compare functions. Fixed a bug in
coptstop.c that popped up if transfer instructions were used to load a value
into X.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4111 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-01 20:57:39 +00:00
uz
0c08f65872 Fixed a bug in Opt_tosaddax.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4103 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-08-31 19:36:06 +00:00
uz
c942568af9 Simplify the code somewhat.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4102 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-08-31 18:18:50 +00:00
uz
30f25ae12d Make the AddOpLow and AddOpHigh functions usable with both, lhs and rhs
operands.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4101 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-08-31 18:02:44 +00:00
uz
8d5999c3a4 Added even more subroutines to the "harmless calls" list.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4083 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-08-29 23:19:01 +00:00