Andrew Cagney skrev den 2015-06-01 20:41:
On 1 June 2015 at 12:54, David Holland <dholland-t...@netbsd.org> wrote:
On Mon, Jun 01, 2015 at 11:41:38AM -0400, Andrew Cagney wrote:
  > >> systems and generates reasonable code.  Unfortunately, and sorry PCC
  > >> (stabs, really?),
  > >
  > > Feel free to add dwarf, the source is out there, and it wouldn't be
  > > especially difficult to do it.  I just haven't had time.
  > > Stabs was "for free" :-)
  >
  > I'm not so sure (a year back I looked at the code with that in mind),
  > and wonder if any quick hack would end up being opportunity lost.

I have not looked at it, nor have I looked at pcc at all in a long
time, so what I'm missing may just be otherwise obvious context, but:

  > PCC, as a "classic" C compiler, only generates debug information at
  > -O0.  This this is because the stabs code is restricted to the
  > un-optimized code generator path.  Having the backend restricted to
  > DWARF when '-O0' might just be ok, were it not for SSA (static single
  > assignment).
  >
  > 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.

LLVM[Lattner et.al.] and GIMPLE[Novillo et.al.] are real world
implementations of that theory.
https://gcc.gnu.org/projects/tree-ssa/#ssa has a good diagram and is a
relevant read.

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 do not understand why either of those choices need to be taken.
Pcc has a reasonable intermediate representation, which in the optimizer
is converted to SSA form, hammered on, and converted back.  This is
done while retaining the intermediate representation, which is no problem.
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.
printf's are only used for data (which is spit out directly), not code.
All code is dealt with function-wise, otherwise things like the register
allocator would not work.

Unless, I guess, what you're talking about is throwing away the
existing backend entirely and writing a new SSA-based one, in which
case I'd gently suggest that this is a large project :-)
Exactly :-(

What is wrong with the existing backend?

-- Ragge

Reply via email to