Commit Graph

4275 Commits

Author SHA1 Message Date
Alex Volkov
de78048319 Generalize the shared, non-removable reg load tests in RemoveRegLoads() to "instruction affects the other register" 2026-03-29 17:05:20 -04:00
Alex Volkov
321e47f0f3 Rhs X removals in coptstop.c should no longer be dangerous. 2026-03-26 18:32:04 -04:00
Alex Volkov
00a1f1d447 Clearly delineate load instruction "must remove" conditions from "may remove" with a new LI_MUST_REMOVE flag. A demand to remove a non-removable load is fatal. 2026-03-25 19:14:14 -04:00
Alex Volkov
c9b885b144 Prevent the removal of a ldaxysp runtime call as a "load instruction" for only the A or the X side, when the other is non-removable. Fixes issue #2942 / #2461. 2026-03-25 19:08:18 -04:00
Alex Volkov
ac69017ca5 Remove redundant LoadEntry clears; DelEntry() already handles clearing them, and the redundant clears are a red herring in the code. 2026-03-25 19:01:37 -04:00
Alex Volkov
62451557f9 Revert the fix for #2461 in search of a more general solution 2026-03-25 19:00:57 -04:00
Alex Volkov
d711b6d6fa Prevent Lhs load insns shared with the Rhs from being inadvertently removed by Rhs optimizers. Fixes issue #2947. 2026-03-22 19:42:57 -04:00
Alex Volkov
af285ba9e5 Remove red herring flag set. It is far too late to set LI_DONT_REMOVE in a subopt. 2026-03-22 18:49:12 -04:00
Alex Volkov
57cc683d91 Whitespace fix (left after var removal) 2026-03-11 19:33:36 -04:00
Alex Volkov
ca98b218e8 Remove the unused (for now) predicate functions in coptstop.c to keep the compiler happy. 2026-03-11 19:17:50 -04:00
Alex Volkov
73f4149554 Refactor: remove the now unused flag variable in OptStackOps() 2026-03-11 19:09:34 -04:00
Alex Volkov
99ccd7e1a3 Refactor: Replace OptStackOps() complex (and buggy) flag-based subopt precondition evaluation system with plain language predicate functions. Any custom preconditions can now be expressed without much trouble.
Also, begin establishing parity between precondition logic and actual subopt branching logic.
2026-03-11 17:44:33 -04:00
Alex Volkov
82d672e904 Refactor: rearrange Opt_a_tosbitwise() code to follow the common if-else if-else pattern form used by other subopts. 2026-03-10 20:47:39 -04:00
Alex Volkov
bf5d8c44e4 BUGFIX: Fix the "same X value" and "same A value" evaluations issue in OptStackOps(), where the values compared come from the wrong instruction when a runtime call has an asm label. 2026-03-10 20:08:35 -04:00
Alex Volkov
505698c450 Refactor: remove StackOpData side effects from IsRegVar() and PreCondOk()/RegAPreCondOk(); setting StackOpData.ZPLo/ZPHi is explicit. 2026-03-10 19:23:40 -04:00
Alex Volkov
1b778edee8 Annotations ahead of refactoring: bugs., looming bugs, and work notes. 2026-03-10 17:46:40 -04:00
Bob Andrews
d45fac3afe Merge pull request #2938 from kugelfuhr/kugelfuhr/fix-2811
Fix an invalid transformation by the optimizer
2026-03-05 19:51:51 +01:00
Kugel Fuhr
380c3f810e Fix an invalid transformation by the optimizer. Introduced by #2811. 2026-03-05 18:40:52 +01:00
Willis Blackburn
5f437e09a0 Move AssignIds to before we print the info line in order to ensure that we write the correct file count. 2026-02-12 17:54:58 -05:00
Bob Andrews
0fca83500b Merge pull request #2927 from kugelfuhr/kugelfuhr/fix-2926
Fix cc65 not detecting invalid integer and float literal suffixes
2026-02-11 19:54:44 +01:00
Kugel Fuhr
61799b07bf Fix unchecked integer or floating point suffixes. 2026-02-06 15:55:30 +01:00
Willis Blackburn
789416798f Add terminating NUL after __func__ string literal #2920 2026-01-24 12:32:31 -05:00
Kugel Fuhr
c4cd575331 Fix parsing boolean not (.not/!). 2025-11-18 14:35:29 +01:00
Bob Andrews
778bc5bc22 Merge pull request #2843 from colinleroy/warn-about-fill-bytes
Emit warnings for wasted bytes when aligning
2025-11-02 18:14:27 +01:00
Bob Andrews
a88d7abd3f Merge pull request #2851 from kugelfuhr/kugelfuhr/fix-2850
Fix "constant expression expected" when using .CPU_ISET_xxx with no target system set
2025-11-01 16:36:39 +01:00
Kugel Fuhr
b4dc41c653 CPU constants must always be defined, not only if a target system was given. 2025-11-01 15:37:57 +01:00
Colin Leroy-Mira
2220c6ec8d Add --warn-align-waste option to ca65, ld65, cl65 2025-10-26 16:06:08 +01:00
Colin Leroy-Mira
28442e60b8 Emit warnings for wasted bytes when aligning 2025-10-19 15:00:13 +02:00
Bob Andrews
c2556bb5e2 Merge pull request #1358 from dmsc/issue-479
Fixes Issue 479 (ca65: can't reference .proc members before declaration)
2025-10-05 15:39:56 +02:00
Bob Andrews
93c1b659ee Merge pull request #2824 from GrosChien/master
ca65 Fixing segfault when using `--expend-macros` without `--listing`
2025-09-22 21:18:39 +02:00
Bob Andrews
ca7335023f Merge pull request #2834 from polluks/patch-12
Fixed overflow
2025-09-22 21:06:41 +02:00
Stefan
9601b11a9c inplicit length 2025-09-18 11:10:41 +02:00
Stefan
5e89953bf9 Fixed overflow 2025-09-17 15:03:55 +02:00
Kugel Fuhr
0dc484f5a7 Fix hardcoded upper limit of input files. 2025-09-08 20:51:27 +02:00
Gros chien
ee096d27df Fix segfault when using -x without -l 2025-08-26 23:45:39 +02:00
Daniel Serpell
2454ab831c When creating a new scope for a forwarded symbol, do not open it.
This fixes las example in the PR.
2025-08-17 20:24:08 -04:00
Daniel Serpell
acc26c0e7b When the scope is not found on ancestors, create on current scope.
This solves comment https://github.com/cc65/cc65/pull/1358#issuecomment-3193961949
2025-08-16 22:28:32 -04:00
Daniel Serpell
2323f46a54 Only search a symbol in parent scopes if not already scoped.
This fixes the case at: https://github.com/cc65/cc65/pull/1358#issuecomment-747194906
2025-08-16 17:29:12 -04:00
Daniel Serpell
5b70654289 Allows referencing a scope not yet created.
Use the "::" syntax at the start of the symbol to force creating
a scope if it does not exists yet.

Fixes issue #479.
2025-08-16 11:17:35 -04:00
Bob Andrews
5197c56c7c Merge pull request #2794 from mrdudz/fixgrc
Fixgrc
2025-07-27 00:23:02 +02:00
Bob Andrews
d06e0d9a16 Merge pull request #2812 from colinleroy/Opt-ldptr1
Optimize ldax?sp/sta/stx to ldptr1?sp
2025-07-27 00:22:21 +02:00
Colin Leroy-Mira
1f6cca2140 Coding style 2025-07-27 00:02:48 +02:00
Colin Leroy-Mira
a0b705fd41 Remove code after inserting new one 2025-07-27 00:02:48 +02:00
Colin Leroy-Mira
0647cb1112 Merge jsr pushax/j?? popax into nothing or RTS 2025-07-27 00:02:48 +02:00
Colin Leroy-Mira
4c2cc24e77 Optimize jsr ldax0sp/incsp2 2025-07-27 00:02:18 +02:00
mrdudz
cb39da2fba Use spaces instead of tabs in the output files 2025-07-26 23:52:14 +02:00
Kugel Fuhr
8f4a4040d6 Complete unreachable checking for switch statements. 2025-07-26 09:03:27 +02:00
Kugel Fuhr
70c1bd5e3c Improved flow analysis in general and especially for "for" loops. Added more
tests.
2025-07-26 09:03:04 +02:00
Kugel Fuhr
8ac25376a0 Fix the "double semicolon" problem where a double semicolon after a statement
that makes the following code unreachable led to an "unreachable code" warning.
2025-07-26 09:02:54 +02:00
Bob Andrews
0a4af6df92 Merge pull request #2808 from kugelfuhr/kugelfuhr/flowanalysis
Simple flow analysis to find unreachable code
2025-07-26 00:10:21 +02:00