c-decl.c (c_expand_body_1): Remove and fold back into ...
ChangeLog: * c-decl.c (c_expand_body_1): Remove and fold back into ... (c_expand_body): here. (c_expand_decl): Move to ... * c-common.c (c_expand_decl): Here and remove check for nested functions. * c-common.h (c_expand_decl): Add prototype. * c-tree.h (c_expand_decl): Remove. cp/ChangeLog: * cp-lang.c (cp_expand_decl): Remove. (LANG_HOOKS_EXPAND_DECL): Use c_expand_decl. From-SVN: r82469
This commit is contained in:
parent
1b0f3e79b1
commit
3c79fa86db
@ -1,3 +1,13 @@
|
||||
2004-05-30 Andrew Pinski <pinskia@physics.uc.edu>
|
||||
|
||||
* c-decl.c (c_expand_body_1): Remove and fold back into ...
|
||||
(c_expand_body): here.
|
||||
(c_expand_decl): Move to ...
|
||||
* c-common.c (c_expand_decl): Here and remove check for nested
|
||||
functions.
|
||||
* c-common.h (c_expand_decl): Add prototype.
|
||||
* c-tree.h (c_expand_decl): Remove.
|
||||
|
||||
2004-05-30 Roger Sayle <roger@eyesopen.com>
|
||||
|
||||
* fold-const.c (combine_comparisons, optimize_bit_field_compare,
|
||||
|
@ -1123,6 +1123,30 @@ fname_as_string (int pretty_p)
|
||||
return namep;
|
||||
}
|
||||
|
||||
/* Expand DECL if it declares an entity not handled by the
|
||||
common code. */
|
||||
|
||||
int
|
||||
c_expand_decl (tree decl)
|
||||
{
|
||||
if (TREE_CODE (decl) == VAR_DECL && !TREE_STATIC (decl))
|
||||
{
|
||||
/* Let the back-end know about this variable. */
|
||||
if (!anon_aggr_type_p (TREE_TYPE (decl)))
|
||||
emit_local_var (decl);
|
||||
else
|
||||
expand_anon_union_decl (decl, NULL_TREE,
|
||||
DECL_ANON_UNION_ELEMS (decl));
|
||||
}
|
||||
else if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl))
|
||||
make_rtl_for_local_static (decl);
|
||||
else
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Return the VAR_DECL for a const char array naming the current
|
||||
function. If the VAR_DECL has not yet been created, create it
|
||||
now. RID indicates how it should be formatted and IDENTIFIER_NODE
|
||||
|
@ -332,6 +332,7 @@ extern void prep_stmt (tree);
|
||||
extern tree c_begin_if_stmt (void);
|
||||
extern tree c_begin_while_stmt (void);
|
||||
extern void c_finish_while_stmt_cond (tree, tree);
|
||||
extern int c_expand_decl (tree);
|
||||
|
||||
extern int field_decl_cmp (const void *, const void *);
|
||||
extern void resort_sorted_fields (void *, void *, gt_pointer_operator,
|
||||
|
79
gcc/c-decl.c
79
gcc/c-decl.c
@ -6361,47 +6361,26 @@ finish_function (void)
|
||||
current_function_decl = NULL;
|
||||
}
|
||||
|
||||
/* Generate the RTL for the body of FNDECL. If NESTED_P is nonzero,
|
||||
then we are already in the process of generating RTL for another
|
||||
function. */
|
||||
|
||||
static void
|
||||
c_expand_body_1 (tree fndecl, int nested_p)
|
||||
{
|
||||
if (nested_p)
|
||||
{
|
||||
/* Make sure that we will evaluate variable-sized types involved
|
||||
in our function's type. */
|
||||
expand_pending_sizes (DECL_LANG_SPECIFIC (fndecl)->pending_sizes);
|
||||
|
||||
/* Squirrel away our current state. */
|
||||
push_function_context ();
|
||||
}
|
||||
|
||||
tree_rest_of_compilation (fndecl, nested_p);
|
||||
|
||||
if (nested_p)
|
||||
/* Return to the enclosing function. */
|
||||
pop_function_context ();
|
||||
|
||||
if (DECL_STATIC_CONSTRUCTOR (fndecl)
|
||||
&& targetm.have_ctors_dtors)
|
||||
targetm.asm_out.constructor (XEXP (DECL_RTL (fndecl), 0),
|
||||
DEFAULT_INIT_PRIORITY);
|
||||
if (DECL_STATIC_DESTRUCTOR (fndecl)
|
||||
&& targetm.have_ctors_dtors)
|
||||
targetm.asm_out.destructor (XEXP (DECL_RTL (fndecl), 0),
|
||||
DEFAULT_INIT_PRIORITY);
|
||||
}
|
||||
|
||||
/* Like c_expand_body_1 but only for unnested functions. */
|
||||
/* Generate the RTL for the body of FNDECL. */
|
||||
|
||||
void
|
||||
c_expand_body (tree fndecl)
|
||||
{
|
||||
|
||||
if (DECL_INITIAL (fndecl) && DECL_INITIAL (fndecl) != error_mark_node)
|
||||
c_expand_body_1 (fndecl, 0);
|
||||
if (!DECL_INITIAL (fndecl)
|
||||
|| DECL_INITIAL (fndecl) == error_mark_node)
|
||||
return;
|
||||
|
||||
tree_rest_of_compilation (fndecl, false);
|
||||
|
||||
if (DECL_STATIC_CONSTRUCTOR (fndecl)
|
||||
&& targetm.have_ctors_dtors)
|
||||
targetm.asm_out.constructor (XEXP (DECL_RTL (fndecl), 0),
|
||||
DEFAULT_INIT_PRIORITY);
|
||||
if (DECL_STATIC_DESTRUCTOR (fndecl)
|
||||
&& targetm.have_ctors_dtors)
|
||||
targetm.asm_out.destructor (XEXP (DECL_RTL (fndecl), 0),
|
||||
DEFAULT_INIT_PRIORITY);
|
||||
}
|
||||
|
||||
/* Check the declarations given in a for-loop for satisfying the C99
|
||||
@ -6597,34 +6576,6 @@ c_begin_compound_stmt (void)
|
||||
return stmt;
|
||||
}
|
||||
|
||||
/* Expand DECL if it declares an entity not handled by the
|
||||
common code. */
|
||||
|
||||
int
|
||||
c_expand_decl (tree decl)
|
||||
{
|
||||
if (TREE_CODE (decl) == VAR_DECL && !TREE_STATIC (decl))
|
||||
{
|
||||
/* Let the back-end know about this variable. */
|
||||
if (!anon_aggr_type_p (TREE_TYPE (decl)))
|
||||
emit_local_var (decl);
|
||||
else
|
||||
expand_anon_union_decl (decl, NULL_TREE,
|
||||
DECL_ANON_UNION_ELEMS (decl));
|
||||
}
|
||||
else if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl))
|
||||
make_rtl_for_local_static (decl);
|
||||
/* Expand nested functions. */
|
||||
else if (TREE_CODE (decl) == FUNCTION_DECL
|
||||
&& DECL_CONTEXT (decl) == current_function_decl
|
||||
&& DECL_SAVED_TREE (decl))
|
||||
c_expand_body_1 (decl, 1);
|
||||
else
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Return the global value of T as a symbol. */
|
||||
|
||||
tree
|
||||
|
@ -192,7 +192,6 @@ extern tree start_struct (enum tree_code, tree);
|
||||
extern void store_parm_decls (void);
|
||||
extern tree xref_tag (enum tree_code, tree);
|
||||
extern tree c_begin_compound_stmt (void);
|
||||
extern int c_expand_decl (tree);
|
||||
extern void c_static_assembler_name (tree);
|
||||
extern tree make_pointer_declarator (tree, tree);
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2004-05-30 Andrew Pinski <pinskia@physics.uc.edu>
|
||||
|
||||
* cp-lang.c (cp_expand_decl): Remove.
|
||||
(LANG_HOOKS_EXPAND_DECL): Use c_expand_decl.
|
||||
|
||||
2004-05-30 Andreas Jaeger <aj@suse.de>
|
||||
|
||||
* lang-specs.h: Add missing initializers for .ii.
|
||||
|
@ -40,7 +40,6 @@ static tree cp_expr_size (tree);
|
||||
static size_t cp_tree_size (enum tree_code);
|
||||
static bool cp_var_mod_type_p (tree);
|
||||
static int cxx_types_compatible_p (tree, tree);
|
||||
static int cp_expand_decl (tree);
|
||||
static void cxx_initialize_diagnostics (diagnostic_context *);
|
||||
|
||||
#undef LANG_HOOKS_NAME
|
||||
@ -72,7 +71,7 @@ static void cxx_initialize_diagnostics (diagnostic_context *);
|
||||
#undef LANG_HOOKS_EXPAND_EXPR
|
||||
#define LANG_HOOKS_EXPAND_EXPR cxx_expand_expr
|
||||
#undef LANG_HOOKS_EXPAND_DECL
|
||||
#define LANG_HOOKS_EXPAND_DECL cp_expand_decl
|
||||
#define LANG_HOOKS_EXPAND_DECL c_expand_decl
|
||||
#undef LANG_HOOKS_SAFE_FROM_P
|
||||
#define LANG_HOOKS_SAFE_FROM_P c_safe_from_p
|
||||
#undef LANG_HOOKS_PARSE_FILE
|
||||
@ -293,29 +292,6 @@ cp_expr_size (tree exp)
|
||||
return lhd_expr_size (exp);
|
||||
}
|
||||
|
||||
/* Expand DECL if it declares an entity not handled by the
|
||||
common code. */
|
||||
|
||||
static int
|
||||
cp_expand_decl (tree decl)
|
||||
{
|
||||
if (TREE_CODE (decl) == VAR_DECL && !TREE_STATIC (decl))
|
||||
{
|
||||
/* Let the back-end know about this variable. */
|
||||
if (!anon_aggr_type_p (TREE_TYPE (decl)))
|
||||
emit_local_var (decl);
|
||||
else
|
||||
expand_anon_union_decl (decl, NULL_TREE,
|
||||
DECL_ANON_UNION_ELEMS (decl));
|
||||
}
|
||||
else if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl))
|
||||
make_rtl_for_local_static (decl);
|
||||
else
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
cp_tree_chain_matters_p (tree t)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user