public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* A patch for CONST_DOUBLE
@ 1998-03-13 18:47 H.J. Lu
  1998-03-16 20:25 ` Jim Wilson
  0 siblings, 1 reply; 5+ messages in thread
From: H.J. Lu @ 1998-03-13 18:47 UTC (permalink / raw)
  To: egcs

Hi,

I have to use this patch to make egcs generate correct asm code
on PPro. I don't understand the way force_const_mem () handles
CONST_DOUBLE in nested function. It doesn't look right to me.
When you force a double into memory, you have to assign a label
to the memory location even if it is in nested function. Otherwise,
force_const_mem () doesn't really do anything for nested function.
I will happen to resend a test case which I have sent to the egcs
list earlier.

BTW, if my patch is wrong, I would appreciate a test case to show it.

Thanks.


-- 
H.J. Lu (hjl@gnu.org)
---
Fri Mar 13 18:40:57 1998  H.J. Lu  (hjl@gnu.org)

	* varasm.c (force_const_mem): Always update the label for
	CONST_DOUBLE even in nested function.
	(mark_constants): Enable searching inside a CONST_DOUBLE.

Index: varasm.c
===================================================================
RCS file: /home/work/cvs/gnu/egcs/gcc/varasm.c,v
retrieving revision 1.1.1.11
diff -u -p -r1.1.1.11 varasm.c
--- varasm.c	1998/03/12 17:18:41	1.1.1.11
+++ varasm.c	1998/03/14 02:35:18
@@ -3423,6 +3431,7 @@ force_const_mem (mode, x)
   CONSTANT_POOL_ADDRESS_P (XEXP (def, 0)) = 1;
   current_function_uses_const_pool = 1;
 
+#if 0
   if (outer_function_chain == 0)
     if (GET_CODE (x) == CONST_DOUBLE)
       {
@@ -3433,6 +3442,17 @@ force_const_mem (mode, x)
 	  }
 	CONST_DOUBLE_MEM (x) = def;
       }
+#else
+  if (GET_CODE (x) == CONST_DOUBLE)
+    {
+      if (outer_function_chain == 0 && CONST_DOUBLE_MEM (x) == cc0_rtx)
+	{
+	  CONST_DOUBLE_CHAIN (x) = const_double_chain;
+	  const_double_chain = x;
+	}
+      CONST_DOUBLE_MEM (x) = def;
+    }
+#endif
 
   return def;
 }
@@ -3625,6 +3645,7 @@ mark_constants (x)
 	find_pool_constant (x)->mark = 1;
       return;
     }
+#if 0
   /* Never search inside a CONST_DOUBLE, because CONST_DOUBLE_MEM may be
      a MEM, but does not constitute a use of that MEM.  This is particularly
      important inside a nested function, because CONST_DOUBLE_MEM may be
@@ -3632,6 +3653,7 @@ mark_constants (x)
      in force_const_mem.  */
   else if (GET_CODE (x) == CONST_DOUBLE)
     return;
+#endif
 
   /* Insns may appear inside a SEQUENCE.  Only check the patterns of
      insns, not any notes that may be attached.  We don't want to mark

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1998-03-17 11:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-03-13 18:47 A patch for CONST_DOUBLE H.J. Lu
1998-03-16 20:25 ` Jim Wilson
1998-03-17 11:27   ` H.J. Lu
1998-03-17 11:27     ` Jim Wilson
1998-03-17 11:33       ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).