Commit f2c5f623 by Ben Chelf

Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o.

2000-07-01  Benjamin Chelf  <chelf@codesourcery.com>

	* Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o.
	(c-semantics.o): New target.

	* c-common.h (TREE_LANG_FLAG_?): Added documentation.
	(genrtl_do_pushlevel): Moved from cp/cp-tree.h.
	(genrtl_clear_out_block): Likewise.
	(genrtl_goto_stmt): Likewise.
	(genrtl_expr_stmt): Likewise.
	(genrtl_decl_stmt): Likewise.
	(genrtl_if_stmt): Likewise.
	(genrtl_while_stmt): Likewise.
	(genrtl_do_stmt): Likewise.
	(genrtl_return_stmt): Likewise.
	(genrtl_for_stmt): Likewise.
	(genrtl_break_stmt): Likewise.
	(genrtl_continue_stmt): Likewise.
	(genrtl_scope_stmt): Likewise.
	(genrtl_switch_stmt): Likewise.
	(genrtl_case_label): Likewise.
	(genrtl_begin_compound_stmt): Likewise.
	(gerntl_finish_compound_stmt): Likewise.
	(genrtl_compound_stmt): Likewise.
	(genrtl_asm_stmt): Likewise.
	(genrtl_decl_cleanup): Likewise.
	(DECL_ANON_UNION_ELEMS): Likewise.
	(emit_local_var): Likewise.
	(make_rtl_for_local_static): Likewise.
	(expand_cond): Likewise.
	(expand_stmt): Likewise.
	(c_expand_return): Likewise.
	(c_expand_start_case): Likewise.
	(do_case): Likewise.
	(COMPOUND_STMT_NO_SCOPE): Likewise.
	(c_expand_asm_operands): Likewise.
	(NEW_FOR_SCOPE_P): New macro.
	(expand_expr_stmt_fn): New type.

	(set_current_function_name_declared): Likewise.
	(current_function_name_declared): Likewise.
	(lang_expand_stmt): Likewise.
	(stmts_are_full_exprs_p): Likewise.
	(anon_aggr_type_p): Likewise.
	(lang_expand_expr_stmt): Likewise.
	(build_case_label): Likewise.

	* c-decl.c (lang_expand_expr_stmt): Initialize.
	(stmts_are_full_exprs_p): Define.
	(current_function_name_declared): Likewise.
	(do_case): Likewise.
	(lang_expand_stmt): Likewise.
	(set_current_function_name_declared): Likewise.
	(anon_aggr_type_p): Likewise.
	(build_case_label): Likewise.

	* c-semantics.c: New file.
	(expand_cond): Moved from cp/semantics.c.
	(genrtl_do_pushlevel): Likewise.
	(genrtl_clear_out_block): Likewise.
	(genrtl_goto_stmt): Likewise.
	(genrtl_expr_stmt): Likewise.
	(genrtl_decl_stmt): Likewise.
	(genrtl_if_stmt): Likewise.
	(genrtl_while_stmt): Likewise.
	(genrtl_do_stmt): Likewise.
	(genrtl_return_stmt): Likewise.
	(genrtl_for_stmt): Likewise.
	(genrtl_break_stmt): Likewise.
	(genrtl_continue_stmt): Likewise.
	(genrtl_scope_stmt): Likewise.
	(genrtl_switch_stmt): Likewise.
	(genrtl_case_label): Likewise.
	(genrtl_begin_compound_stmt): Likewise.
	(genrtl_finish_compound_stmt): Likewise.
	(genrtl_compound_stmt): Likewise.
	(genrtl_asm_stmt): Likewise.
	(genrtl_decl_cleanup): Likewise.
	(make_rtl_for_local_static): Moved from cp/decl.c.
	(emit_local_var): Likewise.
	(expand_stmt): Define.

	* c-tree.h: (c_expand_asm_operands): Moved to c-common.h.
	(c_expand_return): Likewise.
	(c_expand_start_case): Likewise.

        * cp/Make-lang.in (cc1plus$(exeext)): Added c-semantics.o.

	* cp/Makefile.in (OBJS): Added ../c-semantics.o.
	(OBJDEPS): Likewise.

	* cp/cp-tree.h (TREE_LANG_FLAG_?): Moved common documentation to
	../c-common.h.
	(struct stmt_tree): Added comment.
	(current_function_name_declared): Removed.
	(stmts_are_full_exprs_p): Likewise.
	(genrtl_do_pushlevel): Likewise.
	(genrtl_clear_out_block): Likewise.
	(COMPOUND_STMT_NO_SCOPE): Moved to ../c-common.h.
	(DECL_ANON_UNION_ELEMS): Likewise.
	(emit_local_var): Likewise.
	(make_rtl_for_local_static): Likewise.
	(do_case): Likewise.
	(expand_stmt): Likewise.
	(genrtl_decl_cleanup): Likewise.
	(c_expand_asm_operands): Likewise.
	(c_expand_return): Likewise.
	(c_expand_start_case): Likewise.

	* cp/decl.c (make_rtl_for_local_static): Moved to c-semantics.c.
	(emit_local_var): Likewise.
	(initialize_local_var): Change reference to
	stmts_are_full_exprs_p to call to stmts_are_full_exprs_p().
	Change reference to stmts_are_full_exprs_p to
	current_stmt_tree->stmts_are_full_exprs_p.
	(push_cp_function_context): Likewise.

	* cp/expect.c (expand_throw): Change reference to
	stmts_are_full_exprs_p.

	* cp/init.c (build_aggr_init): Change reference to
	stmts_are_full_exprs_p.
	(build_vec_init): Likewise.

	* cp/optimize.c (maybe_clone_body): Change reference to
	current_function_name_declared to
	cp_function_chain->name_declared.

	* cp/pt.c (instantiate_decl): Change reference to
	current_function_name_declared to
	cp_function_chain->name_declared.

	* cp/semantics.c (expand_cond): Moved declaration to c-common.h.
	(genrtl_do_pushlevel): Moved to c-semantics.c.
	(genrtl_clear_out_block): Likewise.
	(genrtl_goto_stmt): Likewise.
	(genrtl_expr_stmt): Likewise.
	(genrtl_decl_stmt): Likewise.
	(gerntl_if_stmt): Likewise.
	(genrtl_while_stmt): Likewise.
	(genrtl_do_stmt): Likewise.
	(genrtl_return_stmt): Likewise.
	(genrtl_for_stmt): Likewise.
	(genrtl_break_stmt): Likewise.
	(genrtl_continue_stmt): Likewise.
	(genrtl_scope_stmt): Likewise.
	(genrtl_switch_stmt): Likewise.
	(genrtl_case_label): Likewise.
	(genrtl_begin_compound_stmt): Likewise.
	(genrtl_finish_compound_stmt): Likewise.
	(genrtl_compound_stmt): Likewise.
	(genrtl_asm_stmt): Likewise.
	(genrtl_decl_cleanup): Likewise.
	(expand_cond): Likewise.
	(expand_stmt): Renamed to ...
	(lang_expand_stmt): ... this.
	(lang_expand_expr_stmt): Initialize.
	(set_current_function_name_declared): Likewise.
	(stmts_are_full_exprs_p): Likewise.
	(current_function_name_declared): Likewise.
	(anon_aggr_type_p): Likewise.
	(do_poplevel): Change reference to
	stmts_are_full_exprs_p to call to stmts_are_full_exprs_p().
	Change reference to stmts_are_full_exprs_p to
	current_stmt_tree->stmts_are_full_exprs_p.
	(add_tree): Likewise.
	(finish_expr_stmt): Likewise.
	(prep_stmt): Likewise.
	(lang_expand_stmt): Likewise.
	(begin_compound_stmt): Change reference to
	current_function_name_declared to
	cp_function_chain->name_declared and call to
	current_function_name_declared().
	(setup_vtbl_ptr): Likewise.
	(genrtl_do_poplevel): Removed.

From-SVN: r34827
parent d6f46e41
2000-07-01 Benjamin Chelf <chelf@codesourcery.com>
* Makefile.in (C_AND_OBJC_OBJS): Added c-semantics.o.
(c-semantics.o): New target.
* c-common.h (TREE_LANG_FLAG_?): Added documentation.
(genrtl_do_pushlevel): Moved from cp/cp-tree.h.
(genrtl_clear_out_block): Likewise.
(genrtl_goto_stmt): Likewise.
(genrtl_expr_stmt): Likewise.
(genrtl_decl_stmt): Likewise.
(genrtl_if_stmt): Likewise.
(genrtl_while_stmt): Likewise.
(genrtl_do_stmt): Likewise.
(genrtl_return_stmt): Likewise.
(genrtl_for_stmt): Likewise.
(genrtl_break_stmt): Likewise.
(genrtl_continue_stmt): Likewise.
(genrtl_scope_stmt): Likewise.
(genrtl_switch_stmt): Likewise.
(genrtl_case_label): Likewise.
(genrtl_begin_compound_stmt): Likewise.
(gerntl_finish_compound_stmt): Likewise.
(genrtl_compound_stmt): Likewise.
(genrtl_asm_stmt): Likewise.
(genrtl_decl_cleanup): Likewise.
(DECL_ANON_UNION_ELEMS): Likewise.
(emit_local_var): Likewise.
(make_rtl_for_local_static): Likewise.
(expand_cond): Likewise.
(expand_stmt): Likewise.
(c_expand_return): Likewise.
(c_expand_start_case): Likewise.
(do_case): Likewise.
(COMPOUND_STMT_NO_SCOPE): Likewise.
(c_expand_asm_operands): Likewise.
(NEW_FOR_SCOPE_P): New macro.
(expand_expr_stmt_fn): New type.
(set_current_function_name_declared): Likewise.
(current_function_name_declared): Likewise.
(lang_expand_stmt): Likewise.
(stmts_are_full_exprs_p): Likewise.
(anon_aggr_type_p): Likewise.
(lang_expand_expr_stmt): Likewise.
(build_case_label): Likewise.
* c-decl.c (lang_expand_expr_stmt): Initialize.
(stmts_are_full_exprs_p): Define.
(current_function_name_declared): Likewise.
(do_case): Likewise.
(lang_expand_stmt): Likewise.
(set_current_function_name_declared): Likewise.
(anon_aggr_type_p): Likewise.
(build_case_label): Likewise.
* c-semantics.c: New file.
(expand_cond): Moved from cp/semantics.c.
(genrtl_do_pushlevel): Likewise.
(genrtl_clear_out_block): Likewise.
(genrtl_goto_stmt): Likewise.
(genrtl_expr_stmt): Likewise.
(genrtl_decl_stmt): Likewise.
(genrtl_if_stmt): Likewise.
(genrtl_while_stmt): Likewise.
(genrtl_do_stmt): Likewise.
(genrtl_return_stmt): Likewise.
(genrtl_for_stmt): Likewise.
(genrtl_break_stmt): Likewise.
(genrtl_continue_stmt): Likewise.
(genrtl_scope_stmt): Likewise.
(genrtl_switch_stmt): Likewise.
(genrtl_case_label): Likewise.
(genrtl_begin_compound_stmt): Likewise.
(genrtl_finish_compound_stmt): Likewise.
(genrtl_compound_stmt): Likewise.
(genrtl_asm_stmt): Likewise.
(genrtl_decl_cleanup): Likewise.
(make_rtl_for_local_static): Moved from cp/decl.c.
(emit_local_var): Likewise.
(expand_stmt): Define.
* c-tree.h: (c_expand_asm_operands): Moved to c-common.h.
(c_expand_return): Likewise.
(c_expand_start_case): Likewise.
2000-07-01 Richard Henderson <rth@cygnus.com>
* config/ia64/ia64.c (symbolic_operand): Reject CONST expressions
......
......@@ -675,7 +675,7 @@ LANG_FLAGS_TO_PASS = $(SUBDIR_FLAGS_TO_PASS) \
# Language-specific object files for C and Objective C.
C_AND_OBJC_OBJS = c-lex.o c-pragma.o c-decl.o c-typeck.o c-convert.o \
c-aux-info.o c-common.o c-iterate.o @extra_c_objs@
c-aux-info.o c-common.o c-iterate.o c-semantics.o @extra_c_objs@
# Language-specific object files for C.
C_OBJS = c-parse.o c-lang.o $(C_AND_OBJC_OBJS)
......@@ -1158,6 +1158,10 @@ c-common.o : c-common.c $(CONFIG_H) system.h $(TREE_H) \
c-common.h flags.h toplev.h output.h c-pragma.h $(RTL_H) $(GGC_H) \
$(EXPR_H)
c-semantics.o : c-semantics.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-lex.h \
c-common.h flags.h toplev.h output.h c-pragma.h $(RTL_H) $(GGC_H) \
$(EXPR_H)
# Language-independent files.
DRIVER_DEFINES = \
......
......@@ -19,6 +19,20 @@ along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Usage of TREE_LANG_FLAG_?:
0: COMPOUND_STMT_NO_SCOPE (in COMPOUND_STMT).
TREE_NEGATED_INT (in INTEGER_CST).
IDENTIFIER_MARKED (used by search routines).
SCOPE_BEGIN_P (in SCOPE_STMT)
DECL_PRETTY_FUNCTION_P (in VAR_DECL)
NEW_FOR_SCOPE_P (in FOR_STMT)
1: C_DECLARED_LABEL_FLAG (in LABEL_DECL)
STMT_IS_FULL_EXPR_P (in _STMT)
2: STMT_LINENO_FOR_FN_P (in _STMT)
3: SCOPE_NO_CLEANUPS_P (in SCOPE_STMT)
4: SCOPE_PARTIAL_P (in SCOPE_STMT)
*/
/* Reserved identifiers. */
enum rid
......@@ -262,7 +276,6 @@ extern tree build_va_arg PARAMS ((tree, tree));
extern int self_promoting_args_p PARAMS ((tree));
extern tree simple_type_promotes_to PARAMS ((tree));
/* These macros provide convenient access to the various _STMT nodes
created when parsing template declarations. */
......@@ -392,6 +405,9 @@ extern tree simple_type_promotes_to PARAMS ((tree));
#define STMT_LINENO_FOR_FN_P(NODE) \
(TREE_LANG_FLAG_2 ((NODE)))
/* Nonzero if we want the new ISO rules for pushing a new scope for `for'
initialization variables. */
#define NEW_FOR_SCOPE_P(NODE) (TREE_LANG_FLAG_0 (NODE))
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
......@@ -404,7 +420,52 @@ enum c_tree_code {
#undef DEFTREECODE
extern void add_c_tree_codes PARAMS ((void));
extern void genrtl_do_pushlevel PARAMS ((void));
extern void genrtl_clear_out_block PARAMS ((void));
extern void genrtl_goto_stmt PARAMS ((tree));
extern void genrtl_expr_stmt PARAMS ((tree));
extern void genrtl_decl_stmt PARAMS ((tree));
extern void genrtl_if_stmt PARAMS ((tree));
extern void genrtl_while_stmt PARAMS ((tree));
extern void genrtl_do_stmt PARAMS ((tree));
extern void genrtl_return_stmt PARAMS ((tree));
extern void genrtl_for_stmt PARAMS ((tree));
extern void genrtl_break_stmt PARAMS ((void));
extern void genrtl_continue_stmt PARAMS ((void));
extern void genrtl_scope_stmt PARAMS ((tree));
extern void genrtl_switch_stmt PARAMS ((tree));
extern void genrtl_case_label PARAMS ((tree, tree));
extern tree genrtl_begin_compound_stmt PARAMS ((int));
extern tree genrtl_finish_compound_stmt PARAMS ((int));
extern tree genrtl_compound_stmt PARAMS ((tree));
extern void genrtl_asm_stmt PARAMS ((tree, tree,
tree, tree,
tree));
extern void genrtl_decl_cleanup PARAMS ((tree, tree));
extern int stmts_are_full_exprs_p PARAMS ((void));
typedef void (*expand_expr_stmt_fn) PARAMS ((tree));
extern expand_expr_stmt_fn lang_expand_expr_stmt;
extern int anon_aggr_type_p PARAMS ((tree));
/* For a VAR_DECL that is an anonymous union, these are the various
sub-variables that make up the anonymous union. */
#define DECL_ANON_UNION_ELEMS(NODE) DECL_ARGUMENTS ((NODE))
extern void emit_local_var PARAMS ((tree));
extern void make_rtl_for_local_static PARAMS ((tree));
extern tree expand_cond PARAMS ((tree));
extern tree expand_stmt PARAMS ((tree));
extern tree lang_expand_stmt PARAMS ((tree));
extern void c_expand_return PARAMS ((tree));
extern tree c_expand_start_case PARAMS ((tree));
extern void do_case PARAMS ((tree, tree));
extern tree build_case_label PARAMS ((tree, tree));
#define COMPOUND_STMT_NO_SCOPE(NODE) TREE_LANG_FLAG_0 (NODE)
extern void c_expand_asm_operands PARAMS ((tree, tree, tree, tree, int, const char *, int));
extern int current_function_name_declared PARAMS ((void));
extern void set_current_function_name_declared PARAMS ((int));
/* These functions must be defined by each front-end which implements
a variant of the C language. They are used in c-common.c. */
......@@ -420,4 +481,3 @@ extern tree default_conversion PARAMS ((tree));
Given two compatible ANSI C types, returns the merged type. */
extern tree common_type PARAMS ((tree, tree));
......@@ -455,6 +455,10 @@ int warn_float_equal = 0;
int warn_multichar = 1;
/* Wrapper since C and C++ expand_expr_stmt are different. */
expand_expr_stmt_fn lang_expand_expr_stmt = c_expand_expr_stmt;
/* The variant of the C language being processed. */
c_language_kind c_language = clk_c;
......@@ -6793,3 +6797,69 @@ lang_mark_tree (t)
else if (TYPE_P (t) && TYPE_LANG_SPECIFIC (t))
ggc_mark (TYPE_LANG_SPECIFIC (t));
}
/* The functions below are required for functionality of doing
function at once processing in the C front end. Currently these
functions are not called from anywhere in the C front end, but as
these changes continue, that will change. */
/* Returns non-zero if the current statement is a full expression,
i.e. temporaries created during that statement should be destroyed
at the end of the statement. */
int
stmts_are_full_exprs_p ()
{
return 0;
}
/* Nonzero if TYPE is an anonymous union or struct type. Always 0 in
C. */
int
anon_aggr_type_p (node)
tree node;
{
return 0;
}
/* One if we have already declared __FUNCTION__ (and related
variables) in the current function. Two if we are in the process
of doing so. */
int
current_function_name_declared ()
{
abort ();
return 0;
}
/* Code to generate the RTL for a case label in C. */
void
do_case (low_value, high_value)
tree low_value;
tree high_value;
{
abort ();
}
/* Language specific handler of tree nodes used when generating RTL
from a tree. */
tree
lang_expand_stmt (t)
tree t;
{
abort ();
return NULL_TREE;
}
/* Accessor to set the 'current_function_name_declared' flag. */
void
set_current_function_name_declared (i)
int i;
{
abort ();
}
......@@ -263,11 +263,6 @@ extern tree pop_init_level PARAMS ((int));
extern void set_init_index PARAMS ((tree, tree));
extern void set_init_label PARAMS ((tree));
extern void process_init_element PARAMS ((tree));
extern void c_expand_asm_operands PARAMS ((tree, tree, tree,
tree, int,
const char *, int));
extern void c_expand_return PARAMS ((tree));
extern tree c_expand_start_case PARAMS ((tree));
extern void pedwarn_c99 PARAMS ((const char *, ...))
ATTRIBUTE_PRINTF_1;
......
2000-07-01 Benjamin Chelf <chelf@codesourcery.com>
* Make-lang.in (cc1plus$(exeext)): Added c-semantics.o.
* Makefile.in (OBJS): Added ../c-semantics.o.
(OBJDEPS): Likewise.
* cp-tree.h (TREE_LANG_FLAG_?): Moved common documentation to
../c-common.h.
(struct stmt_tree): Added comment.
(current_function_name_declared): Removed.
(stmts_are_full_exprs_p): Likewise.
(genrtl_do_pushlevel): Likewise.
(genrtl_clear_out_block): Likewise.
(COMPOUND_STMT_NO_SCOPE): Moved to ../c-common.h.
(DECL_ANON_UNION_ELEMS): Likewise.
(emit_local_var): Likewise.
(make_rtl_for_local_static): Likewise.
(do_case): Likewise.
(expand_stmt): Likewise.
(genrtl_decl_cleanup): Likewise.
(c_expand_asm_operands): Likewise.
(c_expand_return): Likewise.
(c_expand_start_case): Likewise.
* decl.c (make_rtl_for_local_static): Moved to c-semantics.c.
(emit_local_var): Likewise.
(initialize_local_var): Change reference to
stmts_are_full_exprs_p to call to stmts_are_full_exprs_p().
Change reference to stmts_are_full_exprs_p to
current_stmt_tree->stmts_are_full_exprs_p.
(push_cp_function_context): Likewise.
* expect.c (expand_throw): Change reference to
stmts_are_full_exprs_p.
* init.c (build_aggr_init): Change reference to
stmts_are_full_exprs_p.
(build_vec_init): Likewise.
* optimize.c (maybe_clone_body): Change reference to
current_function_name_declared to
cp_function_chain->name_declared.
* pt.c (instantiate_decl): Change reference to
current_function_name_declared to
cp_function_chain->name_declared.
* semantics.c (expand_cond): Moved declaration to c-common.h.
(genrtl_do_pushlevel): Moved to c-semantics.c.
(genrtl_clear_out_block): Likewise.
(genrtl_goto_stmt): Likewise.
(genrtl_expr_stmt): Likewise.
(genrtl_decl_stmt): Likewise.
(gerntl_if_stmt): Likewise.
(genrtl_while_stmt): Likewise.
(genrtl_do_stmt): Likewise.
(genrtl_return_stmt): Likewise.
(genrtl_for_stmt): Likewise.
(genrtl_break_stmt): Likewise.
(genrtl_continue_stmt): Likewise.
(genrtl_scope_stmt): Likewise.
(genrtl_switch_stmt): Likewise.
(genrtl_case_label): Likewise.
(genrtl_begin_compound_stmt): Likewise.
(genrtl_finish_compound_stmt): Likewise.
(genrtl_compound_stmt): Likewise.
(genrtl_asm_stmt): Likewise.
(genrtl_decl_cleanup): Likewise.
(expand_cond): Likewise.
(expand_stmt): Renamed to ...
(lang_expand_stmt): ... this.
(lang_expand_expr_stmt): Initialize.
(set_current_function_name_declared): Likewise.
(stmts_are_full_exprs_p): Likewise.
(current_function_name_declared): Likewise.
(anon_aggr_type_p): Likewise.
(do_poplevel): Change reference to
stmts_are_full_exprs_p to call to stmts_are_full_exprs_p().
Change reference to stmts_are_full_exprs_p to
current_stmt_tree->stmts_are_full_exprs_p.
(add_tree): Likewise.
(finish_expr_stmt): Likewise.
(prep_stmt): Likewise.
(lang_expand_stmt): Likewise.
(begin_compound_stmt): Change reference to
current_function_name_declared to
cp_function_chain->name_declared and call to
current_function_name_declared().
(setup_vtbl_ptr): Likewise.
(genrtl_do_poplevel): Removed.
2000-06-30 Jason Merrill <jason@redhat.com>
* init.c (init_init_processing): Go back to aligning like
......@@ -18,6 +110,20 @@
* cp-tree.h: Declare flag_check_new here.
* init.c: Not here.
2000-06-28 Alex Samuel <samuel@codesourcery.com>
* mangle.c (find_substitution): Use same_type_p.
(write_encoding): Don't check for substitutions.
2000-06-30 Nathan Sidwell <nathan@codesourcery.com>
* parse.y (expr_no_comma_rangle): New non-terminal.
(template_parm): Use it for default parameter case.
(template_arg): Use it.
(expr_no_commas): Remove commented out undefined extensions.
* Makefile.in (CONFLICTS): Adjust to 33 s/r & 48 r/r.
* parse.h, parse.c: Rebuilt.
2000-06-30 Mark Mitchell <mark@codesourcery.com>
* semantics.c (genrtl_asm_stmt): Don't decay input operands here.
......@@ -121,7 +227,6 @@
(overloaded_template_name): Adjust.
* semantics.c (finish_template_template_parm): Adjust.
>>>>>>> 1.1867
2000-06-28 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (CLEAR_BINFO_NEW_VTABLE_MARKED): Remove.
......@@ -346,7 +451,7 @@
* mangle.c (write_method_parms): Use direct comparison for end
of parmlist.
2000-06-19 Benjamin Chelf <chelf@cabriolet.stanford.edu>
2000-06-19 Benjamin Chelf <chelf@codesourcery.com>
* cp-tree.h (genrtl_try_block): Declare function.
(genrtl_handler): Likewise.
......
......@@ -126,7 +126,7 @@ CXX_SRCS = $(srcdir)/cp/call.c $(srcdir)/cp/class.c $(srcdir)/cp/cp-tree.def \
$(srcdir)/cp/typeck.c $(srcdir)/cp/typeck2.c $(srcdir)/cp/xref.c
cc1plus$(exeext): $(P) $(CXX_SRCS) $(LIBDEPS) stamp-objlist c-common.o \
c-pragma.o $(srcdir)/cp/cp-tree.h $(srcdir)/cp/cp-tree.def \
c-pragma.o c-semantics.o $(srcdir)/cp/cp-tree.h $(srcdir)/cp/cp-tree.def \
$(srcdir)/c-common.def $(srcdir)/cp/gxx.gperf $(srcdir)/cp/cfns.gperf hash.o \
$(srcdir)/cp/operators.def
cd cp; $(MAKE) $(LANG_FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) ../cc1plus$(exeext)
......
......@@ -179,8 +179,8 @@ CXX_OBJS = call.o decl.o errfn.o expr.o pt.o typeck2.o \
repo.o dump.o optimize.o mangle.o @extra_cxx_objs@
# Language-independent object files.
OBJS = `cat ../stamp-objlist` ../c-common.o ../c-pragma.o
OBJDEPS = ../stamp-objlist ../c-common.o ../c-pragma.o
OBJS = `cat ../stamp-objlist` ../c-common.o ../c-pragma.o ../c-semantics.o
OBJDEPS = ../stamp-objlist ../c-common.o ../c-pragma.o ../c-semantics.o
compiler: ../cc1plus$(exeext)
../cc1plus$(exeext): $(P) $(OBJDEPS) $(CXX_OBJS) $(LIBDEPS)
......
......@@ -31,20 +31,15 @@ Boston, MA 02111-1307, USA. */
/* Usage of TREE_LANG_FLAG_?:
0: BINFO_MARKED (BINFO nodes).
COMPOUND_STMT_NO_SCOPE (in COMPOUND_STMT).
NEW_EXPR_USE_GLOBAL (in NEW_EXPR).
DELETE_EXPR_USE_GLOBAL (in DELETE_EXPR).
LOOKUP_EXPR_GLOBAL (in LOOKUP_EXPR).
TREE_NEGATED_INT (in INTEGER_CST).
TREE_INDIRECT_USING (in NAMESPACE_DECL).
IDENTIFIER_MARKED (used by search routines).
LOCAL_BINDING_P (in CPLUS_BINDING)
ICS_USER_FLAG (in _CONV)
CLEANUP_P (in TRY_BLOCK)
AGGR_INIT_VIA_CTOR_P (in AGGR_INIT_EXPR)
SCOPE_BEGIN_P (in SCOPE_STMT)
CTOR_BEGIN_P (in CTOR_STMT)
DECL_PRETTY_FUNCTION_P (in VAR_DECL)
BV_USE_VCALL_INDEX_P (in the BINFO_VIRTUALS TREE_LIST)
1: IDENTIFIER_VIRTUAL_P.
TI_PENDING_TEMPLATE_FLAG.
......@@ -52,17 +47,14 @@ Boston, MA 02111-1307, USA. */
DELETE_EXPR_USE_VEC (in DELETE_EXPR).
(TREE_CALLS_NEW) (in _EXPR or _REF) (commented-out).
TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (in _TYPE).
C_DECLARED_LABEL_FLAG (in LABEL_DECL)
INHERITED_VALUE_BINDING_P (in CPLUS_BINDING)
BASELINK_P (in TREE_LIST)
ICS_ELLIPSIS_FLAG (in _CONV)
STMT_IS_FULL_EXPR_P (in _STMT)
BINFO_ACCESS (in BINFO)
BV_GENERATE_THUNK_WITH_VTABLE_P (in TREE_LIST)
2: IDENTIFIER_OPNAME_P.
TYPE_POLYMORHPIC_P (in _TYPE)
ICS_THIS_FLAG (in _CONV)
STMT_LINENO_FOR_FN_P (in _STMT)
BINDING_HAS_LEVEL_P (in CPLUS_BINDING)
BINFO_OVERRIDE_ALONG_VIRTUAL_PATH_P (in BINFO)
3: TYPE_USES_VIRTUAL_BASECLASSES (in a class TYPE).
......@@ -71,13 +63,11 @@ Boston, MA 02111-1307, USA. */
(TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out).
ICS_BAD_FLAG (in _CONV)
FN_TRY_BLOCK_P (in TRY_BLOCK)
SCOPE_NO_CLEANUPS_P (in SCOPE_STMT)
IDENTIFIER_CTOR_OR_DTOR_P (in IDENTIFIER_NODE)
4: BINFO_NEW_VTABLE_MARKED.
TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR,
or FIELD_DECL).
NEED_TEMPORARY_P (in REF_BIND, BASE_CONV)
SCOPE_PARTIAL_P (in SCOPE_STMT)
IDENTIFIER_TYPENAME_P (in IDENTIFIER_NODE)
5: BINFO_PRIMARY_MARKED_P (in BINFO)
6: BINFO_VBASE_PRIMARY_P (in BINFO)
......@@ -791,6 +781,17 @@ extern tree cp_global_trees[CPTI_MAX];
struct stmt_tree {
tree x_last_stmt;
tree x_last_expr_type;
/* 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;
};
......@@ -991,13 +992,6 @@ struct language_function
#define current_function_parms_stored \
cp_function_chain->parms_stored
/* One if we have already declared __FUNCTION__ (and related
variables) in the current function. Two if we are in the process
of doing so. */
#define current_function_name_declared \
cp_function_chain->name_declared
/* Nonzero if we have already generated code to initialize virtual
function tables in this function. */
......@@ -1014,21 +1008,6 @@ struct language_function
#define doing_semantic_analysis_p() (!expanding_p)
/* 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. */
#define stmts_are_full_exprs_p \
current_stmt_tree->stmts_are_full_exprs_p
#define in_function_try_handler cp_function_chain->in_function_try_handler
extern tree current_function_return_value;
......@@ -2472,7 +2451,6 @@ struct lang_decl
#define DECL_SAVED_FUNCTION_DATA(NODE) \
(DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE))->u.saved_language_function)
#define COMPOUND_STMT_NO_SCOPE(NODE) TREE_LANG_FLAG_0 (NODE)
#define NEW_EXPR_USE_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE)
#define DELETE_EXPR_USE_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE)
#define DELETE_EXPR_USE_VEC(NODE) TREE_LANG_FLAG_1 (NODE)
......@@ -2825,10 +2803,6 @@ extern int flag_new_for_scope;
#define ANON_UNION_TYPE_P(NODE) \
(TREE_CODE (NODE) == UNION_TYPE && ANON_AGGR_TYPE_P (NODE))
/* For a VAR_DECL that is an anonymous union, these are the various
sub-variables that make up the anonymous union. */
#define DECL_ANON_UNION_ELEMS(NODE) DECL_ARGUMENTS ((NODE))
#define UNKNOWN_TYPE LANG_TYPE
/* Define fields and accessors for nodes representing declared names. */
......@@ -3919,6 +3893,8 @@ extern void pop_nested_namespace PARAMS ((tree));
extern void maybe_push_to_top_level PARAMS ((int));
extern void push_to_top_level PARAMS ((void));
extern void pop_from_top_level PARAMS ((void));
extern void push_switch PARAMS ((void));
extern void pop_switch PARAMS ((void));
extern tree identifier_type_value PARAMS ((tree));
extern void set_identifier_type_value PARAMS ((tree, tree));
extern void pop_everything PARAMS ((void));
......@@ -3942,8 +3918,6 @@ extern tree lookup_label PARAMS ((tree));
extern tree declare_local_label PARAMS ((tree));
extern tree define_label PARAMS ((const char *, int, tree));
extern void check_goto PARAMS ((tree));
extern void push_switch PARAMS ((void));
extern void pop_switch PARAMS ((void));
extern void define_case_label PARAMS ((void));
extern tree getdecls PARAMS ((void));
extern tree gettags PARAMS ((void));
......@@ -4038,9 +4012,7 @@ extern int wrapup_globals_for_namespace PARAMS ((tree, void *));
extern tree cp_namespace_decls PARAMS ((tree));
extern tree create_implicit_typedef PARAMS ((tree, tree));
extern tree maybe_push_decl PARAMS ((tree));
extern void emit_local_var PARAMS ((tree));
extern tree build_target_expr_with_type PARAMS ((tree, tree));
extern void make_rtl_for_local_static PARAMS ((tree));
extern int local_variable_p PARAMS ((tree));
extern int nonstatic_local_decl_p PARAMS ((tree));
extern tree declare_global_var PARAMS ((tree, tree));
......@@ -4154,7 +4126,6 @@ extern void check_handlers PARAMS ((tree));
extern void init_cplus_expand PARAMS ((void));
extern void fixup_result_decl PARAMS ((tree, struct rtx_def *));
extern int extract_init PARAMS ((tree, tree));
extern void do_case PARAMS ((tree, tree));
extern tree cplus_expand_constant PARAMS ((tree));
/* friend.c */
......@@ -4477,7 +4448,6 @@ extern tree finish_typeof PARAMS ((tree));
extern void add_decl_stmt PARAMS ((tree));
extern void finish_decl_cleanup PARAMS ((tree, tree));
extern void finish_named_return_value PARAMS ((tree, tree));
extern tree expand_stmt PARAMS ((tree));
extern void expand_body PARAMS ((tree));
extern void begin_stmt_tree PARAMS ((tree *));
extern void finish_stmt_tree PARAMS ((tree *));
......@@ -4492,10 +4462,8 @@ extern void genrtl_handler PARAMS ((tree));
extern void genrtl_catch_block PARAMS ((tree));
extern void genrtl_ctor_stmt PARAMS ((tree));
extern void genrtl_subobject PARAMS ((tree));
extern void genrtl_decl_cleanup PARAMS ((tree, tree));
extern tree genrtl_do_poplevel PARAMS ((void));
extern void genrtl_do_pushlevel PARAMS ((void));
extern void genrtl_clear_out_block PARAMS ((void));
extern void clear_out_block PARAMS ((void));
extern void genrtl_goto_stmt PARAMS ((tree));
extern void genrtl_expr_stmt PARAMS ((tree));
extern void genrtl_decl_stmt PARAMS ((tree));
......@@ -4654,9 +4622,6 @@ extern tree build_x_modify_expr PARAMS ((tree, enum tree_code, tree));
extern tree build_modify_expr PARAMS ((tree, enum tree_code, tree));
extern tree dubious_conversion_warnings PARAMS ((tree, tree, const char *, tree, int));
extern tree convert_for_initialization PARAMS ((tree, tree, tree, int, const char *, tree, int));
extern void c_expand_asm_operands PARAMS ((tree, tree, tree, tree, int, const char *, int));
extern void c_expand_return PARAMS ((tree));
extern tree c_expand_start_case PARAMS ((tree));
extern int comp_ptr_ttypes PARAMS ((tree, tree));
extern int ptr_reasonably_similar PARAMS ((tree, tree));
extern tree build_ptrmemfunc PARAMS ((tree, tree, int));
......
......@@ -7887,30 +7887,6 @@ make_rtl_for_nonlocal_decl (decl, init, asmspec)
rest_of_decl_compilation (decl, asmspec, toplev, at_eof);
}
/* Create RTL for the local static variable DECL. */
void
make_rtl_for_local_static (decl)
tree decl;
{
const char *asmspec = NULL;
/* If we inlined this variable, we could see it's declaration
again. */
if (DECL_RTL (decl))
return;
if (DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl))
{
/* The only way this situaton can occur is if the
user specified a name for this DECL using the
`attribute' syntax. */
asmspec = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
DECL_ASSEMBLER_NAME (decl) = DECL_NAME (decl);
}
rest_of_decl_compilation (decl, asmspec, /*top_level=*/0, /*at_end=*/0);
}
/* The old ARM scoping rules injected variables declared in the
initialization statement of a for-statement into the surrounding
......@@ -7997,13 +7973,13 @@ initialize_local_var (decl, init, flags)
emit_line_note (DECL_SOURCE_FILE (decl),
DECL_SOURCE_LINE (decl));
saved_stmts_are_full_exprs_p = stmts_are_full_exprs_p;
stmts_are_full_exprs_p = 1;
saved_stmts_are_full_exprs_p = stmts_are_full_exprs_p ();
current_stmt_tree->stmts_are_full_exprs_p = 1;
if (building_stmt_tree ())
finish_expr_stmt (build_aggr_init (decl, init, flags));
else
genrtl_expr_stmt (build_aggr_init (decl, init, flags));
stmts_are_full_exprs_p = saved_stmts_are_full_exprs_p;
current_stmt_tree->stmts_are_full_exprs_p = saved_stmts_are_full_exprs_p;
}
/* Set this to 0 so we can tell whether an aggregate which was
......@@ -8056,39 +8032,7 @@ destroy_local_var (decl)
finish_decl_cleanup (decl, cleanup);
}
/* Let the back-end know about DECL. */
void
emit_local_var (decl)
tree decl;
{
/* Create RTL for this variable. */
if (DECL_RTL (decl))
/* Only a RESULT_DECL should have non-NULL RTL when arriving here.
All other local variables are assigned RTL in this function. */
my_friendly_assert (TREE_CODE (decl) == RESULT_DECL,
19990828);
else
{
if (DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl))
/* The user must have specified an assembler name for this
variable. Set that up now. */
rest_of_decl_compilation
(decl, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)),
/*top_level=*/0, /*at_end=*/0);
else
expand_decl (decl);
}
/* Actually do the initialization. */
if (stmts_are_full_exprs_p)
expand_start_target_temps ();
expand_decl_init (decl);
if (stmts_are_full_exprs_p)
expand_end_target_temps ();
}
/* Finish processing of a declaration;
install its line number and initial value.
......@@ -14966,7 +14910,7 @@ push_cp_function_context (f)
/* Whenever we start a new function, we destroy temporaries in the
usual way. */
stmts_are_full_exprs_p = 1;
current_stmt_tree->stmts_are_full_exprs_p = 1;
}
/* Free the language-specific parts of F, now that we've finished
......
......@@ -923,7 +923,7 @@ expand_throw (exp)
first. Since there could be temps in the expression, we need
to handle that, too. */
my_friendly_assert (stmts_are_full_exprs_p == 1, 19990926);
my_friendly_assert (stmts_are_full_exprs_p () == 1, 19990926);
/* Store the throw expression into a temp. This can be less
efficient than storing it into the allocated space directly, but
......
......@@ -1223,12 +1223,12 @@ build_aggr_init (exp, init, flags)
TREE_TYPE (exp) = TYPE_MAIN_VARIANT (type);
begin_init_stmts (&stmt_expr, &compound_stmt);
destroy_temps = stmts_are_full_exprs_p;
stmts_are_full_exprs_p = 0;
destroy_temps = stmts_are_full_exprs_p ();
current_stmt_tree->stmts_are_full_exprs_p = 0;
expand_aggr_init_1 (TYPE_BINFO (type), exp, exp,
init, LOOKUP_NORMAL|flags);
stmt_expr = finish_init_stmts (stmt_expr, compound_stmt);
stmts_are_full_exprs_p = destroy_temps;
current_stmt_tree->stmts_are_full_exprs_p = destroy_temps;
TREE_TYPE (exp) = type;
TREE_READONLY (exp) = was_const;
TREE_THIS_VOLATILE (exp) = was_volatile;
......@@ -2850,8 +2850,8 @@ build_vec_init (decl, base, maxindex, init, from_array)
of blocks of memory. */
begin_init_stmts (&stmt_expr, &compound_stmt);
destroy_temps = stmts_are_full_exprs_p;
stmts_are_full_exprs_p = 0;
destroy_temps = stmts_are_full_exprs_p ();
current_stmt_tree->stmts_are_full_exprs_p = 0;
rval = get_temp_regvar (ptype,
cp_convert (ptype, default_conversion (base)));
base = get_temp_regvar (ptype, rval);
......@@ -3013,9 +3013,9 @@ build_vec_init (decl, base, maxindex, init, from_array)
}
else
{
stmts_are_full_exprs_p = 1;
current_stmt_tree->stmts_are_full_exprs_p = 1;
finish_expr_stmt (elt_init);
stmts_are_full_exprs_p = 0;
current_stmt_tree->stmts_are_full_exprs_p = 0;
}
finish_expr_stmt (build_modify_expr
......@@ -3065,7 +3065,7 @@ build_vec_init (decl, base, maxindex, init, from_array)
finish_expr_stmt (rval);
stmt_expr = finish_init_stmts (stmt_expr, compound_stmt);
stmts_are_full_exprs_p = destroy_temps;
current_stmt_tree->stmts_are_full_exprs_p = destroy_temps;
return stmt_expr;
}
......
......@@ -989,7 +989,7 @@ maybe_clone_body (fn)
VARRAY_FREE (id.fns);
/* Now, expand this function into RTL, if appropriate. */
current_function_name_declared = 1;
cp_function_chain->name_declared = 1;
expand_body (finish_function (0));
pop_from_top_level ();
}
......
......@@ -9712,7 +9712,7 @@ instantiate_decl (d, defer_ok)
/* We already set up __FUNCTION__, etc., so we don't want to do
it again now. */
current_function_name_declared = 1;
cp_function_chain->name_declared = 1;
/* Substitute into the body of the function. */
tsubst_expr (DECL_SAVED_TREE (code_pattern), args,
......
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