public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/51770] New: dump gimple lineno when dumping bb
@ 2012-01-05 20:07 nash11228 at gmail dot com
  2012-01-09 12:22 ` [Bug middle-end/51770] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: nash11228 at gmail dot com @ 2012-01-05 20:07 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51770

             Bug #: 51770
           Summary: dump gimple lineno when dumping bb
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: nash11228@gmail.com


Hi all,

  I know gcc can dump lineno information before each gimple statement.
[filename : line:col] gimple statement.
 But it's not convenient to look, too much lineno's and no alignment again.

how about dump lineno at bb level just before gimple statement when lineno
changes ?

# line 11
gs1
gs2
...
# line 12
...

just like dwarf debugging information format.

here is example code


--- gimple-pretty-print.c    (revision 182877)
+++ gimple-pretty-print.c    (working copy)
@@ -2284,6 +2284,7 @@
   gimple_stmt_iterator gsi;
   gimple stmt;
   int label_indent = indent - 2;
+  int lineno = 0;

   if (label_indent < 0)
     label_indent = 0;
@@ -2299,6 +2300,15 @@

       curr_indent = gimple_code (stmt) == GIMPLE_LABEL ? label_indent :
indent;

+      if (gimple_lineno (stmt) != lineno)
+        {
+          lineno = gimple_lineno (stmt);
+
+          INDENT (curr_indent);
+          pp_printf (buffer, "# line %d", lineno);
+          pp_newline (buffer);
+        }
+      
       INDENT (curr_indent);
       dump_gimple_stmt (buffer, stmt, curr_indent, flags);
       pp_newline (buffer);


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug middle-end/51770] dump gimple lineno when dumping bb
  2012-01-05 20:07 [Bug middle-end/51770] New: dump gimple lineno when dumping bb nash11228 at gmail dot com
@ 2012-01-09 12:22 ` rguenth at gcc dot gnu.org
  2021-08-30 22:54 ` pinskia at gcc dot gnu.org
  2023-07-15 19:02 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-09 12:22 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51770

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-09 12:21:48 UTC ---
Patches should be posted to gcc-patches.  This probably deserves a new
dump-file modifier, -compactlineno or so.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug middle-end/51770] dump gimple lineno when dumping bb
  2012-01-05 20:07 [Bug middle-end/51770] New: dump gimple lineno when dumping bb nash11228 at gmail dot com
  2012-01-09 12:22 ` [Bug middle-end/51770] " rguenth at gcc dot gnu.org
@ 2021-08-30 22:54 ` pinskia at gcc dot gnu.org
  2023-07-15 19:02 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-30 22:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51770

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-08-30
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is not a bad idea though comparing line numbers is not the best because
two files could have the same line #.

In the next coming week or so I will finish this patch up correctly and add the
option as requested.  Having it for RTL might be a good idea but RTL already
dumps the lineno by default in the statement.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug middle-end/51770] dump gimple lineno when dumping bb
  2012-01-05 20:07 [Bug middle-end/51770] New: dump gimple lineno when dumping bb nash11228 at gmail dot com
  2012-01-09 12:22 ` [Bug middle-end/51770] " rguenth at gcc dot gnu.org
  2021-08-30 22:54 ` pinskia at gcc dot gnu.org
@ 2023-07-15 19:02 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-15 19:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51770

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 55550
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55550&action=edit
Patch which will fix this

There are a few more tweaks I would like to make but I thought I post a first
pass patch here.
1) There is no documentation yet.
2) the style of file/line changes should be improved.
3) Still deciding if the only the line changes print file out again?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-15 19:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-05 20:07 [Bug middle-end/51770] New: dump gimple lineno when dumping bb nash11228 at gmail dot com
2012-01-09 12:22 ` [Bug middle-end/51770] " rguenth at gcc dot gnu.org
2021-08-30 22:54 ` pinskia at gcc dot gnu.org
2023-07-15 19:02 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).