This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[3/6, committed] RTP PIC support for MIPS VxWorks


As promised in the last message, this patch makes
mips_ok_for_lazy_binding_p check mips_symbol_binds_local_p
for all cases.  mips_dangerous_for_la25_p must not be changed
however; the assembler doesn't necessarily know all that gcc
knows, and might use global accesses for something that gcc
knows binds locally.

Tested on mips64-linux-gnu and mips-wrs-vxworks.  Applied to trunk.
As expected, several bits of code now use normal global GOT accesses
instead of %call* accesses, which allows more optimisation:
the result of a normal global GOT access can be reused,
whereas the result of %call* access should not be.

Unfortunately, the FAKE_CALL_REGNO hack no longer works on mainline,
so gcc _does_ reuse %call* results.  I've got a couple of ideas
for how this can be fixed, but it'll need more thought.

To be clear, this patch is a strict improvement: because there are
fewer %call* accesses, there are fewer that get reused.

Richard


gcc/
	* config/mips/mips.c (mips_ok_for_lazy_binding_p): Always return
	false for locally-binding symbols.
	(mips_dangerous_for_la25_p): Check mips_global_symbol_p.

Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c	2007-04-11 11:41:37.000000000 +0100
+++ gcc/config/mips/mips.c	2007-04-11 11:41:43.000000000 +0100
@@ -3367,9 +3367,7 @@ mips_ok_for_lazy_binding_p (rtx x)
 {
   return (TARGET_USE_GOT
 	  && GET_CODE (x) == SYMBOL_REF
-	  && (TARGET_ABSOLUTE_ABICALLS
-	      ? !mips_symbol_binds_local_p (x)
-	      : mips_global_symbol_p (x)));
+	  && !mips_symbol_binds_local_p (x));
 }
 
 /* Load function address ADDR into register DEST.  SIBCALL_P is true
@@ -7630,7 +7628,10 @@ mips_cannot_change_mode_class (enum mach
 bool
 mips_dangerous_for_la25_p (rtx x)
 {
-  return !TARGET_EXPLICIT_RELOCS && mips_ok_for_lazy_binding_p (x);
+  return (!TARGET_EXPLICIT_RELOCS
+	  && TARGET_USE_GOT
+	  && GET_CODE (x) == SYMBOL_REF
+	  && mips_global_symbol_p (x));
 }
 
 /* Implement PREFERRED_RELOAD_CLASS.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]