Commit 18b9ca6f by Richard Kenner

(memory_address): Call update_temp_slot_address on new and old

address.

From-SVN: r6497
parent e5e76139
/* Subroutines for manipulating rtx's in semantically interesting ways. /* Subroutines for manipulating rtx's in semantically interesting ways.
Copyright (C) 1987, 1991 Free Software Foundation, Inc. Copyright (C) 1987, 1991, 1994 Free Software Foundation, Inc.
This file is part of GNU CC. This file is part of GNU CC.
...@@ -338,26 +338,27 @@ memory_address (mode, x) ...@@ -338,26 +338,27 @@ memory_address (mode, x)
enum machine_mode mode; enum machine_mode mode;
register rtx x; register rtx x;
{ {
register rtx oldx; register rtx oldx = x;
/* By passing constant addresses thru registers /* By passing constant addresses thru registers
we get a chance to cse them. */ we get a chance to cse them. */
if (! cse_not_expected && CONSTANT_P (x) && CONSTANT_ADDRESS_P (x)) if (! cse_not_expected && CONSTANT_P (x) && CONSTANT_ADDRESS_P (x))
return force_reg (Pmode, x); x = force_reg (Pmode, x);
/* Accept a QUEUED that refers to a REG /* Accept a QUEUED that refers to a REG
even though that isn't a valid address. even though that isn't a valid address.
On attempting to put this in an insn we will call protect_from_queue On attempting to put this in an insn we will call protect_from_queue
which will turn it into a REG, which is valid. */ which will turn it into a REG, which is valid. */
if (GET_CODE (x) == QUEUED else if (GET_CODE (x) == QUEUED
&& GET_CODE (QUEUED_VAR (x)) == REG) && GET_CODE (QUEUED_VAR (x)) == REG)
return x; ;
/* We get better cse by rejecting indirect addressing at this stage. /* We get better cse by rejecting indirect addressing at this stage.
Let the combiner create indirect addresses where appropriate. Let the combiner create indirect addresses where appropriate.
For now, generate the code so that the subexpressions useful to share For now, generate the code so that the subexpressions useful to share
are visible. But not if cse won't be done! */ are visible. But not if cse won't be done! */
oldx = x; else
{
if (! cse_not_expected && GET_CODE (x) != REG) if (! cse_not_expected && GET_CODE (x) != REG)
x = break_out_memory_refs (x); x = break_out_memory_refs (x);
...@@ -390,24 +391,32 @@ memory_address (mode, x) ...@@ -390,24 +391,32 @@ memory_address (mode, x)
rtx y = eliminate_constant_term (x, &constant_term); rtx y = eliminate_constant_term (x, &constant_term);
if (constant_term == const0_rtx if (constant_term == const0_rtx
|| ! memory_address_p (mode, y)) || ! memory_address_p (mode, y))
return force_operand (x, NULL_RTX); x = force_operand (x, NULL_RTX);
else
{
y = gen_rtx (PLUS, GET_MODE (x), copy_to_reg (y), constant_term); y = gen_rtx (PLUS, GET_MODE (x), copy_to_reg (y), constant_term);
if (! memory_address_p (mode, y)) if (! memory_address_p (mode, y))
return force_operand (x, NULL_RTX); x = force_operand (x, NULL_RTX);
return y; else
x = y;
} }
}
if (GET_CODE (x) == MULT || GET_CODE (x) == MINUS) if (GET_CODE (x) == MULT || GET_CODE (x) == MINUS)
return force_operand (x, NULL_RTX); x = force_operand (x, NULL_RTX);
/* If we have a register that's an invalid address, /* If we have a register that's an invalid address,
it must be a hard reg of the wrong class. Copy it to a pseudo. */ it must be a hard reg of the wrong class. Copy it to a pseudo. */
if (GET_CODE (x) == REG) else if (GET_CODE (x) == REG)
return copy_to_reg (x); x = copy_to_reg (x);
/* Last resort: copy the value to a register, since /* Last resort: copy the value to a register, since
the register is a valid address. */ the register is a valid address. */
return force_reg (Pmode, x); else
x = force_reg (Pmode, x);
goto done;
}
win2: win2:
x = oldx; x = oldx;
...@@ -419,10 +428,17 @@ memory_address (mode, x) ...@@ -419,10 +428,17 @@ memory_address (mode, x)
|| XEXP (x, 0) == virtual_incoming_args_rtx))) || XEXP (x, 0) == virtual_incoming_args_rtx)))
{ {
if (general_operand (x, Pmode)) if (general_operand (x, Pmode))
return force_reg (Pmode, x); x = force_reg (Pmode, x);
else else
return force_operand (x, NULL_RTX); x = force_operand (x, NULL_RTX);
} }
done:
/* OLDX may have been the address on a temporary. Update the address
to indicate that X is now used. */
update_temp_slot_address (oldx, x);
return x; return x;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment