use LOADFIELD instruction more instead of an extra explicit ADD

add implicit @zp to pointer variables if they don't have a preference
This commit is contained in:
Irmen de Jong
2025-08-31 14:58:40 +02:00
parent a9142b9ce5
commit 3ef09d7d9a
8 changed files with 48 additions and 16 deletions

View File

@@ -11,6 +11,8 @@ Structs and Pointers
to rather large and inefficient assembly code most of the time, when compared to direct array access or regular variables.
At least try to place heavily used pointer variables in zero page using ``@requirezp`` on their declaration,
if zero page space allows.
Pointer variables that don't have a zeropage tag specified will be treated as having ``@zp`` so they get
priority over other variables to be placed into zeropage.
.. note::
Due to some limitations in the language parser, not all pointer related syntax is currently supported

View File

@@ -59,8 +59,9 @@ STRUCTS and TYPED POINTERS (6502 codegen specific)
- implement the remaining TODO's in PointerAssignmentsGen.
- fix code size regressions (if any left)
- update structpointers.rst docs with 6502 specific things?
- optimize deref() and operatorDereference() to not always add the field offset to the pointer value but using it in the Y register instead
- optimize deref() and operatorDereference() when field offset is 0, don't use a temporary at all if the var is in zp already (maybe already solved by the previous one?)
- 6502: optimize deref() to not always add the field offset to the pointer value but using it in the Y register instead
- 6502: optimize operatorDereference() to not always add the field offset to the pointer value but using it in the Y register instead
- 6502 and IR: optimize deref() and operatorDereference() when field offset is 0, don't use a temporary at all if the var is in zp already (maybe already solved by the previous one?)
- optimize operatorDereference() (deref() too?) so that it doesn't load a pointer in AY and then use ADC to add the field offset
- optimize the float copying in assignIndexedPointer() (also word?)
- implement some more struct instance assignments (via memcopy) in CodeDesugarer (see the TODO) (add to documentation as well, paragraph 'Structs')