From 8dde5924c6d38506f903070704352714d54e6aa8 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Mon, 26 Mar 2007 10:34:01 +0200 Subject: [PATCH] reg-stack.c (replace_reg): Use IN_RANGE macro in gcc_assert(). * reg-stack.c (replace_reg): Use IN_RANGE macro in gcc_assert(). * config/i386/constraints.md (define_constraint "I"): Use IN_RANGE macro. (define_constraint "J"): Ditto. (define_constraint "K"): Ditto. (define_constraint "M"): Ditto. (define_constraint "N"): Ditto. (define_constraint "O"): Ditto. * config/i386/predicates.md (define_predicate "register_no_elim_operand"): Use IN_RANGE macro. (define_predicate "const_0_to_3_operand"): Ditto. (define_predicate "const_0_to_7_operand"): Ditto. (define_predicate "const_0_to_15_operand"): Ditto. (define_predicate "const_0_to_63_operand"): Ditto. (define_predicate "const_0_to_255_operand"): Ditto. (define_predicate "const_1_to_31_operand"): Ditto. (define_predicate "const_2_to_3_operand"): Ditto. (define_predicate "const_4_to_7_operand"): Ditto. From-SVN: r123210 --- gcc/ChangeLog | 21 +++++++++++++++++++++ gcc/config/i386/constraints.md | 12 ++++++------ gcc/config/i386/predicates.md | 20 ++++++++++---------- gcc/reg-stack.c | 3 +-- 4 files changed, 38 insertions(+), 18 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6f2c3dca48b..8adcaefdc32 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,24 @@ +2007-03-26 Uros Bizjak + + * reg-stack.c (replace_reg): Use IN_RANGE macro in gcc_assert(). + * config/i386/constraints.md + (define_constraint "I"): Use IN_RANGE macro. + (define_constraint "J"): Ditto. + (define_constraint "K"): Ditto. + (define_constraint "M"): Ditto. + (define_constraint "N"): Ditto. + (define_constraint "O"): Ditto. + * config/i386/predicates.md + (define_predicate "register_no_elim_operand"): Use IN_RANGE macro. + (define_predicate "const_0_to_3_operand"): Ditto. + (define_predicate "const_0_to_7_operand"): Ditto. + (define_predicate "const_0_to_15_operand"): Ditto. + (define_predicate "const_0_to_63_operand"): Ditto. + (define_predicate "const_0_to_255_operand"): Ditto. + (define_predicate "const_1_to_31_operand"): Ditto. + (define_predicate "const_2_to_3_operand"): Ditto. + (define_predicate "const_4_to_7_operand"): Ditto. + 2007-03-25 David Edelsohn * config/rs6000/rs6000.c (rs6000_emit_prologue): Always clobber LR diff --git a/gcc/config/i386/constraints.md b/gcc/config/i386/constraints.md index 8f3e3cef066..da700219ed8 100644 --- a/gcc/config/i386/constraints.md +++ b/gcc/config/i386/constraints.md @@ -103,17 +103,17 @@ (define_constraint "I" "Integer constant in the range 0 @dots{} 31, for 32-bit shifts." (and (match_code "const_int") - (match_test "ival >= 0 && ival <= 31"))) + (match_test "IN_RANGE (ival, 0, 31)"))) (define_constraint "J" "Integer constant in the range 0 @dots{} 63, for 64-bit shifts." (and (match_code "const_int") - (match_test "ival >= 0 && ival <= 63"))) + (match_test "IN_RANGE (ival, 0, 63)"))) (define_constraint "K" "Signed 8-bit integer constant." (and (match_code "const_int") - (match_test "ival >= -128 && ival <= 127"))) + (match_test "IN_RANGE (ival, -128, 127)"))) (define_constraint "L" "@code{0xFF} or @code{0xFFFF}, for andsi as a zero-extending move." @@ -123,18 +123,18 @@ (define_constraint "M" "0, 1, 2, or 3 (shifts for the @code{lea} instruction)." (and (match_code "const_int") - (match_test "ival >= 0 && ival <= 3"))) + (match_test "IN_RANGE (ival, 0, 3)"))) (define_constraint "N" "Unsigned 8-bit integer constant (for @code{in} and @code{out} instructions)." (and (match_code "const_int") - (match_test "ival >= 0 && ival <= 255"))) + (match_test "IN_RANGE (ival, 0, 255)"))) (define_constraint "O" "@internal Integer constant in the range 0 @dots{} 127, for 128-bit shifts." (and (match_code "const_int") - (match_test "ival >= 0 && ival <= 127"))) + (match_test "IN_RANGE (ival, 0, 127)"))) ;; Floating-point constant constraints. ;; We allow constants even if TARGET_80387 isn't set, because the diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md index be2141c13f2..86b6774d062 100644 --- a/gcc/config/i386/predicates.md +++ b/gcc/config/i386/predicates.md @@ -497,8 +497,8 @@ op = SUBREG_REG (op); return !(op == arg_pointer_rtx || op == frame_pointer_rtx - || (REGNO (op) >= FIRST_PSEUDO_REGISTER - && REGNO (op) <= LAST_VIRTUAL_REGISTER)); + || IN_RANGE (REGNO (op), + FIRST_PSEUDO_REGISTER, LAST_VIRTUAL_REGISTER)); }) ;; Similarly, but include the stack pointer. This is used to prevent esp @@ -572,27 +572,27 @@ ;; Match 0 to 3. (define_predicate "const_0_to_3_operand" (and (match_code "const_int") - (match_test "INTVAL (op) >= 0 && INTVAL (op) <= 3"))) + (match_test "IN_RANGE (INTVAL (op), 0, 3)"))) ;; Match 0 to 7. (define_predicate "const_0_to_7_operand" (and (match_code "const_int") - (match_test "INTVAL (op) >= 0 && INTVAL (op) <= 7"))) + (match_test "IN_RANGE (INTVAL (op), 0, 7)"))) ;; Match 0 to 15. (define_predicate "const_0_to_15_operand" (and (match_code "const_int") - (match_test "INTVAL (op) >= 0 && INTVAL (op) <= 15"))) + (match_test "IN_RANGE (INTVAL (op), 0, 15)"))) ;; Match 0 to 63. (define_predicate "const_0_to_63_operand" (and (match_code "const_int") - (match_test "INTVAL (op) >= 0 && INTVAL (op) <= 63"))) + (match_test "IN_RANGE (INTVAL (op), 0, 63)"))) ;; Match 0 to 255. (define_predicate "const_0_to_255_operand" (and (match_code "const_int") - (match_test "INTVAL (op) >= 0 && INTVAL (op) <= 255"))) + (match_test "IN_RANGE (INTVAL (op), 0, 255)"))) ;; Match (0 to 255) * 8 (define_predicate "const_0_to_255_mul_8_operand" @@ -606,17 +606,17 @@ ;; for shift & compare patterns, as shifting by 0 does not change flags). (define_predicate "const_1_to_31_operand" (and (match_code "const_int") - (match_test "INTVAL (op) >= 1 && INTVAL (op) <= 31"))) + (match_test "IN_RANGE (INTVAL (op), 1, 31)"))) ;; Match 2 or 3. (define_predicate "const_2_to_3_operand" (and (match_code "const_int") - (match_test "INTVAL (op) == 2 || INTVAL (op) == 3"))) + (match_test "IN_RANGE (INTVAL (op), 2, 3)"))) ;; Match 4 to 7. (define_predicate "const_4_to_7_operand" (and (match_code "const_int") - (match_test "INTVAL (op) >= 4 && INTVAL (op) <= 7"))) + (match_test "IN_RANGE (INTVAL (op), 4, 7)"))) ;; Match exactly one bit in 4-bit mask. (define_predicate "const_pow2_1_to_8_operand" diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c index 0cc3629858f..933bff25456 100644 --- a/gcc/reg-stack.c +++ b/gcc/reg-stack.c @@ -695,8 +695,7 @@ stack_result (tree decl) static void replace_reg (rtx *reg, int regno) { - gcc_assert (regno >= FIRST_STACK_REG); - gcc_assert (regno <= LAST_STACK_REG); + gcc_assert (IN_RANGE (regno, FIRST_STACK_REG, LAST_STACK_REG)); gcc_assert (STACK_REG_P (*reg)); gcc_assert (SCALAR_FLOAT_MODE_P (GET_MODE (*reg)) -- 2.30.2