On Fri, Sep 06, 2019 at 07:09:45AM -0500, Segher Boessenkool wrote: > On Wed, Sep 04, 2019 at 01:26:27PM -0400, Michael Meissner wrote: > > [snip] > > > So to keep other passes from 'improving' things, I opted to do the pass as > > the > > last pass before final. > > If the problem is that you do not properly analyse dependencies between > insns, well, fix that? > > If this really needs to be done after everything else GCC does, that is > problematic. What when you have two or more passes with that property? > > If this really needs to be done after everything else GCC does, does it > belong in the compiler at all? Should the assembler do it instead, or > the linker?
No, with the definition of the PCREL_OPT there can be only one reference. Yeah, there might be other ways to do it, but fundamentally you need to do this as late as possible and prevent any other optimizations from messing things up. This is similar to figuring out whether a conditional branch is short enough or you have to do reverse the conditional branch and do an unconditional jump. If you add any more code at that point that changes the sizes, it makes the whole calculation moot. -- Michael Meissner, IBM IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA email: meiss...@linux.ibm.com, phone: +1 (978) 899-4797