On Thu, Nov 12, 2026 at 11:26:45PM -0700, Jeff Law wrote: > > > 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.
yeah, we basically have to always split up macros based on get/set to allow both const correctness, and use when modifying data. > 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. yeah, I'm not aware of an easy way to control member visibility without making the accessors members, I guess we could declare all the accessors like this friends but that seems more involved, and harder to do gradually I think. I may be able to split a few more small ones out of my WIP tree in the next few days, but there will definetely be more for next year at least. Thanks Trev >
