Michael J. Mahon wrote:
Common subexpressions, constant folding, most branch to branch
elimination, etc., are all nicely done at the machine-independent
stage.
The most important machine-dependent optimizations have to do with
mapping the semantics to machine resources (registers and page zero),
particularly to optimize addressing.
And of course, which particular items you choose to prioritise has a
tremendous impact on final performance, and generally such decisions
can only be made at compile time for trivial programs - where there is
a small enough number of critical items that they'll mostly fit in
performant machine areas
High performance C on a 6502 is a fascinating problem, and one that a
6502 is ill equipped to solve unfortunately :-)