This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: i370 patches against egcs-1.1.2


It's been rumoured that Richard Henderson said:
> > Too late. I've just finished this branch & base-reg optimization that 
> > should be a major boost to performance.  Once you planted the idea,
> > the rest was easy.  And since I had to write, not just read code
> > that used XEXP & etc. I'm of course feeling like a macho programmer.
>
> Sorry to rain on your parade, but unless you can defend the decision
> not to use the existing branch shortening code, your new stuff won't 
> go in.  Such is how maintanence problems are created.

Not words I want to hear.

But for what its worth,  I would appear to be the only user of this 
compiler, with one exception, Dave Pitts.  From what I can tell,
no one has ever really used it before, it was absolutley just filled
with dozens of bugs that even small programs would have stumbled over.
In all the years of its existance, the i370 back end has never really 
been used before.

> Questions about using it, or problems encountered using it, those
> we can deal with.  

I skimmed the code for a routine called shorten_branches() in final.c
and didn't come away with any clear idea of what it did.  In any case,
I didn't spot any places where I could plug in the information I would
need it to know, or how to extract the info I needed.  I suspect we're
talking about two different things with an unfortunate overlap of 
terminology.

There are two tasks I need to accomplish: determine what kind of
branch assembly to issue, and how to print a label.  Both depend 
on relationships to the current value of a base reg.

Given a branch I need to know what sort of assembly to issue for the branch. 
If both the branch, and the target are within 4KB of the current value of 
the base register, then I can branch by specifying a 12-bit displacement; 
else I load a reg with 32-bit addr and branch to that addr.  Only 
the i370 back end knows the value of the base reg, and the true 
addr's of the insn's;  there appears to be no simple way of using
set_attr "length" since insn sizes are not known until the final 
assembly is generated.

Next, given a label, I need to know if all branches to that label 
are within 4KB of the curent base reg value.  If they are not,
then I must reload the base reg out of the page table (since 
I have to assume the branch came from far away, and the base reg 
value may be invalid).  If all branches are from nearby, I just
emit an ordinary label.

Its been argued that I could do this with a peephole pass, and 
I supose that I should give this further thought.  It could certainly
tighten up the currently overly cautious estimates of locations.

I just don't see how the shorten_branches code aids me with either 
of these tasks.

--linas


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]