This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
A patch for CONST_DOUBLE
- To: egcs at cygnus dot com
- Subject: A patch for CONST_DOUBLE
- From: hjl at lucon dot org (H.J. Lu)
- Date: Fri, 13 Mar 1998 18:47:22 -0800 (PST)
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