diff mbox series

[ARM/FDPIC,v5,07/21,ARM] FDPIC: Avoid saving/restoring r9 on stack since it is read-only

Message ID 20190515124006.25840-8-christophe.lyon@st.com
State Superseded
Headers show
Series FDPIC ABI for ARM | expand

Commit Message

Christophe Lyon May 15, 2019, 12:39 p.m. UTC
2019-XX-XX  Christophe Lyon  <christophe.lyon@st.com>
	Mickaël Guêné <mickael.guene@st.com>

	gcc/
	* config/arm/arm.h (PIC_REGISTER_MAY_NEED_SAVING): New helper.
	* config/arm/arm.c (arm_compute_save_reg0_reg12_mask): Handle
	FDPIC.

Change-Id: I0f3b2023ab2a2a0433dfe081dac6bbb194b7a76c

-- 
2.6.3

Comments

Kyrill Tkachov July 16, 2019, 10:38 a.m. UTC | #1
On 5/15/19 1:39 PM, Christophe Lyon wrote:
> 2019-XX-XX  Christophe Lyon <christophe.lyon@st.com>

>         Mickaël Guêné <mickael.guene@st.com>

>

>         gcc/

>         * config/arm/arm.h (PIC_REGISTER_MAY_NEED_SAVING): New helper.

>         * config/arm/arm.c (arm_compute_save_reg0_reg12_mask): Handle

>         FDPIC.

>

Ok once the rest of the series is approved.

Thanks,

Kyrill


> Change-Id: I0f3b2023ab2a2a0433dfe081dac6bbb194b7a76c

>

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

> index d9397b5..dbd1671 100644

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

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

> @@ -19651,9 +19651,7 @@ arm_compute_save_reg0_reg12_mask (void)

>            save_reg_mask |= (1 << reg);

>

>        /* Also save the pic base register if necessary.  */

> -      if (flag_pic

> -         && !TARGET_SINGLE_PIC_BASE

> -         && arm_pic_register != INVALID_REGNUM

> +      if (PIC_REGISTER_MAY_NEED_SAVING

>            && crtl->uses_pic_offset_table)

>          save_reg_mask |= 1 << PIC_OFFSET_TABLE_REGNUM;

>      }

> @@ -19685,9 +19683,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

> -         && arm_pic_register != INVALID_REGNUM

> +      if (PIC_REGISTER_MAY_NEED_SAVING

>            && (df_regs_ever_live_p (PIC_OFFSET_TABLE_REGNUM)

>                || crtl->uses_pic_offset_table))

>          save_reg_mask |= 1 << PIC_OFFSET_TABLE_REGNUM;

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

> index 7b50ef5..45c0e2b 100644

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

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

> @@ -1967,6 +1967,13 @@ extern unsigned arm_pic_register;

>                     || label_mentioned_p (get_pool_constant 

> (X)))))       \

>           || tls_mentioned_p (X))

>

> +/* We may want to save the PIC register if it is a dedicated one.  */

> +#define PIC_REGISTER_MAY_NEED_SAVING                   \

> +  (flag_pic                                            \

> +   && !TARGET_SINGLE_PIC_BASE                          \

> +   && !TARGET_FDPIC                                    \

> +   && arm_pic_register != INVALID_REGNUM)

> +

>  /* We need to know when we are making a constant pool; this determines

>     whether data needs to be in the GOT or can be referenced via a GOT

>     offset.  */

> -- 

> 2.6.3

>
diff mbox series

Patch

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index d9397b5..dbd1671 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -19651,9 +19651,7 @@  arm_compute_save_reg0_reg12_mask (void)
 	  save_reg_mask |= (1 << reg);
 
       /* Also save the pic base register if necessary.  */
-      if (flag_pic
-	  && !TARGET_SINGLE_PIC_BASE
-	  && arm_pic_register != INVALID_REGNUM
+      if (PIC_REGISTER_MAY_NEED_SAVING
 	  && crtl->uses_pic_offset_table)
 	save_reg_mask |= 1 << PIC_OFFSET_TABLE_REGNUM;
     }
@@ -19685,9 +19683,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
-	  && arm_pic_register != INVALID_REGNUM
+      if (PIC_REGISTER_MAY_NEED_SAVING
 	  && (df_regs_ever_live_p (PIC_OFFSET_TABLE_REGNUM)
 	      || crtl->uses_pic_offset_table))
 	save_reg_mask |= 1 << PIC_OFFSET_TABLE_REGNUM;
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index 7b50ef5..45c0e2b 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -1967,6 +1967,13 @@  extern unsigned arm_pic_register;
 		   || label_mentioned_p (get_pool_constant (X)))))	\
 	 || tls_mentioned_p (X))
 
+/* We may want to save the PIC register if it is a dedicated one.  */
+#define PIC_REGISTER_MAY_NEED_SAVING			\
+  (flag_pic						\
+   && !TARGET_SINGLE_PIC_BASE				\
+   && !TARGET_FDPIC					\
+   && arm_pic_register != INVALID_REGNUM)
+
 /* We need to know when we are making a constant pool; this determines
    whether data needs to be in the GOT or can be referenced via a GOT
    offset.  */