summaryrefslogtreecommitdiff
path: root/gcc/reload1.c
diff options
context:
space:
mode:
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2001-01-12 21:58:56 +0000
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2001-01-12 21:58:56 +0000
commitddaf7ad3f295fc6f36c7af34ae787f52b79e4fa3 (patch)
tree7db1440305362aa4b11577379f87eec6ec050a30 /gcc/reload1.c
parent9469a2e281c00b3ba48e51a0e9201731a23546cf (diff)
downloadgcc-ddaf7ad3f295fc6f36c7af34ae787f52b79e4fa3.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38964 138bc75d-0d04-0410-961f-82ee72b054a4
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 805fd968297..ace38ef5eda 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