tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Removing ARCNET stuffs



On 3 June 2015 at 01:56, David Holland <dholland-tech%netbsd.org@localhost> wrote:
> On Mon, Jun 01, 2015 at 02:41:22PM -0400, Andrew Cagney wrote:
>  > > > To my mind, and I'm assuming a pure SSA compiler design, having SSA
>  > > > forces issues like: [...]
>  > >
>  > > I'm missing something; SSA is just a style of program representation.
>  >
>  > Yes.  Lets think of Static Single Assignment as the pure academic theory.
>
> Ok... although calling it a "theory" is a bit much?

Perhaps we can decide that by counting the number research papers and
PHDs its generated :-)

> It's just a scheme
> for laying out program representations. A useful one for various
> reasons; but it's not itself a representation and it doesn't have much
> effect on the rest of the architecture of the compiler backend, except
> maybe for naive backends.

Right.  Is that bad?

Keep in mind that I think of RTL, based on having to on rare occasions
prod it, as little more than glorified assembler.  And even a little
GCC probably corrupts my point-of-view :-)

One of the debates for GCC was over doing as much as possible using
the SSA representation vs keeping lots of [pre-existing] smarts in RTL
 Given GCC's architecture and the amount of existing intellectual and
emotional investment in RTL,  it was quickly off the table.

> Or so it seems to me anyway, but I've been up to my ears in compiler
> hokum in connection with a $WORK project for several years now.
>
>  > PCC, to the best of my knowledge is still in the [very early] planning
>  > stages.  One of its design choices would be to go pure SSA.  Another
>  > option, closer to GCC (RTL), would be to retain existing code-gen
>  > passes.  Tough choices.
>
> I'm not sure why it's such a big deal, except that everything in gcc
> is a big deal because gcc is such a mess inside.

From my reading, the goal was to keep *all* existing architectures
"working".  Consequently, SSA was wedged into GCC in front of RTL.
Thus preserving all the legacy.

From what your saying, PCC won't suffer from this and can integrate it
directly into the existing framework.  Much easier.

> Moving an existing representation to SSA just requires adding phi
> nodes to the representation, writing a check pass to enforce the
> single assignment property, and updating existing passes to maintain
> the property -- in a language without proper algebraic data types this
> is a bigger deal than otherwise but it does not seem like a
> particularly major undertaking. Unless the representation is totally
> wrong in other ways that need to be rectified first.
>
> Maybe I'm missing something, or maybe I'm coming to this from a
> strange point of view.
>
>  > > Are you talking about a hypothetical future where pcc's backend grows
>  > > an (additional, or replacement) SSA-based layer? Or is pcc's
>  > > optimizing backend already SSA-based (per above, I don't know one way
>  > > or the other) and you're talking about making that preserve debug
>  > > info?
>  > >
>  > > Either way, it seems like adding DWARF support to the non-optimizing
>  > > backend is an orthogonal issue.
>  >
>  > I'm being fast and loose.  My reading of the code was that debug info
>  > was being generated by the back of the front end (very roughly
>  > "gimplify" in this diagram of GCC
>  > https://gcc.gnu.org/projects/tree-ssa/#ssa).   It was pretty much hard
>  > wired printfs, and explained to me why "-g -O" wasn't supported.
>
> printfing from the back of the front end is definitely "totally wrong
> in other ways that need to be rectified first" :(

Or view it as a clean slate.

When SSA was added to GCC there was a perception that debugging became
"worse".  For instance, RTL always assigned things to contiguous
registers so producers and consumers were both designed to assume
this.  SSA removed that limitation; it took longer for things to get
back in sync.  Part of the fallout was "-fvar-tracking", and one of
the "great GCC debates" of 2007.  GCC, with RTL, of course had more
than double the challenge.

While PCC should have nothing approaching those problems, you can
perhaps see why I wonder if focusing first on SSA would be better.
Fortunately it isn't my call.

Andrew


Home | Main Index | Thread Index | Old Index