An asm operand with a "VIEW_CONVERT_EXPR<struct {
[...]
}>" will output the definition of the struct as asm code. Oops.
I hoped setting print_rtx_head would affect print_mem_expr, just
because it's in print-rtl rather than tree-pretty-print, but it didn't
help. I've thus arranged for print_mem_expr to "obey" print_rtx_head
by enabling TDF_SLIM.
Regstrapped on x86_64-linux-gnu. Ok to install?
Another alternative that occurred to me was to get print_rtx_head
printed by e.g. pp_newline, or otherwise get print-rtl and
pretty-print infrastructure to both use the same line-leading
infrastructure. I think that would be a much bigger undertaking, so I
figured I'd ask whether that would be desirable, before taking it up.
Thoughts?
for gcc/ChangeLog
* final.c (output_asm_operand_names): Set print_rtx_head
around print_mem_expr.
* print-rtl.c (print_mem_expr): Enable TDF_SLIM in dump_flags
when print_rtx_head is nonempty.
---
final.c | 3 +++
print-rtl.c | 4 ++++
2 files changed, 7 insertions(+)
diff --git gcc/final.c gcc/final.c
index a360196..482801db 100644
--- gcc/final.c
+++ gcc/final.c
@@ -3706,9 +3706,12 @@ output_asm_operand_names (rtx *operands, int *oporder,
int nops)
wrote = 1;
if (expr)
{
+ const char *saved_print_rtx_head = print_rtx_head;
fprintf (asm_out_file, "%s",
addressp ? "*" : "");
+ print_rtx_head = ASM_COMMENT_START;
print_mem_expr (asm_out_file, expr);
+ print_rtx_head = saved_print_rtx_head;
wrote = 1;
}
else if (REG_P (op) && ORIGINAL_REGNO (op)
diff --git gcc/print-rtl.c gcc/print-rtl.c
index 611ea07..0563540 100644
--- gcc/print-rtl.c
+++ gcc/print-rtl.c
@@ -182,8 +182,12 @@ rtx_reuse_manager::set_seen_def (int reuse_id)
void
print_mem_expr (FILE *outfile, const_tree expr)
{
+ dump_flags_t save_dump_flags = dump_flags;
+ if (*print_rtx_head)
+ dump_flags |= TDF_SLIM;
fputc (' ', outfile);
print_generic_expr (outfile, CONST_CAST_TREE (expr), dump_flags);
+ dump_flags = save_dump_flags;
}
#endif
--
Alexandre Oliva, freedom fighter he/him https://FSFLA.org/blogs/lxo/
Free Software Evangelist Stallman was right, but he's left :(
GNU Toolchain Engineer Live long and free, and prosper ethically