This is the mail archive of the gcc@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]
Other format: [Raw text]

Re: A question about a "subreg SSA patch" from long ago


> From: Steven Bosscher <stevenb@suse.de>
> Date: Mon, 26 Apr 2004 23:51:19 +0200 (CEST)

I've trimmed Steven's mail, but he was asking about

> http://gcc.gnu.org/ml/gcc-patches/2000-07/msg01152.html

and what it did.  I'm not sure I ever actually sent a message about
the whole concept to the list, so I'm sending this explanation now for
posterity.


The idea is that to transform a SUBREG operation into SSA form, you
combine several operations together.  In the most basic case, suppose
you have

(insn (set (subreg (reg X)) Y))

which sets some part of X.  You turn this into

(sequence [
  (insn (set (reg X) (reg X)))
  (insn (set (subreg (reg X)) Y))
])

and then turn it into SSA form like this:

(sequence [
  (insn (set (reg X_1) (reg X_0)))
  (insn (set (subreg (reg X_1)) Y))
])


This SEQUENCE, considered as a whole, is in SSA form.  It has an
input, X_0, and an output, X_1.  X_1 will be set only by this insn.

As an extension, it's nice to recognize cases like

(insn (clobber (reg X)))
(insn (set (subreg (reg X) 0) Y))
(insn (set (subreg (reg X) 1) Z))

which together set all of X, and turn them into

(sequence [
  (insn (clobber (reg X_1)))
  (insn (set (subreg (reg X_1) 0) Y))
  (insn (set (subreg (reg X_1) 1) Z))
])

to eliminate the dependency on the previous value of X; and it's also
nice to eliminate unnecessary copies when converting out of SSA form
(I think this is just an extension of the usual unnecessary copy
elimination).

I'm not sure if it's really best to have a SEQUENCE of INSNs, or a
single INSN which contains a SEQUENCE.  I originally did it the way I
showed above, because the recognizers know to look inside SEQUENCEs,
and so I didn't have to do anything special to them.

-- 
- Geoffrey Keating <geoffk@geoffk.org>


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