diff options
author | David Malcolm <dmalcolm@redhat.com> | 2016-11-09 20:55:03 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2016-11-09 20:55:03 +0000 |
commit | 677aa9b4b79ce0e26cadbdbc9effdbaa00487e6a (patch) | |
tree | 1e612ec728999a697c3b1c9733cf121ba3eb3327 | |
parent | 410fe60d14642e03ba5b1658bff522d92fa4ca9f (diff) | |
download | gcc-677aa9b4b79ce0e26cadbdbc9effdbaa00487e6a.zip gcc-677aa9b4b79ce0e26cadbdbc9effdbaa00487e6a.tar.gz gcc-677aa9b4b79ce0e26cadbdbc9effdbaa00487e6a.tar.bz2 |
print-rtl-function.c: add (param) directive to dump
gcc/ChangeLog:
* print-rtl-function.c: Include varasm.h.
(print_any_param_name): New function.
(print_param): New function.
(print_rtx_function): Call print_param for each argument.
* print-rtl.c (rtx_writer::finish_directive): New function.
* print-rtl.h (rtx_writer::finish_directive): New decl.
From-SVN: r242023
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/print-rtl-function.c | 36 | ||||
-rw-r--r-- | gcc/print-rtl.c | 9 | ||||
-rw-r--r-- | gcc/print-rtl.h | 2 |
4 files changed, 56 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 55c6e6f..edf734f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2016-11-09 David Malcolm <dmalcolm@redhat.com> + + * print-rtl-function.c: Include varasm.h. + (print_any_param_name): New function. + (print_param): New function. + (print_rtx_function): Call print_param for each argument. + * print-rtl.c (rtx_writer::finish_directive): New function. + * print-rtl.h (rtx_writer::finish_directive): New decl. + 2016-11-09 Uros Bizjak <ubizjak@gmail.com> PR target/78262 diff --git a/gcc/print-rtl-function.c b/gcc/print-rtl-function.c index f37e1b7..8842226 100644 --- a/gcc/print-rtl-function.c +++ b/gcc/print-rtl-function.c @@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see #include "langhooks.h" #include "memmodel.h" #include "emit-rtl.h" +#include "varasm.h" /* Print an "(edge-from)" or "(edge-to)" directive describing E to OUTFILE. */ @@ -127,6 +128,37 @@ can_have_basic_block_p (const rtx_insn *insn) return true; } +/* Subroutine of print_param. Write the name of ARG, if any, to OUTFILE. */ + +static void +print_any_param_name (FILE *outfile, tree arg) +{ + if (DECL_NAME (arg)) + fprintf (outfile, " \"%s\"", IDENTIFIER_POINTER (DECL_NAME (arg))); +} + +/* Print a "(param)" directive for ARG to OUTFILE. */ + +static void +print_param (FILE *outfile, rtx_writer &w, tree arg) +{ + fprintf (outfile, " (param"); + print_any_param_name (outfile, arg); + fprintf (outfile, "\n"); + + /* Print the value of DECL_RTL (without lazy-evaluation). */ + fprintf (outfile, " (DECL_RTL "); + w.print_rtx (DECL_RTL_IF_SET (arg)); + w.finish_directive (); + + /* Print DECL_INCOMING_RTL. */ + fprintf (outfile, " (DECL_RTL_INCOMING "); + w.print_rtx (DECL_INCOMING_RTL (arg)); + fprintf (outfile, ")"); + + w.finish_directive (); +} + /* Write FN to OUTFILE in a form suitable for parsing, with indentation and comments to make the structure easy for a human to grok. Track the basic blocks of insns in the chain, wrapping those that are within @@ -197,6 +229,10 @@ print_rtx_function (FILE *outfile, function *fn, bool compact) fprintf (outfile, "(function \"%s\"\n", dname); + /* Params. */ + for (tree arg = DECL_ARGUMENTS (fdecl); arg; arg = DECL_CHAIN (arg)) + print_param (outfile, w, arg); + /* The instruction chain. */ fprintf (outfile, " (insn-chain\n"); basic_block curr_bb = NULL; diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c index 3f15a21..e7368c7 100644 --- a/gcc/print-rtl.c +++ b/gcc/print-rtl.c @@ -804,6 +804,15 @@ rtx_writer::print_rtx (const_rtx in_rtx) m_sawclose = 1; } +/* Emit a closing parenthesis and newline. */ + +void +rtx_writer::finish_directive () +{ + fprintf (m_outfile, ")\n"); + m_sawclose = 0; +} + /* Print an rtx on the current line of FILE. Initially indent IND characters. */ diff --git a/gcc/print-rtl.h b/gcc/print-rtl.h index 68db057..e722038 100644 --- a/gcc/print-rtl.h +++ b/gcc/print-rtl.h @@ -31,6 +31,8 @@ class rtx_writer void print_rtl (const_rtx rtx_first); int print_rtl_single_with_indent (const_rtx x, int ind); + void finish_directive (); + private: void print_rtx_operand_code_0 (const_rtx in_rtx, int idx); void print_rtx_operand_code_e (const_rtx in_rtx, int idx); |