public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeffrey A Law <law@hurl.cygnus.com>
To: Zack Weinberg <zack@rabi.columbia.edu>
Cc: Joern Rennecke <amylaar@cygnus.co.uk>, egcs@egcs.cygnus.com
Subject: Re: a strange infelicity of register allocation
Date: Thu, 28 Jan 1999 19:58:00 -0000	[thread overview]
Message-ID: <704.917582060@hurl.cygnus.com> (raw)
In-Reply-To: <199901290227.VAA29500@blastula.phys.columbia.edu>

  In message < 199901290227.VAA29500@blastula.phys.columbia.edu >you write:
  > ;; Register dispositions:
  > 27 in 5  28 in 3  33 in 0  36 in 3  37 in 4  38 in 0  
  > 40 in 0  43 in 0  50 in 4  57 in 0  69 in 0  73 in 0  
  > 79 in 0  80 in 0  85 in 0  90 in 0  92 in 3  94 in 0  
  > 
  > ;; Hard regs used:  0 1 3 4 5 6 7 16
  > 
  > The source that got this dump is rather different from the source I sent
  > this morning, in particular register numbering is totally shuffled.  I
  > don't know why it wants to use hard reg 0 for so much stuff.  The
  > final assembly is decent, but it doesn't use register C (==2) at all.
Well, %eax is used most often because it's the first one listed in
REG_ALLOC_ORDER.  It's also automatically preferred for anything that is a
return value, or copied from a return value.

  > Where do I start diving?
Much like we did last time.

Find the first reg in the list of regs that are candidates for global
allocation.  Verify that #uses > 4 * # calls crossed.  Then put a breaking
in global.c:find_reg and step through it to find out why it's not getting
a hard reg.

  > It was a lose here because it caused a register spill in the common
  > case - but I don't know if gcc could've known it was the common case.
  > Profile-directed feedback anyone?
Well, we've got a few things that can be examined to build some heuristics
around.

We've got conflict lists.  If tying expands the conflict list, then that's
not good.  The question is how much expansion is too much expansion.

We've got lots of counters.

One could envision a heuristic like "the allocation priority of the tied
regs must be within some delta of the maximum of the alloation priorities of
the individual regs".  And the delta would inversely related to the expansion
of the conflict list.

Just a thought.  I've never tried anything like it.


  > The dump is from initial rtl generation, but reg 44 isn't dead at this
  > point in the code.  However, on x86, it's dirt cheap to rewrite the
  > above to (set (reg:SI 76) (zero_extend:SI (mem:QI (reg:SI 27))) and
  > then replace (reg:QI 44) with (subreg:QI (reg:SI 76)) wherever it
  > appears.  We don't do that.  It would be a big win: it reduces
  > register pressure (always good on x86) and it would enable
  > optimizations based on known contents of reg 76.  This particular
  > function benefits from both.
There's definite inconsistencies in our usage of zero-extend vs subregs on the
x86.  We were never able to reach any kind of conclusion about which one was
better to bias towards.

  > For starters, we seem to leave space for stack slots that are never
  > used; that should be easy to fix, no?
Depends on why they're unused.  Never assume anything is easy until you find
out why it's happening.

For example, maybe they're unused because reload inheritance eliminated the
need to ever store a value into those slots.  By the time we make that kind of
determination it's too late to eliminate the slot.  Similarly for reload_cse
eliminating the need for some slots.

Jeff

  reply	other threads:[~1999-01-28 19:58 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-23 22:42 Zack Weinberg
1999-01-25  4:56 ` Joern Rennecke
1999-01-25 11:47   ` Zack Weinberg
1999-01-25 11:50     ` Joern Rennecke
1999-01-31 23:58       ` Joern Rennecke
1999-01-25 12:00     ` Jeffrey A Law
1999-01-25 13:14       ` John S. Dyson
1999-01-31 23:58         ` John S. Dyson
1999-01-25 13:31       ` Zack Weinberg
1999-01-25 13:36         ` Jeffrey A Law
1999-01-25 19:56           ` Zack Weinberg
1999-01-25 20:33             ` Jeffrey A Law
1999-01-25 20:41               ` Zack Weinberg
1999-01-25 20:53                 ` Jeffrey A Law
1999-01-25 21:18                   ` Zack Weinberg
1999-01-25 21:30                     ` Jeffrey A Law
1999-01-25 21:38                       ` Zack Weinberg
1999-01-26  4:59                         ` Jeffrey A Law
1999-01-27  9:26                           ` Zack Weinberg
1999-01-28  5:26                             ` Jeffrey A Law
1999-01-28 17:20                               ` Zack Weinberg
1999-01-28 17:33                                 ` Joern Rennecke
1999-01-28 18:01                                 ` Jeffrey A Law
1999-01-28 18:27                                   ` Zack Weinberg
1999-01-28 19:58                                     ` Jeffrey A Law [this message]
1999-01-31 23:58                               ` Jeffrey A Law
1999-01-31 23:58                             ` Zack Weinberg
1999-01-31 23:58                           ` Jeffrey A Law
1999-01-31 23:58                         ` Zack Weinberg
1999-01-31 23:58                       ` Jeffrey A Law
1999-01-31 23:58                     ` Zack Weinberg
1999-01-31 23:58                   ` Jeffrey A Law
1999-01-31 23:58                 ` Zack Weinberg
1999-01-31 23:58               ` Jeffrey A Law
1999-01-31 23:58             ` Zack Weinberg
1999-01-31 23:58           ` Jeffrey A Law
1999-01-26  7:44         ` Joern Rennecke
1999-01-27  8:35           ` Zack Weinberg
1999-01-27  9:08             ` Joern Rennecke
1999-01-27  9:52               ` Zack Weinberg
1999-01-27 11:49                 ` Marc Espie
1999-01-31 23:58                   ` Marc Espie
1999-01-31 23:58                 ` Zack Weinberg
1999-01-31 23:58               ` Joern Rennecke
1999-01-28  8:11             ` Jeffrey A Law
1999-01-28 11:40               ` Zack Weinberg
1999-01-31 23:58               ` Jeffrey A Law
1999-01-31 23:58             ` Zack Weinberg
1999-01-31 23:58           ` Joern Rennecke
1999-01-31 23:58         ` Zack Weinberg
1999-01-31 23:58       ` Jeffrey A Law
1999-01-31 23:58     ` Zack Weinberg
1999-01-31 23:58   ` Joern Rennecke
1999-01-31 23:58 ` Zack Weinberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=704.917582060@hurl.cygnus.com \
    --to=law@hurl.cygnus.com \
    --cc=amylaar@cygnus.co.uk \
    --cc=egcs@egcs.cygnus.com \
    --cc=zack@rabi.columbia.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).