aboutsummaryrefslogtreecommitdiff
path: root/gcc/reload1.c
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2001-01-12 21:58:56 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2001-01-12 21:58:56 +0000
commitf474c6f8f92594e09a56c03cdd609d161e690bdd (patch)
tree7db1440305362aa4b11577379f87eec6ec050a30 /gcc/reload1.c
parent7dd232a8824ac79a5d17641804ffe1a72f19c387 (diff)
downloadgcc-f474c6f8f92594e09a56c03cdd609d161e690bdd.zip
gcc-f474c6f8f92594e09a56c03cdd609d161e690bdd.tar.gz
gcc-f474c6f8f92594e09a56c03cdd609d161e690bdd.tar.bz2
calls.c (emit_library_call_value_1): Add USEs and CLOBBERs to function usage for arguments passed by reference.
* calls.c (emit_library_call_value_1): Add USEs and CLOBBERs to function usage for arguments passed by reference. Optimize callee-copied arguments. * regmove.c (find_related_toplev): Find uses in function usage. (replace_in_call_usage): New function. (fixup_match_1): Call it. * cse.c (cse_insn): Canonicalize registers in function usage. * reload1.c (replace_pseudos_in_call_usage): New function. (reload): Call it. From-SVN: r38964
Diffstat (limited to 'gcc/reload1.c')
-rw-r--r--gcc/reload1.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 805fd96..ace38ef 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -577,6 +577,63 @@ compute_use_by_pseudos (to, from)
}
});
}
+
+/* Replace all pseudos found in LOC with their corresponding
+ equivalences. */
+
+static void
+replace_pseudos_in_call_usage (loc, mem_mode, usage)
+ rtx *loc;
+ enum machine_mode mem_mode;
+ rtx usage;
+{
+ rtx x = *loc;
+ enum rtx_code code;
+ const char *fmt;
+ int i, j;
+
+ if (! x)
+ return;
+
+ code = GET_CODE (x);
+ if (code == REG)
+ {
+ if (REGNO (x) < FIRST_PSEUDO_REGISTER)
+ return;
+
+ x = eliminate_regs (x, mem_mode, usage);
+ if (x != *loc)
+ {
+ *loc = x;
+ replace_pseudos_in_call_usage (loc, mem_mode, usage);
+ return;
+ }
+
+ if (reg_renumber [REGNO (x)] < 0)
+ *loc = regno_reg_rtx[REGNO (x)];
+ else if (reg_equiv_mem[REGNO (x)])
+ *loc = reg_equiv_mem[REGNO (x)];
+ else
+ abort ();
+
+ return;
+ }
+ else if (code == MEM)
+ {
+ replace_pseudos_in_call_usage (& XEXP (x, 0), GET_MODE (x), usage);
+ return;
+ }
+
+ /* Process each of our operands recursively. */
+ fmt = GET_RTX_FORMAT (code);
+ for (i = 0; i < GET_RTX_LENGTH (code); i++, fmt++)
+ if (*fmt == 'e')
+ replace_pseudos_in_call_usage (&XEXP (x, i), mem_mode, usage);
+ else if (*fmt == 'E')
+ for (j = 0; j < XVECLEN (x, i); j++)
+ replace_pseudos_in_call_usage (& XVECEXP (x, i, j), mem_mode, usage);
+}
+
/* Global variables used by reload and its subroutines. */
@@ -1114,6 +1171,11 @@ reload (first, global)
{
rtx *pnote;
+ if (GET_CODE (insn) == CALL_INSN)
+ replace_pseudos_in_call_usage (& CALL_INSN_FUNCTION_USAGE (insn),
+ VOIDmode,
+ CALL_INSN_FUNCTION_USAGE (insn));
+
if ((GET_CODE (PATTERN (insn)) == USE
&& find_reg_note (insn, REG_EQUAL, NULL_RTX))
|| (GET_CODE (PATTERN (insn)) == CLOBBER