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

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

Commit Message

Christophe Lyon July 13, 2018, 4:11 p.m.
From: Christophe Lyon <christophe.lyon@linaro.org>


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.

Change-Id: Ib534cf91704cdc740867b46a8fe45fda27894562

-- 
2.6.3

Comments

Kyrill Tkachov Aug. 29, 2018, 10:52 a.m. | #1
Hi Christophe,

On 13/07/18 17:11, christophe.lyon@st.com wrote:
> From: Christophe Lyon <christophe.lyon@linaro.org>

>

> 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.

>

> Change-Id: Ib534cf91704cdc740867b46a8fe45fda27894562

>

> diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c

> index 44c3b08..c9f391b 100644

> --- a/gcc/config/arm/arm.c

> +++ b/gcc/config/arm/arm.c

> @@ -19486,7 +19486,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;

> @@ -19520,7 +19520,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))

> @@ -19689,7 +19689,7 @@ thumb1_compute_save_core_reg_mask (void)

>      mask |= 1 << HARD_FRAME_POINTER_REGNUM;

>

>    if (flag_pic

> -      && !TARGET_SINGLE_PIC_BASE

> +      && !TARGET_SINGLE_PIC_BASE && !TARGET_FDPIC

>        && arm_pic_register != INVALID_REGNUM

>        && crtl->uses_pic_offset_table)

>      mask |= 1 << PIC_OFFSET_TABLE_REGNUM;


Is this change necessary? FDPIC is only supported for Armv7 onwards, so the Thumb1 path shouldn't be called?

Thanks,
Kyrill

> -- 

> 2.6.3

>

Patch

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 44c3b08..c9f391b 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -19486,7 +19486,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;
@@ -19520,7 +19520,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))
@@ -19689,7 +19689,7 @@  thumb1_compute_save_core_reg_mask (void)
     mask |= 1 << HARD_FRAME_POINTER_REGNUM;
 
   if (flag_pic
-      && !TARGET_SINGLE_PIC_BASE
+      && !TARGET_SINGLE_PIC_BASE && !TARGET_FDPIC
       && arm_pic_register != INVALID_REGNUM
       && crtl->uses_pic_offset_table)
     mask |= 1 << PIC_OFFSET_TABLE_REGNUM;