[PATCH] Add a "compact" mode to print_rtx_function

Bernd Schmidt bschmidt@redhat.com
Wed Oct 12 17:31:00 GMT 2016

On 10/12/2016 07:48 PM, David Malcolm wrote:
> This patch implements a "compact" mode for print_rtx_function,
> implementing most of the ideas above.
> Example of output can be seen here:
>   https://dmalcolm.fedorapeople.org/gcc/2016-10-12/test-switch-compact.rtl
> which can be contrasted with the non-compact output here:
>   https://dmalcolm.fedorapeople.org/gcc/2016-10-12/test-switch-noncompact.rtl
> It adds the "c" prefix to the insn names, so we get "cinsn", etc.  However,
> it does lead to things like this:
>    (ccode_label 56 8 "")
> which gives me pause: would the "ccode" in "ccode_label" be confusing? (compared
> to "ccmode").  An alternative might be to have a "compact-insn-chain" vs
> "insn-chain" wrapper element, expressing that this is a compact dump.

Maybe "clabel" or something.

> OK for trunk if it passes?

I'd say yes - we're iterating and this seems to be an improvement.

> I think the only remaining item from our discussion above is what to do
> about the numbering of pseudos in the dumps (currently it just prints the regno
> unmodified).
> Other than that, is the resultant dump format good enough that I can start
> rewriting the RTL frontend parser, or are there other changes you'd want?

Give me a day or two to think it over, and for others to chime in. But I 
think this is reasonably close to what it should look like. Maybe empty 
edge flags don't need to be printed, and possibly there could be a more 
compact format for a large number edges like what you have for the switch?

> +  /* For insns, print the INSN_UID.
> +     In compact mode, we only print the INSN_UID of CODE_LABELs.  */
> +  if (!flag_compact || GET_CODE (in_rtx) == CODE_LABEL)
> +    if (INSN_CHAIN_CODE_P (GET_CODE (in_rtx)))

The two ifs should be merged I think.


More information about the Gcc-patches mailing list