From: Christophe Lyon Date: Tue, 10 Sep 2019 07:49:20 +0000 (+0200) Subject: [ARM/FDPIC v6 07/24] [ARM] FDPIC: Avoid saving/restoring r9 on stack since it is... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4997c9aed45b4439474005c4c71fac65151d1719;p=gcc.git [ARM/FDPIC v6 07/24] [ARM] FDPIC: Avoid saving/restoring r9 on stack since it is read-only 2019-09-10 Christophe Lyon Mickaël Guêné gcc/ * config/arm/arm.h (PIC_REGISTER_MAY_NEED_SAVING): New helper. * config/arm/arm.c (arm_compute_save_reg0_reg12_mask): Handle FDPIC. Co-Authored-By: Mickaël Guêné From-SVN: r275569 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a212eb3ce52..7b061d17b06 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-09-10 Christophe Lyon + Mickaël Guêné + + * config/arm/arm.h (PIC_REGISTER_MAY_NEED_SAVING): New helper. + * config/arm/arm.c (arm_compute_save_reg0_reg12_mask): Handle + FDPIC. + 2019-09-10 Christophe Lyon Mickaël Guêné diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index c34aab88178..6ff3001fd02 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -19571,9 +19571,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; } @@ -19605,9 +19603,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 e404e2cde48..490d22d9d64 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -1960,6 +1960,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. */