Patchwork PowerPC: Add msingle-pic-base option.

login
register
mail settings
Submitter Joakim Tjernlund
Date Oct. 19, 2010, 9:36 p.m.
Message ID <1287524198-24754-1-git-send-email-Joakim.Tjernlund@transmode.se>
Download mbox | patch
Permalink /patch/68383/
State New
Headers show

Comments

Joakim Tjernlund - Oct. 19, 2010, 9:36 p.m.
Do not generate fPIC/fpic prologue nor save
and restore PIC register.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
---

 Didn't get any reaction on gcc ML so trying here.

 rs6000.c   |    4 ++++
 rs6000.opt |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)

Patch

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 5e6f301..71d095d 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -16036,8 +16036,10 @@ 
   return ((df_regs_ever_live_p (reg)
            && (!call_used_regs[reg]
                || (reg == RS6000_PIC_OFFSET_TABLE_REGNUM
-                   && TARGET_TOC && TARGET_MINIMAL_TOC)))
+                   && TARGET_TOC && TARGET_MINIMAL_TOC
+		   && !TARGET_SINGLE_PIC_BASE)))
           || (reg == RS6000_PIC_OFFSET_TABLE_REGNUM
+	      && !TARGET_SINGLE_PIC_BASE
               && ((DEFAULT_ABI == ABI_V4 && flag_pic != 0)
                   || (DEFAULT_ABI == ABI_DARWIN && flag_pic))));
 }
@@ -16721,6 +16723,9 @@ 
       insn = emit_insn (generate_set_vrsave (reg, info, 0));
     }
 
+  if (TARGET_SINGLE_PIC_BASE)
+    return; /* Do not set PIC register */
+
   /* If we are using RS6000_PIC_OFFSET_TABLE_REGNUM, we need to set it up.  */
   if ((TARGET_TOC && TARGET_MINIMAL_TOC && get_pool_size () != 0)
       || (DEFAULT_ABI == ABI_V4
diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
index 8a62352..5f6e6ca 100644
--- a/gcc/config/rs6000/rs6000.opt
+++ b/gcc/config/rs6000/rs6000.opt
@@ -103,6 +103,10 @@  mold-mnemonics
 Target Report RejectNegative InverseMask(NEW_MNEMONICS)
 Use old mnemonics for PowerPC architecture
 
+msingle-pic-base
+Target Report Mask(SINGLE_PIC_BASE)
+Do not load the PIC register in function prologues
+
 msoft-float
 Target Report RejectNegative Mask(SOFT_FLOAT)
 Do not use hardware floating point