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]

fix for explicit SET modes



It is an error to give a mode other than VOIDmode for calls to
gen_rtx_SET().  If you do it, reload can ruin your world.  Also there
are cases where explicit modes are given to SETs in *.md files which
can have similarly disasterous effects.

This tries to take care of all these issues.  It might be nice to add
a check in genrtl.[ch] for these cases to catch such coding errors
explicitly.

Can I install this set of changes into the mainline?

Fri Aug 14 03:41:31 1998  David S. Miller  <davem@pierdol.cobaltmicro.com>

	* config/alpha/alpha.c (alpha_return_addr): Use VOIDmode in vall
	to gen_rtx_SET.
	* config/i386/i386.md (movsf, movdf, movxf): Likewise.
	* config/pa/pa.c (emit_move_sequence): Likewise.
	* expr.c (init_expr_once): Likewise.
	* config/pa/pa.md (switch_jump): Don't give SET an explicit mode.

--- ./config/alpha/alpha.c.~1~	Tue Jul  7 12:00:03 1998
+++ ./config/alpha/alpha.c	Fri Aug 14 03:33:13 1998
@@ -2454,7 +2454,7 @@ alpha_return_addr (count, frame)
 
   /* No rtx yet.  Invent one, and initialize it from $26 in the prologue.  */
   alpha_return_addr_rtx = gen_reg_rtx (Pmode);
-  init = gen_rtx_SET (Pmode, alpha_return_addr_rtx,
+  init = gen_rtx_SET (VOIDmode, alpha_return_addr_rtx,
 		      gen_rtx_REG (Pmode, REG_RA));
 
   /* Emit the insn to the prologue with the other argument copies.  */
--- ./config/i386/i386.md.~1~	Thu Jul 30 00:05:31 1998
+++ ./config/i386/i386.md	Fri Aug 14 03:33:40 1998
@@ -1245,7 +1245,7 @@
       if (flag_pic)
 	current_function_uses_pic_offset_table = 1;
 
-      insn = emit_insn (gen_rtx_SET (SFmode, operands[0], fp_const));
+      insn = emit_insn (gen_rtx_SET (VOIDmode, operands[0], fp_const));
       note = find_reg_note (insn, REG_EQUAL, NULL_RTX);
 
       if (note)
@@ -1393,7 +1393,7 @@
       if (flag_pic)
 	current_function_uses_pic_offset_table = 1;
 
-      insn = emit_insn (gen_rtx_SET (DFmode, operands[0], fp_const));
+      insn = emit_insn (gen_rtx_SET (VOIDmode, operands[0], fp_const));
       note = find_reg_note (insn, REG_EQUAL, NULL_RTX);
 
       if (note)
@@ -1542,7 +1542,7 @@
       if (flag_pic)
 	current_function_uses_pic_offset_table = 1;
 
-      insn = emit_insn (gen_rtx_SET (XFmode, operands[0], fp_const));
+      insn = emit_insn (gen_rtx_SET (VOIDmode, operands[0], fp_const));
       note = find_reg_note (insn, REG_EQUAL, NULL_RTX);
 
       if (note)
--- ./config/pa/pa.md.~1~	Wed Jul  1 00:17:54 1998
+++ ./config/pa/pa.md	Fri Aug 14 03:32:54 1998
@@ -3911,7 +3911,7 @@
   [(set_attr "length" "0")])
 
 (define_insn "switch_jump"
-  [(set:DI (pc) (label_ref (match_operand 0 "" "")))]
+  [(set (pc) (label_ref (match_operand 0 "" "")))]
   ""
   "bl %l0,0%#"
   [(set_attr "type" "uncond_branch")
--- ./config/pa/pa.c.~1~	Tue Jul 28 21:30:02 1998
+++ ./config/pa/pa.c	Fri Aug 14 03:33:56 1998
@@ -1201,7 +1201,7 @@ emit_move_sequence (operands, mode, scra
       emit_move_sequence (xoperands, Pmode, 0);
 
       /* Now load the destination register.  */
-      emit_insn (gen_rtx_SET (mode, operand0, gen_rtx_MEM (mode, scratch_reg)));
+      emit_insn (gen_rtx_SET (VOIDmode, operand0, gen_rtx_MEM (mode, scratch_reg)));
       return 1;
     }
   /* Handle secondary reloads for SAR.  These occur when trying to load
@@ -1405,7 +1405,7 @@ emit_move_sequence (operands, mode, scra
 	      if (REGNO (temp) >= FIRST_PSEUDO_REGISTER)
 		REGNO_POINTER_FLAG (REGNO (temp)) = 1;
 	      if (ishighonly)
-		set = gen_rtx_SET (mode, operand0, temp);
+		set = gen_rtx_SET (VOIDmode, operand0, temp);
 	      else
 		set = gen_rtx_SET (VOIDmode, operand0,
 				   gen_rtx_LO_SUM (mode, temp, operand1));
--- ./expr.c.~1~	Fri Aug 14 00:45:43 1998
+++ ./expr.c	Fri Aug 14 03:34:08 1998
@@ -261,7 +261,7 @@ init_expr_once ()
   mem = gen_rtx_MEM (VOIDmode, stack_pointer_rtx);
   mem1 = gen_rtx_MEM (VOIDmode, frame_pointer_rtx);
 
-  insn = emit_insn (gen_rtx_SET (0, NULL_RTX, NULL_RTX));
+  insn = emit_insn (gen_rtx_SET (VOIDmode, NULL_RTX, NULL_RTX));
   pat = PATTERN (insn);
 
   for (mode = VOIDmode; (int) mode < NUM_MACHINE_MODES;


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