Commit 729bf8ab by Eric Christopher

function.c (purge_addressof_1): Add libcall check.

2003-11-11  Eric Christopher  <echristo@redhat.com>

	* function.c (purge_addressof_1): Add libcall check.
	Remove test for cached replacements on fallback case.
	Simplify mode comparisons. Add libcall test for
	paradoxical subregs.

From-SVN: r73479
parent f24f5831
2003-11-11 Eric Christopher <echristo@redhat.com>
* function.c (purge_addressof_1): Add libcall check.
Remove test for cached replacements on fallback case.
Simplify mode comparisons. Add libcall test for
paradoxical subregs.
2003-11-11 Kazu Hirata <kazu@cs.umass.edu> 2003-11-11 Kazu Hirata <kazu@cs.umass.edu>
* config/h8300/t-h8300: Fix an obsolete comment. * config/h8300/t-h8300: Fix an obsolete comment.
...@@ -46,7 +53,7 @@ ...@@ -46,7 +53,7 @@
anything other than VISIBILITY_DEFAULT and VISIBILITY_HIDDEN. anything other than VISIBILITY_DEFAULT and VISIBILITY_HIDDEN.
* config/darwin.h (TARGET_ASM_ASSEMBLE_VISIBILITY): Use * config/darwin.h (TARGET_ASM_ASSEMBLE_VISIBILITY): Use
darwin_assemble_visibility instead of default. darwin_assemble_visibility instead of default.
2003-11-10 Waldek Hebisch <hebisch@math.uni.wroc.pl> 2003-11-10 Waldek Hebisch <hebisch@math.uni.wroc.pl>
PR target/12865 PR target/12865
...@@ -186,10 +193,10 @@ ...@@ -186,10 +193,10 @@
(decl_visibility): Remove declaration. (decl_visibility): Remove declaration.
* varasm.c (maybe_assemble_visibility): Use DECL_VISIBILITY * varasm.c (maybe_assemble_visibility): Use DECL_VISIBILITY
instead of decl_visibility. instead of decl_visibility.
(default_binds_local_p_1): Use DECL_VISIBILITY instead of (default_binds_local_p_1): Use DECL_VISIBILITY instead of
decl_visibility. decl_visibility.
(decl_visibility): Remove. (decl_visibility): Remove.
2003-11-06 Ulrich Weigand <uweigand@de.ibm.com> 2003-11-06 Ulrich Weigand <uweigand@de.ibm.com>
* config/s390/s390.c (s390_emit_epilogue): Recognize more cases * config/s390/s390.c (s390_emit_epilogue): Recognize more cases
......
...@@ -2929,6 +2929,7 @@ purge_addressof_1 (rtx *loc, rtx insn, int force, int store, int may_postpone, ...@@ -2929,6 +2929,7 @@ purge_addressof_1 (rtx *loc, rtx insn, int force, int store, int may_postpone,
int i, j; int i, j;
const char *fmt; const char *fmt;
bool result = true; bool result = true;
bool libcall = false;
/* Re-start here to avoid recursion in common cases. */ /* Re-start here to avoid recursion in common cases. */
restart: restart:
...@@ -2937,6 +2938,10 @@ purge_addressof_1 (rtx *loc, rtx insn, int force, int store, int may_postpone, ...@@ -2937,6 +2938,10 @@ purge_addressof_1 (rtx *loc, rtx insn, int force, int store, int may_postpone,
if (x == 0) if (x == 0)
return true; return true;
/* Is this a libcall? */
if (!insn)
libcall = REG_NOTE_KIND (*loc) == REG_RETVAL;
code = GET_CODE (x); code = GET_CODE (x);
/* If we don't return in any of the cases below, we will recurse inside /* If we don't return in any of the cases below, we will recurse inside
...@@ -3070,31 +3075,27 @@ purge_addressof_1 (rtx *loc, rtx insn, int force, int store, int may_postpone, ...@@ -3070,31 +3075,27 @@ purge_addressof_1 (rtx *loc, rtx insn, int force, int store, int may_postpone,
which can be succinctly described with a simple SUBREG. which can be succinctly described with a simple SUBREG.
Note that removing the REG_EQUAL note is not an option Note that removing the REG_EQUAL note is not an option
on the last insn of a libcall, so we must do a replacement. */ on the last insn of a libcall, so we must do a replacement. */
if (! purge_addressof_replacements
&& ! purge_bitfield_addressof_replacements)
{
/* In compile/990107-1.c:7 compiled at -O1 -m1 for sh-elf,
we got
(mem:DI (addressof:SI (reg/v:DF 160) 159 0x401c8510)
[0 S8 A32]), which can be expressed with a simple
same-size subreg */
if ((GET_MODE_SIZE (GET_MODE (x))
== GET_MODE_SIZE (GET_MODE (sub)))
/* Again, invalid pointer casts (as in
compile/990203-1.c) can require paradoxical
subregs. */
|| (GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD
&& (GET_MODE_SIZE (GET_MODE (x))
> GET_MODE_SIZE (GET_MODE (sub))))
|| (GET_MODE_SIZE (GET_MODE (x))
< GET_MODE_SIZE (GET_MODE (sub))))
{ /* In compile/990107-1.c:7 compiled at -O1 -m1 for sh-elf,
*loc = gen_rtx_SUBREG (GET_MODE (x), sub, 0); we got
return true; (mem:DI (addressof:SI (reg/v:DF 160) 159 0x401c8510)
} [0 S8 A32]), which can be expressed with a simple
/* ??? Are there other cases we should handle? */ same-size subreg */
if ((GET_MODE_SIZE (GET_MODE (x))
<= GET_MODE_SIZE (GET_MODE (sub)))
/* Again, invalid pointer casts (as in
compile/990203-1.c) can require paradoxical
subregs. */
|| (GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD
&& (GET_MODE_SIZE (GET_MODE (x))
> GET_MODE_SIZE (GET_MODE (sub)))
&& libcall))
{
*loc = gen_rtx_SUBREG (GET_MODE (x), sub, 0);
return true;
} }
/* ??? Are there other cases we should handle? */
/* Sometimes we may not be able to find the replacement. For /* Sometimes we may not be able to find the replacement. For
example when the original insn was a MEM in a wider mode, example when the original insn was a MEM in a wider mode,
and the note is part of a sign extension of a narrowed and the note is part of a sign extension of a narrowed
......
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