From: Hans-Peter Nilsson Date: Mon, 20 Jul 2020 01:17:04 +0000 (+0200) Subject: mmix: When debug-dump, revert to "standard" pseudos for emitting integers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dd64a7fd274b148c6a1ba2772f8f981625412928;p=gcc.git mmix: When debug-dump, revert to "standard" pseudos for emitting integers The sole purpose of not providing pseudos and forcing use of TARGET_ASM_INTEGER is to arrange for assembly output that people can, instead of using gas, usefullt feed to mmixal (Knuth's assembler). It uses pseudos with slightly different semantics (BYTE, WYDE, TETRA, OCTA). Nice when it works, but that only happens for limited use-cases and debug-information is excluded. The dwarf2out.c shortcuts, looking up the pseudo-strings and doing the output on its own, has the result that in absence of such integer-emitting pseudos, the target TARGET_ASM_INTEGER hook is called, which by definition outputs a newline, and then the dwarf2out.c code redundantly adds another. That uglifies output and breaks the expectations of the dwarf2 parts of the test-suite. The wart by which an extra newline is emitted is ripe for a cleanup, and I started out thinking I'd add a default argument for emitting a newline to the assemble_integer family of functions, but then reconsidered. I also can't bring myself to use different pseudos with/without -g so instead I check for options for the more detailed dumps, as used by the test-suite to get those DW_* strings in detailed assembly output. This eliminates all FAILs in the dwarf2-specific parts of the gcc test-suite for mmix-knuth-mmixware, with no regressions. Committed. gcc: * config/mmix/mmix.c (mmix_option_override): Reinstate default integer-emitting targetm.asm_out pseudos when dumping detailed assembly-code. (mmix_assemble_integer): Update comment. --- diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c index 68f7ec3ab88..66e3d585a0a 100644 --- a/gcc/config/mmix/mmix.c +++ b/gcc/config/mmix/mmix.c @@ -318,6 +318,32 @@ mmix_option_override (void) (flag_pic > 1) ? "PIC" : "pic"); flag_pic = 0; } + + /* Don't bother with mmixal-compatible syntax if it's likely that a + certain format of the assembly is expected, like no new-line + after the .byte (or BYTE) parameter, when scanning debug-info + output, as happens in many places in the gcc testsuite. The + dwarf2 output code (maybe others) takes a shortcut based on the + presence of certain assembler directives, instead of calling + assemble_integer. Not worthwhile editing the test-cases: + mixed-syntax assembly output already looks too ugly for the + intent of being readable, and the resulting mix certainly fails + the intent of being compatible with mmixal. See + varasm.c:default_file_start for this triple. See also + mmix_assemble_integer. */ + if (flag_verbose_asm || flag_debug_asm || flag_dump_rtl_in_asm) + { + /* "Reinstate" the defaults from target-def.h that we + overrode. */ + targetm.asm_out.byte_op = "\t.byte\t"; + targetm.asm_out.aligned_op.hi = "\t.short\t"; + targetm.asm_out.aligned_op.si = "\t.long\t"; + + /* Note that TARGET_ASM_ALIGNED_DI_OP is default NULL, so + there's nothing to "reinstate". Still, we add the universal + default (with "recent" gas) for an address. */ + targetm.asm_out.aligned_op.di = "\t.dc.a\t"; + } } /* INIT_EXPANDERS. */ @@ -1379,10 +1405,11 @@ mmix_assemble_integer (rtx x, unsigned int size, int aligned_p) that's ok, because we can punt to generic functions. We then pretend that aligned data isn't needed, so the usual . syntax is used (which works for aligned data too). We actually - *must* do that, since we say we don't have simple aligned - pseudos, causing this function to be called. We just try and - keep as much compatibility as possible with mmixal syntax for - normal cases (i.e. without GNU extensions and C only). */ + *must* do that, since we (usually) say we don't have simple aligned + pseudos, causing this function to be called. See + mmix_option_override for an exception. We just try and keep as + much compatibility as possible with mmixal syntax for normal + cases (i.e. without GNU extensions and C only). */ case 1: if (GET_CODE (x) != CONST_INT) {