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 avr] PR target/32335 ICE in cselib_record_set, at cselib.c:1508


Hi.

   The problem here is that the avr "call_prologue_saves" insns modify the
same register multiple times inside a parallel. After the dataflow merge,
cselib rejects such insns. The patch below fixes it.


2007-06-30 Anatoly Sokolov <aesok@post.ru>

	PR target/32335
	* config/avr/avr.c: Include dataflow header file.
	(expand_prologue): Adjust for prologue insn change.
	* config/avr/avr.c (call_prologue_saves): Only modify REG_SP once
	inside a insn.

Anatoly.

Index: gcc/config/avr/avr.md
===================================================================
--- gcc/config/avr/avr.md	(revision 126115)
+++ gcc/config/avr/avr.md	(working copy)
@@ -2706,20 +2706,16 @@
 ;;  Library prologue saves
 (define_insn "call_prologue_saves"
   [(unspec_volatile:HI [(const_int 0)] UNSPECV_PROLOGUE_SAVES)
+   (match_operand:HI 0 "immediate_operand" "")
    (set (reg:HI REG_SP) (minus:HI 
                            (reg:HI REG_SP)
-                           (match_operand:HI 0 "immediate_operand" "")))
-   (set (reg:HI REG_SP) (minus:HI 
-                           (reg:HI REG_SP)
                            (match_operand:HI 1 "immediate_operand" "")))
-   (set (reg:HI REG_X) (match_dup 0))
+   (use (reg:HI REG_X))
    (clobber (reg:HI REG_Z))]
   ""
-  "ldi r26,lo8(%0)
-	ldi r27,hi8(%0)
-	ldi r30,pm_lo8(1f)
+  "ldi r30,pm_lo8(1f)
 	ldi r31,pm_hi8(1f)
-	%~jmp __prologue_saves__+((18 - %1) * 2)
+	%~jmp __prologue_saves__+((18 - %0) * 2)
 1:"
   [(set_attr_alternative "length"
 			 [(if_then_else (eq_attr "mcu_mega" "yes")
Index: gcc/config/avr/avr.c
===================================================================
--- gcc/config/avr/avr.c	(revision 126115)
+++ gcc/config/avr/avr.c	(working copy)
@@ -44,6 +44,7 @@
 #include "tm_p.h"
 #include "target.h"
 #include "target-def.h"
+#include "df.h"
 
 /* Maximal allowed offset for an address in the LD command */
 #define MAX_LD_OFFSET(MODE) (64 - (signed)GET_MODE_SIZE (MODE))
@@ -631,9 +632,13 @@
     }
   else if (minimize && (frame_pointer_needed || live_seq > 6)) 
     {
+      insn = emit_move_insn (gen_rtx_REG (HImode, REG_X), 
+                             gen_int_mode (size, HImode));
+      RTX_FRAME_RELATED_P (insn) = 1;
+
       insn = 
-        emit_insn (gen_call_prologue_saves (gen_int_mode (size, HImode),
-                                            gen_int_mode (live_seq,
HImode)));
+        emit_insn (gen_call_prologue_saves (gen_int_mode (live_seq, HImode),
+					    gen_int_mode (size + live_seq,
HImode)));
       RTX_FRAME_RELATED_P (insn) = 1;
     }
   else




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