aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-09-02 19:14:06 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-09-02 19:14:06 +0000
commit8012c98334adc980f8e7ad5ceac47fa19b664662 (patch)
tree9082c8abf66f4dc342e033e24906599efdd6475d /gcc/cp/decl.c
parente2bef702d6db5181253b7edd7f9ca9c88abedd00 (diff)
downloadgcc-8012c98334adc980f8e7ad5ceac47fa19b664662.zip
gcc-8012c98334adc980f8e7ad5ceac47fa19b664662.tar.gz
gcc-8012c98334adc980f8e7ad5ceac47fa19b664662.tar.bz2
cp-tree.h (cp_function): Move here, from decl.c.
* cp-tree.h (cp_function): Move here, from decl.c. (cp_function_chain): Declare. (dtor_label): New macro, instead of variable. (ctor_label): Likewise. (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. (current_class_ptr): Likewise. (current_class_ref): Likewise. (last_tree): Likewise. (last_expr_type): Likewise. (current_function_returns_value): Likewise. (current_function_returns_null): Likewise. (current_function_just_assigned_this): Likewise. (current_function_parms_stored): Likewise. (temp_name_counter): Likewise. (static_labelno): Likewise. (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (in_function_try_handler): Likewise. (lang_type): Remove nested type_flags. All uses changed. * call.c (ctor_label): Remove. (dtor_label): Likewise. * class.c (current_class_ptr): Remove. (current_class_ref): Likewise. * decl.c (static_labelno): Remove. (dtor_label): Likewise. (last_dtor_insn): New macro, instead of variable. (last_parm_cleanup_insn): Likewise. (original_result_rtx): Likewise. (in_function_try_handler): Remove. (named_label_uses): New macro, instead of variable. (named_labels): Likewise. (current_function_returns_value): Remove. (current_function_returns_null): Likewise. (current_function_assigns_this): New macro, instead of variable. (current_function_just_assigned_this): Likewise. (current_binding_level): Likewise. (init_decl_processing): Call push_cp_function_context. (cp_function): Move to cp-tree.h (cp_function_chain): Make it global. (temp_name_counter): Remove. (push_cp_function_context): Simplify. (pop_cp_function_context): Likewise. * decl2.c (temp_name_counter): Remove. * init_c (current_base_init_list): Likewise. (current_member_init_list): Likewise. (base_init_expr): Likewise. * method.c (static_labelno): Likewise. * pt.c (last_tree): Likewise. * semantics.c (expanding_p): Likewise. (stmts_are_full_exprs_p): Likewise. (last_expr_type): Likewise. * typeck.c (dtor_label): Likewise. (ctor_label): Likewise. From-SVN: r29062
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c154
1 files changed, 25 insertions, 129 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 024bd52..82b3124 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -55,8 +55,6 @@ extern int current_class_depth;
extern tree static_ctors, static_dtors;
-extern int static_labelno;
-
extern tree current_namespace;
extern tree global_namespace;
@@ -300,36 +298,24 @@ int in_std;
/* Expect only namespace names now. */
static int only_namespace_names;
-/* In a destructor, the point at which all derived class destroying
- has been done, just before any base class destroying will be done. */
-
-tree dtor_label;
-
/* In a destructor, the last insn emitted after the start of the
function and the parms. */
-static rtx last_dtor_insn;
+#define last_dtor_insn cp_function_chain->last_dtor_insn
/* In a constructor, the last insn emitted after the start of the
function and the parms, the exception specification and any
function-try-block. The constructor initializers are emitted after
this insn. */
-static rtx last_parm_cleanup_insn;
-
-/* In a constructor, the point at which we are ready to return
- the pointer to the initialized object. */
-
-tree ctor_label;
+#define last_parm_cleanup_insn cp_function_chain->last_parm_cleanup_insn
/* If original DECL_RESULT of current function was a register,
but due to being an addressable named return value, would up
on the stack, this variable holds the named return value's
original location. */
-static rtx original_result_rtx;
-/* Sequence of insns which represents base initialization. */
-tree base_init_expr;
+#define original_result_rtx cp_function_chain->result_rtx
/* C++: Keep these around to reduce calls to `get_identifier'.
Identifiers for `this' in member functions and the auto-delete
@@ -344,9 +330,6 @@ tree vt_off_identifier;
/* Exception specifier used for throw(). */
tree empty_except_spec;
-/* Nonzero if we're in a handler for a function-try-block. */
-int in_function_try_handler;
-
struct named_label_list
{
struct binding_level *binding_level;
@@ -374,7 +357,7 @@ struct named_label_list
jumps to defined labels can have their validity checked
by stmt.c. */
-static struct named_label_list *named_label_uses = NULL;
+#define named_label_uses cp_function_chain->named_label_uses
/* A list of objects which have constructors or destructors
which reside in the global scope. The decl is stored in
@@ -431,22 +414,12 @@ static tree current_function_parm_tags;
at the end of the function. The TREE_VALUE is a LABEL_DECL; the
TREE_PURPOSE is the previous binding of the label. */
-static tree named_labels;
+#define named_labels cp_function_chain->named_labels
/* The FUNCTION_DECL for the function currently being compiled,
or 0 if between functions. */
tree current_function_decl;
-/* Set to 0 at beginning of a function definition, set to 1 if
- a return statement that specifies a return value is seen. */
-
-int current_function_returns_value;
-
-/* Set to 0 at beginning of a function definition, set to 1 if
- a return statement with no argument is seen. */
-
-int current_function_returns_null;
-
/* Set to 0 at beginning of a function definition, and whenever
a label (case or named) is defined. Set to value of expression
returned from function when that value can be transformed into
@@ -491,13 +464,9 @@ extern tree *current_lang_base, *current_lang_stack;
/* Set to 0 at beginning of a constructor, set to 1
if that function does an allocation before referencing its
instance variable. */
-static int current_function_assigns_this;
-int current_function_just_assigned_this;
-
-/* Set to 0 at beginning of a function. Set non-zero when
- store_parm_decls is called. Don't call store_parm_decls
- if this flag is non-zero! */
-int current_function_parms_stored;
+#define current_function_assigns_this cp_function_chain->assigns_this
+#define current_function_just_assigned_this \
+ cp_function_chain->just_assigned_this
/* Flag used when debugging spew.c */
@@ -664,7 +633,7 @@ struct binding_level
/* The binding level currently in effect. */
-static struct binding_level *current_binding_level;
+#define current_binding_level cp_function_chain->binding_level
/* The binding level of the current class, if any. */
@@ -6204,6 +6173,9 @@ init_decl_processing ()
lang_name_c = get_identifier ("C");
lang_name_java = get_identifier ("Java");
+ /* Create the global per-function variables. */
+ push_cp_function_context (NULL_TREE);
+
/* Enter the global namespace. */
my_friendly_assert (global_namespace == NULL_TREE, 375);
my_friendly_assert (current_lang_name == NULL_TREE, 375);
@@ -14522,39 +14494,7 @@ revert_static_member_fn (decl, fn, argtypes)
*argtypes = args;
}
-struct cp_function
-{
- int returns_value;
- int returns_null;
- int assigns_this;
- int just_assigned_this;
- int parms_stored;
- int temp_name_counter;
- tree named_labels;
- struct named_label_list *named_label_uses;
- tree ctor_label;
- tree dtor_label;
- rtx last_dtor_insn;
- rtx last_parm_cleanup_insn;
- tree base_init_list;
- tree member_init_list;
- tree base_init_expr;
- tree current_class_ptr;
- tree current_class_ref;
- rtx result_rtx;
- struct cp_function *next;
- struct binding_level *binding_level;
- int static_labelno;
- int in_function_try_handler;
- int expanding_p;
- int stmts_are_full_exprs_p;
- tree last_tree;
- tree last_expr_type;
-};
-
-static struct cp_function *cp_function_chain;
-
-extern int temp_name_counter;
+struct cp_function *cp_function_chain;
/* Save and reinitialize the variables
used during compilation of a C++ function. */
@@ -14563,40 +14503,20 @@ void
push_cp_function_context (context)
tree context;
{
- struct cp_function *p
- = (struct cp_function *) xmalloc (sizeof (struct cp_function));
+ struct cp_function *p;
+ /* Push the language-independent context. */
push_function_context_to (context);
+ /* Push the C++-specific context. */
+ p = (struct cp_function *) xmalloc (sizeof (struct cp_function));
+ if (cp_function_chain)
+ *p = *cp_function_chain;
+ else
+ bzero (p, sizeof (struct cp_function));
p->next = cp_function_chain;
cp_function_chain = p;
- p->named_labels = named_labels;
- p->named_label_uses = named_label_uses;
- p->returns_value = current_function_returns_value;
- p->returns_null = current_function_returns_null;
- p->binding_level = current_binding_level;
- p->ctor_label = ctor_label;
- p->dtor_label = dtor_label;
- p->last_dtor_insn = last_dtor_insn;
- p->last_parm_cleanup_insn = last_parm_cleanup_insn;
- p->assigns_this = current_function_assigns_this;
- p->just_assigned_this = current_function_just_assigned_this;
- p->parms_stored = current_function_parms_stored;
- p->result_rtx = original_result_rtx;
- p->base_init_expr = base_init_expr;
- p->temp_name_counter = temp_name_counter;
- p->base_init_list = current_base_init_list;
- p->member_init_list = current_member_init_list;
- p->current_class_ptr = current_class_ptr;
- p->current_class_ref = current_class_ref;
- p->static_labelno = static_labelno;
- p->in_function_try_handler = in_function_try_handler;
- p->last_tree = last_tree;
- p->last_expr_type = last_expr_type;
- p->expanding_p = expanding_p;
- p->stmts_are_full_exprs_p = stmts_are_full_exprs_p;
-
/* For now, we always assume we're expanding all the way to RTL
unless we're explicitly doing otherwise. */
expanding_p = 1;
@@ -14612,38 +14532,14 @@ void
pop_cp_function_context (context)
tree context;
{
- struct cp_function *p = cp_function_chain;
+ struct cp_function *p;
+ /* Pop the language-independent context. */
pop_function_context_from (context);
+ /* Pop the C++-specific context. */
+ p = cp_function_chain;
cp_function_chain = p->next;
-
- named_labels = p->named_labels;
- named_label_uses = p->named_label_uses;
- current_function_returns_value = p->returns_value;
- current_function_returns_null = p->returns_null;
- current_binding_level = p->binding_level;
- ctor_label = p->ctor_label;
- dtor_label = p->dtor_label;
- last_dtor_insn = p->last_dtor_insn;
- last_parm_cleanup_insn = p->last_parm_cleanup_insn;
- current_function_assigns_this = p->assigns_this;
- current_function_just_assigned_this = p->just_assigned_this;
- current_function_parms_stored = p->parms_stored;
- original_result_rtx = p->result_rtx;
- base_init_expr = p->base_init_expr;
- temp_name_counter = p->temp_name_counter;
- current_base_init_list = p->base_init_list;
- current_member_init_list = p->member_init_list;
- current_class_ptr = p->current_class_ptr;
- current_class_ref = p->current_class_ref;
- static_labelno = p->static_labelno;
- in_function_try_handler = p->in_function_try_handler;
- last_tree = p->last_tree;
- last_expr_type = p->last_expr_type;
- expanding_p = p->expanding_p;
- stmts_are_full_exprs_p = p->stmts_are_full_exprs_p;
-
free (p);
}