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]

Small optimisation tweak for rs6000.c


This adds an intermediate register.  It's an old patch from Apple's
tree; it's not clear if it's supposed to be an optimisation or a real
bug fix.  It's a good idea either way.

Bootstrapped & tested on powerpc-darwin.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/rs6000-darwin-legitpicreg.patch===========
2003-11-05  Geoffrey Keating  <geoffk@apple.com>

	* config/rs6000/rs6000.c (rs6000_machopic_legitimize_pic_address): Use
	an intermediate register for better optimisation.

Index: config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.542
diff -u -p -u -p -r1.542 rs6000.c
--- config/rs6000/rs6000.c	5 Nov 2003 18:17:20 -0000	1.542
+++ config/rs6000/rs6000.c	5 Nov 2003 18:18:36 -0000
@@ -14787,9 +14806,13 @@ rs6000_machopic_legitimize_pic_address (
 
       if (GET_CODE (XEXP (orig, 0)) == PLUS)
 	{
+	  /* Use a different reg for the intermediate value, as
+	     it will be marked UNCHANGING. */
+	  rtx reg_temp = no_new_pseudos ? reg : gen_reg_rtx (Pmode);
+
 	  base =
 	    rs6000_machopic_legitimize_pic_address (XEXP (XEXP (orig, 0), 0),
-						    Pmode, reg);
+						    Pmode, reg_temp);
 	  offset =
 	    rs6000_machopic_legitimize_pic_address (XEXP (XEXP (orig, 0), 1),
 						    Pmode, reg);
============================================================


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