From c033690d7e2108d2b7ddbb37d488a6f1519eedff Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Fri, 9 Jul 2010 21:40:48 +0000 Subject: reload.c (find_reloads): Don't clear badop if we have a winreg alternative... * reload.c (find_reloads): Don't clear badop if we have a winreg alternative, but not win, and the class only has fixed regs. * hard-reg-set.h (class_only_fixed_regs): Declare. * reginfo.c (class_only_fixed_regs): New array. (init_reg_sets_1): Initialize it. * config/arm/arm.md (arm_addsi3, thumb1_addsi3, arm_subsi3_insn): Don't discourage alternatives using the stack pointer. testsuite/ * gcc.dg/pr32370.c: Allow another kind of error message. From-SVN: r162019 --- gcc/ChangeLog | 11 +++++++++++ gcc/config/arm/arm.md | 20 ++++++++------------ gcc/hard-reg-set.h | 4 ++++ gcc/reginfo.c | 18 +++++++++++++++--- gcc/reload.c | 3 ++- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/pr32370.c | 2 +- 7 files changed, 45 insertions(+), 17 deletions(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c557f73..a3a28a7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2010-07-09 Bernd Schmidt + + * reload.c (find_reloads): Don't clear badop if we have a + winreg alternative, but not win, and the class only has fixed + regs. + * hard-reg-set.h (class_only_fixed_regs): Declare. + * reginfo.c (class_only_fixed_regs): New array. + (init_reg_sets_1): Initialize it. + * config/arm/arm.md (arm_addsi3, thumb1_addsi3, arm_subsi3_insn): Don't + discourage alternatives using the stack pointer. + 2010-07-09 Richard Guenther * gimple.c (struct type_fixup_s): New struct and VEC type. diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index f36a56c..6f20aea 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -610,9 +610,9 @@ ;; (plus (reg rN) (reg sp)) into (reg rN). In this case reload will ;; put the duplicated register first, and not try the commutative version. (define_insn_and_split "*arm_addsi3" - [(set (match_operand:SI 0 "s_register_operand" "=r, !k, r,r, !k,r") - (plus:SI (match_operand:SI 1 "s_register_operand" "%rk,!k, r,rk,!k,rk") - (match_operand:SI 2 "reg_or_int_operand" "rI, rI,!k,L, L,?n")))] + [(set (match_operand:SI 0 "s_register_operand" "=r, k,r,r, k,r") + (plus:SI (match_operand:SI 1 "s_register_operand" "%rk,k,r,rk,k,rk") + (match_operand:SI 2 "reg_or_int_operand" "rI,rI,k,L, L,?n")))] "TARGET_32BIT" "@ add%?\\t%0, %1, %2 @@ -637,14 +637,10 @@ (set_attr "predicable" "yes")] ) -;; Register group 'k' is a single register group containing only the stack -;; register. Trying to reload it will always fail catastrophically, -;; so never allow those alternatives to match if reloading is needed. - (define_insn_and_split "*thumb1_addsi3" - [(set (match_operand:SI 0 "register_operand" "=l,l,l,*rk,*hk,l,!k,l,l") - (plus:SI (match_operand:SI 1 "register_operand" "%0,0,l,*0,*0,!k,!k,0,l") - (match_operand:SI 2 "nonmemory_operand" "I,J,lL,*hk,*rk,!M,!O,Pa,Pb")))] + [(set (match_operand:SI 0 "register_operand" "=l,l,l,*rk,*hk,l,k,l,l") + (plus:SI (match_operand:SI 1 "register_operand" "%0,0,l,*0,*0,k,k,0,l") + (match_operand:SI 2 "nonmemory_operand" "I,J,lL,*hk,*rk,M,O,Pa,Pb")))] "TARGET_THUMB1" "* static const char * const asms[] = @@ -1089,8 +1085,8 @@ ; ??? Check Thumb-2 split length (define_insn_and_split "*arm_subsi3_insn" [(set (match_operand:SI 0 "s_register_operand" "=r,r,rk,r,r") - (minus:SI (match_operand:SI 1 "reg_or_int_operand" "rI,r,!k,?n,r") - (match_operand:SI 2 "reg_or_int_operand" "r,rI, r, r,?n")))] + (minus:SI (match_operand:SI 1 "reg_or_int_operand" "rI,r,k,?n,r") + (match_operand:SI 2 "reg_or_int_operand" "r,rI,r, r,?n")))] "TARGET_32BIT" "@ rsb%?\\t%0, %2, %1 diff --git a/gcc/hard-reg-set.h b/gcc/hard-reg-set.h index 272a239..1e79728 100644 --- a/gcc/hard-reg-set.h +++ b/gcc/hard-reg-set.h @@ -643,6 +643,10 @@ extern int inv_reg_alloc_order[FIRST_PSEUDO_REGISTER]; extern HARD_REG_SET reg_class_contents[N_REG_CLASSES]; +/* For each reg class, a boolean saying whether the class contains only + fixed registers. */ +extern bool class_only_fixed_regs[N_REG_CLASSES]; + /* For each reg class, number of regs it contains. */ extern unsigned int reg_class_size[N_REG_CLASSES]; diff --git a/gcc/reginfo.c b/gcc/reginfo.c index 0db988f..40f21d1 100644 --- a/gcc/reginfo.c +++ b/gcc/reginfo.c @@ -141,6 +141,10 @@ int inv_reg_alloc_order[FIRST_PSEUDO_REGISTER]; /* For each reg class, a HARD_REG_SET saying which registers are in it. */ HARD_REG_SET reg_class_contents[N_REG_CLASSES]; +/* For each reg class, a boolean saying whether the class contains only + fixed registers. */ +bool class_only_fixed_regs[N_REG_CLASSES]; + /* The same information, but as an array of unsigned ints. We copy from these unsigned ints to the table above. We do this so the tm.h files do not have to be aware of the wordsize for machines with <= 64 regs. @@ -421,9 +425,17 @@ init_reg_sets_1 (void) memset (reg_class_size, 0, sizeof reg_class_size); for (i = 0; i < N_REG_CLASSES; i++) - for (j = 0; j < FIRST_PSEUDO_REGISTER; j++) - if (TEST_HARD_REG_BIT (reg_class_contents[i], j)) - reg_class_size[i]++; + { + bool any_nonfixed = false; + for (j = 0; j < FIRST_PSEUDO_REGISTER; j++) + if (TEST_HARD_REG_BIT (reg_class_contents[i], j)) + { + reg_class_size[i]++; + if (!fixed_regs[j]) + any_nonfixed = true; + } + class_only_fixed_regs[i] = !any_nonfixed; + } /* Initialize the table of subunions. reg_class_subunion[I][J] gets the largest-numbered reg-class diff --git a/gcc/reload.c b/gcc/reload.c index 8a3d295..6301f9a 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -3470,7 +3470,8 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known, /* If this operand could be handled with a reg, and some reg is allowed, then this operand can be handled. */ - if (winreg && this_alternative[i] != NO_REGS) + if (winreg && this_alternative[i] != NO_REGS + && (win || !class_only_fixed_regs[this_alternative[i]])) badop = 0; /* Record which operands fit this alternative. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0f0c497..77e4d9d1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2010-07-09 Bernd Schmidt + + * gcc.dg/pr32370.c: Allow another kind of error message. + 2010-07-09 Eric Botcazou * gnat.dg/atomic3.adb: New test. diff --git a/gcc/testsuite/gcc.dg/pr32370.c b/gcc/testsuite/gcc.dg/pr32370.c index f039bdf..fc3d724 100644 --- a/gcc/testsuite/gcc.dg/pr32370.c +++ b/gcc/testsuite/gcc.dg/pr32370.c @@ -19,7 +19,7 @@ unsigned int foo (TYPE port) { unsigned int v; - __asm__ __volatile__ ("" : C (v) : "Nd" (port)); /* { dg-error "while reloading\|has impossible" } */ + __asm__ __volatile__ ("" : C (v) : "Nd" (port)); /* { dg-error "while reloading\|has impossible\|inconsistent operand constraints" } */ return v; } -- cgit v1.1