Revert these changes:

2002-04-06  Mark Mitchell  <mark@codesourcery.com>

	PR c++/5571
	* stor-layout.c (layout_decl): Reset the RTL for the decl.

	2002-03-15  Mark Mitchell  <mark@codesourcery.com>

	* expr.c (expand_expr): Tidy.

	* decl.c (duplicate_decls): Do not copy the RTL for a variable
	declaration if the old variable had an incomplete type and the new
	variable does not.
	(complete_vars): Do not call layout_decl for completed variables.

From-SVN: r52257
This commit is contained in:
Mark Mitchell 2002-04-13 01:25:11 +00:00 committed by Mark Mitchell
parent 36ea005204
commit 6d840fb794
5 changed files with 83 additions and 44 deletions

View File

@ -1,3 +1,16 @@
2002-04-12 Mark Mitchell <mark@codesourcery.com>
Revert these changes:
2002-04-06 Mark Mitchell <mark@codesourcery.com>
PR c++/5571
* stor-layout.c (layout_decl): Reset the RTL for the decl.
2002-03-15 Mark Mitchell <mark@codesourcery.com>
* expr.c (expand_expr): Tidy.
2002-04-12 Richard Henderson <rth@redhat.com>
* config.gcc (sparcv9-*-solaris2): Default to 32-bit code.

View File

@ -1,3 +1,10 @@
2002-04-12 Mark Mitchell <mark@codesourcery.com>
* decl.c (duplicate_decls): Do not copy the RTL for a variable
declaration if the old variable had an incomplete type and the new
variable does not.
(complete_vars): Do not call layout_decl for completed variables.
2002-04-11 Andrew Haley <aph@redhat.com>
* typeck.c (type_after_usual_arithmetic_conversions):

View File

@ -3610,15 +3610,23 @@ duplicate_decls (newdecl, olddecl)
if (DECL_SECTION_NAME (newdecl) == NULL_TREE)
DECL_SECTION_NAME (newdecl) = DECL_SECTION_NAME (olddecl);
/* Keep the old rtl since we can safely use it. */
COPY_DECL_RTL (olddecl, newdecl);
if (TREE_CODE (newdecl) == FUNCTION_DECL)
{
DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (newdecl)
|= DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (olddecl);
DECL_NO_LIMIT_STACK (newdecl)
|= DECL_NO_LIMIT_STACK (olddecl);
/* Keep the old RTL. */
COPY_DECL_RTL (olddecl, newdecl);
}
else if (TREE_CODE (newdecl) == VAR_DECL
&& (DECL_SIZE (olddecl) || !DECL_SIZE (newdecl)))
{
/* Keep the old RTL. We cannot keep the old RTL if the old
declaration was for an incomplete object and the new
declaration is not since many attributes of the RTL will
change. */
COPY_DECL_RTL (olddecl, newdecl);
}
}
/* If cannot merge, then use the new type and qualifiers,
@ -14539,11 +14547,9 @@ complete_vars (type)
if (same_type_p (type, TREE_PURPOSE (*list)))
{
tree var = TREE_VALUE (*list);
/* Make sure that the type of the VAR has been laid out. It
might not have been if the type of VAR is an array. */
layout_type (TREE_TYPE (var));
/* Lay out the variable itself. */
layout_decl (var, 0);
/* Complete the type of the variable. The VAR_DECL itself
will be laid out in expand_expr. */
complete_type (TREE_TYPE (var));
/* Remove this entry from the list. */
*list = TREE_CHAIN (*list);
}

View File

@ -8384,45 +8384,63 @@ expand_expr (exp, target, tmode, modifier)
knows that it should fix up those uses. */
TREE_USED (slot) = 1;
/* If we have already expanded the slot, so don't do
it again. (mrs) */
if (DECL_RTL_SET_P (slot))
{
target = DECL_RTL (slot);
if (TREE_OPERAND (exp, 1) == NULL_TREE)
return target;
}
if (target == 0)
{
target = assign_temp (type, 2, 0, 1);
/* All temp slots at this level must not conflict. */
preserve_temp_slots (target);
SET_DECL_RTL (slot, target);
if (TREE_ADDRESSABLE (slot))
put_var_into_stack (slot);
if (DECL_RTL_SET_P (slot))
{
target = DECL_RTL (slot);
/* If we have already expanded the slot, so don't do
it again. (mrs) */
if (TREE_OPERAND (exp, 1) == NULL_TREE)
return target;
}
else
{
target = assign_temp (type, 2, 0, 1);
/* All temp slots at this level must not conflict. */
preserve_temp_slots (target);
SET_DECL_RTL (slot, target);
if (TREE_ADDRESSABLE (slot))
put_var_into_stack (slot);
/* Since SLOT is not known to the called function
to belong to its stack frame, we must build an explicit
cleanup. This case occurs when we must build up a reference
to pass the reference as an argument. In this case,
it is very likely that such a reference need not be
built here. */
if (TREE_OPERAND (exp, 2) == 0)
TREE_OPERAND (exp, 2) = maybe_build_cleanup (slot);
cleanups = TREE_OPERAND (exp, 2);
/* Since SLOT is not known to the called function
to belong to its stack frame, we must build an explicit
cleanup. This case occurs when we must build up a reference
to pass the reference as an argument. In this case,
it is very likely that such a reference need not be
built here. */
if (TREE_OPERAND (exp, 2) == 0)
TREE_OPERAND (exp, 2) = maybe_build_cleanup (slot);
cleanups = TREE_OPERAND (exp, 2);
}
}
else
{
/* This case does occur, when expanding a parameter which
needs to be constructed on the stack. The target
is the actual stack address that we want to
initialize. */
SET_DECL_RTL (slot, target);
/* If we must have an addressable slot, then make sure that
the RTL that we just stored in slot is OK. */
if (TREE_ADDRESSABLE (slot))
put_var_into_stack (slot);
is the actual stack address that we want to initialize.
The function we call will perform the cleanup in this case. */
/* If we have already assigned it space, use that space,
not target that we were passed in, as our target
parameter is only a hint. */
if (DECL_RTL_SET_P (slot))
{
target = DECL_RTL (slot);
/* If we have already expanded the slot, so don't do
it again. (mrs) */
if (TREE_OPERAND (exp, 1) == NULL_TREE)
return target;
}
else
{
SET_DECL_RTL (slot, target);
/* If we must have an addressable slot, then make sure that
the RTL that we just stored in slot is OK. */
if (TREE_ADDRESSABLE (slot))
put_var_into_stack (slot);
}
}
exp1 = TREE_OPERAND (exp, 3) = TREE_OPERAND (exp, 1);

View File

@ -459,11 +459,6 @@ layout_decl (decl, known_align)
larger_than_size);
}
}
/* If there was already RTL for this DECL, as for a variable with an
incomplete type whose type is completed later, update the RTL. */
if (DECL_RTL_SET_P (decl))
make_decl_rtl (decl, NULL);
}
/* Hook for a front-end function that can modify the record layout as needed