summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2001-04-30 15:09:51 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2001-04-30 15:09:51 +0000
commitb8792625e1e858ec782655ab3c42d6fad1e82bb5 (patch)
tree68c63569a6f9b3ecbd97a32561f3d1cb8f8b7e19 /gcc
parentec3f26aa1e1fd9078b9e41870c6c2e04a1ec1adf (diff)
downloadgcc-b8792625e1e858ec782655ab3c42d6fad1e82bb5.tar.gz
* regmove.c (record_stack_memrefs): Catch all references to the
stack pointer. * optimize.c (update_cloned_parm): New function. (maybe_clone_body): Use it. Update the `this' parameter too. * gcc.dg/20000724-1.c: Add a clobber of `esp'. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@41687 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/optimize.c33
-rw-r--r--gcc/extend.texi4
-rw-r--r--gcc/regmove.c15
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/20000724-1.c2
7 files changed, 53 insertions, 15 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6293ff54c1b..78c48762d13 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2001-04-30 Mark Mitchell <mark@codesourcery.com>
+
+ * regmove.c (record_stack_memrefs): Catch all references to the
+ stack pointer.
+
2001-04-29 Toomas Rosin <toomas at ns dot tklabor dot ee>
* Makefile.in(stmp-fixinc): quote shell assignment values
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a2e13ec0820..b3e4d39e8dc 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2001-04-30 Mark Mitchell <mark@codesourcery.com>
+
+ * optimize.c (update_cloned_parm): New function.
+ (maybe_clone_body): Use it. Update the `this' parameter too.
+
2001-04-29 Joseph S. Myers <jsm28@cam.ac.uk>
* decl2.c (unsupported_options): Add new-abi.
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c
index ae5a1ff3c40..5b0298779b7 100644
--- a/gcc/cp/optimize.c
+++ b/gcc/cp/optimize.c
@@ -99,6 +99,7 @@ static tree remap_decl PARAMS ((tree, inline_data *));
static void remap_block PARAMS ((tree, tree, inline_data *));
static void copy_scope_stmt PARAMS ((tree *, int *, inline_data *));
static tree calls_setjmp_r PARAMS ((tree *, int *, void *));
+static void update_cloned_parm PARAMS ((tree, tree));
/* The approximate number of instructions per statement. This number
need not be particularly accurate; it is used only to make
@@ -1009,6 +1010,25 @@ calls_setjmp_p (fn)
NULL) != NULL_TREE;
}
+/* CLONED_PARM is a copy of CLONE, generated for a cloned constructor
+ or destructor. Update it to ensure that the source-position for
+ the cloned parameter matches that for the original, and that the
+ debugging generation code will be able to find the original PARM. */
+
+static void
+update_cloned_parm (parm, cloned_parm)
+ tree parm;
+ tree cloned_parm;
+{
+ DECL_ABSTRACT_ORIGIN (cloned_parm) = parm;
+
+ /* The name may have changed from the declaration. */
+ DECL_NAME (cloned_parm) = DECL_NAME (parm);
+ DECL_SOURCE_FILE (cloned_parm) = DECL_SOURCE_FILE (parm);
+ DECL_SOURCE_LINE (cloned_parm) = DECL_SOURCE_LINE (parm);
+
+}
+
/* FN is a function that has a complete body. Clone the body as
necessary. Returns non-zero if there's no longer any need to
process the main body. */
@@ -1057,6 +1077,10 @@ maybe_clone_body (fn)
/* Adjust the parameter names and locations. */
parm = DECL_ARGUMENTS (fn);
clone_parm = DECL_ARGUMENTS (clone);
+ /* Update the `this' parameter, which is always first.
+ Sometimes, we end update the `this' parameter twice because
+ we process it again in the loop below. That is harmless. */
+ update_cloned_parm (parm, clone_parm);
if (DECL_HAS_IN_CHARGE_PARM_P (fn))
parm = TREE_CHAIN (parm);
if (DECL_HAS_VTT_PARM_P (fn))
@@ -1066,13 +1090,8 @@ maybe_clone_body (fn)
for (; parm;
parm = TREE_CHAIN (parm), clone_parm = TREE_CHAIN (clone_parm))
{
- DECL_ABSTRACT_ORIGIN (clone_parm) = parm;
-
- /* The name may have changed from the declaration. */
- DECL_NAME (clone_parm) = DECL_NAME (parm);
- DECL_SOURCE_FILE (clone_parm) = DECL_SOURCE_FILE (parm);
- DECL_SOURCE_LINE (clone_parm) = DECL_SOURCE_LINE (parm);
-
+ /* Update this paramter. */
+ update_cloned_parm (parm, clone_parm);
/* We should only give unused information for one clone. */
if (!first)
TREE_USED (clone_parm) = 1;
diff --git a/gcc/extend.texi b/gcc/extend.texi
index 7bcba9d6375..89c60185d8b 100644
--- a/gcc/extend.texi
+++ b/gcc/extend.texi
@@ -1,4 +1,4 @@
-@c Copyright (C) 1988,89,92,93,94,96,98,99,2000,01 Free Software Foundation, Inc.
+@c Copyright (C) 1988,1989,1992,1993,1994,1996,1998,1999,2000,2001 Free Software Foundation, Inc.
@c This is part of the GCC manual.
@c For copying conditions, see the file gcc.texi.
@@ -3059,7 +3059,7 @@ memory, you should write the @code{volatile} keyword to prevent future
versions of GNU CC from moving the instruction around within a core
region.
-An @code{asm} instruction without any operands or clobbers (and ``old
+An @code{asm} instruction without any operands or clobbers (an ``old
style'' @code{asm}) will not be deleted or moved significantly,
regardless, unless it is unreachable, the same way as if you had
written a @code{volatile} keyword.
diff --git a/gcc/regmove.c b/gcc/regmove.c
index 2e0fa9ed5fe..bb227006ebd 100644
--- a/gcc/regmove.c
+++ b/gcc/regmove.c
@@ -2303,11 +2303,16 @@ record_stack_memrefs (xp, data)
}
return 1;
case REG:
- /* ??? We want be able to handle non-memory stack pointer references
- later. For now just discard all insns refering to stack pointer
- outside mem expressions. We would probably want to teach
- validate_replace to simplify expressions first. */
- if (x == stack_pointer_rtx)
+ /* ??? We want be able to handle non-memory stack pointer
+ references later. For now just discard all insns refering to
+ stack pointer outside mem expressions. We would probably
+ want to teach validate_replace to simplify expressions first.
+
+ We can't just compare with STACK_POINTER_RTX because the
+ reference to the stack pointer might be in some other mode.
+ In particular, an explict clobber in an asm statement will
+ result in a QImode clober. */
+ if (REGNO (x) == STACK_POINTER_REGNUM)
return 1;
break;
default:
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index bc5066725d9..45fe556efe2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2001-04-30 Mark Mitchell <mark@codesourcery.com>
+
+ * gcc.dg/20000724-1.c: Add a clobber of `esp'.
+
2001-04-29 Joseph S. Myers <jsm28@cam.ac.uk>
* g++.old-deja/g++.other/crash14.C: Remove -fnew-abi.
diff --git a/gcc/testsuite/gcc.dg/20000724-1.c b/gcc/testsuite/gcc.dg/20000724-1.c
index 5027d6e9746..fecf9e79590 100644
--- a/gcc/testsuite/gcc.dg/20000724-1.c
+++ b/gcc/testsuite/gcc.dg/20000724-1.c
@@ -51,7 +51,7 @@ NT "ret"
extern inline void do_asm(struct s * x)
{
- asm volatile("call ___checkme" : : "c" (x) : "memory");
+ asm volatile("call ___checkme" : : "c" (x) : "esp", "memory");
}
int foo(void)