This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
postreload-gcse.c: Obvious fix applied: don't emit jumps when we can't
- From: Joern RENNECKE <joern dot rennecke at st dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 31 Mar 2005 18:00:36 +0100
- Subject: postreload-gcse.c: Obvious fix applied: don't emit jumps when we can't
The redundancy elimination used by postreload-gcse can necessitate to
split an edge,
which is not possible when we can't emit new jumps. I have therefore
added the
same check as we already had in bb-reorder.c:reorder_basic_blocks as an
obvious fix.
It appears that more and more passes are added that simply can't work
for SH5 SHmedia
code because of this inability to generate jumps after reload. A
possible solution is to
reserve a call-clobbered target register during register allocation and
the first branch target
optimization phase, so that we can generate (atrociously scheduled)
pta/blink pairs after
reload to expand a jump. The would then have to be cleaned up by the
second branch
target optimization pass. However, it is not possible to get a useful
measure of the target
register pressure without the first branch target registyer optimization
pass, so we'd have
to run them both, which also means that we need separate dump files.
Also some new
infrastructure is needed to reserve a target register. All in all, this
is a bit too much right
to add to my pile of pending patches, so I'm tabling this till I've made
some serious progress
with the merge of the existing patches.
2005-03-31 J"orn Rennecke <joern.rennecke@st.com>
* postreload-gcse.c: Include target.h.
(gcse_after_reload_main): Return early if we cannot modify jumps.
* Makefile.in (postreload-gcse.o): Depend on $(TARGET_H).
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.1455
diff -p -r1.1455 Makefile.in
*** Makefile.in 21 Mar 2005 17:58:06 -0000 1.1455
--- Makefile.in 31 Mar 2005 15:43:21 -0000
*************** postreload.o : postreload.c $(CONFIG_H)
*** 2115,2121 ****
postreload-gcse.o : postreload-gcse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) real.h insn-config.h $(GGC_H) \
$(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) function.h output.h toplev.h $(TM_P_H) \
! except.h $(TREE_H)
caller-save.o : caller-save.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(FLAGS_H) $(REGS_H) hard-reg-set.h insn-config.h $(BASIC_BLOCK_H) function.h \
$(RECOG_H) reload.h $(EXPR_H) toplev.h $(TM_P_H)
--- 2115,2121 ----
postreload-gcse.o : postreload-gcse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) real.h insn-config.h $(GGC_H) \
$(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) function.h output.h toplev.h $(TM_P_H) \
! except.h $(TREE_H) $(TARGET_H)
caller-save.o : caller-save.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(FLAGS_H) $(REGS_H) hard-reg-set.h insn-config.h $(BASIC_BLOCK_H) function.h \
$(RECOG_H) reload.h $(EXPR_H) toplev.h $(TM_P_H)
Index: postreload-gcse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/postreload-gcse.c,v
retrieving revision 2.9
diff -p -r2.9 postreload-gcse.c
*** postreload-gcse.c 18 Jan 2005 11:36:16 -0000 2.9
--- postreload-gcse.c 31 Mar 2005 15:43:21 -0000
*************** Software Foundation, 59 Temple Place - S
*** 43,48 ****
--- 43,49 ----
#include "obstack.h"
#include "hashtab.h"
#include "params.h"
+ #include "target.h"
/* The following code implements gcse after reload, the purpose of this
pass is to cleanup redundant loads generated by reload and other
*************** delete_redundant_insns (void)
*** 1283,1288 ****
--- 1284,1293 ----
void
gcse_after_reload_main (rtx f ATTRIBUTE_UNUSED)
{
+
+ if (targetm.cannot_modify_jumps_p ())
+ return;
+
memset (&stats, 0, sizeof (stats));
/* Allocate ememory for this pass.