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]

Re: [PATCH] Fix PR middle-end/23199


> I guess I have to ask to obvious stupid question: why not define
> AVOID_CCMODE_COPIES in sparc.h?

Old debate. :-)  I sort of have set a legal precedent in

2003-04-03  Eric Botcazou  <ebotcazou@libertysurf.fr>

	PR optimization/10157
	* gcse.c (can_copy_p): Rename it to can_copy.
	(can_copy_init_p): Remove.
	(compute_can_copy): Use can_copy instead of can_copy_p.
	(can_copy_p): New exported function. Call compute_can_copy.
	(hash_scan_set): Use it.
	(gcse_main): Don't call compute_can_copy.
	(bypass_jumps): Don't call compute_can_copy.
	* rtl.h (can_copy_p): Declare.
	* loop.c (scan_loop): Don't move the source and add a reg-to-reg
	copy if the mode doesn't support copy operations.

http://gcc.gnu.org/ml/gcc-patches/2003-04/msg00096.html

which is that you don't have to additionally bother about defining 
AVOID_CCMODE_COPIES if you cannot copy CCmode in the first place.

Probably better patch attached.


2005-10-18  Eric Botcazou  <ebotcazou@libertysurf.fr>

        PR middle-end/23199
        * cfgrtl.c (safe_insert_insn_on_edge): Use can_copy_p to detect
	whether registers live on the edge can be saved/restored.


-- 
Eric Botcazou
Index: cfgrtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgrtl.c,v
retrieving revision 1.181
diff -u -p -r1.181 cfgrtl.c
--- cfgrtl.c	28 Jul 2005 21:11:30 -0000	1.181
+++ cfgrtl.c	18 Oct 2005 05:41:32 -0000
@@ -1456,16 +1456,9 @@ safe_insert_insn_on_edge (rtx insn, edge
   regset killed;
   rtx save_regs = NULL_RTX;
   unsigned regno;
-  int noccmode;
   enum machine_mode mode;
   reg_set_iterator rsi;
 
-#ifdef AVOID_CCMODE_COPIES
-  noccmode = true;
-#else
-  noccmode = false;
-#endif
-
   killed = ALLOC_REG_SET (&reg_obstack);
 
   for (x = insn; x; x = NEXT_INSN (x))
@@ -1491,7 +1484,8 @@ safe_insert_insn_on_edge (rtx insn, edge
       if (mode == VOIDmode)
 	return false;
 
-      if (noccmode && mode == CCmode)
+      /* Avoid copying in CCmode if we can't.  */
+      if (!can_copy_p (mode))
 	return false;
 	
       save_regs = alloc_EXPR_LIST (0,

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