Commit 8b04083b by Vladimir Makarov Committed by Vladimir Makarov

function.c (purge_addressof_replacements): Rename into purge_bitfield_addressof_replacements.

Wed May  5 16:26:13 1999  Vladimir Makarov  <vmakarov@tofu.to.cygnus.com>
	* function.c (purge_addressof_replacements): Rename into
 	purge_bitfield_addressof_replacements.
	(purge_addressof_replacements): New variable.
	(purge_addressof_1): Add code for changing addressof in notes for
 	field values which are extracted by usage MEM with narrower mode.
	(purge_addressof): Initialize purge_bitfield_addressof_replacements.

From-SVN: r26784
parent 24dc3000
Wed May 5 16:26:13 1999 Vladimir Makarov <vmakarov@tofu.to.cygnus.com>
* function.c (purge_addressof_replacements): Rename into
purge_bitfield_addressof_replacements.
(purge_addressof_replacements): New variable.
(purge_addressof_1): Add code for changing addressof in notes for
field values which are extracted by usage MEM with narrower mode.
(purge_addressof): Initialize purge_bitfield_addressof_replacements.
Wed May 5 07:40:02 1999 Nick Clifton <nickc@cygnus.com> Wed May 5 07:40:02 1999 Nick Clifton <nickc@cygnus.com>
Patch from: Nick Burrett <nick.burrett@btinternet.com> Patch from: Nick Burrett <nick.burrett@btinternet.com>
......
...@@ -3031,6 +3031,14 @@ put_addressof_into_stack (r, ht) ...@@ -3031,6 +3031,14 @@ put_addressof_into_stack (r, ht)
/* List of replacements made below in purge_addressof_1 when creating /* List of replacements made below in purge_addressof_1 when creating
bitfield insertions. */ bitfield insertions. */
static rtx purge_bitfield_addressof_replacements;
/* List of replacements made below in purge_addressof_1 for patterns
(MEM (ADDRESSOF (REG ...))). The key of the list entry is the
corresponding (ADDRESSOF (REG ...)) and value is a substitution for
the all pattern. List PURGE_BITFIELD_ADDRESSOF_REPLACEMENTS is not
enough in complex cases, e.g. when some field values can be
extracted by usage MEM with narrower mode. */
static rtx purge_addressof_replacements; static rtx purge_addressof_replacements;
/* Helper function for purge_addressof. See if the rtx expression at *LOC /* Helper function for purge_addressof. See if the rtx expression at *LOC
...@@ -3110,31 +3118,36 @@ purge_addressof_1 (loc, insn, force, store, ht) ...@@ -3110,31 +3118,36 @@ purge_addressof_1 (loc, insn, force, store, ht)
was replaced by. */ was replaced by. */
rtx tem; rtx tem;
for (tem = purge_addressof_replacements; tem != NULL_RTX; for (tem = purge_bitfield_addressof_replacements;
tem != NULL_RTX;
tem = XEXP (XEXP (tem, 1), 1)) tem = XEXP (XEXP (tem, 1), 1))
if (rtx_equal_p (x, XEXP (tem, 0)))
{ {
rtx y = XEXP (tem, 0); *loc = XEXP (XEXP (tem, 1), 0);
if (GET_CODE (y) == MEM return;
&& rtx_equal_p (XEXP (x, 0), XEXP (y, 0))) }
{
/* It can happen that the note may speak of things in
a wider (or just different) mode than the code did.
This is especially true of REG_RETVAL. */
rtx z = XEXP (XEXP (tem, 1), 0); /* See comment for purge_addressof_replacements. */
if (GET_MODE (x) != GET_MODE (y)) for (tem = purge_addressof_replacements;
tem != NULL_RTX;
tem = XEXP (XEXP (tem, 1), 1))
if (rtx_equal_p (XEXP (x, 0), XEXP (tem, 0)))
{ {
if (GET_CODE (z) == SUBREG && SUBREG_WORD (z) == 0) rtx z = XEXP (XEXP (tem, 1), 0);
z = SUBREG_REG (z);
/* ??? If we'd gotten into any of the really complex if (GET_MODE (x) == GET_MODE (z)
cases below, I'm not sure we can do a proper || (GET_CODE (XEXP (XEXP (tem, 1), 0)) != REG
replacement. Might we be able to delete the && GET_CODE (XEXP (XEXP (tem, 1), 0)) != SUBREG))
note in some cases? */
if (GET_MODE_SIZE (GET_MODE (x))
< GET_MODE_SIZE (GET_MODE (y)))
abort (); abort ();
/* It can happen that the note may speak of things
in a wider (or just different) mode than the
code did. This is especially true of
REG_RETVAL. */
if (GET_CODE (z) == SUBREG && SUBREG_WORD (z) == 0)
z = SUBREG_REG (z);
if (GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD if (GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD
&& (GET_MODE_SIZE (GET_MODE (x)) && (GET_MODE_SIZE (GET_MODE (x))
> GET_MODE_SIZE (GET_MODE (z)))) > GET_MODE_SIZE (GET_MODE (z))))
...@@ -3149,12 +3162,10 @@ purge_addressof_1 (loc, insn, force, store, ht) ...@@ -3149,12 +3162,10 @@ purge_addressof_1 (loc, insn, force, store, ht)
} }
else else
z = gen_lowpart (GET_MODE (x), z); z = gen_lowpart (GET_MODE (x), z);
}
*loc = z; *loc = z;
return; return;
} }
}
/* There should always be such a replacement. */ /* There should always be such a replacement. */
abort (); abort ();
...@@ -3242,10 +3253,11 @@ purge_addressof_1 (loc, insn, force, store, ht) ...@@ -3242,10 +3253,11 @@ purge_addressof_1 (loc, insn, force, store, ht)
/* Remember the replacement so that the same one can be done /* Remember the replacement so that the same one can be done
on the REG_NOTES. */ on the REG_NOTES. */
purge_addressof_replacements purge_bitfield_addressof_replacements
= gen_rtx_EXPR_LIST (VOIDmode, x, = gen_rtx_EXPR_LIST (VOIDmode, x,
gen_rtx_EXPR_LIST (VOIDmode, val, gen_rtx_EXPR_LIST
purge_addressof_replacements)); (VOIDmode, val,
purge_bitfield_addressof_replacements));
/* We replaced with a reg -- all done. */ /* We replaced with a reg -- all done. */
return; return;
...@@ -3255,10 +3267,24 @@ purge_addressof_1 (loc, insn, force, store, ht) ...@@ -3255,10 +3267,24 @@ purge_addressof_1 (loc, insn, force, store, ht)
{ {
/* Remember the replacement so that the same one can be done /* Remember the replacement so that the same one can be done
on the REG_NOTES. */ on the REG_NOTES. */
if (GET_CODE (sub) == REG || GET_CODE (sub) == SUBREG)
{
rtx tem;
for (tem = purge_addressof_replacements;
tem != NULL_RTX;
tem = XEXP (XEXP (tem, 1), 1))
if (rtx_equal_p (XEXP (x, 0), XEXP (tem, 0)))
{
XEXP (XEXP (tem, 1), 0) = sub;
return;
}
purge_addressof_replacements purge_addressof_replacements
= gen_rtx_EXPR_LIST (VOIDmode, x, = gen_rtx (EXPR_LIST, VOIDmode, XEXP (x, 0),
gen_rtx_EXPR_LIST (VOIDmode, sub, gen_rtx_EXPR_LIST (VOIDmode, sub,
purge_addressof_replacements)); purge_addressof_replacements));
return;
}
goto restart; goto restart;
} }
give_up:; give_up:;
...@@ -3440,6 +3466,7 @@ purge_addressof (insns) ...@@ -3440,6 +3466,7 @@ purge_addressof (insns)
/* Clean up. */ /* Clean up. */
hash_table_free (&ht); hash_table_free (&ht);
purge_bitfield_addressof_replacements = 0;
purge_addressof_replacements = 0; purge_addressof_replacements = 0;
} }
......
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