summaryrefslogtreecommitdiff
path: root/gcc/caller-save.c
diff options
context:
space:
mode:
authorhp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>2007-12-10 01:01:03 +0000
committerhp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>2007-12-10 01:01:03 +0000
commit87bd12fcde3511c653cca04757de6ebe28bd67ac (patch)
tree4d46990c076f2782885e8a8a034988ab5096b244 /gcc/caller-save.c
parentc3d8729e5fd7bb66c398fd2512211e49f7ececbc (diff)
downloadgcc-87bd12fcde3511c653cca04757de6ebe28bd67ac.tar.gz
* caller-save.c (insert_one_insn): If inserting before a call_insn
then the registers containing the arguments of the call are live_throughout in the new insn. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130733 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/caller-save.c')
-rw-r--r--gcc/caller-save.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/caller-save.c b/gcc/caller-save.c
index 26ac50eadd1..7976fd5fd75 100644
--- a/gcc/caller-save.c
+++ b/gcc/caller-save.c
@@ -850,6 +850,38 @@ insert_one_insn (struct insn_chain *chain, int before_p, int code, rtx pat)
SET_REGNO_REG_SET (&new->live_throughout, regno + i);
}
}
+
+ /* If CHAIN->INSN is a call, then the registers which contain
+ the arguments to the function are live in the new insn. */
+ if (CALL_P (chain->insn))
+ {
+ for (link = CALL_INSN_FUNCTION_USAGE (chain->insn);
+ link != NULL_RTX;
+ link = XEXP (link, 1))
+ {
+ rtx arg = XEXP (link, 0);
+
+ if (GET_CODE (arg) == USE)
+ {
+ rtx reg = XEXP (arg, 0);
+
+ if (REG_P (reg))
+ {
+ int i, regno = REGNO (reg);
+
+ /* Registers in CALL_INSN_FUNCTION_USAGE are always
+ hard registers. */
+ gcc_assert (regno < FIRST_PSEUDO_REGISTER);
+
+ for (i = hard_regno_nregs[regno][GET_MODE (reg)] - 1;
+ i >= 0; i--)
+ SET_REGNO_REG_SET (&new->live_throughout, regno + i);
+ }
+ }
+ }
+
+ }
+
CLEAR_REG_SET (&new->dead_or_set);
if (chain->insn == BB_HEAD (BASIC_BLOCK (chain->block)))
BB_HEAD (BASIC_BLOCK (chain->block)) = new->insn;