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]

[patch] Bug in arm_final_prescan_insn


As the comment in the code says, arm_final_prescan_insn calls get_attr_* which 
may clobber recog_data. This needs to be restored before returning.
To this it calls recog(). However AFAICS this doesn't have the desired effect. 
It just returns the pattern ID.

The attached patch fixes this by using extract_constrain_insn_cached() 
instead. This is the same routine as used by get_attr_*.

I haven't managed to come up with a testcase for this. It showed up with some 
local Thumb-2 changes which use this much more aggressively.

Tested with cross to arm-none-eabi.
I'd appreciate it if someone else could look over this patch, check I'm not 
missing something.

Paul

2005-09-07  Paul Brook  <paul@codesourcery.com>

	* config/arm/arm.c (arm_final_prescan_insn): Use
	extract_constrain_insn_cached instead of recog.
Index: gcc/config/arm/arm.c
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/config/arm/arm.c,v
retrieving revision 1.476
diff -u -p -r1.476 arm.c
--- gcc/config/arm/arm.c	20 Aug 2005 10:31:40 -0000	1.476
+++ gcc/config/arm/arm.c	7 Sep 2005 03:26:58 -0000
@@ -11435,7 +11435,7 @@ arm_final_prescan_insn (rtx insn)
 	      if (!this_insn)
 	        {
 		  /* Oh, dear! we ran off the end.. give up.  */
-		  recog (PATTERN (insn), insn, NULL);
+		  extract_constrain_insn_cached (insn);
 		  arm_ccfsm_state = 0;
 		  arm_target_insn = NULL;
 		  return;
@@ -11468,9 +11468,8 @@ arm_final_prescan_insn (rtx insn)
 
       /* Restore recog_data (getting the attributes of other insns can
 	 destroy this array, but final.c assumes that it remains intact
-	 across this call; since the insn has been recognized already we
-	 call recog direct).  */
-      recog (PATTERN (insn), insn, NULL);
+	 across this call.  */
+      extract_constrain_insn_cached (insn);
     }
 }
 

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