arm.h (FUNCTION_ARG_REGNO_P): Use IN_RANGE.
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Sun, 21 Oct 2001 19:44:08 +0000 (19:44 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Sun, 21 Oct 2001 19:44:08 +0000 (19:44 +0000)
* arm.h (FUNCTION_ARG_REGNO_P): Use IN_RANGE.

* system.h (IN_RANGE): New macro.

From-SVN: r46395

gcc/ChangeLog
gcc/config/arm/arm.h
gcc/system.h

index 056e39d9489a67fff707c4ec660f2f3a0b0b02d1..9e8abcc450563eae96dc8e04208cfe0bf40ad9b8 100644 (file)
@@ -1,3 +1,9 @@
+2001-10-21  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * arm.h (FUNCTION_ARG_REGNO_P): Use IN_RANGE.
+
+       * system.h (IN_RANGE): New macro.
+
 2001-10-21  Zack Weinberg  <zack@codesourcery.com>
 
        * aclocal.m4 (AM_WITH_NLS): Also create and substitute
index fcd3d42ce3478618c18679fb59e510b4daad2fe7..7347298772f90e0d84c5aad03599f8c94af96bc6 100644 (file)
@@ -1505,8 +1505,7 @@ typedef struct
 
 /* 1 if N is a possible register number for function argument passing.
    On the ARM, r0-r3 are used to pass args.  */
-#define FUNCTION_ARG_REGNO_P(REGNO)  \
-  ((REGNO) >= 0 && (REGNO) <= 3)
+#define FUNCTION_ARG_REGNO_P(REGNO)    (IN_RANGE ((REGNO), 0, 3))
 
 \f
 /* Tail calling.  */
index 55a9370aca4536c013737a7dcd57cd4e692a5edd..7cf3b5fe8bf79cd6ca3a08da2ee5d1e3e856af0d 100644 (file)
@@ -168,6 +168,16 @@ extern int errno;
 /* Get definitions of HOST_WIDE_INT and HOST_WIDEST_INT.  */
 #include "hwint.h"
 
+/* A macro to determine whether a VALUE lies inclusively within a
+   certain range without evaluating the VALUE more than once.  This
+   macro won't warn if the VALUE is unsigned and the LOWER bound is
+   zero, as it would e.g. with "VALUE >= 0 && ...".  Note the LOWER
+   bound *is* evaluated twice, and LOWER must not be greater than
+   UPPER.  However the bounds themselves can be either positive or
+   negative.  */
+#define IN_RANGE(VALUE, LOWER, UPPER) \
+  ((unsigned HOST_WIDE_INT)((VALUE) - (LOWER)) <= ((UPPER) - (LOWER)))
+
 /* Infrastructure for defining missing _MAX and _MIN macros.  Note that
    macros defined with these cannot be used in #if.  */