diff options
| author | Alexandre Oliva <oliva@adacore.com> | 2025-12-06 22:08:04 -0300 |
|---|---|---|
| committer | Alexandre Oliva <oliva@gnu.org> | 2025-12-06 22:08:04 -0300 |
| commit | 83739ee76da65ddf56a1be3eda253e2ad0fa5ab8 (patch) | |
| tree | 8235b39fe030680eb86e87e4ed4570e2f04ead6d | |
| parent | c70bf3e009397fc7d13b5a5bd64da02e92bba3e9 (diff) | |
| download | gcc-83739ee76da65ddf56a1be3eda253e2ad0fa5ab8.zip gcc-83739ee76da65ddf56a1be3eda253e2ad0fa5ab8.tar.gz gcc-83739ee76da65ddf56a1be3eda253e2ad0fa5ab8.tar.bz2 | |
cselib: dump_cselib_* fixes
Rework dump_cselib_table to not crash when cselib_preserved_hash_table
is not allocated, and to remove the extraneous indirection from
dump_cselib_val that made it inconvenient to call from a debugger.
for gcc/ChangeLog
* cselib.cc (dump_cselib_val): Split out of and rename to...
(dump_cselib_val_ptr): ... this.
(dump_cselib_table): Adjust. Skip cselib_preserved_hash_table
when not allocated.
| -rw-r--r-- | gcc/cselib.cc | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/gcc/cselib.cc b/gcc/cselib.cc index 7f1991b..9303574 100644 --- a/gcc/cselib.cc +++ b/gcc/cselib.cc @@ -3459,12 +3459,11 @@ cselib_finish (void) next_uid = 0; } -/* Dump the cselib_val *X to FILE *OUT. */ +/* Dump the cselib_val V to FILE *OUT. */ int -dump_cselib_val (cselib_val **x, FILE *out) +dump_cselib_val (cselib_val *v, FILE *out) { - cselib_val *v = *x; bool need_lf = true; print_inline_rtx (out, v->val_rtx, 0); @@ -3533,15 +3532,27 @@ dump_cselib_val (cselib_val **x, FILE *out) return 1; } +/* Dump the cselib_val *X to FILE *OUT. */ + +static int +dump_cselib_val_ptr (cselib_val **x, FILE *out) +{ + cselib_val *v = *x; + return dump_cselib_val (v, out); +} + /* Dump to OUT everything in the CSELIB table. */ void dump_cselib_table (FILE *out) { fprintf (out, "cselib hash table:\n"); - cselib_hash_table->traverse <FILE *, dump_cselib_val> (out); - fprintf (out, "cselib preserved hash table:\n"); - cselib_preserved_hash_table->traverse <FILE *, dump_cselib_val> (out); + cselib_hash_table->traverse <FILE *, dump_cselib_val_ptr> (out); + if (cselib_preserved_hash_table) + { + fprintf (out, "cselib preserved hash table:\n"); + cselib_preserved_hash_table->traverse <FILE *, dump_cselib_val_ptr> (out); + } if (first_containing_mem != &dummy_val) { fputs ("first mem ", out); |
