diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-02-18 13:52:46 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-02-18 13:52:46 +0000 |
commit | e7ffa1e68699c0bf8a68b11e0f6e44526e46eb4f (patch) | |
tree | 40162bebea953063b468308fa9475a3a6732b079 /gcc | |
parent | 27546795d9934e40dbc7888739786485ba03f287 (diff) | |
download | gcc-e7ffa1e68699c0bf8a68b11e0f6e44526e46eb4f.tar.gz |
* calls.c (mem_overlaps_already_clobbered_arg_p): Return true
for arg pointer based indexed addressing.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122095 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/calls.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/tail_call.adb | 9 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/tail_call_p.adb | 35 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/tail_call_p.ads | 13 |
6 files changed, 72 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c20044cc3fc..99b01abb392 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2007-02-18 Eric Botcazou <ebotcazou@adacore.com> + + * calls.c (mem_overlaps_already_clobbered_arg_p): Return true + for arg pointer based indexed addressing. + 2007-02-18 Kazu Hirata <kazu@codesourcery.com> * config/ia64/ia64.h, config/ia64/ia64.md, diff --git a/gcc/calls.c b/gcc/calls.c index d84eb51aa36..e65a2cc79c9 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -1481,10 +1481,14 @@ mem_overlaps_already_clobbered_arg_p (rtx addr, unsigned HOST_WIDE_INT size) if (addr == current_function_internal_arg_pointer) i = 0; else if (GET_CODE (addr) == PLUS - && (XEXP (addr, 0) - == current_function_internal_arg_pointer) + && XEXP (addr, 0) == current_function_internal_arg_pointer && GET_CODE (XEXP (addr, 1)) == CONST_INT) i = INTVAL (XEXP (addr, 1)); + /* Return true for arg pointer based indexed addressing. */ + else if (GET_CODE (addr) == PLUS + && (XEXP (addr, 0) == current_function_internal_arg_pointer + || XEXP (addr, 1) == current_function_internal_arg_pointer)) + return true; else return false; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 05fdf91ce7d..13745a05af1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2007-02-18 Eric Botcazou <ebotcazou@adacore.com> + * gnat.dg/tail_call_p.ads, tail_call_p.adb, tail_call.adb: New test. + +2007-02-18 Eric Botcazou <ebotcazou@adacore.com> + * gnat.dg/test_prio_p.adb: Compile with -gnatws. * lib/gnat.exp (gnat_target_compile): Pass -f to the driver. diff --git a/gcc/testsuite/gnat.dg/tail_call.adb b/gcc/testsuite/gnat.dg/tail_call.adb new file mode 100644 index 00000000000..4f109adffc5 --- /dev/null +++ b/gcc/testsuite/gnat.dg/tail_call.adb @@ -0,0 +1,9 @@ +-- { dg-do run } +-- { dg-options "-O2 -fno-unit-at-a-time" } + +with Tail_Call_P; use Tail_Call_P; + +procedure Tail_Call is +begin + Insert (My_Array, 0, 0); +end; diff --git a/gcc/testsuite/gnat.dg/tail_call_p.adb b/gcc/testsuite/gnat.dg/tail_call_p.adb new file mode 100644 index 00000000000..56add5f6b75 --- /dev/null +++ b/gcc/testsuite/gnat.dg/tail_call_p.adb @@ -0,0 +1,35 @@ +package body Tail_Call_P is + + function Start_Side (Element : T) return Index is + begin + if Element = 1 then + raise Program_Error; + end if; + if Element = 0 then + return Second; + else + return First; + end if; + end; + + function Segment (Element : T) return T is + begin + if Element /= 0 then + raise Program_Error; + end if; + return 1; + end; + + procedure Really_Insert (Into : T; Element : T; Value : T) is + begin + if Into /= 0 then + raise Program_Error; + end if; + end; + + procedure Insert (Into : A; Element : T; Value : T) is + begin + Really_Insert (Into (Start_Side (Element)), Segment (Element), Value); + end Insert; + +end Tail_Call_P; diff --git a/gcc/testsuite/gnat.dg/tail_call_p.ads b/gcc/testsuite/gnat.dg/tail_call_p.ads new file mode 100644 index 00000000000..1665bc30c55 --- /dev/null +++ b/gcc/testsuite/gnat.dg/tail_call_p.ads @@ -0,0 +1,13 @@ +package Tail_Call_P is + + type T is new Natural; + + type Index is (First, Second); + + type A is array (Index) of T; + + My_Array : A := (0, 0); + + procedure Insert (Into : A; Element : T; Value : T); + +end Tail_Call_P; |