Bug 51770 - dump gimple lineno when dumping bb
dump gimple lineno when dumping bb
Status: UNCONFIRMED
Product: gcc
Classification: Unclassified
Component: middle-end
unknown
: P3 enhancement
: ---
Assigned To: Not yet assigned to anyone
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-01-05 20:07 UTC by nash,steve
Modified: 2012-01-09 12:21 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nash,steve 2012-01-05 20:07:15 UTC
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);
Comment 1 Richard Biener 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.