This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Improve funcorder.c optimisation on ppc-darwin
- From: gkeating at apple dot com (Geoffrey Keating)
- To: gcc-patches at gcc dot gnu dot org
- Cc: John David Anglin <dave dot anglin at nrc-cnrc dot gc dot ca>
- Date: Tue, 14 Oct 2003 08:00:17 -0700 (PDT)
- Subject: Improve funcorder.c optimisation on ppc-darwin
This patch:
+2003-10-08 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ PR optimization/12142
+ * cse.c (count_reg_usage): In a SET with a REG SET_DEST, count the
+ uses of the register in the SET_SRC. Remove unnecessary argument.
+ * pa.c (legitimize_pic_address): Before reload, use a scratch register
+ for the intermediate result in loading the address of a SYMBOL_REF.
+ Set the MEM_NOTRAP_P flag for the MEM. Add a REG_EQUAL to the insn
+ which loads the SYMBOL_REF address.
caused
FAIL: gcc.dg/funcorder.c scan-assembler-not link_error
on powerpc-darwin. I can't convince myself that the Dave's patch is either
correct or incorrect; certainly, it seems like the patch suppresses at
least some legitimate optimisations. However, I can be sure that it'd
be better if the Darwin backend used a scratch register in this case,
so I am making this change.
Bootstrapped & tested on powerpc-darwin.
--
- Geoffrey Keating <geoffk@apple.com>
===File ~/patches/gcc-tempregindirectref.patch==============
2003-10-13 Geoffrey Keating <geoffk@apple.com>
* config/darwin.c (machopic_indirect_data_reference): Use a scratch
register when generating indirect address.
Index: config/darwin.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin.c,v
retrieving revision 1.51
diff -u -p -u -p -r1.51 darwin.c
--- config/darwin.c 6 Oct 2003 13:35:36 -0000 1.51
+++ config/darwin.c 14 Oct 2003 14:55:51 -0000
@@ -470,7 +470,7 @@ machopic_indirect_data_reference (rtx or
#endif
#if defined (TARGET_TOC) /* i.e., PowerPC */
- rtx hi_sum_reg = reg;
+ rtx hi_sum_reg = (no_new_pseudos ? reg : gen_reg_rtx (Pmode));
if (reg == NULL)
abort ();
============================================================