aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2001-04-30 15:09:51 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2001-04-30 15:09:51 +0000
commitd60e54483d5049e875f94c703f47738605633e51 (patch)
tree68c63569a6f9b3ecbd97a32561f3d1cb8f8b7e19 /gcc/cp
parentfea633fdfb15a45c811db7fcbfc8aa7b43713f40 (diff)
downloadgcc-d60e54483d5049e875f94c703f47738605633e51.zip
gcc-d60e54483d5049e875f94c703f47738605633e51.tar.gz
gcc-d60e54483d5049e875f94c703f47738605633e51.tar.bz2
regmove.c (record_stack_memrefs): Catch all references to the stack pointer.
* 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'. From-SVN: r41687
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/optimize.c33
2 files changed, 31 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a2e13ec..b3e4d39 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 ae5a1ff..5b02987 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;