From 07338cf892502dff03d25ec1e4ccb0a6758f8cd8 Mon Sep 17 00:00:00 2001 From: Hans-Peter Nilsson Date: Mon, 21 Jan 2002 07:25:48 +0000 Subject: [PATCH] Remove workaround for register stack overwrite bug in mmix. * config/mmix/mmix.c (mmix_target_asm_function_prologue): Remove support for TARGET_REG_STACK_FILL_BUG. * config/mmix/mmix.h: Remove member has_call_without_parameters. (TARGET_MASK_REG_STACK_FILL_BUG, TARGET_REG_STACK_FILL_BUG): Delete. (TARGET_DEFAULT): Remove TARGET_MASK_REG_STACK_FILL_BUG. (TARGET_SWITCHES): Remove -mreg-stack-fill-bug-workaround and -mno-reg-stack-fill-bug-workaround. * config/mmix/mmix.md ("call", "call_value"): Don't set struct machine member has_call_without_parameters. * doc/invoke.texi (Option Summary) : Remove -mreg-stack-fill-bug-workaround and -mno-reg-stack-fill-bug-workaround. (MMIX Options): Ditto. From-SVN: r49035 --- gcc/ChangeLog | 18 ++++++++++++++++++ gcc/config/mmix/mmix.c | 46 ---------------------------------------------- gcc/config/mmix/mmix.h | 12 +----------- gcc/config/mmix/mmix.md | 10 ++-------- gcc/doc/invoke.texi | 12 +----------- 5 files changed, 22 insertions(+), 76 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c86738f..8ee4aef 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,21 @@ +2002-01-21 Hans-Peter Nilsson + + Remove workaround for register stack overwrite bug in mmix. + * config/mmix/mmix.c (mmix_target_asm_function_prologue): Remove + support for TARGET_REG_STACK_FILL_BUG. + * config/mmix/mmix.h: Remove member has_call_without_parameters. + (TARGET_MASK_REG_STACK_FILL_BUG, TARGET_REG_STACK_FILL_BUG): + Delete. + (TARGET_DEFAULT): Remove TARGET_MASK_REG_STACK_FILL_BUG. + (TARGET_SWITCHES): Remove -mreg-stack-fill-bug-workaround and + -mno-reg-stack-fill-bug-workaround. + * config/mmix/mmix.md ("call", "call_value"): Don't set struct + machine member has_call_without_parameters. + * doc/invoke.texi (Option Summary) : Remove + -mreg-stack-fill-bug-workaround and + -mno-reg-stack-fill-bug-workaround. + (MMIX Options): Ditto. + 2002-01-21 Kazu Hirata * config/h8300/h8300.c (function_arg): Replace 0 with NULL_RTX diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c index 8478fc4..bbe8313 100644 --- a/gcc/config/mmix/mmix.c +++ b/gcc/config/mmix/mmix.c @@ -966,52 +966,6 @@ mmix_target_asm_function_prologue (stream, locals_size) break; mmix_highest_saved_stack_register = regno; - - /* FIXME: Remove this when a corrected mmix version is released. - - This kludge is a work-around for a presumed bug in the mmix simulator - (reported to knuth-bug), all versions up and including "Version of 14 - October 2001". When the circular register stack fills up, the parts - that would be overwritten need to be written to memory. If the - "filling" instruction is a PUSHJ or PUSHGO, rL == 0 afterwards. That - precise condition (rS == rO && rL == 0) is the same as for an empty - register stack, which means no more data is written to memory for - that round. A hack is to remove the "&& L!=0" from "@=" in mmix-sim.w: the register stack isn't empty under normal - circumstances, unless SAVE or UNSAVE is used, interrupts are enabled - or cases where rS == rO and rL is explicitly written to 0 as in - "PUT rL,0". - - A workaround is to make sure PUSHJ or PUSHGO isn't filling up the - register stac. This is accomplished if $16 or higher is written - before the function call. This doesn't happen from a leaf functions - of course. For the MMIXware ABI, this can't happen if all called - functions have parameters, because parameters start at $16. - Otherwise, and for the GNU ABI, if any register $16 and up is used, - we can see if it's mentioned before any function-call without - parameters. This isn't too important; the bug will probably be fixed - soon and there's an option to not emit the work-around code. The - call-with-parameters kludge wouldn't be there if it hadn't been for - it being left-over from a previous mmix version. - - The actual code makes sure any register stack fill happens as early - as in the function prologue with a "SET $16,$16" (essentially a nop - except for the effects on the register stack). */ - if (TARGET_REG_STACK_FILL_BUG - && ((TARGET_ABI_GNU && !leaf_function_p ()) - || (!TARGET_ABI_GNU - && cfun->machine->has_call_without_parameters))) - { - /* We don't have a specific macro or derivable expression for the - first non-call-saved register. If we need it in other places - than here (which is temporary code anyway), such a macro should - be added. */ - int flush_regno - = TARGET_ABI_GNU ? mmix_highest_saved_stack_register + 2 : 16; - - fprintf (stream, "\tSET %s,%s\n", - reg_names[flush_regno], reg_names[flush_regno]); - } } /* TARGET_ASM_FUNCTION_EPILOGUE. */ diff --git a/gcc/config/mmix/mmix.h b/gcc/config/mmix/mmix.h index 25a89d8..9c1e2f1 100644 --- a/gcc/config/mmix/mmix.h +++ b/gcc/config/mmix/mmix.h @@ -90,7 +90,6 @@ extern struct rtx_def *mmix_compare_op1; mmix.md too. */ struct machine_function { - int has_call_without_parameters; int has_landing_pad; }; @@ -157,7 +156,6 @@ extern int target_flags; #define TARGET_MASK_KNUTH_DIVISION 16 #define TARGET_MASK_TOPLEVEL_SYMBOLS 32 #define TARGET_MASK_BRANCH_PREDICT 64 -#define TARGET_MASK_REG_STACK_FILL_BUG 128 /* FIXME: Get rid of this one. */ #define TARGET_LIBFUNC (target_flags & TARGET_MASK_LIBFUNCS) @@ -167,11 +165,9 @@ extern int target_flags; #define TARGET_KNUTH_DIVISION (target_flags & TARGET_MASK_KNUTH_DIVISION) #define TARGET_TOPLEVEL_SYMBOLS (target_flags & TARGET_MASK_TOPLEVEL_SYMBOLS) #define TARGET_BRANCH_PREDICT (target_flags & TARGET_MASK_BRANCH_PREDICT) -#define TARGET_REG_STACK_FILL_BUG \ - (target_flags & TARGET_MASK_REG_STACK_FILL_BUG) #define TARGET_DEFAULT \ - (TARGET_MASK_BRANCH_PREDICT | TARGET_MASK_REG_STACK_FILL_BUG) + (TARGET_MASK_BRANCH_PREDICT) /* FIXME: Provide a way to *load* the epsilon register. */ #define TARGET_SWITCHES \ @@ -202,12 +198,6 @@ extern int target_flags; N_("Use P-mnemonics for branches statically predicted as taken")}, \ {"no-branch-predict", -TARGET_MASK_BRANCH_PREDICT, \ N_("Don't use P-mnemonics for branches")}, \ - {"reg-stack-fill-bug-workaround", TARGET_MASK_REG_STACK_FILL_BUG, \ - N_("Work around inconsistent behavior when a PUSHJ or PUSHGO\ - instruction fills the register stack")}, \ - {"no-reg-stack-fill-bug-workaround", -TARGET_MASK_REG_STACK_FILL_BUG,\ - N_("Don't work around inconsistent behavior when a PUSHJ or PUSHGO\ - instruction fills the register stack")}, \ {"", TARGET_DEFAULT, ""}} /* Unfortunately, this must not reference anything in "mmix.c". */ diff --git a/gcc/config/mmix/mmix.md b/gcc/config/mmix/mmix.md index 08ee0b3..c8e0167 100644 --- a/gcc/config/mmix/mmix.md +++ b/gcc/config/mmix/mmix.md @@ -996,11 +996,6 @@ DIVU %1,%1,%2\;GET %0,:rR\;NEGU %2,0,%0\;CSNN %0,$255,%2") if (operands[2] == NULL_RTX) operands[2] = const0_rtx; - /* FIXME: Documentation bug: operands[3] (operands[2] for 'call') is the - *next* argument register, not the number of arguments in registers. */ - cfun->machine->has_call_without_parameters - |= REG_P (operands[2]) && REGNO (operands[2]) == MMIX_FIRST_ARG_REGNUM; - operands[4] = gen_rtx_REG (DImode, MMIX_INCOMING_RETURN_ADDRESS_REGNUM); }") @@ -1025,9 +1020,8 @@ DIVU %1,%1,%2\;GET %0,:rR\;NEGU %2,0,%0\;CSNN %0,$255,%2") operands[3] = const0_rtx; /* FIXME: Documentation bug: operands[3] (operands[2] for 'call') is the - *next* argument register, not the number of arguments in registers. */ - cfun->machine->has_call_without_parameters - |= REG_P (operands[3]) && REGNO (operands[3]) == MMIX_FIRST_ARG_REGNUM; + *next* argument register, not the number of arguments in registers. + (There used to be code here where that mattered.) */ operands[5] = gen_rtx_REG (DImode, MMIX_INCOMING_RETURN_ADDRESS_REGNUM); }") diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 3e67503..945819e 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -593,8 +593,7 @@ in the following sections. @gccoptlist{ -mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol --melf -mbranch-predict -mreg-stack-fill-bug-workaround @gol --mno-branch-predict -mno-reg-stack-fill-bug-workaround} +-melf -mbranch-predict -mno-branch-predict} @emph{IA-64 Options} @gccoptlist{ @@ -9486,15 +9485,6 @@ Generate an executable in the ELF format, rather than the default @opindex mno-branch-predict Use (do not use) the probable-branch instructions, when static branch prediction indicates a probable branch. - -@item -mreg-stack-fill-bug-workaround -@itemx -mno-reg-stack-fill-bug-workaround -@opindex mreg-stack-fill-bug-workaround -@opindex mno-reg-stack-fill-bug-workaround -Work around (do not work around) an inconsistency in the circular -register stack mechanism in the @command{mmix} simulator, which -causes entries in the register stack to not be flushed to memory if -the instruction causing the fill-up is @code{PUSHJ} or @code{PUSHGO}. @end table @node PDP-11 Options -- 2.7.4