[ARM / Refactor] Reference count corrections
Summary
This merge request primarily focuses on ARM, but has one fix that is platform-agnostic. It serves to correct reference counting in duplicated instructions and PC-relative data.
- Duplicated
taicpu
objects (viagetcopy
) now correctly increment any symbols that appear in the operands. This admittedly affects x86 more than ARM . - When PC-relative data is inserted into the assembly file, the method, among other things, merges duplicate data into a single entry to save space. This process now correctly increments the reference count for the symbol that will serve as the lone entry while also handling entries that have more than one reference (this fact along with the above instruction duplication triggered an assembler error during optimisation development on ARM - these two fixes ensure it will no longer happen).
- More a semantic change, but labels pointing to constants are now data labels rather than jump labels (not every jump label of this type has been exhaustively changed though, and I'm not sure why it was done the way it was).
System
- Processor architecture: ARM (mostly), i386, x86_64 and others
What is the current bug behavior?
Some data reference counts are too low on ARM and may cause assembler errors in contrived situations (especially during optimisation development). Other hard-to-trace errors may occur when taicpu.getcopy
is called and a symbol later gets dereferenced.
What is the behavior after applying this patch?
Reference counts around duplicated instructions and defined constants on ARM should now be correct.
Relevant logs and/or screenshots
Output code is not changed (other than data labels in place of jump labels where applicable), although when compiled with DEBUG_LABEL
, observed reference counts for data should now be correct.
Edited by J. Gareth "Kit" Moreton