summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog13
-rw-r--r--gcc/c-decl.c4
-rw-r--r--gcc/dwarf2out.c26
-rw-r--r--gcc/dwarfout.c23
-rw-r--r--gcc/integrate.c40
-rw-r--r--gcc/tree.h5
6 files changed, 61 insertions, 50 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 917de8d149d..d49c23253af 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,15 @@
+Thu Sep 10 10:46:01 1998 Mark Mitchell <mark@markmitchell.com>
+
+ * tree.h (DECL_ORIGIN): New macro.
+ * integrate.c (copy_and_set_decl_abstract_origin): New function.
+ (copy_decl_list): Use it.
+ (integrate_parm_decls): Likewise.
+ (integrate_decl_tree): Likewise.
+ * dwarf2out.c (decl_ultimate_origin): Simplify.
+ * dwarfout.c (decl_ultimate_origin): Likewise.
+ * c-decl.c (duplicate_decls): Use DECL_ORIGIN.
+ (pushdecl): Likewise.
+
Thu Sep 10 08:01:31 1998 Anthony Green <green@cygnus.com>
* config/rs6000/rs6000.c (output_epilog): Add Java support.
@@ -388,7 +400,6 @@ Thu Sep 3 18:05:16 1998 David Edelsohn <edelsohn@mhpcc.edu>
(movdf): Remove TARGET_POWERPC64 explicit secondary-reload-like
functionality.
->>>>>>> 1.2012
Thu Sep 3 11:41:40 1998 Robert Lipe <robertl@dgii.com>
* fixinc.sco: Borrow code to wrap 'bool' typedefs from tinfo.h
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 9f880c3be5e..168400bd7f5 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -2020,7 +2020,7 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
DECL_SAVED_INSNS (newdecl) = DECL_SAVED_INSNS (olddecl);
DECL_ARGUMENTS (newdecl) = DECL_ARGUMENTS (olddecl);
if (DECL_INLINE (newdecl))
- DECL_ABSTRACT_ORIGIN (newdecl) = olddecl;
+ DECL_ABSTRACT_ORIGIN (newdecl) = DECL_ORIGIN (olddecl);
}
}
if (different_binding_level)
@@ -2384,7 +2384,7 @@ pushdecl (x)
DECL_ARGUMENTS (x) = DECL_ARGUMENTS (oldglobal);
DECL_RESULT (x) = DECL_RESULT (oldglobal);
TREE_ASM_WRITTEN (x) = TREE_ASM_WRITTEN (oldglobal);
- DECL_ABSTRACT_ORIGIN (x) = oldglobal;
+ DECL_ABSTRACT_ORIGIN (x) = DECL_ORIGIN (oldglobal);
}
/* Inner extern decl is built-in if global one is. */
if (DECL_BUILT_IN (oldglobal))
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index e3acb98d530..d768320b2de 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -3539,24 +3539,14 @@ static tree
decl_ultimate_origin (decl)
register tree decl;
{
- register tree immediate_origin = DECL_ABSTRACT_ORIGIN (decl);
-
- if (immediate_origin == NULL_TREE)
- return NULL_TREE;
- else
- {
- register tree ret_val;
- register tree lookahead = immediate_origin;
-
- do
- {
- ret_val = lookahead;
- lookahead = DECL_ABSTRACT_ORIGIN (ret_val);
- }
- while (lookahead != NULL && lookahead != ret_val);
+#ifdef ENABLE_CHECKING
+ if (DECL_FROM_INLINE (DECL_ORIGIN (decl)))
+ /* Since the DECL_ABSTRACT_ORIGIN for a DECL is supposed to be the
+ most distant ancestor, this should never happen. */
+ abort ();
+#endif
- return ret_val;
- }
+ return DECL_ABSTRACT_ORIGIN (decl);
}
/* Determine the "ultimate origin" of a block. The block may be an inlined
@@ -9432,7 +9422,7 @@ dwarf2out_decl (decl)
if (DECL_IGNORED_P (decl))
{
if (TREE_CODE (decl) == FUNCTION_DECL
- && DECL_INITIAL (decl) != NULL)
+ && DECL_INITIAL (decl) != NULL)
abort ();
return;
diff --git a/gcc/dwarfout.c b/gcc/dwarfout.c
index 450e063c120..660865b11d6 100644
--- a/gcc/dwarfout.c
+++ b/gcc/dwarfout.c
@@ -1150,23 +1150,14 @@ static tree
decl_ultimate_origin (decl)
register tree decl;
{
- register tree immediate_origin = DECL_ABSTRACT_ORIGIN (decl);
-
- if (immediate_origin == NULL)
- return NULL;
- else
- {
- register tree ret_val;
- register tree lookahead = immediate_origin;
+#ifdef ENABLE_CHECKING
+ if (DECL_FROM_INLINE (DECL_ORIGIN (decl)))
+ /* Since the DECL_ABSTRACT_ORIGIN for a DECL is supposed to be the
+ most distant ancestor, this should never happen. */
+ abort ();
+#endif
- do
- {
- ret_val = lookahead;
- lookahead = DECL_ABSTRACT_ORIGIN (ret_val);
- }
- while (lookahead != NULL && lookahead != ret_val);
- return ret_val;
- }
+ return DECL_ABSTRACT_ORIGIN (decl);
}
/* Determine the "ultimate origin" of a block. The block may be an
diff --git a/gcc/integrate.c b/gcc/integrate.c
index 38a900a9768..a84eb19435f 100644
--- a/gcc/integrate.c
+++ b/gcc/integrate.c
@@ -78,6 +78,7 @@ static void set_decl_origin_self PROTO((tree));
static void set_block_abstract_flags PROTO((tree, int));
void set_decl_abstract_flags PROTO((tree, int));
+static tree copy_and_set_decl_abstract_origin PROTO((tree));
/* Returns the Ith entry in the label_map contained in MAP. If the
Ith entry has not yet been set, return a fresh label. This function
@@ -752,11 +753,30 @@ save_for_inline_copying (fndecl)
free (label_map);
}
+/* Copy NODE (as with copy_node). NODE must be a DECL. Set the
+ DECL_ABSTRACT_ORIGIN for the new accordinly. */
+
+static tree
+copy_and_set_decl_abstract_origin (node)
+ tree node;
+{
+ tree copy = copy_node (node);
+ if (DECL_ABSTRACT_ORIGIN (copy) != NULL_TREE)
+ /* That means that NODE already had a DECL_ABSTRACT_ORIGIN. (This
+ situation occurs if we inline a function which itself made
+ calls to inline functions.) Since DECL_ABSTRACT_ORIGIN is the
+ most distant ancestor, we don't have to do anything here. */
+ ;
+ else
+ /* The most distant ancestor must be NODE. */
+ DECL_ABSTRACT_ORIGIN (copy) = node;
+
+ return copy;
+}
+
/* Return a copy of a chain of nodes, chained through the TREE_CHAIN field.
For example, this can copy a list made of TREE_LIST nodes. While copying,
- for each node copied which doesn't already have is DECL_ABSTRACT_ORIGIN
- set to some non-zero value, set the DECL_ABSTRACT_ORIGIN of the copy to
- point to the corresponding (abstract) original node. */
+ set DECL_ABSTRACT_ORIGIN appropriately. */
static tree
copy_decl_list (list)
@@ -768,17 +788,13 @@ copy_decl_list (list)
if (list == 0)
return 0;
- head = prev = copy_node (list);
- if (DECL_ABSTRACT_ORIGIN (head) == NULL_TREE)
- DECL_ABSTRACT_ORIGIN (head) = list;
+ head = prev = copy_and_set_decl_abstract_origin (head);
next = TREE_CHAIN (list);
while (next)
{
register tree copy;
- copy = copy_node (next);
- if (DECL_ABSTRACT_ORIGIN (copy) == NULL_TREE)
- DECL_ABSTRACT_ORIGIN (copy) = next;
+ copy = copy_and_set_decl_abstract_origin (next);
TREE_CHAIN (prev) = copy;
prev = copy;
next = TREE_CHAIN (next);
@@ -2192,7 +2208,7 @@ integrate_parm_decls (args, map, arg_vector)
/* These args would always appear unused, if not for this. */
TREE_USED (decl) = 1;
/* Prevent warning for shadowing with these. */
- DECL_ABSTRACT_ORIGIN (decl) = tail;
+ DECL_ABSTRACT_ORIGIN (decl) = DECL_ORIGIN (tail);
pushdecl (decl);
/* Fully instantiate the address with the equivalent form so that the
debugging information contains the actual register, instead of the
@@ -2231,7 +2247,7 @@ integrate_decl_tree (let, level, map)
push_obstacks_nochange ();
saveable_allocation ();
- d = copy_node (t);
+ d = copy_and_set_decl_abstract_origin (t);
pop_obstacks ();
if (DECL_RTL (t) != 0)
@@ -2246,8 +2262,6 @@ integrate_decl_tree (let, level, map)
}
/* These args would always appear unused, if not for this. */
TREE_USED (d) = 1;
- /* Prevent warning for shadowing with these. */
- DECL_ABSTRACT_ORIGIN (d) = t;
if (DECL_LANG_SPECIFIC (d))
copy_lang_decl (d);
diff --git a/gcc/tree.h b/gcc/tree.h
index 08bda4881ee..aee712fc97f 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1101,6 +1101,11 @@ struct tree_type
definition. */
#define DECL_ABSTRACT_ORIGIN(NODE) (DECL_CHECK (NODE)->decl.abstract_origin)
+/* Like DECL_ABSTRACT_ORIGIN, but returns NODE if there's no abstract
+ origin. This is useful when setting the DECL_ABSTRACT_ORIGIN. */
+#define DECL_ORIGIN(NODE) \
+ (DECL_ABSTRACT_ORIGIN (NODE) ? DECL_ABSTRACT_ORIGIN (NODE) : NODE)
+
/* Nonzero for any sort of ..._DECL node means this decl node represents
an inline instance of some original (abstract) decl from an inline function;
suppress any warnings about shadowing some other variable. */