This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [980307]: Warning patches #2/5 - enumeration value not handled... (problem on ARM)


 > From: Jim Wilson <wilson@cygnus.com>
 > 
 > It doesn't seem very elegant, but I think we can worry about later.
 > 
 > However, since you are adding a new target macro, we should provide
 > documentation for it in the tm.texi file.
 > 
 > The patch is OK if you check it in with tm.texi documentation.
 > 
 > Jim

	Yes, I had an offline discussion with Richard Earnshaw and
Nick Clifton and we came to similar conclusions.  Ie, that it was not
elegant and it needed a tm.texi entry.  Below is what we came up with.

	Is this one OK to install?

		Thanks,
		--Kaveh





Tue Mar 10 10:33:59 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
                          Richard Earnshaw (rearnsha@arm.com)
                          Nick Clifton  <nickc@cygnus.com>

	* tm.texi (DEFAULT_RTX_COSTS): Document new macro.

        * arm.h (DEFAULT_RTX_COSTS): Define instead of RTX_COSTS.

	* cse.c (rtx_cost): Provide a default case in an enumeration
        switch, and call DEFAULT_RTX_COSTS if it's defined.


RCS file: /egcs/carton/cvsfiles/egcs/gcc/tm.texi,v
retrieving revision 1.20
diff -p -r1.20 tm.texi
*** tm.texi     1998/03/06 14:48:58     1.20
--- tm.texi     1998/03/10 19:40:05
*************** instructions.  @var{outer_code} is the c
*** 4436,4441 ****
--- 4436,4456 ----
  This macro is optional; do not define it if the default cost assumptions
  are adequate for the target machine.
  
+ @findex DEFAULT_RTX_COSTS
+ @item DEFAULT_RTX_COSTS (@var{x}, @var{code}, @var{outer_code})
+ This macro, if defined, is called for any case not handled by the
+ @code{RTX_COSTS} or @code{CONST_COSTS} macros.  This eliminates the need
+ to put case labels into the macro, but the code, or any functions it
+ calls, must assume that the RTL in @var{x} could be of any type that has
+ not already been handled.  The arguments are the same as for
+ @code{RTX_COSTS}, and the macro should execute a return statement giving
+ the cost of any RTL expressions that it can handle.  The default cost
+ calculation is used for any RTL for which this macro does not return a
+ value.
+ 
+ This macro is optional; do not define it if the default cost assumptions
+ are adequate for the target machine.  
+ 
  @findex ADDRESS_COST
  @item ADDRESS_COST (@var{address})
  An expression giving the cost of an addressing mode that contains



diff -rup orig/egcs-980308/gcc/config/arm/arm.h egcs-980308/gcc/config/arm/arm.h
--- orig/egcs-980308/gcc/config/arm/arm.h	Fri Dec 19 11:42:21 1997
+++ egcs-980308/gcc/config/arm/arm.h	Tue Mar 10 10:20:45 1998
@@ -1620,8 +1620,7 @@ extern struct rtx_def *legitimize_pic_ad
   ((X) == frame_pointer_rtx || (X) == stack_pointer_rtx	\
    || (X) == arg_pointer_rtx)
 
-#define RTX_COSTS(X,CODE,OUTER_CODE)		\
-  default:					\
+#define DEFAULT_RTX_COSTS(X,CODE,OUTER_CODE)		\
    return arm_rtx_costs (X, CODE, OUTER_CODE);
 
 /* Moves to and from memory are quite expensive */
diff -rup orig/egcs-980308/gcc/cse.c egcs-980308/gcc/cse.c
--- orig/egcs-980308/gcc/cse.c	Sat Feb 28 02:06:27 1998
+++ egcs-980308/gcc/cse.c	Tue Mar 10 10:20:08 1998
@@ -751,6 +751,12 @@ rtx_cost (x, outer_code)
       RTX_COSTS (x, code, outer_code);
 #endif 
       CONST_COSTS (x, code, outer_code);
+
+    default:
+#ifdef DEFAULT_RTX_COSTS
+      DEFAULT_RTX_COSTS(x, code, outer_code);
+#endif
+      break;
     }
 
   /* Sum the costs of the sub-rtx's, plus cost of this operation,

--
Kaveh R. Ghazi			Project Manager / Custom Development
ghazi@caip.rutgers.edu		Icon CMT Corp.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]