Commit 02e24c7a by Mark Mitchell Committed by Mark Mitchell

tree.h (DECL_ORIGIN): New macro.

	* 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
parent 76f42086
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> Thu Sep 10 08:01:31 1998 Anthony Green <green@cygnus.com>
* config/rs6000/rs6000.c (output_epilog): Add Java support. * 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> ...@@ -388,7 +400,6 @@ Thu Sep 3 18:05:16 1998 David Edelsohn <edelsohn@mhpcc.edu>
(movdf): Remove TARGET_POWERPC64 explicit secondary-reload-like (movdf): Remove TARGET_POWERPC64 explicit secondary-reload-like
functionality. functionality.
>>>>>>> 1.2012
Thu Sep 3 11:41:40 1998 Robert Lipe <robertl@dgii.com> Thu Sep 3 11:41:40 1998 Robert Lipe <robertl@dgii.com>
* fixinc.sco: Borrow code to wrap 'bool' typedefs from tinfo.h * fixinc.sco: Borrow code to wrap 'bool' typedefs from tinfo.h
......
...@@ -2020,7 +2020,7 @@ duplicate_decls (newdecl, olddecl, different_binding_level) ...@@ -2020,7 +2020,7 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
DECL_SAVED_INSNS (newdecl) = DECL_SAVED_INSNS (olddecl); DECL_SAVED_INSNS (newdecl) = DECL_SAVED_INSNS (olddecl);
DECL_ARGUMENTS (newdecl) = DECL_ARGUMENTS (olddecl); DECL_ARGUMENTS (newdecl) = DECL_ARGUMENTS (olddecl);
if (DECL_INLINE (newdecl)) if (DECL_INLINE (newdecl))
DECL_ABSTRACT_ORIGIN (newdecl) = olddecl; DECL_ABSTRACT_ORIGIN (newdecl) = DECL_ORIGIN (olddecl);
} }
} }
if (different_binding_level) if (different_binding_level)
...@@ -2384,7 +2384,7 @@ pushdecl (x) ...@@ -2384,7 +2384,7 @@ pushdecl (x)
DECL_ARGUMENTS (x) = DECL_ARGUMENTS (oldglobal); DECL_ARGUMENTS (x) = DECL_ARGUMENTS (oldglobal);
DECL_RESULT (x) = DECL_RESULT (oldglobal); DECL_RESULT (x) = DECL_RESULT (oldglobal);
TREE_ASM_WRITTEN (x) = TREE_ASM_WRITTEN (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. */ /* Inner extern decl is built-in if global one is. */
if (DECL_BUILT_IN (oldglobal)) if (DECL_BUILT_IN (oldglobal))
......
...@@ -3539,24 +3539,14 @@ static tree ...@@ -3539,24 +3539,14 @@ static tree
decl_ultimate_origin (decl) decl_ultimate_origin (decl)
register tree decl; register tree decl;
{ {
register tree immediate_origin = DECL_ABSTRACT_ORIGIN (decl); #ifdef ENABLE_CHECKING
if (DECL_FROM_INLINE (DECL_ORIGIN (decl)))
if (immediate_origin == NULL_TREE) /* Since the DECL_ABSTRACT_ORIGIN for a DECL is supposed to be the
return NULL_TREE; most distant ancestor, this should never happen. */
else abort ();
{ #endif
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);
return ret_val; return DECL_ABSTRACT_ORIGIN (decl);
}
} }
/* Determine the "ultimate origin" of a block. The block may be an inlined /* Determine the "ultimate origin" of a block. The block may be an inlined
......
...@@ -1150,23 +1150,14 @@ static tree ...@@ -1150,23 +1150,14 @@ static tree
decl_ultimate_origin (decl) decl_ultimate_origin (decl)
register tree decl; register tree decl;
{ {
register tree immediate_origin = DECL_ABSTRACT_ORIGIN (decl); #ifdef ENABLE_CHECKING
if (DECL_FROM_INLINE (DECL_ORIGIN (decl)))
if (immediate_origin == NULL) /* Since the DECL_ABSTRACT_ORIGIN for a DECL is supposed to be the
return NULL; most distant ancestor, this should never happen. */
else abort ();
{ #endif
register tree ret_val;
register tree lookahead = immediate_origin;
do return DECL_ABSTRACT_ORIGIN (decl);
{
ret_val = lookahead;
lookahead = DECL_ABSTRACT_ORIGIN (ret_val);
}
while (lookahead != NULL && lookahead != ret_val);
return ret_val;
}
} }
/* Determine the "ultimate origin" of a block. The block may be an /* Determine the "ultimate origin" of a block. The block may be an
......
...@@ -78,6 +78,7 @@ static void set_decl_origin_self PROTO((tree)); ...@@ -78,6 +78,7 @@ static void set_decl_origin_self PROTO((tree));
static void set_block_abstract_flags PROTO((tree, int)); static void set_block_abstract_flags PROTO((tree, int));
void set_decl_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 /* 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 Ith entry has not yet been set, return a fresh label. This function
...@@ -752,11 +753,30 @@ save_for_inline_copying (fndecl) ...@@ -752,11 +753,30 @@ save_for_inline_copying (fndecl)
free (label_map); 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. /* 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 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 DECL_ABSTRACT_ORIGIN appropriately. */
set to some non-zero value, set the DECL_ABSTRACT_ORIGIN of the copy to
point to the corresponding (abstract) original node. */
static tree static tree
copy_decl_list (list) copy_decl_list (list)
...@@ -768,17 +788,13 @@ copy_decl_list (list) ...@@ -768,17 +788,13 @@ copy_decl_list (list)
if (list == 0) if (list == 0)
return 0; return 0;
head = prev = copy_node (list); head = prev = copy_and_set_decl_abstract_origin (head);
if (DECL_ABSTRACT_ORIGIN (head) == NULL_TREE)
DECL_ABSTRACT_ORIGIN (head) = list;
next = TREE_CHAIN (list); next = TREE_CHAIN (list);
while (next) while (next)
{ {
register tree copy; register tree copy;
copy = copy_node (next); copy = copy_and_set_decl_abstract_origin (next);
if (DECL_ABSTRACT_ORIGIN (copy) == NULL_TREE)
DECL_ABSTRACT_ORIGIN (copy) = next;
TREE_CHAIN (prev) = copy; TREE_CHAIN (prev) = copy;
prev = copy; prev = copy;
next = TREE_CHAIN (next); next = TREE_CHAIN (next);
...@@ -2192,7 +2208,7 @@ integrate_parm_decls (args, map, arg_vector) ...@@ -2192,7 +2208,7 @@ integrate_parm_decls (args, map, arg_vector)
/* These args would always appear unused, if not for this. */ /* These args would always appear unused, if not for this. */
TREE_USED (decl) = 1; TREE_USED (decl) = 1;
/* Prevent warning for shadowing with these. */ /* Prevent warning for shadowing with these. */
DECL_ABSTRACT_ORIGIN (decl) = tail; DECL_ABSTRACT_ORIGIN (decl) = DECL_ORIGIN (tail);
pushdecl (decl); pushdecl (decl);
/* Fully instantiate the address with the equivalent form so that the /* Fully instantiate the address with the equivalent form so that the
debugging information contains the actual register, instead of the debugging information contains the actual register, instead of the
...@@ -2231,7 +2247,7 @@ integrate_decl_tree (let, level, map) ...@@ -2231,7 +2247,7 @@ integrate_decl_tree (let, level, map)
push_obstacks_nochange (); push_obstacks_nochange ();
saveable_allocation (); saveable_allocation ();
d = copy_node (t); d = copy_and_set_decl_abstract_origin (t);
pop_obstacks (); pop_obstacks ();
if (DECL_RTL (t) != 0) if (DECL_RTL (t) != 0)
...@@ -2246,8 +2262,6 @@ integrate_decl_tree (let, level, map) ...@@ -2246,8 +2262,6 @@ integrate_decl_tree (let, level, map)
} }
/* These args would always appear unused, if not for this. */ /* These args would always appear unused, if not for this. */
TREE_USED (d) = 1; TREE_USED (d) = 1;
/* Prevent warning for shadowing with these. */
DECL_ABSTRACT_ORIGIN (d) = t;
if (DECL_LANG_SPECIFIC (d)) if (DECL_LANG_SPECIFIC (d))
copy_lang_decl (d); copy_lang_decl (d);
......
...@@ -1101,6 +1101,11 @@ struct tree_type ...@@ -1101,6 +1101,11 @@ struct tree_type
definition. */ definition. */
#define DECL_ABSTRACT_ORIGIN(NODE) (DECL_CHECK (NODE)->decl.abstract_origin) #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 /* Nonzero for any sort of ..._DECL node means this decl node represents
an inline instance of some original (abstract) decl from an inline function; an inline instance of some original (abstract) decl from an inline function;
suppress any warnings about shadowing some other variable. */ suppress any warnings about shadowing some other variable. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment