* 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.
From-SVN: r22380
+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.
(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
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)
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))
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
if (DECL_IGNORED_P (decl))
{
if (TREE_CODE (decl) == FUNCTION_DECL
- && DECL_INITIAL (decl) != NULL)
+ && DECL_INITIAL (decl) != NULL)
abort ();
return;
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
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));
\f
/* 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
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)
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);
/* 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
push_obstacks_nochange ();
saveable_allocation ();
- d = copy_node (t);
+ d = copy_and_set_decl_abstract_origin (t);
pop_obstacks ();
if (DECL_RTL (t) != 0)
}
/* 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);
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. */