diff options
author | Richard Biener <rguenther@suse.de> | 2021-04-07 09:09:09 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2021-04-07 09:59:07 +0200 |
commit | 6eaf7ac6f49eae85825be185005338ca5c886161 (patch) | |
tree | 0dd60d7f40998bcabaa91c954546bdc919e0bae6 /gcc/tree-ssa-sccvn.c | |
parent | e0bdccac582c01c928a05f26edcd8f5ac24669eb (diff) | |
download | gcc-6eaf7ac6f49eae85825be185005338ca5c886161.zip gcc-6eaf7ac6f49eae85825be185005338ca5c886161.tar.gz gcc-6eaf7ac6f49eae85825be185005338ca5c886161.tar.bz2 |
Add debug_vn_reference_ops helper
This factors out a helper to dump VN reference operands, sth that
proves useful in debugging VN issues.
2021-04-07 Richard Biener <rguenther@suse.de>
* tree-ssa-sccvn.h (print_vn_reference_ops): Declare.
* tree-ssa-pre.c (print_pre_expr): Factor out VN reference operand
printing...
* tree-ssa-sccvn.c (print_vn_reference_ops): ... into this new
function.
(debug_vn_reference_ops): New.
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r-- | gcc/tree-ssa-sccvn.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 0567a2e..16e75b5 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -249,6 +249,55 @@ vn_reference_hasher::equal (const vn_reference_s *v, const vn_reference_s *c) typedef hash_table<vn_reference_hasher> vn_reference_table_type; typedef vn_reference_table_type::iterator vn_reference_iterator_type; +/* Pretty-print OPS to OUTFILE. */ + +void +print_vn_reference_ops (FILE *outfile, const vec<vn_reference_op_s> ops) +{ + vn_reference_op_t vro; + unsigned int i; + fprintf (outfile, "{"); + for (i = 0; ops.iterate (i, &vro); i++) + { + bool closebrace = false; + if (vro->opcode != SSA_NAME + && TREE_CODE_CLASS (vro->opcode) != tcc_declaration) + { + fprintf (outfile, "%s", get_tree_code_name (vro->opcode)); + if (vro->op0) + { + fprintf (outfile, "<"); + closebrace = true; + } + } + if (vro->op0) + { + print_generic_expr (outfile, vro->op0); + if (vro->op1) + { + fprintf (outfile, ","); + print_generic_expr (outfile, vro->op1); + } + if (vro->op2) + { + fprintf (outfile, ","); + print_generic_expr (outfile, vro->op2); + } + } + if (closebrace) + fprintf (outfile, ">"); + if (i != ops.length () - 1) + fprintf (outfile, ","); + } + fprintf (outfile, "}"); +} + +DEBUG_FUNCTION void +debug_vn_reference_ops (const vec<vn_reference_op_s> ops) +{ + print_vn_reference_ops (stderr, ops); + fputc ('\n', stderr); +} /* The set of VN hashtables. */ |