[PATCH] First attempt at unwind epilogue support for powerpc{,64} (take 2)

David Edelsohn dje.gcc@gmail.com
Fri Jun 5 01:36:00 GMT 2009


In trying to figure out why this patch causes bootstrap failures on AIX...


> @@ -17028,7 +17037,13 @@ rs6000_emit_epilogue (int sibcall)
>            addr = gen_rtx_PLUS (Pmode, frame_reg_rtx, areg);
>            mem = gen_frame_mem (V4SImode, addr);
>
> -           emit_move_insn (gen_rtx_REG (V4SImode, i), mem);
> +           reg = gen_rtx_REG (V4SImode, i);
> +           emit_move_insn (reg, mem);
> +           if (offset_below_red_zone_p (info->altivec_save_offset
> +                                        + (i - info->first_altivec_reg_save)
> +                                          * 16))
> +             cfa_restores = alloc_reg_note (REG_CFA_RESTORE, reg,
> +                                            cfa_restores);
>          }
>     }

Why isn't this guarded by DEFAULT_ABI == ABI_V4?


> +  if (insn && frame_reg_rtx == sp_reg_rtx)
> +    {
> +      if (cfa_restores)
> +       {
> +         REG_NOTES (insn) = cfa_restores;
> +         cfa_restores = NULL_RTX;
> +       }
> +      add_reg_note (insn, REG_CFA_DEF_CFA, sp_reg_rtx);
> +      RTX_FRAME_RELATED_P (insn) = 1;
> +    }

Or this?


> @@ -17326,8 +17372,22 @@ rs6000_emit_epilogue (int sibcall)
>             back.  */
>          return;
>        }
> -      else
> -       emit_insn (par);
> +
> +      insn = emit_insn (par);
> +      if (DEFAULT_ABI == ABI_V4)
> +       {
> +         if (frame_pointer_needed)
> +           {
> +             add_reg_note (insn, REG_CFA_DEF_CFA,
> +                           plus_constant (frame_reg_rtx, sp_offset));
> +             RTX_FRAME_RELATED_P (insn) = 1;
> +           }
> +
> +         for (i = info->first_gp_reg_save; i < 32; i++)
> +           cfa_restores
> +             = alloc_reg_note (REG_CFA_RESTORE,
> +                               gen_rtx_REG (reg_mode, i), cfa_restores);
> +       }

Why is this block no longer in an "else" clause?


>   /* If this is V.4, unwind the stack pointer after all of the loads
>      have been done.  */
> -  rs6000_emit_stack_reset (info, sp_reg_rtx, frame_reg_rtx,
> -                          sp_offset, !restoring_FPRs_inline);
> +  insn = rs6000_emit_stack_reset (info, sp_reg_rtx, frame_reg_rtx,
> +                                 sp_offset, !restoring_FPRs_inline);
> +  if (insn)
> +    {
> +      if (cfa_restores)
> +       {
> +         REG_NOTES (insn) = cfa_restores;
> +         cfa_restores = NULL_RTX;
> +       }
> +      add_reg_note (insn, REG_CFA_DEF_CFA, sp_reg_rtx);
> +      RTX_FRAME_RELATED_P (insn) = 1;
> +    }

Why isn't this guarded by DEFAULT_ABI == ABI_V4?

Thanks, David



More information about the Gcc-patches mailing list