This patch fixes the debug output of rtx_costs as enabled with -mdeb.

rtx_costs are typically computed for SET_SRC of patters, not of pattern/insn
as a whole resp for SETs.

This patch yields more accurate dumps of rtx_costs in asm file.

Ok?

Johann

        * config/avr/avr.c (final_prescan_insn): Fix printing of rtx_costs.

Index: config/avr/avr.c
===================================================================
--- config/avr/avr.c	(revision 176554)
+++ config/avr/avr.c	(working copy)
@@ -1633,8 +1633,14 @@ final_prescan_insn (rtx insn, rtx *opera
 {
   if (TARGET_ALL_DEBUG)
     {
-      fprintf (asm_out_file, "/* DEBUG: cost = %d.  */\n",
-	       rtx_cost (PATTERN (insn), INSN, !optimize_size));
+      rtx set;
+
+      if ((set = single_set (insn), set))
+        fprintf (asm_out_file, "/* DEBUG: cost = %d.  */\n",
+                 rtx_cost (SET_SRC (set), SET, !optimize_size));
+      else
+        fprintf (asm_out_file, "/* DEBUG: pattern-cost = %d.  */\n",
+                 rtx_cost (PATTERN (insn), INSN, !optimize_size));
     }
 }
 

Reply via email to