Commit 8012c983 by Mark Mitchell Committed by Mark Mitchell

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
parent e2bef702
1999-09-02 Mark Mitchell <mark@codesourcery.com>
* 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.
1999-09-01 Alex Samuel <samuel@codesourcery.com>
* decl2.c (arg_assoc_template_arg): New prototype. New function.
......
......@@ -38,7 +38,6 @@ Boston, MA 02111-1307, USA. */
#define obstack_chunk_free free
extern int inhibit_warnings;
extern tree ctor_label, dtor_label;
static tree build_new_method_call PROTO((tree, tree, tree, tree, int));
......
......@@ -71,11 +71,6 @@ typedef struct class_stack_node {
static int current_class_stack_size;
static class_stack_node_t current_class_stack;
/* When we're processing a member function, current_class_ptr is the
PARM_DECL for the `this' pointer. The current_class_ref is an
expression for `*this'. */
tree current_class_ptr, current_class_ref;
/* The following two can be derived from the previous one */
tree current_class_name; /* IDENTIFIER_NODE: name of current class */
tree current_class_type; /* _TYPE: the type of the current class */
......
......@@ -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);
}
......
......@@ -112,11 +112,6 @@ static size_t pending_statics_used;
static varray_type saved_inlines;
static size_t saved_inlines_used;
/* Used to help generate temporary names which are unique within
a function. Reset to 0 by start_function. */
int temp_name_counter;
/* Same, but not reset. Local temp variables and global temp variables
can have the same name. */
static int global_temp_name_counter;
......
......@@ -33,17 +33,6 @@ Boston, MA 02111-1307, USA. */
#include "expr.h"
#include "toplev.h"
/* In C++, structures with well-defined constructors are initialized by
those constructors, unasked. CURRENT_BASE_INIT_LIST
holds a list of stmts for a BASE_INIT term in the grammar.
This list has one element for each base class which must be
initialized. The list elements are [basename, init], with
type basetype. This allows the possibly anachronistic form
(assuming d : a, b, c) "d (int a) : c(a+5), b (a-4), a (a+3)"
where each successive term can be handed down the constructor
line. Perhaps this was not intended. */
tree current_base_init_list, current_member_init_list;
static void expand_aggr_vbase_init_1 PROTO((tree, tree, tree, tree));
static void construct_virtual_bases PROTO((tree, tree, tree, tree, tree));
static void expand_aggr_init_1 PROTO((tree, tree, tree, tree, int));
......@@ -502,8 +491,6 @@ sort_base_init (t, rbase_ptr, vbase_ptr)
Note that emit_base_init does *not* initialize virtual base
classes. That is done specially, elsewhere. */
extern tree base_init_expr;
void
emit_base_init (t)
tree t;
......
......@@ -47,8 +47,6 @@ Boston, MA 02111-1307, USA. */
processed. */
struct pending_inline *pending_inlines;
int static_labelno;
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
......
......@@ -9874,8 +9874,6 @@ tsubst_expr_values (t, argvec)
return first;
}
tree last_tree;
void
add_tree (t)
tree t;
......
......@@ -45,29 +45,6 @@ static void expand_stmts PROTO((tree));
static void do_pushlevel PROTO((void));
static tree do_poplevel PROTO((void));
/* Non-zero if we should generate RTL for functions that we process.
When this is zero, we just accumulate tree structure, without
interacting with the back end. */
int expanding_p = 1;
/* Non-zero if we should treat statements as full expressions. In
particular, this variable is no-zero if at the end of a statement
we should destroy any temporaries created during that statement.
Similarly, if, at the end of a block, we should destroy any local
variables in this block. Normally, this variable is non-zero,
since those are the normal semantics of C++.
However, in order to represent aggregate initialization code as
tree structure, we use statement-expressions. The statements
within the statement expression should not result in cleanups being
run until the entire enclosing statement is complete. */
int stmts_are_full_exprs_p = 1;
/* The type of the last expression-statement we have seen. This is
required because the type of a statement-expression is the type of
the last expression statement. */
tree last_expr_type;
/* When parsing a template, LAST_TREE contains the last statement
parsed. These are chained together through the TREE_CHAIN field,
but often need to be re-organized since the parse is performed
......@@ -1030,8 +1007,6 @@ finish_named_return_value (return_id, init)
void
setup_vtbl_ptr ()
{
extern tree base_init_expr;
if (base_init_expr == 0
&& DECL_CONSTRUCTOR_P (current_function_decl))
{
......
......@@ -6773,7 +6773,6 @@ void
c_expand_return (retval)
tree retval;
{
extern tree dtor_label, ctor_label;
tree result = DECL_RESULT (current_function_decl);
tree valtype = TREE_TYPE (result);
......
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