This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
FIX_REGISTER_CHECK
- To: Jim Wilson <wilson at cygnus dot com>
- Subject: FIX_REGISTER_CHECK
- From: Gavin Romig-Koch <gavin at cygnus dot com>
- Date: Wed, 7 Oct 1998 11:52:15 -0400 (EDT)
- CC: egcs-patches at cygnus dot com
This patch implements an error message for the use of an invalid
register in a -fcall-used-REG or -fcall-saved-REG option.
OK to commit to egcs?
-gavin...
* tm.texi (FIX_REGISTER_CHECK): New.
* regclass.c (fix_register) : Use FIX_REGISTER_CHECK.
* config/mips/mips.h (FIX_REGISTER_CHECK): Define.
Index: regclass.c
===================================================================
*************** fix_register (name, fixed, call_used)
*** 574,581 ****
if ((i = decode_reg_name (name)) >= 0)
{
! fixed_regs[i] = fixed;
! call_used_regs[i] = call_used;
}
else
{
--- 574,595 ----
if ((i = decode_reg_name (name)) >= 0)
{
! #ifdef FIX_REGISTER_CHECK
! if (! FIX_REGISTER_CHECK (i, fixed, call_used))
! {
! static char* what_option[2][2] = {
! "call-saved", "call-used",
! "no-such-option", "fixed" };
!
! error ("can't use '%s' as a %s register", name,
! what_option[fixed][call_used]);
! }
! else
! #endif
! {
! fixed_regs[i] = fixed;
! call_used_regs[i] = call_used;
! }
}
else
{
Index: tm.texi
===================================================================
*************** of the insn patterns whose constraints p
*** 1371,1376 ****
--- 1371,1382 ----
controlled by target switches, then GCC will automatically avoid using
these registers when the target switches are opposed to them.)
+ @findex FIX_REGISTER_CHECK
+ @item FIX_REGISTER_CHECK
+ If defined this macro is a boolean valued expression used to check
+ for invalid uses of -fcall-used-REG or -fcall-saved-REG. It should
+ evaluate to false for invalid uses. It need not be defined.
+
@findex NON_SAVING_SETJMP
@item NON_SAVING_SETJMP
If this macro is defined and has a nonzero value, it means that
Index: config/mips/mips.h
===================================================================
*************** while (0)
*** 684,689 ****
--- 684,698 ----
/* Show we can debug even without a frame pointer. */
#define CAN_DEBUG_WITHOUT_FP
+
+ /* Return false for invalid use of -fcall-used-REG or -fcall-saved-REG,
+ true otherwise. */
+ #define FIX_REGISTER_CHECK(NUMBER,FIXED,CALL_USED) \
+ (! (((NUMBER) == HARD_FRAME_POINTER_REGNUM \
+ || (NUMBER) == STACK_POINTER_REGNUM) \
+ && (!(FIXED) && !(CALL_USED) \
+ || !(FIXED) && (CALL_USED))))
+
/* Complain about missing specs and predefines that should be defined in each
of the target tm files to override the defaults. This is mostly a place-