Commit Graph

48 Commits

Author SHA1 Message Date
Jason Merrill da4ac6f859 comment
From-SVN: r39044
2001-01-15 12:06:49 -05:00
Jakub Jelinek 5eec284733 optimize.c (copy_body_r): Set STMT_IS_FULL_EXPR_P on EXPR_STMT.
* optimize.c (copy_body_r): Set STMT_IS_FULL_EXPR_P on EXPR_STMT.

	* g++.old-deja/g++.other/cleanup4.C: New test.

From-SVN: r38110
2000-12-07 10:19:10 +01:00
Mark Mitchell f9808f81c9 expr.c (do_preexpand_calls): Remove.
* expr.c (do_preexpand_calls): Remove.
	(same_from_p): Don't use CALL_EXPR_RTL.
	(expand_expr): Don't call preexpand_calls, or use CALL_EXPR_RTL.
	(preexpand_calls): Remove.
	* tree.c (first_rtl_op): Remove CALL_EXPR case.
	(unsave_expr_1): Likewise.
	* tree.def (CALL_EXPR): Give it only two slots.
	* tree.h (CALL_EXPR_RTL): Remove.

	* optimize.c (copy_body_r): Don't treat CALL_EXPRs specially.

From-SVN: r37012
2000-10-23 04:40:26 +00:00
Mark Mitchell 8f17b5c5cb splay-tree.c (splay_tree_predecessor): Fix typo in comment.
* splay-tree.c (splay_tree_predecessor): Fix typo in comment.

	Convert the C front-end to use function-at-a-time mode.
	* c-common.h: Include splay-tree.h.
	(C_DECLARED_LABEL_FLAG): New macro.
	(struct language_function): Add x_scope_stmt_stack and
	x_function_name_declared_p.
	(RECHAIN_STMTS): Move definition.
	(lang_statment_code_p): Likewise.
	(lang_expand_stmt): Likewise.
	(lang_expand_decl_stmt): New variable.
	(lang_expand_function_end): Likewise.
	(current_scope_stmt_stack): New function.
	(add_decl_stmt): Likewise.
	(add_scope_stmt): Likewise.
	(mark_stmt_tree): Likewise.
	(struct c_lang_decl): New structure.
	(DECL_SAVED_TREE): Define.
	(c_mark_lang_decl): New function.
	(c_expand_start_cond): Change prototype.
	(c_finish_then): New function.
	(c_finish_else): Likewise.
	(current_function_name_declared): Remove.
	(set_current_function_name_declared): Likewise.
	(mark_c_language_function): Declare.
	(case_compare): Likewise.
	(c_add_case_label): Likewise.
	(c_expand_expr): Likewise.
	(c_safe_from_p): Likewise.
	* c-common.c (lang_expand_function_end): New variable.
	(struct if_elt): Add if_stmt.
	(c_expand_start_cond): Add the if-statement to the statement-tree,
	rather than generating RTL.
	(c_finish_then): New function.
	(c_expand_start_else): Don't generate RTL.
	(c_finish_else): New function.
	(c_expand_expr_stmt): Don't generate RTL.
	(statement_code_p): Add SCOPE_STMT.
	(case_compare): New function.
	(c_add_case_label): Likewise.
	(mark_stmt_tree): Likewise.
	(c_mark_lang_decl): Likewise.
	(mark_c_language_function): Likewise.
	(c_expand_expr): Likewise.
	(c_safe_from_p): Likewise.
	* c-decl.c (c_stmt_tree): New variable
	(c_scope_stmt_stack): Likewise.
	(c_function_name_declared_p): Likewise.
	(lang_expand_expr_stmt): Remove.
	(poplevel): Don't call output_inline_function for nested
	functions.
	(pushdecl): Don't set DECL_CONTEXT for a local declaration of an
	`extern' function.
	(redeclaration_error_message): Change means of computing whether
	or not a function is nested.
	(lookup_label): Don't call label_rtx.
	(init_decl_processing): Add more GC roots.
	(start_decl): Add DECL_STMTs to the statement-tree, rather than
	calling rest_of_decl_compilation.
	(finish_decl): Don't call expand_decl.
	(store_parm_decls): Begin the statement-tree, but don't generate
	RTL.
	(finish_function): Tie off the statement-tree.  Call c_expand_body
	if appropriate.
	(c_expand_body): New function.
	(push_c_function_context): Save more information.
	(pop_c_function_contxt): Likewise.
	(copy_lang_decl): Now that we use DECL_LANG_SPECIFIC, copy it.
	(lang_mark_tree): Mark it.
	(current_stmt_tree): Adjust.
	(current_scope_stmt_stack): New function.
	(do_case): Remove.
	(set_current_name_declared): Likewise.
	(c_begin_compound_stmt): Define.
	(c_expand_decl_stmt): Likewise.
	* c-lang.c: Include rtl.h and expr.h.
	(lang_init): Set more language-specific hooks.
	* c-lex.c: Include expr.h.
	* c-parse.in: Changes throughout to add statements to the
	statement-tree, rather than generating RTL after every statement.
	* c-semantics.c (lang_expand_decl_stmt): Define.
	(add_decl_stmt): New function.
	(add_scope_stmt): Likewise.
	(finish_stmt_tree): Tweak.
	(genrtl_expr_stmt): Likewise.
	(genrtl_decl_stmt): Handle local labels, and call
	lang_expand_decl_stmt if required.
	(genrtl_for_stmt): Fix line-number handling.
	(genrtl_case_label): Handle cleanups.
	(genrtl_asm_stmt): Don't call combine_strings.
	(genrtl_compound_stmt): Simplify.
	(expand_stmt): Handle SCOPE_STMTs.
	* c-tree.h (struct lang_decl): New structure.
	(C_DECLARED_LABEL_FLAG): Remove.
	(c_begin_compound_stmt): Declare.
	(c_expand_decl_stmt): Likewise.
	(c_expand_start_case): Rename to c_start_case.
	(c_finish_case): New function.
	* c-typeck.c (start_init): Tweak setting of
	constructor_incremental.
	(c_expand_asm_operands): Tweak error-handling.  Add to the
	statement-tree.
	(c_expand_return): Add to the statement-tree.
	(c_expand_start_case): Rename to ...
	(c_start_case): ... this.
	(struct c_switch): New type.
	(switch_stack): New variable.
	(do_case): Simplify.
	(c_finish_case): New function.
	* dependence.c: Include expr.h.
	(enum dependence_type): Change spelling of enumerals.
	(check_node_dependence): Adjust.
	* expr.h (lang_safe_from_p): Declare.
	(safe_from_p): Likewise.
	* expr.c (lang_safe_from_p): New variable.
	(safe_from_p): Give it external linkage.  Use lang_safe_from_p.
	* stmt.c (expand_expr_stmt): Avoid clobberring of last_expr_type.
	* toplev.c (rest_of_decl_compilation): Robustify.
	* tree.c (contains_placeholder_p): Likewise.
	* Makefile.in: Update dependencies.
	* objc/objc-act.h: Adjust calculation of value for dummy_tree_code.
	* objc/objc-act.c: Include rtl.h, expr.h, and c-common.h.
	(objc_expand_function_end): New function.
	(finish_method_def): Use it.
	(init_objc): Initialize more language-specific hooks.
	* objc/Make-lang.in: Update dependencies.

	* cp-tree.h (struct cp_language_function): Remove
	x_scope_stmt_stack and name_declared.
	(current_scope_stmt_stack): Remove.
	(function_name_declared_p): New macro.
	(struct lang_decl_flags): Use c_lang_decl as a base class.
	(context): Remove.
	(struct lang_decl): Replace saved_tree with context.
	(DECL_FRIEND_CONTEXT): Adjust accordingly.
	(SET_DECL_FRIEND_CONTEXT): Likewise.
	(DECL_VIRTUAL_CONTEXT): Likewise.
	(DECL_SAVED_TREE): Remove.
	(C_DECLARED_LABEL_FLAG): Likewise.
	(cplus_expand_expr_stmt): Don't declare.
	(add_decl_stmt): Likewise.
	(add_scope_stmt): Likewise.
	* decl.c (mark_stmt_tree): Remove.
	(case_compare): Likewise.
	(finish_case_label): Use c_add_case_label.
	(init_decl_processing): Set more language-specific hooks.
	(build_enumerator): Fix typo in comment.
	(cplus_expand_expr_stmt): Remove.
	(mark_lang_function): Use mark_c_language_function.
	(lang_mark_tree): Use c_mark_lang_decl.
	* decl2.c: Change order of inclusion.
	* except.c: Likewise.
	* expr.c (cplus_expand_expr): Remove handling of STMT_EXPR.  Fall
	back on c_expand_expr.
	* friend.c: Include expr.h.
	* init.c: Change order of inclusion.
	* Makefile.in: Update dependencies.
	* lex.h (free_lang_decl_chain): Remove.
	* optimize.c (maybe_clone_body): Use function_name_declared_p.
	* pt.c (build_template_decl): Don't copy DECL_VIRTUAL_CONTEXT if
	it doesn't exist.
	(instantiate_decl): Use function_name_declared_p.
	* semantics.c (lang_expand_expr_stmt): Remove.
	(set_current_function_name_declared): Likewise.
	(current_function_name_declared): Likewise.
	(begin_compound_stmt): Use function_name_declared_p.
	(add_decl_stmt): Remove.
	(setup_vtbl_ptr): Use function_name_declared_p.
	(add_scope_stmt): Remove.
	(current_scope_stmt_stack): New function.
	(cp_expand_stmt): Don't handle SCOPE_STMTs.
	(expand_body): Use function_name_declared_p.
	* tree.c (cp_statement_code_p): Don't include SCOPE_STMT.
	* typeck.c: Change order of includes.
	(convert_sequence): Remove.

From-SVN: r36464
2000-09-17 07:38:23 +00:00
Mark Mitchell f444e36b2d c-common.h (genrtl_clear_out_block): Remove.
* c-common.h (genrtl_clear_out_block): Remove.
	* c-semantics.c (genrtl_clear_out_block): Remove.
	(genrtl_while_stmt): Don't call it.
	(genrtl_for_stmt): Likewise.

	* cp-tree.h (struct saved_scope): Remove x_function_parms.
	(current_function_parms): Don't define.
	(struct cp_language_function): Remove parms_stored.
	(current_function_just_assigned_this): Don't define.
	(current_function_parms_stored): Likewise.
	(static_ctors): Declare.
	(static_dtors): Likewise.
	(SF_EXPAND): Don't define.
	(expand_start_early_try_stmts): Remove declaration.
	(store_parm_decls): Likewise.
	* decl.c (static_ctors): Don't declare.
	(static_dtors): Likewise.
	(struct binding_level): Remove this_block.
	(poplevel): Remove dead code.
	(set_block): Likewise.
	(mark_binding_level): Don't mark this_block.
	(mark_saved_scope): Don't mark x_function_parms.
	(init_decl_processing): Don't add current_function_parms as a GC
	root.
	(check_function_type): Change prototype.
	(start_function): Remove RTL-generation code.
	(expand_start_early_try_stmts): Remove.
	(store_parm_decls): Give it internal linkage.  Remove
	RTL-generation code.
	(finish_function): Remove RTL-generation code.
	* decl2.c (static_ctors): Fix formatting.
	(static_dtors): Likewise.
	* method.c (use_thunk): Don't call store_parm_decls.
	(synthesize_method): Likewise.
	* optimize.c (maybe_clone_body): Likewise.
	* parse.y (fn.def2): Likewise.
	(.set_base_init): Likewise.
	(nodecls): Likewise.
	* pt.c (instantiate_decl): Likewise.
	* rtti.c (synthesize_tinfo_fn): Likewise.
	* semantics.c (genrtl_try_block): Simplify.
	(expand_body): Use genrtl_start_function and
	genrtl_finish_function.
	(genrtl_start_function): New function.
	(genrtl_finish_function): Likewise.

From-SVN: r36350
2000-09-12 06:46:00 +00:00
Mark Mitchell ee94fce6ef Makefile.in (CXX_TREE_H): Add dependency on HTAB_H.
* Makefile.in (CXX_TREE_H): Add dependency on HTAB_H.
	(pt.o): Remove dependency on HTAB_H.
	* cp-tree.h: Include hashtab.h.
	(walk_tree): Change prototype.
	(walk_tree_without_duplicates): New function.
	* decl.c (check_default_argument): Use it.
	* optimize.c (remap_decl): Adjust calls to walk_tree.
	(copy_body): Likewise.
	(expand_calls_inline): Likewise.
	(calls_setjmp_p): Use walk_tree_without_duplicates.
	* pt.c: Don't include hashtab.h.
	(for_each_template_parm): Use walk_tree_without_duplicates.
	* semantics.c (finish-stmt_tree): Likewise.
	(expand_body): Likewise.
	* tree.c (walk_tree): Add additional parameter.
	(walk_tree_without_duplicates): New function.
	(count_trees): Use it.
	(verify_stmt_tree): Adjust call to walk_tree.
	(find_tree): Use walk_tree_without_duplicates.
	(no_linkage_check): Likewise.
	(break_out_target_exprs): Adjust call to walk_tree.
	(cp_unsave): Likewise.

From-SVN: r36155
2000-09-05 07:31:27 +00:00
Mark Mitchell b2244c65f5 cp-tree.h (function_depth): Declare.
* cp-tree.h (function_depth): Declare.
	(verify_stmt_tree): Likewise.
	(find_tree): Likewise.
	* decl.c (function_depth): Give it external linkage.
	* optimize.c (optimize_function): Increment and decrement it.
	* tree.c (verify_stmt_tree_r): New function.
	(verify_stmt_tree): Likewise.
	(find_tree_r): Likewise.
	(find_tree): Likewise.

From-SVN: r35301
2000-07-27 21:10:29 +00:00
Benjamin Chelf 0dfdeca6e0 c-common.h (build_stmt): Declare.
2000-07-10  Benjamin Chelf  <chelf@codesourcery.com>

	* c-common.h (build_stmt): Declare.
	(build_continue_stmt): Likewise.
	(build_break_stmt): Likewise.
	(build_return_stmt): Likewise.

	* c-decl.c (do_case): Rewrite to do what previously done in
	c-parse.in.

	* c-semantics.c (build_stmt): Define.
	(build_return_stmt): Likewise.
	(build_break_stmt): Likewise.
	(build_continue_stmt): Likewise.
	(build_case_label): Likewise.

	* c-parse.in (BREAK): Change to build tree, then generate RTL.
	(CONTINUE): Likewise.
	(RETURN): Likewise.
	(CASE): Likewise.
	(DEFAULT): Likewise.

	* c-parse.y: Regenerate.
	* c-pasre.c: Likewise.

	* cp/semantics.c (finish_for_stmt): Remove call to emit_line_note.
	(finish_continue_stmt): Likewise.
	(begin_for_stmt): Remove call to note_level_for_for.
	(finish_goto_stmt): Change call from build_min_nt
	to build_stmt.
	(finish_expr_stmt): Likewise.
	(begin_if_stmt): Likewise.
	(begin_while_stmt): Likewise.
	(finish_while_stmt): Likewise.
	(finish_return_stmt): Likewise.
	(begin_for_stmt): Likewise.
	(finish_for_stmt): Likewise.
	(finish_break_stmt): Likewise.
	(begin_switch_stmt): Likewise.
	(finish_case_label): Likewise.
	(genrtl_try_block): Likewise.
	(begin_try_block): Likewise.
	(begin_handler): Likewise.
	(begin_compound_stmt): Likewise.
	(finish_asm_stmt): Likewise.
	(finish_label_stmt): Likewise.
	(add_decl_stmt): Likewise.
	(finish_subobject): Likewise.
	(finish_decl_cleanup): Likewise.
	(finish_named_return_value): Likewise.
	(setup_vtbl_ptr): Likewise.
	(add_scope_stmt): Likewise.
	* cp/decl.c (finish_constructor_body): Likewise.
	(finish_destructor_body): Likewise.
	* cp/optimize.c (copy_body_r): Likewise.
	(initialize_inlined_parameters): Likewise.
	(declare_return_variable): Likewise.
	(expand_call_inline): Likewise.

From-SVN: r34943
2000-07-10 03:56:23 -07:00
Ben Chelf f2c5f623b0 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
2000-07-01 22:23:01 -07:00
Nathan Sidwell b72801e28a call.c (build_conditional_expr): Use VOID_TYPE_P.
* call.c (build_conditional_expr): Use VOID_TYPE_P.
	* cvt.c (cp_convert_to_pointer): Likewise.
	(convert_to_void): Likewise.
	* error.c (dump_expr): Likewise.
	* except.c (complete_ptr_ref_or_void_ptr_p): Likewise.
	* init.c (build_delete): Likewise.
	* method.c (emit_thunk): Likewise.
	* optmize.c (declare_return_variable): Likewise.
	* rtti.c (get_tinfo_decl_dynamic): Likewise.
	(get_typeid): Likewise.
	(build_dynamic_cast_1): Likewise.
	* typeck.c (composite_pointer_type): Likewise.
	(common_type): Likewise.
	(build_indirect_ref): Likewise.
	(build_binary_op): Likewise.
	(build_x_compound_expr): Likewise.
	(check_return_expr): Likewise.
	* typeck2.c (add_exception_specifier): Likewise.

	* mangle.c (write_method_parms): Use direct comparison for end
	of parmlist.

From-SVN: r34617
2000-06-20 15:42:55 +00:00
Jason Merrill 297a5329dc tree.c (count_trees): New debugging function.
* tree.c (count_trees): New debugging function.

        * typeck.c (build_x_function_call): Use DECL_FUNCTION_TEMPLATE_P.
        * init.c (build_member_call): Pull out the name of a DECL.

        * Makefile.in (semantics.o, pt.o): Depend on TIMEVAR_H.
        * semantics.c (expand_body): Push to TV_INTEGRATION here.
        * optimize.c (optimize_function): Not here.
        * pt.c (instantiate_decl): Push to TV_PARSE.

From-SVN: r34568
2000-06-15 17:24:39 -04:00
Mark Mitchell 071f9809f9 optimize.c (expand_call_inline): Don't recurse into the code used to initialize the parameters more than once.
* optimize.c (expand_call_inline): Don't recurse into the code
	used to initialize the parameters more than once.

From-SVN: r34501
2000-06-12 19:26:43 +00:00
Mark Mitchell 459c43ad00 mangle.c (NESTED_TEMPLATE_MATCH): Fix typo in comment.
* mangle.c (NESTED_TEMPLATE_MATCH): Fix typo in comment.
	(is_std_substitution): Don't check CLASSTYPE_USE_TEMPLATE here.
	(find_substitution): Only use the `Sa' substitution for
	std::allocator, not instantiations of it.
	(write_template_prefix): Move comment.  Only use a TREE_LIST to
	represent substitutions for a member template.
	(write_array_type): Mangle array dimensions correctly.
	* optimize.c (maybe_clone_body): Copy more information from the
	cloned function.
	* pt.c (regenerate_decl_from_template): Preserve DECL_USE_TEMPLATE
	on the regenerated declaration.

From-SVN: r34497
2000-06-12 06:43:27 +00:00
Jason Merrill ea11ca7ec1 timevar.def: Add TV_EXPAND.
* timevar.def: Add TV_EXPAND.
        * timevar.c (timevar_print): Update timing information.
        * calls.c (try_to_integrate): Push to TV_INTEGRATION for inlining.

        * stmt.c (expand_return): Check for error_mark_node.

cp/:
        * semantics.c (expand_body): Push to TV_EXPAND.
        * optimize.c (optimize_function): Push to TV_INTEGRATION.
        * decl.c (start_function): Always call announce_function.

        * tinfo2.cc: Just declare abort.

From-SVN: r34470
2000-06-09 12:23:47 -04:00
Mark Mitchell 3ec6bad360 Finish implementation of VTTs.
* cp-tree.h (cp_tree_index): Add CPTI_VTT_PARM_TYPE and
	CPTI_VTT_PARM_IDENTIFIER.
	(vtt_parm_identifier): New macro.
	(vtt_parm_type): Likewise.
	(BINFO_SUBVTT_INDEX): Likewise.
	(BINFO_VPTR_INDEX): Likewise.
	(struct lang_decl): Add vtt_parm.
	(DECL_VTT_PARM): New macro.
	(DECL_USE_VTT_PARM): Likewise.
	(DECL_NEEDS_VTT_PARM_P): Likewise.
	(get_vtt_name): Declare.
	(build_artifical_parm): Likewise.
	(fixup_all_virtual_upcast_offsets): Likewise.
	(expand_indirect_vtbls_init): Remove.
	* call.c (build_new_method_call): Pass the vtt to subobject
	constructors and destructors.
	* class.c (get_vtt_name): Give it external linkage.
	(build_clone): Handle the magic VTT parameters for clones.
	(clone_function_decl): Fix typo in comment.
	(build_vtt): Keep track of the indices in the VTTs where various
	entities are stored.
	(build_vtt_inits): Likewise.
	(dfs_build_vtt_inits): Likewise.
	(build_ctor_vtbl_group): Tweak type of construction vtables.
	(dfs_accumulate_vtbl_inits): Build vtables for all bases, even
	primary bases, when building construction vtables.
	* decl.c (duplicate_decls): Handle DECL_VTT_PARM.
	(initialize_predefined_identifiers): Add vtt_parm_identifier.
	(init_decl_processing): Initialize vtt_parm_type.
	(grokfndecl): Use DECL_OVERLOADED_OPERATOR_P.
	(lang_mark_tree): Make vtt_parm.
	* decl2.c (build_artificial_parm): New function.
	(maybe_retrofit_in_chrg): Use it.  Add VTT parameters.
	(grokclassfn): Use build_artificial_parm.
	* init.c (initialize_vtbl_ptrs): Call
	fixup_all_virtual_upcast_offsets directly.
	(perform_member_init): Use the complete subobject destructor for
	member cleanups.
	(build_vtbl_address): New function.
	(expand_virtual_init): Handle VTTs.
	* optimize (maybe_clone_body): Likewise.
	* search.c (fixup_all_virtual_upcast_offsets): Give it external
	linkage.
	(expand_indirect_vtbls_init): Remove.
	* semantics.c (setup_vtbl_ptr): Fix typos in comment.
	* tree.c (make_binfo): Make them bigger.

From-SVN: r34177
2000-05-25 23:27:18 +00:00
Mark Mitchell 993894639c class.c (build_ctor_vtbl_group): Set inits.
* class.c (build_ctor_vtbl_group): Set inits.
	* optimize.c (maybe_clone_body): Set DECL_INLINE and
	DECL_THIS_INLINE appropriately for clones.

From-SVN: r34101
2000-05-23 06:31:16 +00:00
Jason Merrill 5062dbd5ae tree.c (build_target_expr_with_type): If we already have a TARGET_EXPR, just return it.
* tree.c (build_target_expr_with_type): If we already have a
        TARGET_EXPR, just return it.

        * optimize.c (initialize_inlined_parameters): Don't generate an
        EXPR_STMT if we can just use DECL_INITIAL.
        * decl.c (emit_local_var): Only make the initialization a
        full-expression if stmts_are_full_exprs_p.

From-SVN: r33595
2000-05-01 19:51:37 -04:00
Mark Mitchell 9edc391342 cp-tree.h (same_type_ignoring_top_level_qualifiers_p): New macro.
* cp-tree.h (same_type_ignoring_top_level_qualifiers_p): New
	macro.
	* call.c (standard_conversion): Use it.
	(direct_reference_binding): Likewise.
	(build_over_call): Likewise.
	(is_properly_derived_from): Likewise.
	(compare_ics): Likewise.
	* class.c (resolves_to_fixed_type_p): Likewise.
	* optimize.c (declare_return_variable): Likewise.
	* pt.c (is_specialization_of): Likewise.
	(unify): Likewise.
	* typeck.c (comp_target_parms): Likeiwse.
	(build_static_cast): Likewise.
	(build_reinterpret_cast): Likewise.
	(build_const_cast): Likewise.
	(comp_ptr_ttypes_real): Likewise.
	(comp_ptr_ttypes_const): Likewise.
	* typeck2.c (process_init_constructor): Likewise.

From-SVN: r33571
2000-05-01 16:51:17 +00:00
Mark Mitchell 738e281059 expr.c (cplus_expand_expr): Preserve temporaries when expanding STMT_EXPRs.
* expr.c (cplus_expand_expr): Preserve temporaries when expanding
	STMT_EXPRs.
	* optimize.c (struct inline_data): Add target_exprs field.
	(declare_return_variable): When a function returns an aggregate,
	use the variable declared in the TARGET_EXPR as the remapped
	DECL_RESULT.
	(expand_call_inline): Update the pending target_exprs stack.
	(optimize_function): Initialize the stack.

From-SVN: r33561
2000-05-01 05:50:40 +00:00
Mark Mitchell 04dfcc8fbe optimize.c (initialize_inlined_parameters): If the parameter is addressable...
* optimize.c (initialize_inlined_parameters): If the parameter is
	addressable, we need to make a new VAR_DECL, even if the
	initializer is constant.

From-SVN: r33553
2000-04-30 18:02:10 +00:00
Jason Merrill 0cc2105eb3 revert
From-SVN: r33531
2000-04-28 20:17:06 -04:00
Jason Merrill c083cf9a09 tree.c (get_callee_fndecl): Extract the initial value from a readonly decl.
* tree.c (get_callee_fndecl): Extract the initial value from
        a readonly decl.

        * cp/optimize.c (initialize_inlined_parameters): Call
        c_apply_type_quals_to_decl.  Set DECL_INITIAL.

From-SVN: r33518
2000-04-28 16:52:31 -04:00
Mark Mitchell 27c58e25f7 optimize.c (copy_body_r): Use STRIP_TYPE_NOPS when copying variables.
* optimize.c (copy_body_r): Use STRIP_TYPE_NOPS when copying
	variables.
	(initialize_inlined_parameters): Try to avoid creating new
	VAR_DECLs.

From-SVN: r33505
2000-04-28 06:40:28 +00:00
Jason Merrill 89a75b6d83 correct comment
From-SVN: r33425
2000-04-25 19:23:41 -04:00
Mark Mitchell 298d6f6099 cp-tree.h (IDENTIFIER_CTOR_OR_DTOR_P): New macro.
* cp-tree.h (IDENTIFIER_CTOR_OR_DTOR_P): New macro.
	(cp_tree_index): Add CPTI_PUSH_EXCEPTION_IDENTIFIER.
	(cp_push_exception_identifier): New macro.
	(DECL_COMPLETE_DESTRUCTOR_P): New macro.
	(DECL_BASE_DESTRUCTOR_P): Likewise.
	(DECL_DELETING_DESTRUCTOR_P): Likewise.
	(get_vtbl_decl_for_binfo): Fix formatting.
	(in_charge_arg_for_name): New macro.
	(maybe_build_cleanup_and_delete): Remove declaration.
	* call.c (build_field_call): Use IDENTIFIER_CTOR_OR_DTOR_P.
	(in_charge_arg_for_name): New function.
	(build_new_method_call): Use it.  Handle cloned destructors.
	(build_clone): Don't make the base constructor virtual.
	Automatically defer generated functions.
	(clone_function_decl): Handle destructors, too.
	(clone_constructors_and_destructors): Likewise.
	(create_vtable_ptr): Don't create a vtable entry for a cloned
	function.
	* decl.c (predefined_identifier): Add ctor_or_dtor_p.
	(initialize_predefined_identifiers): Update appropriately.
	(finish_destructor_body): Simplify.
	(maybe_build_cleanup_and_delete): Remove.
	* except.c (expand_throw): Handle new-ABI destructors.
	* init.c (expand_cleanup_for_base): Use base_dtor_identifier.
	(build_dtor_call): New function.
	(build_delete): Use it.  Simplify.
	* optimize.c (maybe_clone_body): Handle destructors.
	* search.c (lookup_field_queue_p): Use IDENTIFIER_CTOR_OR_DTOR_P.

From-SVN: r33096
2000-04-12 07:48:13 +00:00
Mark Mitchell db9b217498 cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER.
* cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER.
	(complete_dtor_identifier): New macro.
	(CLASSTYPE_FIRST_CONVERSION): Remove.
	(CLASSTYPE_CONSTRUCTOR_SLOT): New macro.
	(CLASSTYPE_DESTRUCTOR_SLOT): Likewise.
	(CLASSTYPE_FIRST_CONVERSION_SLOT): Likewise.
	(CLASSTYPE_CONSTRUCTORS): Likewise.
	(CLASSTYPE_DESTRUCTORS): Likewise.
	(lang_decl): Add cloned_function.
	(DECL_COMPLETE_CONSTRUCTOR_P): New macro.
	(DECL_BASE_CONSTRUCTOR_P): Likewise.
	(DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P): Likewise.
	(DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P): Likewise.
	(DECL_CLONED_FUNCTION_P): Likewise.
	(DECL_CLONED_FUNCTION): Likewise.
	(clone_function_decl): Declare.
	(maybe_clone_body): Likewise.
	* call.c (build_user_type_conversion_1): Call complete object
	constructors in the new ABI.
	(build_new_method_call): Don't add in-charge parameters under the
	new ABI.
	* class.c (add_method): Use DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P,
	DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P, CLASSTYPE_CONSTRUCTOR_SLOT, and
	CLASSTYPE_DESTRUCTOR_SLOT.
	(build_clone): New function.
	(clone_function_decl): Likewise.
	(clone_constructors_and_destructors): Likewise.
	(check_bases_and_members): Use it.
	* decl.c (iniitialize_predefined_identifiers): Initialize
	complete_dtor_identifier.
	(finish_function): Don't add extra code to a clone.
	(lang_mark_tree): Mark cloned_function.
	* decl2.c (mark_used): Don't bother trying to instantiate things
	we synthesized.
	* dump.c (dequeue_and_dump): Don't dump CP_DECL_CONTEXT twice.
	* method.c (set_mangled_name_for_decl): Don't treat clones as
	constructors.
	(synthesize_method): Sythesize cloned functions, not the clones.
	* optimize.c (inline_data): Update comment on ret_label.
	(remap_block): Don't assume DECL_INITIAL exists.
	(copy_body_r): Allow ret_label to be NULL.
	(maybe_clone_body): Define.
	* pt.c (tsubst_decl): Handle clones.
	(instantiate_clone): New function.
	(instantiate_template): Use it.
	(set_mangled_name_for_template_decl): Don't treat clones as
	constructors.
	* search.c (lookup_fnfields_1): Use CLASSTYPE_CONSTRUCTOR_SLOT,
	CLASSTYPE_DESTRUCTOR_SLOT, and CLASSTYPE_FIRST_CONVERSION_SLOT.
	* semantics.c (expand_body): Clone function bodies as necessary.

From-SVN: r33084
2000-04-11 20:16:36 +00:00
Mark Mitchell cba6a0b29f optimize.c (remap_decl): Avoid sharing structure for arrays whose size is only known at run-time.
* optimize.c (remap_decl): Avoid sharing structure for arrays
	whose size is only known at run-time.
	* tree.c (copy_tree_r): Don't copy PARM_DECLs.

From-SVN: r33081
2000-04-11 17:29:54 +00:00
Mark Mitchell 16d53b6439 cp-tree.h (instantiate_decl): Change prototype.
* cp-tree.h (instantiate_decl): Change prototype.
	* decl2.c (mark_used): Adjust call.
	* optimize.c (inlinable_function_p): Adjust handling of templates.
	* pt.c (do_decl_instantiation): Adjust call to instantiate_decl.
	(do_type_instantiation): Likewise.
	(instantiate_decl): Defer more templates.
	(instantiate_pending_templates): Adjust logic to handle inline
	friend functions.

From-SVN: r32959
2000-04-06 03:12:19 +00:00
Jan Hubicka c9fff01f44 Fix problems in my previous commit.
From-SVN: r32930
2000-04-05 15:27:08 +00:00
Jan Hubicka f2d33f1321 calls.c (ECF_MALLOC, [...]): New constants.
* calls.c (ECF_MALLOC, ECF_MAY_BE_ALLOCA, ECF_RETURNS_TWICE,
	 ECF_LONGJMP, ECF_FORK_OR_EXEC):  New constants.
	(ECF_IS_CONST): Rename to ECF_CONST.
	(special_function_p): Make static, change interface.
	(flags_from_decl_or_type, try_to_integrate): Break out from ...
	(expand_call) ... here; convert number of variables to flags.
	(emit_library_call_vlue_1): Likewise.
	(setjmp_call_p): New function.
	(initialize_argument_information): Accepts flags as argument;
	return flags.
	(precompute_arguments): Likewise.
	* tree.h (special_function_p): Remove.
	(setjmp_call_p): Add prototype.

From-SVN: r32904
2000-04-04 17:19:30 +00:00
Jim Wilson 3431f196c0 Fix 3 ia64 g++ testsuite failures, and groff miscompilation.
* optimize.c (expand_call_inline): Emit the return label before
	evaluating the return value.

From-SVN: r32169
2000-02-25 21:32:24 -08:00
Mark Mitchell 574a0ef53c lex.c (check_newline): Use push_srcloc and pop_srcloc, rather than duplicating functionality here.
* lex.c (check_newline): Use push_srcloc and pop_srcloc, rather
	than duplicating functionality here.
	* optimize.c: Include input.h.
	(expand_call_inline): Use push_srcloc and pop_srcloc.
	* parse.y (maybe_cv_qualifier): Remove calls to emit_line_note.
	* parse.c: Regenerated.
	* Makefile.in (lex.o): Depend on input.h.
	(optimize.o): Likewise.

From-SVN: r32142
2000-02-25 01:36:03 +00:00
Richard Kenner 06ceef4e7b c-common.c (decl_attributes): Set DECL_SIZE_UNIT.
* c-common.c (decl_attributes): Set DECL_SIZE_UNIT.
	* c-decl.c (duplicate_decls, finish_enum): Likewise.
	(finish_decl): Remove -Wlarger-than code from here.
	* flags.h (id_clash_len): Now int.
	(larger_than_size): Now HOST_WIDE_INT.
	* fold-const.c (size_int_wide): No more HIGH parm; NUMBER is signed.
	Clean up checking to see if in table.
	(make_bit_field_ref): Remove extra parm to bitsize_int.
	* ggc-common.c (ggc_mark_tree_children): Mark DECL_SIZE_UNIT.
	* print-tree.c (print_node): Print DECL_SIZE_UNIT and TYPE_SIZE_UNIT.
	* stmt.c (expand_decl): Use DECL_SIZE_UNIT for stack checking size
	and for computing size of decl.
	* stor-layout.c (layout_decl): Set DECL_SIZE_UNIT.
	Move -Wlarger-than code to here.
	(layout_record): Remove extra arg to bitsize_int.
	Set TYPE_BINFO_SIZE_UNIT.
	(layout_union): Remove extra arg to bitsize_int.
	Use proper type for size of QUAL_UNION.
	(layout_type): Remove extra arg to bitsize_int.
	* toplev.c (id_clash_len): Now int.
	(larger_than_size): Now HOST_WIDE_INT.
	(decode_W_option): Clean up id-clash and larger-than- cases.
	* tree.c (get_identifier, maybe_get_identifier): Remove unneeded casts.
	(expr_align, case FUNCTION_DECL): DECL_ALIGN is not defined.
	* tree.h (BINFO_SIZE_UNIT, TYPE_BINFO_SIZE_UNIT, DECL_SIZE_UNIT): New.
	(struct tree_decl): New field size_unit.
	(size_int_wide): No HIGH operand; NUMBER is now signed.
	(size_int_2): Deleted.
	(size_int, bitsize_int): Don't use it and rework args.
	* varasm.c (assemble_variable, output_constructor): Use DECL_SIZE_UNIT.
	* ch/decl.c (layout_enum): Set DECL_SIZE_UNIT.
	* ch/satisfy.c (safe_satisfy_decl): Likewise.
	* cp/class.c (build_primary_vtable, layout_vtable_decl): Likewise.
	(avoid_overlap, build_base_field): Likewise.
	(build_base_field, build_base_fields, is_empty_class):
	Test DECL_SIZE with integer_zero.
	(layout_class_type): Set CLASSTYPE_SIZE_UNIT.
	* cp/cp-tree.h (struct lang_type): New field size_unit.
	(CLASSTYPE_SIZE_UNIT): New macro.
	* cp/decl.c (init_decl_processing): Set DECL_SIZE_UNIT.
	(cp_finish_decl): Delete -Wlarger-than processing.
	* cp/optimize.c (remap_decl): Walk DECL_SIZE_UNIT.
	* cp/pt.c (tsubst_decl): Set DECL_SIZE_UNIT.
	* cp/tree.c (make_binfo): binfo vector is one entry longer.
	(walk_tree): Walk DECL_SIZE_UNIT.
	* f/com.c (ffecom_sym_transform): Use DECL_SIZE_UNIT.
	(ffecom_transform_common_, ffecom_transform_equiv_): Likewise.
	(duplicate_decls): Likewise.
	(ffecom_tree_canonize_ptr_): Delete extra arg to bitsize_int.
	(finish_decl): Delete -Wlarger-than processing.
	* java/class.c (build_class_ref, push_super_field): Set DECL_SIZE_UNIT.
	* java/constants.c (build_constants_constructor): Likewise.

From-SVN: r32068
2000-02-19 20:11:00 -05:00
Jim Wilson aa1eac0c9f Fix winsup (cygwin) build failure with VLAs and inline functions.
* cp/optimize.c (remap_decl): Add walk_tree calls for DECL_SIZE (t)
	and TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (t))).

From-SVN: r31663
2000-01-27 20:56:59 -08:00
J"orn Rennecke e09d24ffb1 calls.c (special_function_p): New argument fork_or_exec.
gcc:
	* calls.c (special_function_p): New argument fork_or_exec.
	(expand_call): When profile_arc_flag is set and the function
	is in the fork_or_exec group, call __bb_fork_func first.
	* libgcc2.c, _bb module (__bb_fork_func): New function.
	(__bb_exit_func): If fcntl F_SETLKW is available, use it to lock
	output file.
	* config/svr4.h (TARGET_HAS_F_SETLKW): Define.
	* tree.h (special_function_p): Update prototype.

gcc/cp:
	* cp/optimize.c (calls_setjmp_r): Supply new argument
	to special_function_p.

From-SVN: r31635
2000-01-26 22:27:31 +00:00
Kaveh R. Ghazi 158991b7e5 call.c: PROTO -> PARAMS.
* call.c: PROTO -> PARAMS.
        * class.c: Likewise.
        * cp-tree.h: Likewise.
        * cvt.c: Likewise.
        * decl.c: Likewise.
        * decl.h: Likewise.
        * decl2.c: Likewise.
        * dump.c: Likewise.
        * errfn.c: Likewise.
        * error.c: Likewise.
        * except.c: Likewise.
        * expr.c: Likewise.
        * init.c: Likewise.
        * input.c: Likewise.
        * lex.c: Likewise.
        * lex.h: Likewise.
        * method.c: Likewise.
        * optimize.c: Likewise.
        * parse.y: Likewise.
        * pt.c: Likewise.
        * repo.c: Likewise.
        * rtti.c: Likewise.
        * search.c: Likewise.
        * semantics.c: Likewise.
        * spew.c: Likewise.
        * tree.c: Likewise.
        * typeck.c: Likewise.
        * typeck2.c: Likewise.
        * xref.c: Likewise.

From-SVN: r31632
2000-01-26 20:51:37 +00:00
Mark Mitchell ef97bf6bdd optimize.c (copy_body_r): Clear the operand three of a TARGET_EXPR when copying it.
* optimize.c (copy_body_r): Clear the operand three of a
	TARGET_EXPR when copying it.

From-SVN: r31435
2000-01-15 04:36:04 +00:00
Mark Mitchell a97901e608 Makefile.in (INTREGRATE_H): Rename to INTEGRATE_H.
* Makefile.in (INTREGRATE_H): Rename to INTEGRATE_H.
	* function.c (insert_block_after_note): Remove.
	(retrofit_block): Likewise.
	(identify_blocks): Fix indentation.
	(reorder_blocks): Don't NULL out NOTE_SOURCE_FILE for a
	NOTE_INSN_BLOCK_BEG or NOTE_INSN_BLOCK_END.
	* function.h (insert_block_after_note): Remove prototype.
	(retrofit_block): Likewise.
	* integrate.c (expand_inline_function): Don't call
	find_loop_tree_blocks.  Use expand_start_bindings_and_block, not
	just expand_start_bindings.  Use the block_map to remap old
	NOTE_BLOCKs to new ones.
	(integrate_decl_tree): Keep track of remapped blocks.
	* integrate.h (struct inline_remap): Add block_map.
	* stmt.c (expand_fixup): Don't try to retrofit_blocks.  Just set
	NOTE_BLOCK on the notes.
	(expand_start_bindings): Rename to ...
	(expand_start_bindings_and_block): Add parameter.  Set NOTE_BLOCK.
	(expand_end_bindings): Set NOTE_BLOCK.
	* toplev.c (rest_of_compilation): In function-at-a-time-mode,
	reconstruct the BLOCK tree.
	* tree.h (expand_start_bindings): Macroize.  Call ...
	(expand_start_bindings_and_block): New function.

	* optimize.c (struct inline_data): Remove scope_stmt.
	(remap_block): Don't use insert_block_after_note.  Don't update
	scope_stmt.
	(expand_call_inline): Don't update scope_stmt.
	(optimize_function): Don't initialize scope_stmt.
	* semantics.c (expand_stmt): Set NOTE_BLOCK for newly emitted
	NOTE_INSN_BLOCK_BEG/NOTE_INSN_BLOCK_END notes.

From-SVN: r30982
1999-12-16 17:50:29 +00:00
Jason Merrill 5afb79e7f8 function.c (retrofit_block): Abort if we don't find a suitable insn.
* function.c (retrofit_block): Abort if we don't find a suitable insn.
        (insert_block_after_note): Abort if we don't have a previous block.
        Remove FN parameter.
        * function.h: Adjust.

        * tree.c (walk_tree): Walk operand subtrees in forward order.
        * optimize.c (expand_call_inline): Likewise.
        (optimize_function): Initialize id->scope_stmt to something useful.
        (remap_block): Assume id->scope_stmt has a useful value.

From-SVN: r30965
1999-12-15 19:09:35 -05:00
Jason Merrill 8890f3d8df tweak comments
From-SVN: r30961
1999-12-15 14:33:38 -05:00
Jason Merrill 8cb360d3a2 optimize.c (expand_call_inline): Set BLOCK_ABSTRACT_ORIGIN on the outermost block to point to the inlined...
* optimize.c (expand_call_inline): Set BLOCK_ABSTRACT_ORIGIN on the
        outermost block to point to the inlined function decl.

From-SVN: r30945
1999-12-15 04:03:06 -05:00
Mark Mitchell d7d5e42f2d cp-tree.h (remap_save_expr): Add walk_subtrees parameter.
* cp-tree.h (remap_save_expr): Add walk_subtrees parameter.
	* optimize.c (copy_body_r): Pass it.
	* tree.c (remap_save_expr): Clear walk_subtrees for an
	already-handled SAVE_EXPR.
	(cp_unsave_r): Pass walk_subtrees to remap_save_expr.

From-SVN: r30926
1999-12-14 18:52:40 +00:00
Mark Mitchell 92e8164f76 optimize.c (initialize_inlined_parameters): Take FN to which the parameters belong as an argument.
* optimize.c (initialize_inlined_parameters): Take FN to which the
	parameters belong as an argument.
	(expand_call_inline): Expand calls into the parameter
	initializations before pushing the function onto the list of
	functions we are presently expanding.

From-SVN: r30888
1999-12-13 08:40:04 +00:00
Kaveh R. Ghazi 486837a79c class.c (get_vtable_name): Use a literal format string and VTABLE_NAME_PREFIX macro instead of...
* class.c (get_vtable_name): Use a literal format string and
	VTABLE_NAME_PREFIX macro instead of VTABLE_NAME_FORMAT.
	(prepare_fresh_vtable): Likewise.

	* cp-tree.h (VTABLE_NAME_PREFIX): Define this instead of
	VTABLE_NAME_FORMAT.

	* decl.c (make_rtl_for_local_static): Remove unused variable `type'.

	* init.c (build_vec_init): Initialize variable `try_body'.

	* lex.c (yyerror): Don't call a variadic function with a
	non-literal format string.

	* optimize.c (optimize_function): Call memset, not bzero.

	* pt.c (for_each_template_parm_r): Add static prototype.

From-SVN: r30868
1999-12-11 19:02:10 +00:00
Mark Mitchell 95fabfd362 cp-tree.h (calls_setjmp_p): Declare.
* cp-tree.h (calls_setjmp_p): Declare.
	* decl.c (finish_function): Mark functions that call setjmp as
	uninlinable.
	* optimize.c (calls_setjmp_r): New function.
	(calls_setjmp_p): Likewise.

From-SVN: r30789
1999-12-05 17:58:46 +00:00
Mark Mitchell 5679f67863 optimize.c (expand_call_inline): Wrap the expanded call in an EXPR_WITH_FILE_LOCATION node to get correct line...
* optimize.c (expand_call_inline): Wrap the expanded call in an
	EXPR_WITH_FILE_LOCATION node to get correct line numbers for
	inlined functions.

From-SVN: r30784
1999-12-05 02:46:48 +00:00
Mark Mitchell 390f4e9a7d optimize.c (inline_data): Remove fns_top.
* optimize.c (inline_data): Remove fns_top.  Add scope_stmt.  Add
	in_target_cleanup_p.
	(remap_decl): New function.
	(remap_block): Likewise.
	(copy_scope_stmt): Likewise.
	(copy_body_r): Use remap_decl and copy_scope_stmt.
	(copy_body): Use VARRAY_TOP_TREE.
	(initialize_inlined_parameters): Likewise.
	(declare_return_variable): Likewise.
	(inlinable_function_p): Check flag_inline_trees.
	(expand_call_inline): Handle SCOPE_STMTs and TARGET_EXPRs
	specially.  Use VARRAY_PUSH_TREE.  Create a BLOCK for the
	parameters of the inlined function.
	(optimize_function): Prevent recursion into partially complete
	functions.

From-SVN: r30781
1999-12-05 01:00:28 +00:00
Mark Mitchell 46e8c075d0 Make-lang.in (CXX_SRCS): Add optimize.c.
1999-11-25  Mark Mitchell  <mark@codesourcery.com>

	* Make-lang.in (CXX_SRCS): Add optimize.c.
	* Makefile.in (CXX_OBJS): Add optimize.o.
	(CXX_TREE_H): Add splay-tree.h, system.h, and $(CONFIG_H).
	(spew.o, lex.o, decl.o, decl2.o, typeck2.o, typeck.o): Adjust.
	(class.o, call.o, friend.o, init.o, method.o, cvt.o): Likewise.
	(search.o, tree.o, ptree.o, rtti.o, except.o, expr.o): Likewise.
	(xref.o, pt.o, error.o, errfn.o, repo.o, semantics.o): Likewise.
	(dump.o): Likewise.
	(optimize.o): New target.
	* class.c: Don't include splay-tree.h.
	* cp-tree.def (CTOR_COMPLETE): Rename to CTOR_STMT.
	* cp-tree.h: Include splay-tree.h.
	(DECL_UNINLINABLE): New macro.
	(CTOR_BEGIN_P, CTOR_END_P): New macros.
	(flag_inline_trees): New variable.
	(local_variable_p): New function.
	(nonstatic_local_decl_p): Likewise.
	(optimize_function): Likewise.
	(cplus_unsave_expr_now): Remove.
	(copy_tree_r): Declare.
	(remap_save_expr): Likewise.
	* decl.c (local_variable_p): Don't
	make it static.
	(local_variable_p_walkfn): New function.
	(make_rtl_for_local_static): Remove code to try to avoid writing
	out static constants.
	(emit_local_var): Fix indentation.
	(nonstatic_local_decl_p): New function.
	(check_default_argument): Use local_variable_p_walkfn, not
	local_variable_p, when walking the tree.
	(start_function): Set the DECL_CONTEXT for automatically generated
	labels.
	(finish_constructor_body): Use CTOR_STMT to mark the end of a
	constructor.
	* decl2.c: Don't include splay-tree.h.
	(flag_inline_trees): Define.
	* dump.c: Don't include
	splay-tree.h.
	* except.c (expand_end_catch_block): Fix comment formatting.
	(expand_end_eh_spec): Set DECL_CONTEXT on temporary variables.
	(expand_throw): Tidy comment.
	* init.c (build_vec_delete_1): Use create_temporary_var.
	* lex.c (cplus_tree_code_type): Make it static.
	(cplus_tree_code_length): Likewise.
	(cplus_tree_code_name): Likewise.
	* optimize.c: New file.
	* semantics.c (finish_goto_stmt): Set DECL_UNLINABLE for functions
	with computed gotos.
	(setup_vtbl_ptr): Mark the beginnings of constructors with
	CTOR_STMT.
	(expand_stmt): Handle CTOR_STMT, not CTOR_COMPLETE.
	(expand_body): Call optimize_function.  Save bodies if we're doing
	inlining on trees.
	* tree.c: Don't include splay-tree.h.  Include insn-config.h and
	integrate.h.
	(copy_tree_r): Make it public.
	(statement_code_p): New function.
	(mark_local_for_remap_r): Likewise.
	(cp_usave_r): Likewise.
	(cp_unsave): Likewise.
	(build_cplus_new): Set DECL_CONTEXT for temporary variables.
	(walk_tree): Walk into `s' class nodes.  Walk statement chains.
	(copy_tree_r): Handle 's' class nodes.  Restore chains for
	statements.  Nullify scopes.  Don't copy types.
	(init_tree): Set lang_unsave to cp_unsave.
	(remap_save_expr): Define.
	* ir.texi: Document CTOR_STMT.

From-SVN: r30669
1999-11-25 20:32:04 +00:00