summaryrefslogtreecommitdiff
path: root/gcc/sibcall.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2000-07-07 19:55:29 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2000-07-07 19:55:29 +0000
commit6e9acf75c0033b72c7b3ac1095302c28fb1835e1 (patch)
treefdedd15c9880042d1b946a1ccf10f032757ff7b1 /gcc/sibcall.c
parentd34352df7a1c0b284e22b8927e15f3bddd0fd64c (diff)
downloadgcc-6e9acf75c0033b72c7b3ac1095302c28fb1835e1.tar.gz
* sibcall.c (uses_addressof): Add INMEM argument, check for
current_function_internal_arg_pointer outside of MEM rtxs in addition to ADDRESSOFs. (sequence_uses_addressof): Update caller. * gcc.c-torture/execute/20000706-1.c: New test. * gcc.c-torture/execute/20000706-2.c: New test. * gcc.c-torture/execute/20000706-3.c: New test. * gcc.c-torture/execute/20000706-4.c: New test. * gcc.c-torture/execute/20000706-5.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34906 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/sibcall.c')
-rw-r--r--gcc/sibcall.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/gcc/sibcall.c b/gcc/sibcall.c
index 8387bf5d79b..120b6410db2 100644
--- a/gcc/sibcall.c
+++ b/gcc/sibcall.c
@@ -37,7 +37,7 @@ static rtx skip_copy_to_return_value PARAMS ((rtx, rtx, rtx));
static rtx skip_use_of_return_value PARAMS ((rtx, enum rtx_code));
static rtx skip_stack_adjustment PARAMS ((rtx));
static rtx skip_jump_insn PARAMS ((rtx));
-static int uses_addressof PARAMS ((rtx));
+static int uses_addressof PARAMS ((rtx, int));
static int sequence_uses_addressof PARAMS ((rtx));
static void purge_reg_equiv_notes PARAMS ((void));
@@ -235,12 +235,18 @@ skip_jump_insn (orig_insn)
return orig_insn;
}
-/* Scan the rtx X for an ADDRESSOF expressions. Return nonzero if an ADDRESSOF
- expresion is found, else return zero. */
+/* Scan the rtx X for ADDRESSOF expressions or
+ current_function_internal_arg_pointer registers.
+ INMEM argument should be 1 if we're looking at inner part of some
+ MEM expression, otherwise 0.
+ Return nonzero if an ADDRESSOF expresion is found or if
+ current_function_internal_arg_pointer is found outside of some MEM
+ expression, else return zero. */
static int
-uses_addressof (x)
+uses_addressof (x, inmem)
rtx x;
+ int inmem;
{
RTX_CODE code;
int i, j;
@@ -254,19 +260,25 @@ uses_addressof (x)
if (code == ADDRESSOF)
return 1;
+ if (x == current_function_internal_arg_pointer && ! inmem)
+ return 1;
+
+ if (code == MEM)
+ return uses_addressof (XEXP (x, 0), 1);
+
/* Scan all subexpressions. */
fmt = GET_RTX_FORMAT (code);
for (i = 0; i < GET_RTX_LENGTH (code); i++, fmt++)
{
if (*fmt == 'e')
{
- if (uses_addressof (XEXP (x, i)))
+ if (uses_addressof (XEXP (x, i), inmem))
return 1;
}
else if (*fmt == 'E')
{
for (j = 0; j < XVECLEN (x, i); j++)
- if (uses_addressof (XVECEXP (x, i, j)))
+ if (uses_addressof (XVECEXP (x, i, j), inmem))
return 1;
}
}
@@ -274,8 +286,10 @@ uses_addressof (x)
}
/* Scan the sequence of insns in SEQ to see if any have an ADDRESSOF
- rtl expression. If an ADDRESSOF expression is found, return nonzero,
- else return zero.
+ rtl expression or current_function_internal_arg_pointer occurences
+ not enclosed within a MEM. If an ADDRESSOF expression or
+ current_function_internal_arg_pointer is found, return nonzero, otherwise
+ return zero.
This function handles CALL_PLACEHOLDERs which contain multiple sequences
of insns. */
@@ -304,8 +318,8 @@ sequence_uses_addressof (seq)
&& sequence_uses_addressof (XEXP (PATTERN (insn), 2)))
return 1;
}
- else if (uses_addressof (PATTERN (insn))
- || (REG_NOTES (insn) && uses_addressof (REG_NOTES (insn))))
+ else if (uses_addressof (PATTERN (insn), 0)
+ || (REG_NOTES (insn) && uses_addressof (REG_NOTES (insn), 0)))
return 1;
}
return 0;