On 1 June 2015 at 02:15, Anders Magnusson <ra...@ludd.ltu.se> wrote: > Andrew Cagney skrev den 2015-06-01 03:24: >> >> 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. 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: - new back-ends that talk SSA (GCC still seems to be unable to eliminate RTL); and one day generate debug information - intermediate debug information paired with the SSA so that, at -O0, "front end -> SSA -> backend" can generate debug information - the expectation that "-O -g" works - untouched SSA results in code far far worse than PCC at -O0 (the basic backend has a lot of smarts that deserve credit) Just the SSA side of things (if debugging is ignored) is a lot of work (LLVM's solution was to largely ignore debugging. I once asked Lattner directly about this and he answered that he considered it a "back-end problem"). If PCC starts generating DWARF then be sure I'll find and report bugs; however I think that would be a distraction. Andrew (I've got to admit that I wonder if C is the best language for an optimizing compiler; but then, it is what we have)