RFA: Remove insn_contains_asm from ira.c

Richard Sandiford rdsandiford@googlemail.com
Wed Jul 30 21:31:00 GMT 2014


Just a small clean-up in preparation for the FOR_EACH_SUBRTX patches.
insn_contains_asm can be tested more directly using extract_asm_operands,
which doesn't involve any subcalls and should therefore be more efficient
than calling for_each_rtx.

Tested on x86_64-linux-gnu.  OK to install?

Thanks,
Richard


gcc/
	* ira.c (insn_contains_asm_1, insn_contains_asm): Delete.
	(compute_regs_asm_clobbered): Use extract_asm_operands instead.

Index: gcc/ira.c
===================================================================
--- gcc/ira.c	2014-07-30 20:04:53.199301309 +0100
+++ gcc/ira.c	2014-07-30 20:05:28.844636897 +0100
@@ -2221,25 +2221,6 @@ ira_bad_reload_regno (int regno, rtx in,
 	  || ira_bad_reload_regno_1 (regno, out));
 }
 
-/* Return TRUE if *LOC contains an asm.  */
-static int
-insn_contains_asm_1 (rtx *loc, void *data ATTRIBUTE_UNUSED)
-{
-  if ( !*loc)
-    return FALSE;
-  if (GET_CODE (*loc) == ASM_OPERANDS)
-    return TRUE;
-  return FALSE;
-}
-
-
-/* Return TRUE if INSN contains an ASM.  */
-static bool
-insn_contains_asm (rtx insn)
-{
-  return for_each_rtx (&insn, insn_contains_asm_1, NULL);
-}
-
 /* Add register clobbers from asm statements.  */
 static void
 compute_regs_asm_clobbered (void)
@@ -2253,7 +2234,7 @@ compute_regs_asm_clobbered (void)
 	{
 	  df_ref def;
 
-	  if (insn_contains_asm (insn))
+	  if (NONDEBUG_INSN_P (insn) && extract_asm_operands (PATTERN (insn)))
 	    FOR_EACH_INSN_DEF (def, insn)
 	      {
 		unsigned int dregno = DF_REF_REGNO (def);



More information about the Gcc-patches mailing list