diff options
author | David Malcolm <dmalcolm@redhat.com> | 2016-10-13 13:17:59 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2016-10-13 13:17:59 +0000 |
commit | 7810c4ebfc4ecaf5efd532d05af6a3ed75b1e6dc (patch) | |
tree | de1bdc49e4b5ea7c8cb945574137a3e85c85f946 /gcc/print-rtl-function.c | |
parent | 950e6f418ae2c2a110bc72520deba87289def55e (diff) | |
download | gcc-7810c4ebfc4ecaf5efd532d05af6a3ed75b1e6dc.zip gcc-7810c4ebfc4ecaf5efd532d05af6a3ed75b1e6dc.tar.gz gcc-7810c4ebfc4ecaf5efd532d05af6a3ed75b1e6dc.tar.bz2 |
Add a "compact" mode to print_rtx_function
gcc/ChangeLog:
* function-tests.c (selftest::test_expansion_to_rtl): Add "true"
for new "compact" param of print_rtx_function. Check for "cinsn"
rather than "insn".
* print-rtl-function.c (flag_compact): New decl.
(print_rtx_function): Add param "compact" and use it to set
flag_compact, adding a description of the effect to the leading
comment, and updating the example output.
* print-rtl.c (flag_compact): New variable.
(print_rtx_operand_code_0): Omit the JUMP_LABEL reference in compact
mode.
(print_rtx_operand_code_i): When printing source locations, wrap
xloc.file in quotes. Don't print INSN_CODEs in compact mode.
(print_rtx_operand_code_r): Don't print regnos for hard regs and
virtuals in compact mode.
(print_rtx_operand_code_u): Don't print insn UIDs in compact mode,
apart from in LABEL_REFs.
(print_rtx_operand): In case 'w', don't print in hex in compact mode.
Don't print basic block ids in compact mode.
(print_rtx): In compact mode, prefix the code of insns with "c",
only print the INSN_UID of CODE_LABELs, and omit their LABEL_NUSES.
* print-rtl.h (print_rtx_function): Add "compact" param.
gcc/testsuite/ChangeLog:
* gcc.target/i386/vararg-loc.c: Update for quoting of xloc.file
in INSN_LOCATION.
From-SVN: r241120
Diffstat (limited to 'gcc/print-rtl-function.c')
-rw-r--r-- | gcc/print-rtl-function.c | 76 |
1 files changed, 44 insertions, 32 deletions
diff --git a/gcc/print-rtl-function.c b/gcc/print-rtl-function.c index 4f9b4ef..90a0ff7 100644 --- a/gcc/print-rtl-function.c +++ b/gcc/print-rtl-function.c @@ -33,6 +33,8 @@ along with GCC; see the file COPYING3. If not see #include "langhooks.h" #include "emit-rtl.h" +extern bool flag_compact; + /* Print an "(edge-from)" or "(edge-to)" directive describing E to OUTFILE. */ @@ -126,55 +128,63 @@ can_have_basic_block_p (const rtx_insn *insn) the basic blocks of insns in the chain, wrapping those that are within blocks within "(block)" directives. - Example output: + If COMPACT, then instructions are printed in a compact form: + - INSN_UIDs are omitted, except for jumps and CODE_LABELs, + - INSN_CODEs are omitted, + - register numbers are omitted for hard and virtual regs + - insn names are prefixed with "c" (e.g. "cinsn", "cnote", etc) + + Example output (with COMPACT==true): (function "times_two" (insn-chain - (note 1 0 4 (nil) NOTE_INSN_DELETED) + (cnote NOTE_INSN_DELETED) (block 2 (edge-from entry (flags "FALLTHRU")) - (note 4 1 2 2 [bb 2] NOTE_INSN_BASIC_BLOCK) - (insn 2 4 3 2 (set (mem/c:SI (plus:DI (reg/f:DI 82 virtual-stack-vars) - (const_int -4 [0xfffffffffffffffc])) [1 i+0 S4 A32]) - (reg:SI 5 di [ i ])) t.c:2 -1 - (nil)) - (note 3 2 6 2 NOTE_INSN_FUNCTION_BEG) - (insn 6 3 7 2 (set (reg:SI 89) - (mem/c:SI (plus:DI (reg/f:DI 82 virtual-stack-vars) - (const_int -4 [0xfffffffffffffffc])) [1 i+0 S4 A32])) t.c:3 -1 - (nil)) - (insn 7 6 10 2 (parallel [ - (set (reg:SI 87 [ _2 ]) - (ashift:SI (reg:SI 89) - (const_int 1 [0x1]))) - (clobber (reg:CC 17 flags)) - ]) t.c:3 -1 - (expr_list:REG_EQUAL (ashift:SI (mem/c:SI (plus:DI (reg/f:DI 82 virtual-stack-vars) - (const_int -4 [0xfffffffffffffffc])) [1 i+0 S4 A32]) - (const_int 1 [0x1])) - (nil))) - (insn 10 7 14 2 (set (reg:SI 88 [ <retval> ]) - (reg:SI 87 [ _2 ])) t.c:3 -1 - (nil)) - (insn 14 10 15 2 (set (reg/i:SI 0 ax) - (reg:SI 88 [ <retval> ])) t.c:4 -1 - (nil)) - (insn 15 14 0 2 (use (reg/i:SI 0 ax)) t.c:4 -1 - (nil)) + (cnote [bb 2] NOTE_INSN_BASIC_BLOCK) + (cinsn (set (mem/c:SI (plus:DI (reg/f:DI virtual-stack-vars) + (const_int -4)) [1 i+0 S4 A32]) + (reg:SI di [ i ])) "t.c":2 + (nil)) + (cnote NOTE_INSN_FUNCTION_BEG) + (cinsn (set (reg:SI 89) + (mem/c:SI (plus:DI (reg/f:DI virtual-stack-vars) + (const_int -4)) [1 i+0 S4 A32])) "t.c":3 + (nil)) + (cinsn (parallel [ + (set (reg:SI 87 [ _2 ]) + (ashift:SI (reg:SI 89) + (const_int 1))) + (clobber (reg:CC flags)) + ]) "t.c":3 + (expr_list:REG_EQUAL (ashift:SI (mem/c:SI (plus:DI (reg/f:DI virtual-stack-vars) + (const_int -4)) [1 i+0 S4 A32]) + (const_int 1)) + (nil))) + (cinsn (set (reg:SI 88 [ <retval> ]) + (reg:SI 87 [ _2 ])) "t.c":3 + (nil)) + (cinsn (set (reg/i:SI ax) + (reg:SI 88 [ <retval> ])) "t.c":4 + (nil)) + (cinsn (use (reg/i:SI ax)) "t.c":4 + (nil)) (edge-to exit (flags "FALLTHRU")) ) ;; block 2 ) ;; insn-chain (crtl (return_rtx - (reg/i:SI 0 ax) + (reg/i:SI ax) ) ;; return_rtx ) ;; crtl ) ;; function "times_two" */ DEBUG_FUNCTION void -print_rtx_function (FILE *outfile, function *fn) +print_rtx_function (FILE *outfile, function *fn, bool compact) { + flag_compact = compact; + tree fdecl = fn->decl; const char *dname = lang_hooks.decl_printable_name (fdecl, 2); @@ -210,4 +220,6 @@ print_rtx_function (FILE *outfile, function *fn) fprintf (outfile, " ) ;; crtl\n"); fprintf (outfile, ") ;; function \"%s\"\n", dname); + + flag_compact = false; } |