selfpatch-slr/docs/plan.txt
2025-10-15 23:03:02 +02:00

21 lines
1.3 KiB
Plaintext

General:
- Use custom __builtin_offsetof definition to preserve the call until lower gimple
OLD Approach:
- At the very last point of gimple (after gimple optimizations), recognize accesses
- Build a mapping of statement location (multiple statements share) to a semantic graph (or tree)
- Right after expansion to RTL, pattern match set of RTL instructions with same location to graph
- Add notes (persistent over RTL transformations) to any RTL instruction that is relevant
- After all RTL optimizations, add assembly labels before relevant RTL instructions (identified by notes)
- Might need an additional early pass to prevent COMPONENT_REFs to constant/static stuff from being folded early
Approach:
- At the very first point of gimple (before optimizations), replace COMPONENT_REFs of relevant structs
- Turn them into calls of __spslr_component_ref(base (new ssa stmt), type uid, member uid)
- Make sure the return type is matching that of the COMPONENT_REF (member type)
- Let those calls get lowered all the way into UNOPTIMIZED RTL
- Replace calls by inserting original constants and attaching notes
- Let RTL optimizations do their job with those many separate constants
- At the very end of RTL, recognize member offsets by notes and add assembly labels
- MIGHT require some logic to trace notes through RTL optimizations (which operand?, combined how?)