aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBen Chelf <chelf@gcc.gnu.org>2000-07-01 22:23:01 -0700
committerBen Chelf <chelf@gcc.gnu.org>2000-07-01 22:23:01 -0700
commitf2c5f623b0eec0fbac3eda4d020cccbca01d7afc (patch)
tree322133cfcfd4ce1672bbd64e4e165811a77d8828 /gcc
parentd6f46e4177b1d39d36f5906e67939941c009d995 (diff)
downloadgcc-f2c5f623b0eec0fbac3eda4d020cccbca01d7afc.zip
gcc-f2c5f623b0eec0fbac3eda4d020cccbca01d7afc.tar.gz
gcc-f2c5f623b0eec0fbac3eda4d020cccbca01d7afc.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog86
-rw-r--r--gcc/Makefile.in6
-rw-r--r--gcc/c-common.h66
-rw-r--r--gcc/c-decl.c70
-rw-r--r--gcc/c-semantics.c491
-rw-r--r--gcc/c-tree.h5
-rw-r--r--gcc/cp/ChangeLog109
-rw-r--r--gcc/cp/Make-lang.in2
-rw-r--r--gcc/cp/Makefile.in4
-rw-r--r--gcc/cp/cp-tree.h63
-rw-r--r--gcc/cp/decl.c64
-rw-r--r--gcc/cp/except.c2
-rw-r--r--gcc/cp/init.c16
-rw-r--r--gcc/cp/optimize.c2
-rw-r--r--gcc/cp/pt.c2
-rw-r--r--gcc/cp/semantics.c568
16 files changed, 916 insertions, 640 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 48eef23..0e823eb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,89 @@
+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
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 74b40f3..a18c76b 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -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 = \
diff --git a/gcc/c-common.h b/gcc/c-common.h
index 9fd9bdd..53bbfba 100644
--- a/gcc/c-common.h
+++ b/gcc/c-common.h
@@ -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));
-
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 21f71f8..8319f45 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -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 ();
+}
diff --git a/gcc/c-semantics.c b/gcc/c-semantics.c
new file mode 100644
index 0000000..42cdf08e
--- /dev/null
+++ b/gcc/c-semantics.c
@@ -0,0 +1,491 @@
+/* This file contains the definitions and documentation for the common
+ tree codes used in the GNU C and C++ compilers (see c-common.def
+ for the standard codes).
+ Copyright (C) 2000 Free Software Foundation, Inc. Written by
+ Benjamin Chelf (chelf@codesourcery.com).
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+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. */
+
+#include "config.h"
+#include "system.h"
+#include "tree.h"
+#include "function.h"
+#include "splay-tree.h"
+#include "varray.h"
+#include "c-common.h"
+#include "except.h"
+#include "toplev.h"
+#include "flags.h"
+#include "ggc.h"
+#include "rtl.h"
+#include "output.h"
+#include "timevar.h"
+
+/* Some statements, like for-statements or if-statements, require a
+ condition. This condition can be a declaration. If T is such a
+ declaration it is processed, and an expression appropriate to use
+ as the condition is returned. Otherwise, T itself is returned. */
+
+tree
+expand_cond (t)
+ tree t;
+{
+ if (t && TREE_CODE (t) == TREE_LIST)
+ {
+ expand_stmt (TREE_PURPOSE (t));
+ return TREE_VALUE (t);
+ }
+ else
+ return t;
+}
+
+/* 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);
+}
+
+/* Let the back-end know about DECL. */
+
+void
+emit_local_var (decl)
+ tree decl;
+{
+ /* Create RTL for this variable. */
+ if (!DECL_RTL (decl))
+ {
+ 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 ();
+}
+
+/* Helper for generating the RTL at the beginning of a scope. */
+
+void
+genrtl_do_pushlevel ()
+{
+ emit_line_note (input_filename, lineno);
+ clear_last_expr ();
+}
+
+/* Helper for generating the RTL. */
+
+void
+genrtl_clear_out_block ()
+{
+ /* If COND wasn't a declaration, clear out the
+ block we made for it and start a new one here so the
+ optimization in expand_end_loop will work. */
+ if (getdecls () == NULL_TREE)
+ genrtl_do_pushlevel ();
+}
+
+/* Generate the RTL for DESTINATION, which is a GOTO_STMT. */
+
+void
+genrtl_goto_stmt (destination)
+ tree destination;
+{
+ if (TREE_CODE (destination) == IDENTIFIER_NODE)
+ abort ();
+
+ /* We warn about unused labels with -Wunused. That means we have to
+ mark the used labels as used. */
+ if (TREE_CODE (destination) == LABEL_DECL)
+ TREE_USED (destination) = 1;
+
+ emit_line_note (input_filename, lineno);
+
+ if (TREE_CODE (destination) == LABEL_DECL)
+ {
+ label_rtx (destination);
+ expand_goto (destination);
+ }
+ else
+ expand_computed_goto (destination);
+}
+
+/* Generate the RTL for EXPR, which is an EXPR_STMT. */
+
+void
+genrtl_expr_stmt (expr)
+ tree expr;
+{
+ if (expr != NULL_TREE)
+ {
+ emit_line_note (input_filename, lineno);
+
+ if (stmts_are_full_exprs_p ())
+ expand_start_target_temps ();
+
+ lang_expand_expr_stmt (expr);
+
+ if (stmts_are_full_exprs_p ())
+ expand_end_target_temps ();
+ }
+}
+
+/* Generate the RTL for T, which is a DECL_STMT. */
+
+void
+genrtl_decl_stmt (t)
+ tree t;
+{
+ tree decl;
+ emit_line_note (input_filename, lineno);
+ decl = DECL_STMT_DECL (t);
+ /* If this is a declaration for an automatic local
+ variable, initialize it. Note that we might also see a
+ declaration for a namespace-scope object (declared with
+ `extern'). We don't have to handle the initialization
+ of those objects here; they can only be declarations,
+ rather than definitions. */
+ if (TREE_CODE (decl) == VAR_DECL
+ && !TREE_STATIC (decl)
+ && !DECL_EXTERNAL (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))
+ {
+ if (DECL_ARTIFICIAL (decl) && ! TREE_USED (decl))
+ /* Do not emit unused decls. This is not just an
+ optimization. We really do not want to emit
+ __PRETTY_FUNCTION__ etc, if they're never used. */
+ DECL_IGNORED_P (decl) = 1;
+ else
+ make_rtl_for_local_static (decl);
+ }
+}
+
+/* Generate the RTL for T, which is an IF_STMT. */
+
+void
+genrtl_if_stmt (t)
+ tree t;
+{
+ tree cond;
+ genrtl_do_pushlevel ();
+ cond = expand_cond (IF_COND (t));
+ emit_line_note (input_filename, lineno);
+ expand_start_cond (cond, 0);
+ if (THEN_CLAUSE (t))
+ expand_stmt (THEN_CLAUSE (t));
+ if (ELSE_CLAUSE (t))
+ {
+ expand_start_else ();
+ expand_stmt (ELSE_CLAUSE (t));
+ }
+ expand_end_cond ();
+}
+
+/* Generate the RTL for T, which is a WHILE_STMT. */
+
+void
+genrtl_while_stmt (t)
+ tree t;
+{
+ tree cond;
+ emit_nop ();
+ emit_line_note (input_filename, lineno);
+ expand_start_loop (1);
+ genrtl_do_pushlevel ();
+
+ cond = expand_cond (WHILE_COND (t));
+ emit_line_note (input_filename, lineno);
+ expand_exit_loop_if_false (0, cond);
+ genrtl_clear_out_block ();
+
+ expand_stmt (WHILE_BODY (t));
+
+ expand_end_loop ();
+}
+
+/* Generate the RTL for T, which is a DO_STMT. */
+
+void
+genrtl_do_stmt (t)
+ tree t;
+{
+ tree cond;
+ emit_nop ();
+ emit_line_note (input_filename, lineno);
+ expand_start_loop_continue_elsewhere (1);
+
+ expand_stmt (DO_BODY (t));
+
+ expand_loop_continue_here ();
+
+ cond = expand_cond (DO_COND (t));
+ emit_line_note (input_filename, lineno);
+ expand_exit_loop_if_false (0, cond);
+ expand_end_loop ();
+}
+
+/* Generate the RTL for EXPR, which is a RETURN_STMT. */
+
+void
+genrtl_return_stmt (expr)
+ tree expr;
+{
+ emit_line_note (input_filename, lineno);
+ c_expand_return (expr);
+}
+
+/* Generate the RTL for T, which is a FOR_STMT. */
+
+void
+genrtl_for_stmt (t)
+ tree t;
+{
+ tree tmp;
+ tree cond;
+ if (NEW_FOR_SCOPE_P (t))
+ genrtl_do_pushlevel ();
+
+ expand_stmt (FOR_INIT_STMT (t));
+
+ emit_nop ();
+ emit_line_note (input_filename, lineno);
+ expand_start_loop_continue_elsewhere (1);
+ genrtl_do_pushlevel ();
+ cond = expand_cond (FOR_COND (t));
+ emit_line_note (input_filename, lineno);
+ if (cond)
+ expand_exit_loop_if_false (0, cond);
+ genrtl_clear_out_block ();
+ tmp = FOR_EXPR (t);
+
+ expand_stmt (FOR_BODY (t));
+
+ emit_line_note (input_filename, lineno);
+ expand_loop_continue_here ();
+ if (tmp)
+ genrtl_expr_stmt (tmp);
+ expand_end_loop ();
+}
+
+/* Generate the RTL for a BREAK_STMT. */
+
+void
+genrtl_break_stmt ()
+{
+ emit_line_note (input_filename, lineno);
+ if ( ! expand_exit_something ())
+ error ("break statement not within loop or switch");
+}
+
+/* Generate the RTL for a CONTINUE_STMT. */
+
+void
+genrtl_continue_stmt ()
+{
+ emit_line_note (input_filename, lineno);
+ if (! expand_continue_loop (0))
+ error ("continue statement not within a loop");
+}
+
+/* Generate the RTL for T, which is a SCOPE_STMT. */
+
+void
+genrtl_scope_stmt (t)
+ tree t;
+{
+ if (!SCOPE_NO_CLEANUPS_P (t))
+ {
+ if (SCOPE_BEGIN_P (t))
+ expand_start_bindings_and_block (2 * SCOPE_NULLIFIED_P (t),
+ SCOPE_STMT_BLOCK (t));
+ else if (SCOPE_END_P (t))
+ expand_end_bindings (NULL_TREE, !SCOPE_NULLIFIED_P (t), 0);
+ }
+ else if (!SCOPE_NULLIFIED_P (t))
+ {
+ rtx note = emit_note (NULL,
+ (SCOPE_BEGIN_P (t)
+ ? NOTE_INSN_BLOCK_BEG
+ : NOTE_INSN_BLOCK_END));
+ NOTE_BLOCK (note) = SCOPE_STMT_BLOCK (t);
+ }
+}
+
+/* Generate the RTL for T, which is a SWITCH_STMT. */
+
+void
+genrtl_switch_stmt (t)
+ tree t;
+{
+ tree cond;
+ genrtl_do_pushlevel ();
+
+ cond = expand_cond (SWITCH_COND (t));
+ if (cond != error_mark_node)
+ {
+ emit_line_note (input_filename, lineno);
+ c_expand_start_case (cond);
+ }
+ else
+ /* The code is in error, but we don't want expand_end_case to
+ crash. */
+ c_expand_start_case (boolean_false_node);
+
+ expand_stmt (SWITCH_BODY (t));
+
+ expand_end_case (cond);
+}
+
+/* Generate the RTL for a CASE_LABEL. */
+
+void
+genrtl_case_label (low_value, high_value)
+ tree low_value;
+ tree high_value;
+{
+ do_case (low_value, high_value);
+}
+
+/* Generate the RTL for the start of a COMPOUND_STMT. */
+
+tree
+genrtl_begin_compound_stmt (has_no_scope)
+ int has_no_scope;
+{
+ /* If this is the outermost block of the function, declare the
+ variables __FUNCTION__, __PRETTY_FUNCTION__, and so forth. */
+ if (cfun
+ && !current_function_name_declared ()
+ && !has_no_scope)
+ {
+ set_current_function_name_declared (1);
+ declare_function_name ();
+ }
+
+ return NULL_TREE;
+}
+
+/* Generate the RTL for the end of a COMPOUND_STMT. */
+
+tree genrtl_finish_compound_stmt (has_no_scope)
+ int has_no_scope;
+{
+ return NULL_TREE;
+}
+
+/* Generate the RTL for T, which is a COMPOUND_STMT. */
+
+tree
+genrtl_compound_stmt (t)
+ tree t;
+{
+ genrtl_begin_compound_stmt (COMPOUND_STMT_NO_SCOPE (t));
+ expand_stmt (COMPOUND_BODY (t));
+ return (genrtl_finish_compound_stmt (COMPOUND_STMT_NO_SCOPE (t)));
+}
+
+/* Generate the RTL for an ASM_STMT. */
+
+void
+genrtl_asm_stmt (cv_qualifier, string, output_operands,
+ input_operands, clobbers)
+ tree cv_qualifier;
+ tree string;
+ tree output_operands;
+ tree input_operands;
+ tree clobbers;
+{
+ if (TREE_CHAIN (string))
+ string = combine_strings (string);
+
+ if (cv_qualifier != NULL_TREE
+ && cv_qualifier != ridpointers[(int) RID_VOLATILE])
+ {
+ warning ("%s qualifier ignored on asm",
+ IDENTIFIER_POINTER (cv_qualifier));
+ cv_qualifier = NULL_TREE;
+ }
+
+ emit_line_note (input_filename, lineno);
+ if (output_operands != NULL_TREE || input_operands != NULL_TREE
+ || clobbers != NULL_TREE)
+ c_expand_asm_operands (string, output_operands,
+ input_operands,
+ clobbers,
+ cv_qualifier != NULL_TREE,
+ input_filename, lineno);
+ else
+ expand_asm (string);
+}
+
+/* Generate the RTL for a DECL_CLEANUP. */
+
+void
+genrtl_decl_cleanup (decl, cleanup)
+ tree decl;
+ tree cleanup;
+{
+ if (!decl || (DECL_SIZE (decl) && TREE_TYPE (decl) != error_mark_node))
+ expand_decl_cleanup (decl, cleanup);
+}
+
+tree
+expand_stmt (t)
+ tree t;
+{
+ tree rval;
+ rval = lang_expand_stmt (t);
+ return rval;
+}
diff --git a/gcc/c-tree.h b/gcc/c-tree.h
index 8619071..fcf6112 100644
--- a/gcc/c-tree.h
+++ b/gcc/c-tree.h
@@ -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;
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a1d99de..60c9b8b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,95 @@
+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.
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index 91a1a54..8e483a5 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -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)
diff --git a/gcc/cp/Makefile.in b/gcc/cp/Makefile.in
index 2232986..df95a2d 100644
--- a/gcc/cp/Makefile.in
+++ b/gcc/cp/Makefile.in
@@ -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)
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 373114f..4356792 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -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));
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 3e952ed..9110b80 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -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
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index 24b4310..e872859 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -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
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 1f21f4e..b1c3af9 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -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;
}
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c
index d2b3c8e..0234734 100644
--- a/gcc/cp/optimize.c
+++ b/gcc/cp/optimize.c
@@ -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 ();
}
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 28e2e72..0eec453 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -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,
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index d93ddd8..c14909d 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -46,7 +46,6 @@
parsing into this file; that will make implementing the new parser
much easier since it will be able to make use of these routines. */
-static tree expand_cond PARAMS ((tree));
static tree maybe_convert_cond PARAMS ((tree));
static tree simplify_aggr_init_exprs_r PARAMS ((tree *, int *, void *));
static void deferred_type_access_control PARAMS ((void));
@@ -88,55 +87,63 @@ static void emit_associated_thunks PARAMS ((tree));
substmt = cond; \
} while (0)
-/* Finish a scope. */
+/* Wrapper since C and C++ expand_expr_stmt are different. */
-tree
-do_poplevel ()
+expand_expr_stmt_fn lang_expand_expr_stmt = cplus_expand_expr_stmt;
+
+/* Wrapper function instead of #define for use with c-common code. */
+
+void
+set_current_function_name_declared (i)
+ int i;
{
- tree block = NULL_TREE;
+ cp_function_chain->name_declared = i;
+}
- if (stmts_are_full_exprs_p)
- {
- tree scope_stmts;
+/* 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. */
- if (!processing_template_decl)
- scope_stmts = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0);
+int
+stmts_are_full_exprs_p ()
+{
+ return current_stmt_tree->stmts_are_full_exprs_p;
+}
- block = poplevel (kept_level_p (), 1, 0);
- if (block && !processing_template_decl)
- {
- SCOPE_STMT_BLOCK (TREE_PURPOSE (scope_stmts)) = block;
- SCOPE_STMT_BLOCK (TREE_VALUE (scope_stmts)) = block;
- }
- }
+/* One if we have already declared __FUNCTION__ (and related
+ variables) in the current function. Two if we are in the process
+ of doing so. */
- return block;
+int
+current_function_name_declared ()
+{
+ return cp_function_chain->name_declared;
}
-/* Begin a new scope. */
+/* Nonzero if TYPE is an anonymous union or struct type. We have to use a
+ flag for this because "A union for which objects or pointers are
+ declared is not an anonymous union" [class.union]. */
-void
-do_pushlevel ()
+int
+anon_aggr_type_p (node)
+ tree node;
{
- if (stmts_are_full_exprs_p)
- {
- pushlevel (0);
- if (!processing_template_decl)
- add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0);
- }
+ return (CLASS_TYPE_P (node) && TYPE_LANG_SPECIFIC(node)->anon_aggr);
}
-/* Helper for generating the RTL at the end of a scope. */
+/* Finish a scope. */
tree
-genrtl_do_poplevel ()
+do_poplevel ()
{
tree block = NULL_TREE;
- if (stmts_are_full_exprs_p)
+ if (stmts_are_full_exprs_p ())
{
tree scope_stmts;
- scope_stmts = NULL_TREE;
+
+ if (!processing_template_decl)
+ scope_stmts = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0);
block = poplevel (kept_level_p (), 1, 0);
if (block && !processing_template_decl)
@@ -149,34 +156,16 @@ genrtl_do_poplevel ()
return block;
}
-/* Helper for generating the RTL at the beginning of a scope. */
-
-void
-genrtl_do_pushlevel ()
-{
- emit_line_note (input_filename, lineno);
- clear_last_expr ();
-
- if (stmts_are_full_exprs_p)
- {
- pushlevel (0); // Try to get rid of me.
- if (!cfun->x_whole_function_mode_p)
- my_friendly_abort (19991129);
- }
-}
-
-/* Helper for generating the RTL. */
+/* Begin a new scope. */
void
-genrtl_clear_out_block ()
+do_pushlevel ()
{
- /* If COND wasn't a declaration, clear out the
- block we made for it and start a new one here so the
- optimization in expand_end_loop will work. */
- if (getdecls () == NULL_TREE)
+ if (stmts_are_full_exprs_p ())
{
- genrtl_do_poplevel ();
- genrtl_do_pushlevel ();
+ pushlevel (0);
+ if (!processing_template_decl)
+ add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0);
}
}
@@ -191,7 +180,7 @@ add_tree (t)
SET_LAST_STMT (t);
/* When we expand a statement-tree, we must know whether or not the
statements are full-expresions. We record that fact here. */
- STMT_IS_FULL_EXPR_P (last_tree) = stmts_are_full_exprs_p;
+ STMT_IS_FULL_EXPR_P (last_tree) = stmts_are_full_exprs_p ();
}
/* Finish a goto-statement. */
@@ -220,35 +209,10 @@ finish_goto_stmt (destination)
add_tree (build_min_nt (GOTO_STMT, destination));
}
-/* Generate the RTL for DESTINATION, which is a GOTO_STMT. */
-
-void
-genrtl_goto_stmt (destination)
- tree destination;
-{
- if (TREE_CODE (destination) == IDENTIFIER_NODE)
- destination = lookup_label (destination);
-
- /* We warn about unused labels with -Wunused. That means we have to
- mark the used labels as used. */
- if (TREE_CODE (destination) == LABEL_DECL)
- TREE_USED (destination) = 1;
-
- emit_line_note (input_filename, lineno);
-
- if (TREE_CODE (destination) == LABEL_DECL)
- {
- label_rtx (destination);
- expand_goto (destination);
- }
- else
- expand_computed_goto (destination);
-}
-
/* COND is the condition-expression for an if, while, etc.,
statement. Convert it to a boolean value, if appropriate. */
-static tree
+tree
maybe_convert_cond (cond)
tree cond;
{
@@ -274,13 +238,13 @@ finish_expr_stmt (expr)
if (expr != NULL_TREE)
{
if (!processing_template_decl
- && !stmts_are_full_exprs_p
+ && !(stmts_are_full_exprs_p ())
&& ((TREE_CODE (TREE_TYPE (expr)) == ARRAY_TYPE
&& lvalue_p (expr))
|| TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE))
expr = default_conversion (expr);
- if (stmts_are_full_exprs_p)
+ if (stmts_are_full_exprs_p ())
expr = convert_to_void (expr, "statement");
if (!processing_template_decl)
@@ -296,92 +260,6 @@ finish_expr_stmt (expr)
last_expr_type = expr ? TREE_TYPE (expr) : NULL_TREE;
}
-/* Generate the RTL for EXPR, which is an EXPR_STMT. */
-
-void
-genrtl_expr_stmt (expr)
- tree expr;
-{
- if (expr != NULL_TREE)
- {
- emit_line_note (input_filename, lineno);
-
- if (stmts_are_full_exprs_p)
- expand_start_target_temps ();
-
- cplus_expand_expr_stmt (expr);
-
- if (stmts_are_full_exprs_p)
- expand_end_target_temps ();
- }
-
- finish_stmt ();
-
- /* This was an expression-statement, so we save the type of the
- expression. */
- last_expr_type = expr ? TREE_TYPE (expr) : NULL_TREE;
-}
-
-/* Generate the RTL for T, which is a DECL_STMT. */
-
-void
-genrtl_decl_stmt (t)
- tree t;
-{
- tree decl;
- emit_line_note (input_filename, lineno);
- decl = DECL_STMT_DECL (t);
- /* If this is a declaration for an automatic local
- variable, initialize it. Note that we might also see a
- declaration for a namespace-scope object (declared with
- `extern'). We don't have to handle the initialization
- of those objects here; they can only be declarations,
- rather than definitions. */
- if (TREE_CODE (decl) == VAR_DECL
- && !TREE_STATIC (decl)
- && !DECL_EXTERNAL (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))
- {
- if (DECL_ARTIFICIAL (decl) && ! TREE_USED (decl))
- /* Do not emit unused decls. This is not just an
- optimization. We really do not want to emit
- __PRETTY_FUNCTION__ etc, if they're never used. */
- DECL_IGNORED_P (decl) = 1;
- else
- make_rtl_for_local_static (decl);
- }
-}
-
-/* Generate the RTL for T, which is an IF_STMT. */
-
-void
-genrtl_if_stmt (t)
- tree t;
-{
- tree cond;
- genrtl_do_pushlevel ();
- cond = maybe_convert_cond (expand_cond (IF_COND (t)));
- emit_line_note (input_filename, lineno);
- expand_start_cond (cond, 0);
- if (THEN_CLAUSE (t))
- expand_stmt (THEN_CLAUSE (t));
- if (ELSE_CLAUSE (t))
- {
- expand_start_else ();
- expand_stmt (ELSE_CLAUSE (t));
- }
- expand_end_cond ();
- genrtl_do_poplevel ();
- finish_stmt ();
-}
/* Begin an if-statement. Returns a newly created IF_STMT if
appropriate. */
@@ -459,30 +337,6 @@ clear_out_block ()
}
}
-/* Generate the RTL for T, which is a WHILE_STMT. */
-
-void
-genrtl_while_stmt (t)
- tree t;
-{
- tree cond;
- emit_nop ();
- emit_line_note (input_filename, lineno);
- expand_start_loop (1);
- genrtl_do_pushlevel ();
-
- cond = maybe_convert_cond (expand_cond (WHILE_COND (t)));
- emit_line_note (input_filename, lineno);
- expand_exit_loop_if_false (0, cond);
- genrtl_clear_out_block ();
-
- expand_stmt (WHILE_BODY (t));
-
- genrtl_do_poplevel ();
- expand_end_loop ();
- finish_stmt ();
-}
-
/* Begin a while-statement. Returns a newly created WHILE_STMT if
appropriate. */
@@ -520,28 +374,6 @@ finish_while_stmt (while_stmt)
finish_stmt ();
}
-/* Generate the RTL for T, which is a DO_STMT. */
-
-void
-genrtl_do_stmt (t)
- tree t;
-{
- tree cond;
- emit_nop ();
- emit_line_note (input_filename, lineno);
- expand_start_loop_continue_elsewhere (1);
-
- expand_stmt (DO_BODY (t));
-
- expand_loop_continue_here ();
-
- cond = maybe_convert_cond (DO_COND (t));
- emit_line_note (input_filename, lineno);
- expand_exit_loop_if_false (0, cond);
- expand_end_loop ();
- finish_stmt ();
-}
-
/* Begin a do-statement. Returns a newly created DO_STMT if
appropriate. */
@@ -575,17 +407,6 @@ finish_do_stmt (cond, do_stmt)
finish_stmt ();
}
-/* Generate the RTL for EXPR, which is a RETURN_STMT. */
-
-void
-genrtl_return_stmt (expr)
- tree expr;
-{
- emit_line_note (input_filename, lineno);
- c_expand_return (expr);
- finish_stmt ();
-}
-
/* Finish a return-statement. The EXPRESSION returned, if any, is as
indicated. */
@@ -622,47 +443,6 @@ finish_return_stmt (expr)
finish_stmt ();
}
-/* Generate the RTL for T, which is a FOR_STMT. */
-
-void
-genrtl_for_stmt (t)
- tree t;
-{
- tree tmp;
- tree cond;
- if (flag_new_for_scope > 0)
- {
- genrtl_do_pushlevel ();
- note_level_for_for ();
- }
-
- expand_stmt (FOR_INIT_STMT (t));
-
- emit_nop ();
- emit_line_note (input_filename, lineno);
- expand_start_loop_continue_elsewhere (1);
- genrtl_do_pushlevel ();
- cond = maybe_convert_cond (expand_cond (FOR_COND (t)));
- emit_line_note (input_filename, lineno);
- if (cond)
- expand_exit_loop_if_false (0, cond);
- genrtl_clear_out_block ();
- tmp = FOR_EXPR (t);
-
- expand_stmt (FOR_BODY (t));
-
- /* Pop the scope for the body of the loop. */
- genrtl_do_poplevel ();
- emit_line_note (input_filename, lineno);
- expand_loop_continue_here ();
- if (tmp)
- genrtl_expr_stmt (tmp);
- expand_end_loop ();
- if (flag_new_for_scope > 0)
- genrtl_do_poplevel ();
- finish_stmt ();
-}
-
/* Begin a for-statement. Returns a new FOR_STMT if appropriate. */
tree
@@ -672,9 +452,9 @@ begin_for_stmt ()
r = build_min_nt (FOR_STMT, NULL_TREE, NULL_TREE,
NULL_TREE, NULL_TREE);
+ NEW_FOR_SCOPE_P (r) = flag_new_for_scope > 0;
add_tree (r);
-
- if (flag_new_for_scope > 0)
+ if (NEW_FOR_SCOPE_P (r))
{
do_pushlevel ();
note_level_for_for ();
@@ -730,21 +510,11 @@ finish_for_stmt (for_stmt)
/* Pop the scope for the body of the loop. */
do_poplevel ();
RECHAIN_STMTS (for_stmt, FOR_BODY (for_stmt));
- if (flag_new_for_scope > 0)
+ if (NEW_FOR_SCOPE_P (for_stmt))
do_poplevel ();
finish_stmt ();
}
-/* Generate the RTL for a BREAK_STMT. */
-
-void
-genrtl_break_stmt ()
-{
- emit_line_note (input_filename, lineno);
- if ( ! expand_exit_something ())
- cp_error ("break statement not within loop or switch");
-}
-
/* Finish a break-statement. */
void
@@ -754,16 +524,6 @@ finish_break_stmt ()
add_tree (build_min_nt (BREAK_STMT));
}
-/* Generate the RTL for a CONTINUE_STMT. */
-
-void
-genrtl_continue_stmt ()
-{
- emit_line_note (input_filename, lineno);
- if (! expand_continue_loop (0))
- cp_error ("continue statement not within a loop");
-}
-
/* Finish a continue-statement. */
void
@@ -773,60 +533,6 @@ finish_continue_stmt ()
add_tree (build_min_nt (CONTINUE_STMT));
}
-/* Generate the RTL for T, which is a SCOPE_STMT. */
-
-void
-genrtl_scope_stmt (t)
- tree t;
-{
- if (!SCOPE_NO_CLEANUPS_P (t))
- {
- if (SCOPE_BEGIN_P (t))
- expand_start_bindings_and_block (2 * SCOPE_NULLIFIED_P (t),
- SCOPE_STMT_BLOCK (t));
- else if (SCOPE_END_P (t))
- expand_end_bindings (NULL_TREE, !SCOPE_NULLIFIED_P (t), 0);
- }
- else if (!SCOPE_NULLIFIED_P (t))
- {
- rtx note = emit_note (NULL,
- (SCOPE_BEGIN_P (t)
- ? NOTE_INSN_BLOCK_BEG
- : NOTE_INSN_BLOCK_END));
- NOTE_BLOCK (note) = SCOPE_STMT_BLOCK (t);
- }
-}
-
-/* Generate the RTL for T, which is a SWITCH_STMT. */
-
-void
-genrtl_switch_stmt (t)
- tree t;
-{
- tree cond;
- genrtl_do_pushlevel ();
-
- cond = expand_cond (SWITCH_COND (t));
- if (cond != error_mark_node)
- {
- emit_line_note (input_filename, lineno);
- c_expand_start_case (cond);
- }
- else
- /* The code is in error, but we don't want expand_end_case to
- crash. */
- c_expand_start_case (boolean_false_node);
-
- push_switch ();
-
- expand_stmt (SWITCH_BODY (t));
-
- expand_end_case (cond);
- pop_switch ();
- genrtl_do_poplevel ();
- finish_stmt ();
-}
-
/* Begin a switch-statement. Returns a new SWITCH_STMT if
appropriate. */
@@ -892,16 +598,6 @@ finish_switch_stmt (switch_stmt)
finish_stmt ();
}
-/* Generate the RTL for a CASE_LABEL. */
-
-void
-genrtl_case_label (low_value, high_value)
- tree low_value;
- tree high_value;
-{
- do_case (low_value, high_value);
-}
-
/* Finish a case-label. */
void
@@ -1070,8 +766,6 @@ genrtl_handler (t)
expand_goto (top_label_entry (&caught_return_label_stack));
end_catch_handler ();
}
-
- genrtl_do_poplevel ();
}
/* Begin a handler. Returns a HANDLER if appropriate. */
@@ -1165,79 +859,6 @@ genrtl_ctor_stmt (t)
end_protect_partials ();
}
-/* Generate the RTL for the start of a COMPOUND_STMT. */
-
-tree genrtl_begin_compound_stmt (has_no_scope)
- int has_no_scope;
-{
- tree r;
- int is_try = 0;
-
- r = NULL_TREE;
-
- last_expr_type = NULL_TREE;
-
- if (!has_no_scope)
- {
- genrtl_do_pushlevel ();
- if (is_try)
- note_level_for_eh ();
- }
- else
- /* Normally, we try hard to keep the BLOCK for a
- statement-expression. But, if it's a statement-expression with
- a scopeless block, there's nothing to keep, and we don't want
- to accidentally keep a block *inside* the scopeless block. */
- keep_next_level (0);
-
- /* If this is the outermost block of the function, declare the
- variables __FUNCTION__, __PRETTY_FUNCTION__, and so forth. */
- if (cfun
- && !current_function_name_declared
- && !has_no_scope)
- {
- current_function_name_declared = 1;
- declare_function_name ();
- }
-
- return r;
-}
-
-/* Generate the RTL for the end of a COMPOUND_STMT. */
-
-tree genrtl_finish_compound_stmt (has_no_scope)
- int has_no_scope;
-{
- tree r;
- tree t;
-
- if (!has_no_scope)
- r = genrtl_do_poplevel ();
- else
- r = NULL_TREE;
-
- /* When we call finish_stmt we will lose LAST_EXPR_TYPE. But, since
- the precise purpose of that variable is store the type of the
- last expression statement within the last compound statement, we
- preserve the value. */
- t = last_expr_type;
- finish_stmt ();
- last_expr_type = t;
-
- return r;
-}
-
-/* Generate the RTL for T, which is a COMPOUND_STMT. */
-
-tree
-genrtl_compound_stmt (t)
- tree t;
-{
- genrtl_begin_compound_stmt (COMPOUND_STMT_NO_SCOPE (t));
- expand_stmt (COMPOUND_BODY (t));
- return (genrtl_finish_compound_stmt (COMPOUND_STMT_NO_SCOPE (t)));
-}
-
/* Begin a compound-statement. If HAS_NO_SCOPE is non-zero, the
compound-statement does not define a scope. Returns a new
COMPOUND_STMT if appropriate. */
@@ -1276,10 +897,10 @@ begin_compound_stmt (has_no_scope)
/* If this is the outermost block of the function, declare the
variables __FUNCTION__, __PRETTY_FUNCTION__, and so forth. */
if (cfun
- && !current_function_name_declared
+ && !(current_function_name_declared () )
&& !has_no_scope)
{
- current_function_name_declared = 1;
+ cp_function_chain->name_declared = 1;
declare_function_name ();
}
@@ -1316,42 +937,6 @@ finish_compound_stmt (has_no_scope, compound_stmt)
return r;
}
-/* Generate the RTL for an ASM_STMT. */
-
-void
-genrtl_asm_stmt (cv_qualifier, string, output_operands,
- input_operands, clobbers)
- tree cv_qualifier;
- tree string;
- tree output_operands;
- tree input_operands;
- tree clobbers;
-{
- if (TREE_CHAIN (string))
- string = combine_strings (string);
-
- if (cv_qualifier != NULL_TREE
- && cv_qualifier != ridpointers[(int) RID_VOLATILE])
- {
- cp_warning ("%s qualifier ignored on asm",
- IDENTIFIER_POINTER (cv_qualifier));
- cv_qualifier = NULL_TREE;
- }
-
- emit_line_note (input_filename, lineno);
- if (output_operands != NULL_TREE || input_operands != NULL_TREE
- || clobbers != NULL_TREE)
- c_expand_asm_operands (string, output_operands,
- input_operands,
- clobbers,
- cv_qualifier != NULL_TREE,
- input_filename, lineno);
- else
- expand_asm (string);
-
- finish_stmt ();
-}
-
/* Finish an asm-statement, whose components are a CV_QUALIFIER, a
STRING, some OUTPUT_OPERANDS, some INPUT_OPERANDS, and some
CLOBBERS. */
@@ -1446,17 +1031,6 @@ finish_subobject (cleanup)
add_tree (r);
}
-/* Generate the RTL for a DECL_CLEANUP. */
-
-void
-genrtl_decl_cleanup (decl, cleanup)
- tree decl;
- tree cleanup;
-{
- if (!decl || (DECL_SIZE (decl) && TREE_TYPE (decl) != error_mark_node))
- expand_decl_cleanup (decl, cleanup);
-}
-
/* When DECL goes out of scope, make sure that CLEANUP is executed. */
void
@@ -1694,10 +1268,10 @@ setup_vtbl_ptr (member_init_list, base_init_list)
/* Don't declare __PRETTY_FUNCTION__ and friends here when we
open the block for the if-body. */
- saved_cfnd = current_function_name_declared;
- current_function_name_declared = 1;
+ saved_cfnd = current_function_name_declared ();
+ cp_function_chain->name_declared = 1;
compound_stmt = begin_compound_stmt (/*has_no_scope=*/0);
- current_function_name_declared = saved_cfnd;
+ cp_function_chain->name_declared = saved_cfnd;
/* Make all virtual function table pointers in non-virtual base
classes point to CURRENT_CLASS_TYPE's virtual function
@@ -2722,32 +2296,14 @@ prep_stmt (t)
{
if (!STMT_LINENO_FOR_FN_P (t))
lineno = STMT_LINENO (t);
- stmts_are_full_exprs_p = STMT_IS_FULL_EXPR_P (t);
-}
-
-/* Some statements, like for-statements or if-statements, require a
- condition. This condition can be a declaration. If T is such a
- declaration it is processed, and an expression appropriate to use
- as the condition is returned. Otherwise, T itself is returned. */
-
-static tree
-expand_cond (t)
- tree t;
-{
- if (t && TREE_CODE (t) == TREE_LIST)
- {
- expand_stmt (TREE_PURPOSE (t));
- return TREE_VALUE (t);
- }
- else
- return t;
+ current_stmt_tree->stmts_are_full_exprs_p = STMT_IS_FULL_EXPR_P (t);
}
/* Generate RTL for the statement T, and its substatements, and any
other statements at its nesting level. */
tree
-expand_stmt (t)
+lang_expand_stmt (t)
tree t;
{
tree rval = NULL_TREE;
@@ -2760,7 +2316,7 @@ expand_stmt (t)
rval = NULL_TREE;
/* Set up context appropriately for handling this statement. */
- saved_stmts_are_full_exprs_p = stmts_are_full_exprs_p;
+ saved_stmts_are_full_exprs_p = stmts_are_full_exprs_p ();
prep_stmt (t);
switch (TREE_CODE (t))
@@ -2865,7 +2421,7 @@ expand_stmt (t)
}
/* Restore saved state. */
- 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;
/* Go on to the next statement in this scope. */
t = TREE_CHAIN (t);
@@ -3107,14 +2663,14 @@ expand_body (fn)
/* We don't need to redeclare __FUNCTION__, __PRETTY_FUNCTION__, or
any of the other magic variables we set up when starting a
function body. */
- current_function_name_declared = 1;
+ cp_function_chain->name_declared = 1;
/* Expand the body. */
expand_stmt (DECL_SAVED_TREE (fn));
/* Statements should always be full-expressions at the outermost set
of curly braces for a function. */
- my_friendly_assert (stmts_are_full_exprs_p, 19990831);
+ my_friendly_assert (stmts_are_full_exprs_p (), 19990831);
/* The outermost statement for a function contains the line number
recorded when we finished processing the function. */