From: Vladimir Makarov Date: Fri, 3 Sep 2004 14:45:23 +0000 (+0000) Subject: re PR target/15832 (ICE in move_for_stack_reg, at reg-stack.c:1120) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d6df6ae236c4810dc264357801e0f94e02690369;p=gcc.git re PR target/15832 (ICE in move_for_stack_reg, at reg-stack.c:1120) 2004-09-03 Vladimir Makarov PR target/15832 * global.c (modify_reg_pav): New function. (make_accurate_live_analysis): Call the new function. Move pavin modification by earlyclobber set into the new function. From-SVN: r87035 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index da4164b011f..98cd6041e7a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2004-09-03 Vladimir Makarov + + PR target/15832 + * global.c (modify_reg_pav): New function. + (make_accurate_live_analysis): Call the new function. Move pavin + modification by earlyclobber set into the new function. + 2004-09-03 Andreas Schwab * config/m68k/m68k.c (output_andsi3): Use -1 instead of diff --git a/gcc/global.c b/gcc/global.c index ab508444de4..9964d728d71 100644 --- a/gcc/global.c +++ b/gcc/global.c @@ -319,6 +319,7 @@ static void set_up_bb_rts_numbers (void); static int rpost_cmp (const void *, const void *); static bool modify_bb_reg_pav (basic_block, basic_block, bool); static void calculate_reg_pav (void); +static void modify_reg_pav (void); static void make_accurate_live_analysis (void); @@ -2360,6 +2361,61 @@ calculate_reg_pav (void) sbitmap_free (wset); } +/* The function modifies partial availability information for two + special cases to prevent incorrect work of the subsequent passes + with the accurate live information based on the partial + availability. */ + +static void +modify_reg_pav (void) +{ + basic_block bb; + struct bb_info *bb_info; +#ifdef STACK_REGS + int i; + HARD_REG_SET zero, stack_hard_regs, used; + bitmap stack_regs; + + CLEAR_HARD_REG_SET (zero); + CLEAR_HARD_REG_SET (stack_hard_regs); + for (i = FIRST_STACK_REG; i <= LAST_STACK_REG; i++) + SET_HARD_REG_BIT(stack_hard_regs, i); + stack_regs = BITMAP_XMALLOC (); + for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++) + { + COPY_HARD_REG_SET (used, reg_class_contents[reg_preferred_class (i)]); + IOR_HARD_REG_SET (used, reg_class_contents[reg_alternate_class (i)]); + AND_HARD_REG_SET (used, stack_hard_regs); + GO_IF_HARD_REG_EQUAL(used, zero, skip); + bitmap_set_bit (stack_regs, i); + skip: + ; + } +#endif + FOR_EACH_BB (bb) + { + bb_info = BB_INFO (bb); + + /* Reload can assign the same hard register to uninitialized + pseudo-register and early clobbered pseudo-register in an + insn if the pseudo-register is used first time in given BB + and not lived at the BB start. To prevent this we don't + change life information for such pseudo-registers. */ + bitmap_a_or_b (bb_info->pavin, bb_info->pavin, bb_info->earlyclobber); +#ifdef STACK_REGS + /* We can not use the same stack register for uninitialized + pseudo-register and another living pseudo-register because if the + uninitialized pseudo-register dies, subsequent pass reg-stack + will be confused (it will believe that the other register + dies). */ + bitmap_a_or_b (bb_info->pavin, bb_info->pavin, stack_regs); +#endif + } +#ifdef STACK_REGS + BITMAP_XFREE (stack_regs); +#endif +} + /* The following function makes live information more accurate by modifying global_live_at_start and global_live_at_end of basic blocks. After the function call a register lives at a program @@ -2379,16 +2435,11 @@ make_accurate_live_analysis (void) calculate_local_reg_bb_info (); set_up_bb_rts_numbers (); calculate_reg_pav (); + modify_reg_pav (); FOR_EACH_BB (bb) { bb_info = BB_INFO (bb); - /* Reload can assign the same hard register to uninitialized - pseudo-register and early clobbered pseudo-register in an - insn if the pseudo-register is used first time in given BB - and not lived at the BB start. To prevent this we don't - change life information for such pseudo-registers. */ - bitmap_a_or_b (bb_info->pavin, bb_info->pavin, bb_info->earlyclobber); bitmap_a_and_b (bb->global_live_at_start, bb->global_live_at_start, bb_info->pavin); bitmap_a_and_b (bb->global_live_at_end, bb->global_live_at_end,