Hi!

On 2022-02-10T16:36:51+0000, Michael Matz via Gcc-patches 
<gcc-patches@gcc.gnu.org> wrote:
> On Thu, 10 Feb 2022, Richard Biener via Gcc-patches wrote:
>> On Wed, Feb 9, 2022 at 2:21 PM Thomas Schwinge <tho...@codesourcery.com> 
>> wrote:
>> > OK to push (now, or in next development stage 1?) the attached
>> > "Consider 'TDF_UID', 'TDF_NOUID' in 'print_node_brief', 'print_node'",
>> > or should that be done differently -- or, per the current state (why?)
>> > not at all?

First, thanks for (indirectly) having confirmed that my confusion is not
completely off, why this is currently missing.  ;-)

>> Hmm, I wonder if we shouldn't simply dump DECL_UID as
>>
>>  'uid NNN'
>
> Yes, much better in line with the normal dump_tree output.

>> somewhere.  For example after or before DECL_NAME?

Heh -- that's what I wanted to do initially, but then I saw that we've
currently got in 'print_node_brief' (and very similar in 'print_node'):

    [...]
      fprintf (file, "%s <%s", prefix, get_tree_code_name (TREE_CODE (node)));
      dump_addr (file, " ", node);

      if (tclass == tcc_declaration)
        {
          if (DECL_NAME (node))
            fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
          else if (TREE_CODE (node) == LABEL_DECL
                   && LABEL_DECL_UID (node) != -1)
            {
              if (dump_flags & TDF_NOUID)
                fprintf (file, " L.xxxx");
              else
                fprintf (file, " L.%d", (int) LABEL_DECL_UID (node));
            }
          else
            {
              if (dump_flags & TDF_NOUID)
                fprintf (file, " %c.xxxx",
                         TREE_CODE (node) == CONST_DECL ? 'C' : 'D');
              else
                fprintf (file, " %c.%u",
                         TREE_CODE (node) == CONST_DECL ? 'C' : 'D',
                         DECL_UID (node));
            }
        }
    [...]

That is, if there's no 'DECL_NAME', we print 'L.[UID]', 'C.[UID]',
'D.[UID]'.  The same we do in 'gcc/tree-pretty-print.cc:dump_decl_name',
I found.  But in the latter function, we also do it that same way if
there is a 'DECL_NAME' ('i' -> 'iD.4249', for example), so that's why I
copied that style back to my proposed 'print_node_brief'/'print_node'
change.

Are you now suggesting to only print 'DECL_NAME' as '[NAME] uid [UID]',
but keep 'L.[UID]', 'C.[UID]', 'D.[UID]' in the "dot" form, or change
these to 'L uid [UID]', 'C uid [UID]', 'D uid [UID]' correspondingly?
And also do the similar changes in
'gcc/tree-pretty-print.cc:dump_decl_name' (as well as another dozen or so
places where such things are printed...), or don't change those?

I don't care very much which way, just have some slight preference to
keep things similar.


Grüße
 Thomas
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 
München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas 
Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht 
München, HRB 106955

Reply via email to