Message ID | alpine.LNX.2.02.1107241852140.1374@localhost.localdomain |
---|---|
State | New |
Headers | show |
On Sun, Jul 24, 2011 at 6:08 PM, Dimitrios Apostolou <jimis@gmx.net> wrote: > Hello all, > > attached is my attempt to replace bitmaps, that we are *sure* they will > never map any pseudo regs, with HARD_REG_SETs. Jakub, I have moved the check > you suggested, for never surpassing FIRST_PSEUDO_REGS, into hard-reg-set.h, > that's one of the two patches. > > Unfortunately the other patch is a little intrusive and it breaks something. > I'm out of ideas for some days now, can you spot what's wrong? Hi Jimis, Can you please create your patches with the -p option, so that it's easier to see what function you are changing? Also, even for an RFC patch a ChangeLog is more than just nice to have ;-) This hunk in df-problems looks odd: @@ -2511,9 +2535,9 @@ if (bb_index == EXIT_BLOCK) { unsigned regno; - bitmap_iterator bi; - EXECUTE_IF_SET_IN_BITMAP (df->exit_block_uses, FIRST_PSEUDO_REGISTER, - regno, bi) So this EXECUTE_IF_SET_IN_BITMAP starts with FIRST_PSEUDO_REGISTER (i.e. works on pseudo registers) ... + hard_reg_set_iterator iter; + EXECUTE_IF_SET_IN_HARD_REG_SET (df->exit_block_uses, FIRST_PSEUDO_REGISTER, + regno, iter) gcc_unreachable (); } else ... and you change it to work only on hard registers. That code looked like a check to verify that exit_block_uses only contains hard registers. So you can probably just drop this check. The only suggestion that I can make for now to investigate the ICE in reg-stack, is to compare the DF info before your patch and after. Since your patch does not (or rather: should not) change the logic in DF, the DF info at reg-stack should be the same. Your ICE suggests that the register allocator has left a stack register live across an abnormal edge, and that may be due to changed DF info. Ciao! Steven
Hi Steven, On Sun, 24 Jul 2011, Steven Bosscher wrote: > Can you please create your patches with the -p option, so that it's > easier to see what function you are changing? Also, even for an RFC > patch a ChangeLog is more than just nice to have ;-) Do you mean an entry in Changelog file in root directory? I should update my tree to latest every time, for my patch to be valid, right? > > This hunk in df-problems looks odd: > > @@ -2511,9 +2535,9 @@ > if (bb_index == EXIT_BLOCK) > { > unsigned regno; > - bitmap_iterator bi; > - EXECUTE_IF_SET_IN_BITMAP (df->exit_block_uses, FIRST_PSEUDO_REGISTER, > - regno, bi) > > So this EXECUTE_IF_SET_IN_BITMAP starts with FIRST_PSEUDO_REGISTER > (i.e. works on pseudo registers) ... > > + hard_reg_set_iterator iter; > + EXECUTE_IF_SET_IN_HARD_REG_SET (df->exit_block_uses, FIRST_PSEUDO_REGISTER, > + regno, iter) > gcc_unreachable (); > } > else > > ... and you change it to work only on hard registers. That code looked > like a check to verify that exit_block_uses only contains hard > registers. So you can probably just drop this check. Thanks for reminding me this, I had indeed removed this check, I just didn't commit to my VCS :-) Should I resend my patch with all the suggestions you made? Thanks, Dimitris
diff: === modified file 'gcc/hard-reg-set.h' --- gcc/hard-reg-set.h 2011-01-03 20:52:22 +0000 +++ gcc/hard-reg-set.h 2011-07-23 18:32:12 +0000 @@ -91,14 +91,36 @@ #define UHOST_BITS_PER_WIDE_INT ((unsigned) HOST_BITS_PER_WIDEST_FAST_INT) -#ifdef HARD_REG_SET - #define SET_HARD_REG_BIT(SET, BIT) \ - ((SET) |= HARD_CONST (1) << (BIT)) + hard_reg_set_set_bit (&(SET), (BIT)) #define CLEAR_HARD_REG_BIT(SET, BIT) \ - ((SET) &= ~(HARD_CONST (1) << (BIT))) + hard_reg_set_clear_bit(&(SET), (BIT)) #define TEST_HARD_REG_BIT(SET, BIT) \ - (!!((SET) & (HARD_CONST (1) << (BIT)))) + hard_reg_set_bit_p((SET), (BIT)) + + +#ifdef HARD_REG_SET + +static inline void +hard_reg_set_set_bit (HARD_REG_SET *s, unsigned int bit) +{ + gcc_checking_assert (bit < FIRST_PSEUDO_REGISTER); + (*s) |= HARD_CONST (1) << bit; +} + +static inline void +hard_reg_set_clear_bit (HARD_REG_SET *s, unsigned int bit) +{ + gcc_checking_assert (bit < FIRST_PSEUDO_REGISTER); + (*s) &= ~(HARD_CONST (1) << bit); +} + +static inline bool +hard_reg_set_bit_p (const HARD_REG_SET s, unsigned int bit) +{ + gcc_checking_assert (bit < FIRST_PSEUDO_REGISTER); + return ((s >> bit) & HARD_CONST (1)); +} #define CLEAR_HARD_REG_SET(TO) ((TO) = HARD_CONST (0)) #define SET_HARD_REG_SET(TO) ((TO) = ~ HARD_CONST (0)) @@ -137,17 +159,32 @@ #else -#define SET_HARD_REG_BIT(SET, BIT) \ - ((SET)[(BIT) / UHOST_BITS_PER_WIDE_INT] \ - |= HARD_CONST (1) << ((BIT) % UHOST_BITS_PER_WIDE_INT)) - -#define CLEAR_HARD_REG_BIT(SET, BIT) \ - ((SET)[(BIT) / UHOST_BITS_PER_WIDE_INT] \ - &= ~(HARD_CONST (1) << ((BIT) % UHOST_BITS_PER_WIDE_INT))) - -#define TEST_HARD_REG_BIT(SET, BIT) \ - (!!((SET)[(BIT) / UHOST_BITS_PER_WIDE_INT] \ - & (HARD_CONST (1) << ((BIT) % UHOST_BITS_PER_WIDE_INT)))) +static inline void +hard_reg_set_set_bit (HARD_REG_SET *s, unsigned int bit) +{ + int byte = bit / UHOST_BITS_PER_WIDE_INT; + int bitpos = bit % UHOST_BITS_PER_WIDE_INT; + gcc_checking_assert (bit < FIRST_PSEUDO_REGISTER); + (*s)[byte] |= HARD_CONST (1) << bitpos; +} + +static inline void +hard_reg_set_clear_bit (HARD_REG_SET *s, unsigned int bit) +{ + int byte = bit / UHOST_BITS_PER_WIDE_INT; + int bitpos = bit % UHOST_BITS_PER_WIDE_INT; + gcc_checking_assert (bit < FIRST_PSEUDO_REGISTER); + (*s)[byte] &= ~(HARD_CONST (1) << bitpos); +} + +static inline bool +hard_reg_set_bit_p (const HARD_REG_SET s, unsigned int bit) +{ + int byte = bit / UHOST_BITS_PER_WIDE_INT; + int bitpos = bit % UHOST_BITS_PER_WIDE_INT; + gcc_checking_assert (bit < FIRST_PSEUDO_REGISTER); + return ((s[byte] >> bitpos) & HARD_CONST (1)); +} #if FIRST_PSEUDO_REGISTER <= 2*HOST_BITS_PER_WIDEST_FAST_INT #define CLEAR_HARD_REG_SET(TO) \