summaryrefslogtreecommitdiff
path: root/gcc/rtlanal.c
diff options
context:
space:
mode:
authordalej <dalej@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-16 20:42:37 +0000
committerdalej <dalej@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-16 20:42:37 +0000
commita6971e982119af18c653122215d5b86bd329bd88 (patch)
tree99aa1333d8e8d2fd4c95bfdca522410c2fd65374 /gcc/rtlanal.c
parentd5c3b1aff6f79663b7f12efd0d6a86fbd4c6b731 (diff)
downloadgcc-a6971e982119af18c653122215d5b86bd329bd88.tar.gz
2005-03-16 Dale Johannesen <dalej@apple.com>
* rtlanal.c (find_first_parameter_load): Rewrite to return actual first param load or the call if none, instead of first in block, when not all loads exist. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@96578 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/rtlanal.c')
-rw-r--r--gcc/rtlanal.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 79121d48b78..0686af8c65b 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -3159,12 +3159,15 @@ parms_set (rtx x, rtx pat ATTRIBUTE_UNUSED, void *data)
}
/* Look backward for first parameter to be loaded.
+ Note that loads of all parameters will not necessarily be
+ found if CSE has eliminated some of them (e.g., an argument
+ to the outer function is passed down as a parameter).
Do not skip BOUNDARY. */
rtx
find_first_parameter_load (rtx call_insn, rtx boundary)
{
struct parms_set_data parm;
- rtx p, before;
+ rtx p, before, first_set;
/* Since different machines initialize their parameter registers
in different orders, assume nothing. Collect the set of all
@@ -3186,6 +3189,7 @@ find_first_parameter_load (rtx call_insn, rtx boundary)
parm.nregs++;
}
before = call_insn;
+ first_set = call_insn;
/* Search backward for the first set of a register in this set. */
while (parm.nregs && before != boundary)
@@ -3208,9 +3212,20 @@ find_first_parameter_load (rtx call_insn, rtx boundary)
}
if (INSN_P (before))
- note_stores (PATTERN (before), parms_set, &parm);
+ {
+ int nregs_old = parm.nregs;
+ note_stores (PATTERN (before), parms_set, &parm);
+ /* If we found something that did not set a parameter reg,
+ we're done. Do not keep going, as that might result
+ in hoisting an insn before the setting of a pseudo
+ that is used by the hoisted insn. */
+ if (nregs_old != parm.nregs)
+ first_set = before;
+ else
+ break;
+ }
}
- return before;
+ return first_set;
}
/* Return true if we should avoid inserting code between INSN and preceding