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 compile/20000804-1.c



This is a fix for compile/20000804-1.c by preventing CONCATs escaping
from RTL generation.  It's ugliness is mostly caused by the CONCAT
thing itself.

Built & tested on x86-linux.  I'll bootstrap on ppc-linux before
committing it.

-- 
Geoff Keating <geoffk@cygnus.com>

===File ~/patches/rs6000-cmplxLLreload-2.patch==============
2000-08-31  Geoffrey Keating  <geoffk@cygnus.com>

	* stmt.c (expand_asm_operands): Twiddle generating_concat_p
	so that CONCATs are not generated for ASMs.
	* emit-rtl.c (gen_reg_rtx): Don't generate CONCATs when
	not generating_concat_p.
	* function.c (pop_function_context_from): Reset
	generating_concat_p.
	(prepare_function_start): Likewise.
	* rtl.c (generating_concat_p): Define.
	* rtl.h (generating_concat_p): Declare.
	* toplev.c (rest_of_compilation): No CONCATs after RTL generation.

Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/emit-rtl.c,v
retrieving revision 1.143
diff -u -p -r1.143 emit-rtl.c
--- emit-rtl.c	2000/08/24 20:31:31	1.143
+++ emit-rtl.c	2000/08/31 11:51:23
@@ -539,8 +539,9 @@ gen_reg_rtx (mode)
   if (no_new_pseudos)
     abort ();
 
-  if (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT
-      || GET_MODE_CLASS (mode) == MODE_COMPLEX_INT)
+  if (generating_concat_p
+      && (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT
+	  || GET_MODE_CLASS (mode) == MODE_COMPLEX_INT))
     {
       /* For complex modes, don't make a single pseudo.
 	 Instead, make a CONCAT of two pseudos.
Index: function.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/function.c,v
retrieving revision 1.216
diff -u -p -r1.216 function.c
--- function.c	2000/08/25 21:32:05	1.216
+++ function.c	2000/08/31 11:51:23
@@ -413,6 +413,7 @@ pop_function_context_from (context)
   /* Reset variables that have known state during rtx generation.  */
   rtx_equal_function_value_matters = 1;
   virtuals_instantiated = 0;
+  generating_concat_p = 1;
 }
 
 void
@@ -5919,6 +5920,9 @@ prepare_function_start ()
 
   /* Indicate that we have not instantiated virtual registers yet.  */
   virtuals_instantiated = 0;
+
+  /* Indicate that we want CONCATs now.  */
+  generating_concat_p = 1;
 
   /* Indicate we have no need of a frame pointer yet.  */
   frame_pointer_needed = 0;
Index: rtl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/rtl.c,v
retrieving revision 1.75
diff -u -p -r1.75 rtl.c
--- rtl.c	2000/08/03 16:06:13	1.75
+++ rtl.c	2000/08/31 11:51:23
@@ -578,6 +578,9 @@ shallow_copy_rtx (orig)
 
 /* This is 1 until after the rtl generation pass.  */
 int rtx_equal_function_value_matters;
+
+/* Nonzero when we are generating CONCATs.  */
+int generating_concat_p;
 
 /* Return 1 if X and Y are identical-looking rtx's.
    This is the Lisp function EQUAL for rtx arguments.  */
Index: rtl.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/rtl.h,v
retrieving revision 1.218
diff -u -p -r1.218 rtl.h
--- rtl.h	2000/08/21 13:42:28	1.218
+++ rtl.h	2000/08/31 11:51:23
@@ -1102,6 +1102,9 @@ extern const char * const note_insn_name
    This is 1 until after the rtl generation pass.  */
 extern int rtx_equal_function_value_matters;
 
+/* Nonzero when we are generating CONCATs.  */
+extern int generating_concat_p;
+
 /* Generally useful functions.  */
 
 /* The following functions accept a wide integer argument.  Rather than
Index: stmt.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/stmt.c,v
retrieving revision 1.161
diff -u -p -r1.161 stmt.c
--- stmt.c	2000/08/24 21:40:23	1.161
+++ stmt.c	2000/08/31 11:51:23
@@ -1336,6 +1336,7 @@ expand_asm_operands (string, outputs, in
     = (enum machine_mode *) alloca (noutputs * sizeof (enum machine_mode));
   /* The insn we have emitted.  */
   rtx insn;
+  int old_generating_concat_p = generating_concat_p;
 
   /* An ASM with no outputs needs to be treated as volatile, for now.  */
   if (noutputs == 0)
@@ -1526,6 +1527,8 @@ expand_asm_operands (string, outputs, in
 	 Make the asm insn write into that, then our caller will copy it to
 	 the real output operand.  Likewise for promoted variables.  */
 
+      generating_concat_p = 0;
+
       real_output_rtx[i] = NULL_RTX;
       if ((TREE_CODE (val) == INDIRECT_REF
 	   && allows_mem)
@@ -1545,7 +1548,8 @@ expand_asm_operands (string, outputs, in
 
 	  if (! allows_reg && GET_CODE (output_rtx[i]) != MEM)
 	    error ("output number %d not directly addressable", i);
-	  if (! allows_mem && GET_CODE (output_rtx[i]) == MEM)
+	  if ((! allows_mem && GET_CODE (output_rtx[i]) == MEM)
+	      || GET_CODE (output_rtx[i]) == CONCAT)
 	    {
     	      real_output_rtx[i] = protect_from_queue (output_rtx[i], 1);
 	      output_rtx[i] = gen_reg_rtx (GET_MODE (output_rtx[i]));
@@ -1559,6 +1563,8 @@ expand_asm_operands (string, outputs, in
 	  TREE_VALUE (tail) = make_tree (type, output_rtx[i]);
 	}
 
+      generating_concat_p = old_generating_concat_p;
+
       if (is_inout)
 	{
 	  inout_mode[ninout] = TYPE_MODE (TREE_TYPE (TREE_VALUE (tail)));
@@ -1700,6 +1706,11 @@ expand_asm_operands (string, outputs, in
 
       op = expand_expr (TREE_VALUE (tail), NULL_RTX, VOIDmode, 0);
 
+      /* Never pass a CONCAT to an ASM.  */
+      generating_concat_p = 0;
+      if (GET_CODE (op) == CONCAT)
+	op = force_reg (GET_MODE (op), op);
+
       if (asm_operand_ok (op, constraint) <= 0)
 	{
 	  if (allows_reg)
@@ -1732,6 +1743,7 @@ expand_asm_operands (string, outputs, in
 	       not satisfied.  */
 	    warning ("asm operand %d probably doesn't match constraints", i);
 	}
+      generating_concat_p = old_generating_concat_p;
       XVECEXP (body, 3, i) = op;
 
       XVECEXP (body, 4, i)      /* constraints */
@@ -1743,12 +1755,14 @@ expand_asm_operands (string, outputs, in
   /* Protect all the operands from the queue now that they have all been
      evaluated.  */
 
+  generating_concat_p = 0;
+  
   for (i = 0; i < ninputs - ninout; i++)
     XVECEXP (body, 3, i) = protect_from_queue (XVECEXP (body, 3, i), 0);
 
   for (i = 0; i < noutputs; i++)
     output_rtx[i] = protect_from_queue (output_rtx[i], 1);
-
+  
   /* For in-out operands, copy output rtx to input rtx. */
   for (i = 0; i < ninout; i++)
     {
@@ -1760,6 +1774,8 @@ expand_asm_operands (string, outputs, in
 	= gen_rtx_ASM_INPUT (inout_mode[i], digit_strings[j]);
     }
 
+  generating_concat_p = old_generating_concat_p;
+
   /* Now, for each output, construct an rtx
      (set OUTPUT (asm_operands INSN OUTPUTNUMBER OUTPUTCONSTRAINT
 			       ARGVEC CONSTRAINTS))
@@ -1842,6 +1858,8 @@ expand_asm_operands (string, outputs, in
 
       insn = emit_insn (body);
     }
+
+  generating_concat_p = old_generating_concat_p;
 
   /* For any outputs that needed reloading into registers, spill them
      back to where they belong.  */
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/toplev.c,v
retrieving revision 1.369
diff -u -p -r1.369 toplev.c
--- toplev.c	2000/08/28 22:52:30	1.369
+++ toplev.c	2000/08/31 11:51:24
@@ -2618,6 +2618,10 @@ rest_of_compilation (decl)
 
   timevar_push (TV_REST_OF_COMPILATION);
 
+  /* Now that we're out of the frontend, we shouldn't have any more
+     CONCATs anywhere.  */
+  generating_concat_p = 0;
+
   /* When processing delayed functions, prepare_function_start() won't
      have been run to re-initialize it.  */
   cse_not_expected = ! optimize;
============================================================

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