This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Committed, MMIX: Don't work around register stack overwrite-on-fillbug.
- From: Hans-Peter Nilsson <hp at bitrange dot com>
- To: <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 21 Jan 2002 02:33:31 -0500 (EST)
- Subject: Committed, MMIX: Don't work around register stack overwrite-on-fillbug.
The register-stack overwrite-on-fill bug is fixed in mmix in the
"version of 13 January 2002", so there's too little reason to
keep the work-around. Tested with and without -mabi=gnu.
2002-01-21 Hans-Peter Nilsson <hp@bitrange.com>
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) <MMIX Options>: Remove
-mreg-stack-fill-bug-workaround and
-mno-reg-stack-fill-bug-workaround.
(MMIX Options): Ditto.
Index: mmix.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mmix/mmix.c,v
retrieving revision 1.14
diff -p -c -r1.14 mmix.c
*** mmix.c 2002/01/10 01:23:07 1.14
--- mmix.c 2002/01/20 23:24:16
*************** mmix_target_asm_function_prologue (strea
*** 966,1017 ****
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 "@<Increase
- rL@>=" 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. */
--- 966,971 ----
Index: mmix.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mmix/mmix.h,v
retrieving revision 1.13
diff -p -c -r1.13 mmix.h
*** mmix.h 2002/01/10 04:06:16 1.13
--- mmix.h 2002/01/20 23:24:17
*************** extern struct rtx_def *mmix_compare_op1;
*** 90,96 ****
mmix.md too. */
struct machine_function
{
- int has_call_without_parameters;
int has_landing_pad;
};
--- 90,95 ----
*************** extern int target_flags;
*** 157,163 ****
#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)
--- 156,161 ----
*************** extern int target_flags;
*** 167,177 ****
#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)
/* FIXME: Provide a way to *load* the epsilon register. */
#define TARGET_SWITCHES \
--- 165,173 ----
#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_DEFAULT \
! (TARGET_MASK_BRANCH_PREDICT)
/* FIXME: Provide a way to *load* the epsilon register. */
#define TARGET_SWITCHES \
*************** extern int target_flags;
*** 202,213 ****
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". */
--- 198,203 ----
Index: mmix.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mmix/mmix.md,v
retrieving revision 1.6
diff -p -c -r1.6 mmix.md
*** mmix.md 2002/01/05 04:03:36 1.6
--- mmix.md 2002/01/20 23:24:19
*************** DIVU %1,%1,%2\;GET %0,:rR\;NEGU %2,0,%0\
*** 996,1006 ****
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);
}")
--- 996,1001 ----
*************** DIVU %1,%1,%2\;GET %0,:rR\;NEGU %2,0,%0\
*** 1025,1033 ****
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;
operands[5] = gen_rtx_REG (DImode, MMIX_INCOMING_RETURN_ADDRESS_REGNUM);
}")
--- 1020,1027 ----
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.
! (There used to be code here where that mattered.) */
operands[5] = gen_rtx_REG (DImode, MMIX_INCOMING_RETURN_ADDRESS_REGNUM);
}")
Index: doc/invoke.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/invoke.texi,v
retrieving revision 1.108
diff -p -c -r1.108 invoke.texi
*** invoke.texi 2002/01/16 17:23:32 1.108
--- invoke.texi 2002/01/20 23:40:42
*************** in the following sections.
*** 593,600 ****
@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}
@emph{IA-64 Options}
@gccoptlist{
--- 593,599 ----
@gccoptlist{
-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
! -melf -mbranch-predict -mno-branch-predict}
@emph{IA-64 Options}
@gccoptlist{
*************** Generate an executable in the ELF format
*** 9486,9500 ****
@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
--- 9485,9490 ----
brgds, H-P