Patchwork Dump slim RTL to assembly file if the final dump is slim

login
register
mail settings
Submitter Steven Bosscher
Date July 31, 2012, 10:13 a.m.
Message ID <CABu31nOGvZkneJrifxgMg+NxfS=BHiDHb=e5WTGB81z3qg9gbA@mail.gmail.com>
Download mbox | patch
Permalink /patch/174192/
State New
Headers show

Comments

Steven Bosscher - July 31, 2012, 10:13 a.m.
Hello,

For me, the slim RTL dumps are much easier to read than the default
lisp-like representation. I use the -dAP option frequently, to see
where an assembly instruction came from. This patch scratches an itch:
The insns dumped to the assembly file are always dumped as lisp-like,
ignoring the "slim" in the -fdump-rtl-final-slim flag. With the patch
applied, final will dump slim RTL if the final dump is asked as slim
RTL.

Bootstrapped&tested on x86_64-unknown-linux-gnu. OK for trunk?

Ciao!
Steven



        * sched-vis.c (dump_insn_slim): Print print_rtx_head at the
        start of each new line.
        * final.c (final_scan_insn): If the final dump is requested as
        slim RTL, dump slim RTL to the assembly file also.
Richard Guenther - July 31, 2012, 10:24 a.m.
On Tue, Jul 31, 2012 at 12:13 PM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> Hello,
>
> For me, the slim RTL dumps are much easier to read than the default
> lisp-like representation. I use the -dAP option frequently, to see
> where an assembly instruction came from. This patch scratches an itch:
> The insns dumped to the assembly file are always dumped as lisp-like,
> ignoring the "slim" in the -fdump-rtl-final-slim flag. With the patch
> applied, final will dump slim RTL if the final dump is asked as slim
> RTL.
>
> Bootstrapped&tested on x86_64-unknown-linux-gnu. OK for trunk?

Ok.

Thanks,
Richard.

> Ciao!
> Steven
>
>
>
>         * sched-vis.c (dump_insn_slim): Print print_rtx_head at the
>         start of each new line.
>         * final.c (final_scan_insn): If the final dump is requested as
>         slim RTL, dump slim RTL to the assembly file also.
>
> Index: sched-vis.c
> ===================================================================
> --- sched-vis.c (revision 189997)
> +++ sched-vis.c (working copy)
> @@ -767,11 +767,13 @@ dump_insn_slim (FILE *f, const_rtx x)
>    rtx note;
>
>    print_insn (t, x, 1);
> +  fputs (print_rtx_head, f);
>    fputs (t, f);
>    putc ('\n', f);
>    if (INSN_P (x) && REG_NOTES (x))
>      for (note = REG_NOTES (x); note; note = XEXP (note, 1))
>        {
> +       fputs (print_rtx_head, f);
>          print_value (t, XEXP (note, 0), 1);
>         fprintf (f, "      %s: %s\n",
>                  GET_REG_NOTE_NAME (REG_NOTE_KIND (note)), t);
> Index: final.c
> ===================================================================
> --- final.c     (revision 189997)
> +++ final.c     (working copy)
> @@ -2747,11 +2747,16 @@ final_scan_insn (rtx insn, FILE *file, int optimiz
>         insn_code_number = recog_memoized (insn);
>         cleanup_subreg_operands (insn);
>
> -       /* Dump the insn in the assembly for debugging.  */
> +       /* Dump the insn in the assembly for debugging (-dAP).
> +          If the final dump is requested as slim RTL, dump slim
> +          RTL to the assembly file also.  */
>         if (flag_dump_rtl_in_asm)
>           {
>             print_rtx_head = ASM_COMMENT_START;
> -           print_rtl_single (asm_out_file, insn);
> +           if (! (dump_flags & TDF_SLIM))
> +             print_rtl_single (asm_out_file, insn);
> +           else
> +             dump_insn_slim (asm_out_file, insn);

Patch

Index: sched-vis.c
===================================================================
--- sched-vis.c (revision 189997)
+++ sched-vis.c (working copy)
@@ -767,11 +767,13 @@  dump_insn_slim (FILE *f, const_rtx x)
   rtx note;

   print_insn (t, x, 1);
+  fputs (print_rtx_head, f);
   fputs (t, f);
   putc ('\n', f);
   if (INSN_P (x) && REG_NOTES (x))
     for (note = REG_NOTES (x); note; note = XEXP (note, 1))
       {
+       fputs (print_rtx_head, f);
         print_value (t, XEXP (note, 0), 1);
        fprintf (f, "      %s: %s\n",
                 GET_REG_NOTE_NAME (REG_NOTE_KIND (note)), t);
Index: final.c
===================================================================
--- final.c     (revision 189997)
+++ final.c     (working copy)
@@ -2747,11 +2747,16 @@  final_scan_insn (rtx insn, FILE *file, int optimiz
        insn_code_number = recog_memoized (insn);
        cleanup_subreg_operands (insn);

-       /* Dump the insn in the assembly for debugging.  */
+       /* Dump the insn in the assembly for debugging (-dAP).
+          If the final dump is requested as slim RTL, dump slim
+          RTL to the assembly file also.  */
        if (flag_dump_rtl_in_asm)
          {
            print_rtx_head = ASM_COMMENT_START;
-           print_rtl_single (asm_out_file, insn);
+           if (! (dump_flags & TDF_SLIM))
+             print_rtl_single (asm_out_file, insn);
+           else
+             dump_insn_slim (asm_out_file, insn);