[ARM/FDPIC,v3,07/21,ARM] FDPIC: Avoid saving/restoring r9 on stack since it is RO

Message ID 20181011133518.17258-8-christophe.lyon@st.com
State New
Headers show
Series
  • FDPIC ABI for ARM
Related show

Commit Message

Christophe Lyon Oct. 11, 2018, 1:34 p.m.
2018-XX-XX  Christophe Lyon  <christophe.lyon@st.com>
	Mickaël Guêné <mickael.guene@st.com>

	gcc/
	* config/arm/arm.c (arm_compute_save_reg0_reg12_mask): Handle
	FDPIC.
	(thumb1_compute_save_core_reg_mask): Likewise.

Comments

Richard Earnshaw (lists) Oct. 12, 2018, 11:45 a.m. | #1
On 11/10/18 14:34, Christophe Lyon wrote:
> 2018-XX-XX  Christophe Lyon  <christophe.lyon@st.com>
> 	Mickaël Guêné <mickael.guene@st.com>
> 
> 	gcc/
> 	* config/arm/arm.c (arm_compute_save_reg0_reg12_mask): Handle
> 	FDPIC.
> 	(thumb1_compute_save_core_reg_mask): Likewise.

The hunk for this bit is missing.

> 
> diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
> index 92ae24b..a6dce36 100644
> --- a/gcc/config/arm/arm.c
> +++ b/gcc/config/arm/arm.c
> @@ -19470,7 +19470,7 @@ arm_compute_save_reg0_reg12_mask (void)
>  
>        /* Also save the pic base register if necessary.  */
>        if (flag_pic
> -	  && !TARGET_SINGLE_PIC_BASE
> +	  && !TARGET_SINGLE_PIC_BASE && !TARGET_FDPIC
>  	  && arm_pic_register != INVALID_REGNUM
>  	  && crtl->uses_pic_offset_table)
>  	save_reg_mask |= 1 << PIC_OFFSET_TABLE_REGNUM;
> @@ -19504,7 +19504,7 @@ arm_compute_save_reg0_reg12_mask (void)
>        /* If we aren't loading the PIC register,
>  	 don't stack it even though it may be live.  */
>        if (flag_pic
> -	  && !TARGET_SINGLE_PIC_BASE
> +	  && !TARGET_SINGLE_PIC_BASE && !TARGET_FDPIC
>  	  && arm_pic_register != INVALID_REGNUM
>  	  && (df_regs_ever_live_p (PIC_OFFSET_TABLE_REGNUM)
>  	      || crtl->uses_pic_offset_table))
> 

	flag_pic
	  && !TARGET_SINGLE_PIC_BASE && !TARGET_FDPIC
  	  && arm_pic_register != INVALID_REGNUM

Might be worth lifting this out into a macro.

R.
Christophe Lyon Oct. 15, 2018, 2:25 p.m. | #2
On Fri, 12 Oct 2018 at 13:45, Richard Earnshaw (lists)
<Richard.Earnshaw@arm.com> wrote:
>
> On 11/10/18 14:34, Christophe Lyon wrote:
> > 2018-XX-XX  Christophe Lyon  <christophe.lyon@st.com>
> >       Mickaël Guêné <mickael.guene@st.com>
> >
> >       gcc/
> >       * config/arm/arm.c (arm_compute_save_reg0_reg12_mask): Handle
> >       FDPIC.
> >       (thumb1_compute_save_core_reg_mask): Likewise.
>
> The hunk for this bit is missing.
>
Sigh, I forgot to remove it when I removed the code from v2.

>
> >
> > diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
> > index 92ae24b..a6dce36 100644
> > --- a/gcc/config/arm/arm.c
> > +++ b/gcc/config/arm/arm.c
> > @@ -19470,7 +19470,7 @@ arm_compute_save_reg0_reg12_mask (void)
> >
> >        /* Also save the pic base register if necessary.  */
> >        if (flag_pic
> > -       && !TARGET_SINGLE_PIC_BASE
> > +       && !TARGET_SINGLE_PIC_BASE && !TARGET_FDPIC
> >         && arm_pic_register != INVALID_REGNUM
> >         && crtl->uses_pic_offset_table)
> >       save_reg_mask |= 1 << PIC_OFFSET_TABLE_REGNUM;
> > @@ -19504,7 +19504,7 @@ arm_compute_save_reg0_reg12_mask (void)
> >        /* If we aren't loading the PIC register,
> >        don't stack it even though it may be live.  */
> >        if (flag_pic
> > -       && !TARGET_SINGLE_PIC_BASE
> > +       && !TARGET_SINGLE_PIC_BASE && !TARGET_FDPIC
> >         && arm_pic_register != INVALID_REGNUM
> >         && (df_regs_ever_live_p (PIC_OFFSET_TABLE_REGNUM)
> >             || crtl->uses_pic_offset_table))
> >
>
>         flag_pic
>           && !TARGET_SINGLE_PIC_BASE && !TARGET_FDPIC
>           && arm_pic_register != INVALID_REGNUM
>
> Might be worth lifting this out into a macro.
>
> R.

Patch

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 92ae24b..a6dce36 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -19470,7 +19470,7 @@  arm_compute_save_reg0_reg12_mask (void)
 
       /* Also save the pic base register if necessary.  */
       if (flag_pic
-	  && !TARGET_SINGLE_PIC_BASE
+	  && !TARGET_SINGLE_PIC_BASE && !TARGET_FDPIC
 	  && arm_pic_register != INVALID_REGNUM
 	  && crtl->uses_pic_offset_table)
 	save_reg_mask |= 1 << PIC_OFFSET_TABLE_REGNUM;
@@ -19504,7 +19504,7 @@  arm_compute_save_reg0_reg12_mask (void)
       /* If we aren't loading the PIC register,
 	 don't stack it even though it may be live.  */
       if (flag_pic
-	  && !TARGET_SINGLE_PIC_BASE
+	  && !TARGET_SINGLE_PIC_BASE && !TARGET_FDPIC
 	  && arm_pic_register != INVALID_REGNUM
 	  && (df_regs_ever_live_p (PIC_OFFSET_TABLE_REGNUM)
 	      || crtl->uses_pic_offset_table))