On 11/12/26 3:53 PM, [email protected] wrote:
From: Trevor Saunders <[email protected]>

INSN_LOCATION and INSN_HAS_LOCATION already take an rtx_insn *.  Read
the location with location, store it with set_location, and test it
with has_location.


This started to find places that aren't rtx_insn * but now its done, I
wonder if people think it makes sense to switch this to a member? I'd
hope it will eventually help with making the inheritance of rtx_insn on
rtx_def protected rather than public or reorganize the data model
further but that's probably still a ways away.

bootstrapped and regtested on ppc64le-linux-gnu and run through
config-list.mk with the previous patch, ok?

thanks

Trev

gcc/ChangeLog:

        * rtl.h (rtx_insn::location, rtx_insn::set_location,
        rtx_insn::has_location): New functions.  Remove INSN_LOCATION
        and INSN_HAS_LOCATION.
        (RTL_LOCATION): Use location.
        * cfgcleanup.cc: Use location and set_location.
        * cfghooks.cc: Use location and has_location.
        * cfgloop.cc: Use has_location.
        * cfgrtl.cc: Use location, set_location, and has_location.
        * combine.cc: Use location and set_location.
        * compare-elim.cc: Likewise.
        * config/aarch64/aarch64-speculation.cc: Likewise.
        * config/arm/arm.cc: Likewise.
        * config/avr/avr.cc: Likewise.
        * config/bfin/bfin.cc: Likewise.
        * config/bpf/bpf.cc: Use has_location.
        * config/c6x/c6x.cc: Use location and set_location.
        * config/i386/i386-features.cc: Likewise.
        * config/microblaze/microblaze.cc: Likewise.
        * config/mips/mips.cc: Likewise.
        * config/nvptx/nvptx.md: Likewise.
        * config/riscv/riscv-sr.cc: Likewise.
        * config/sh/sh.cc: Likewise.
        * config/sparc/sparc.cc: Likewise.
        * dumpfile.cc: Likewise.
        * emit-rtl.cc: Likewise.
        * except.cc: Likewise.
        * final.cc: Use location and has_location.
        * gcse.cc: Use location and set_location.
        * hierarchical_discriminator.cc: Use location and has_location.
        * ifcvt.cc: Use location and set_location.
        * ira-emit.cc: Likewise.
        * modulo-sched.cc: Use has_location.
        * print-rtl.cc: Likewise.
        * recog.cc: Use location and set_location.
        * reorg.cc: Likewise.
        * var-tracking.cc: Likewise.
        * gdbinit.in: Skip location, set_location, and has_location.

Signed-off-by: Trevor Saunders <[email protected]>
This reminds me a bit of the scaffolding that David put in place when he was working in this space on one of the other accessor macros (I forget which).  Essentially split up the getter/setter cases which in turn allowed him to more easily do whatever cleanup he had in mind at the time.

If you think it'll help with pushing forward type safety and better visibility lockdown, then OK.  I don't mind if it takes some time to get there.

jeff

Reply via email to