Re: -fdump-tree-all documentation.

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

 



DCH writes:
 > Hi Andrew et alumni,
 > 
 > At 08:57 13/03/2007, Andrew Haley wrote:
 > >DCH writes:
 > >
 > >  > Forgive me if I've missed something obvious, but does anyone
 > >  > know if the output from -fdump-tree-all is documented somewhere?
 > >
 > >It's C, more or less, except for a few additions such as Phi nodes.
 > 
 > I guess that means no :-)  Looks nothing like C to me, but there again
 > I'm used to looking a normal type C, not some kind of parsed C.

Oh, you mean the front end dump.  Most of the dumps look like this:

() (D.779)
{
  struct  * #ref#1#2.24;

  {
    struct  * D.782;
    void *[<unknown>] * D.784;
    void * #ref#0#0;
    struct  * D.786;
    void * #ref#1#2;

  ... etc.

Only _one_ of the dumps looks like the one below, and that's the
original translation unit.

 > Well, most of it really.  Basically someone posted this to ACCU-general
 > a while ago:
 > 
 > ====================================================
 > struct no_default_ctor {
 >          no_default_ctor(int i) : m_i(i) { };
 >          ~no_default_ctor() { };
 >        private:
 >          no_default_ctor();
 >          const int m_i;
 >      };
 > 
 > //  Why is `no_default_ctor(Anint)' below a syntax error?
 > 
 >      const int Anint = 3;
 >      int foo() {
 >          no_default_ctor name(Anint);    // This works.
 >          no_default_ctor(Anint);         // This gives me a syntax error.
 >          no_default_ctor(3);             // But this does not.
 >          (no_default_ctor)(Anint);       // And neither does this.
 >      }
 > ====================================================
 > 
 > It provoked some discussion, the outcome of that was rather
 > unclear.  I thought at least I could pass it into GCC to see how
 > no_default_ctor(Anint) is parsed and got the following output.  I
 > think I decided at the time that it was being interpreted as a
 > function-style cast, but then I wasn't sure, and now I can't even
 > see that for some reason.  There was some discussion if it was a
 > cast or a declaration.  There are a couple of references in the
 > output below to line 13 but I don't know the syntax here to unwind
 > it.
 > 
 > ;; Function int foo() (_Z3foov)
 > ;; enabled by -fdump-tree-original
 > 
 > @1      function_decl    name: @2       mngl: @3       type: @4
 >                           srcp: ctors_orig.cpp:12       extern
 >                           body: @5
 > @2      identifier_node  strg: foo      lngt: 3
 > @3      identifier_node  strg: _Z3foov  lngt: 7
 > @4      function_type    size: @6       algn: 64       retn: @7
 >                           prms: @8
 > @5      compound_stmt    line: 17       body: @9
 > @6      integer_cst      type: @10      low : 64
 > @7      integer_type     name: @11      size: @12      algn: 32
 >                           prec: 32       min : @13      max : @14
 > @8      tree_list        valu: @15
 > @9      scope_stmt       line: 12       begn           clnp
 >                           next: @16
 > @10     integer_type     name: @17      size: @6       algn: 64
 >                           prec: 36       unsigned       min : @18
 >                           max : @19

Each one of these is a tree node, and links are replaced by numbers of
the form @N.  After that, it's just tree nodes.  Most of the meaning
of these nodes is documented in gcc/tree.def, but a few nodes are
language-specific and are documented in the language front ends.

 > Is this clear to anyone?  Is there a doc somewhere which tells me
 > how to read this output?

Andrew.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux