aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1994-05-06 17:45:07 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1994-05-06 17:45:07 -0400
commitf1e7c95f89be637e052cd7ee3e31aaade607404c (patch)
treecaf227fa0e435ae148dea110062acdb07ee16331 /gcc
parent6e2d1486acf5c27ff368e28af3b781f3eaf7405b (diff)
downloadgcc-f1e7c95f89be637e052cd7ee3e31aaade607404c.zip
gcc-f1e7c95f89be637e052cd7ee3e31aaade607404c.tar.gz
gcc-f1e7c95f89be637e052cd7ee3e31aaade607404c.tar.bz2
(cse_insn): Invalidate CLOBBERed registers.
(count_reg_usage): Count registers in USE rtls on CALL_INSNs. From-SVN: r7237
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cse.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/gcc/cse.c b/gcc/cse.c
index 9c64402..8845403 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -5903,6 +5903,13 @@ cse_insn (insn, in_libcall_block)
Also determine whether there is a CLOBBER that invalidates
all memory references, or all references at varying addresses. */
+ if (GET_CODE (insn) == CALL_INSN)
+ {
+ for (tem = CALL_INSN_FUNCTION_USAGE (insn); tem; tem = XEXP (tem, 1))
+ if (GET_CODE (XEXP (tem, 0)) == CLOBBER)
+ invalidate (SET_DEST (XEXP (tem, 0)));
+ }
+
if (GET_CODE (x) == SET)
{
sets = (struct set *) alloca (sizeof (struct set));
@@ -8315,11 +8322,14 @@ count_reg_usage (x, counts, dest, incr)
rtx dest;
int incr;
{
- enum rtx_code code = GET_CODE (x);
+ enum rtx_code code;
char *fmt;
int i, j;
- switch (code)
+ if (x == 0)
+ return;
+
+ switch (code = GET_CODE (x))
{
case REG:
if (x != dest)
@@ -8352,24 +8362,26 @@ count_reg_usage (x, counts, dest, incr)
incr);
return;
+ case CALL_INSN:
+ count_reg_usage (CALL_INSN_FUNCTION_USAGE (x), counts, NULL_RTX, incr);
+
+ /* ... falls through ... */
case INSN:
case JUMP_INSN:
- case CALL_INSN:
count_reg_usage (PATTERN (x), counts, NULL_RTX, incr);
/* Things used in a REG_EQUAL note aren't dead since loop may try to
use them. */
- if (REG_NOTES (x))
- count_reg_usage (REG_NOTES (x), counts, NULL_RTX, incr);
+ count_reg_usage (REG_NOTES (x), counts, NULL_RTX, incr);
return;
case EXPR_LIST:
case INSN_LIST:
- if (REG_NOTE_KIND (x) == REG_EQUAL)
+ if (REG_NOTE_KIND (x) == REG_EQUAL
+ || GET_CODE (XEXP (x,0)) == USE)
count_reg_usage (XEXP (x, 0), counts, NULL_RTX, incr);
- if (XEXP (x, 1))
- count_reg_usage (XEXP (x, 1), counts, NULL_RTX, incr);
+ count_reg_usage (XEXP (x, 1), counts, NULL_RTX, incr);
return;
}