Richard Kenner [Sat, 27 Nov 1999 13:50:13 +0000 (13:50 +0000)]
fold-const.c (negate_expr, [...]): New.
* fold-const.c (negate_expr, associate_trees, extract_muldiv): New.
(split_tree): Completely rework to make more general.
(make_range, fold): Call negate_expr.
(fold, case NEGATE_EXPR): Simplify -(a-b) is -ffast-math.
(fold, associate): Call new split_tree and associate_trees.
(fold, case MULT_EXPR, case *_{DIV,MOD}_EXPR): Call extract_muldiv.
Mark Mitchell [Thu, 25 Nov 1999 20:32:04 +0000 (20:32 +0000)]
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.
Jan Hubicka [Thu, 25 Nov 1999 12:53:44 +0000 (13:53 +0100)]
reg-stack.c (subst_stack_regs_pat): Swap operands in commutative operations when needed.
* reg-stack.c (subst_stack_regs_pat): Swap operands in commutative
operations when needed.
* i386.md (fop_?f_comm): New.
(fop_?f_1): Do not accept commutative operands.
Jason Merrill [Thu, 25 Nov 1999 09:31:49 +0000 (09:31 +0000)]
dwarf2out.c (pend_type, [...]): Lose.
* dwarf2out.c (pend_type, output_pending_types_for_scope): Lose.
(splice_child_die): Handle moving a child DIE from the declaration
DIE of a class to its specification.
(gen_struct_or_union_type_die): Use 'complete' consistently.
(gen_decl_die): Generate the virtual context DIE first.
Use decl_ultimate_origin instead of DECL_ABSTRACT_ORIGIN.
Jason Merrill [Thu, 25 Nov 1999 02:36:40 +0000 (02:36 +0000)]
dwarf2out.c (free_AT, free_die): New fns.
* dwarf2out.c (free_AT, free_die): New fns.
(remove_children): Call them.
(output_line_info): Disable removal of duplicate notes.
Generate minimal debug info for types with TYPE_DECL_SUPPRESS_INFO set.
* dwarf2out.c (gen_struct_or_union_type_die): TYPE_DECL_SUPPRESS_INFO
means pretend the type isn't defined.
Don't defer emitting types.
(gen_type_die_for_member): New fn.
(gen_decl_die): Call it.
(splice_child_die): New fn.
(gen_member_die): Call it rather than generate duplicate dies.
Defer emitting information for the abstract instance of an inline
until we either inline it or emit an out-of-line copy.
* dwarf2out.c (decl_ultimate_origin): Ignore DECL_ABSTRACT_ORIGIN
from output_inline_function if DECL_ABSTRACT is also set.
(block_ultimate_origin): Likewise.
(gen_abstract_function): New fn.
(gen_decl_die, gen_inlined_subroutine_die): Call it.
(gen_subprogram_die): An abstract instance is not a declaration
just because it doesn't match current_function_decl. Don't abort
because DECL_DEFER_OUTPUT isn't set. Do abort if a declaration
has an abstract origin.
* toplev.c (rest_of_compilation): Don't emit dwarf2 info for the
abstract instance here.
Jason Merrill [Thu, 25 Nov 1999 02:33:31 +0000 (02:33 +0000)]
search.c (note_debug_info_needed): Do perform this optimization for dwarf2.
* search.c (note_debug_info_needed): Do perform this optimization
for dwarf2.
(maybe_suppress_debug_info): Likewise. Start by clearing
TYPE_DECL_SUPPRESS_DEBUG.
Tom Tromey [Thu, 25 Nov 1999 00:36:51 +0000 (00:36 +0000)]
prims.cc (_Jv_NewObjectArray): Use _Jv_GetArrayElementFromElementType.
* prims.cc (_Jv_NewObjectArray): Use
_Jv_GetArrayElementFromElementType.
(_Jv_NewPrimArray): Likewise.
* java/lang/natObject.cc (clone): Use
_Jv_GetArrayElementFromElementType instead of sizeof.
* java/lang/natSystem.cc (arraycopy): Use
_Jv_GetArrayElementFromElementType.
* include/jvm.h (_Jv_GetArrayElementFromElementType): New
function.
Geoff Keating [Wed, 24 Nov 1999 06:35:10 +0000 (06:35 +0000)]
mips.h (ASM_SPEC): Don't pass -G to the assembler when -membedded-pic is passed.
* config/mips/mips.h (ASM_SPEC): Don't pass -G to the assembler
when -membedded-pic is passed.
* config/mips/mips.md (casesi): Handle 64-bit case too.
(casesi_internal_di): New insn.
* config/mips/mips.c (embedded_pic_offset): Always make the
embedded-pic subtractions relative to the name of the current
function by use of the magic string "..CURRENT_FUNCTION".
* config/mips/mips.h (ASM_OUTPUT_LABELREF): Make the magic happen.
Geoff Keating [Wed, 24 Nov 1999 06:25:14 +0000 (06:25 +0000)]
mips.md (div_trap_normal): Don't ask for the REGNO of (const_int 0)...
* config/mips/mips.md (div_trap_normal): Don't ask for the REGNO
of (const_int 0), when what we really care about is
whether it's a zero constant anyway.
(div_trap_mips16): Likewise.
Mark Mitchell [Wed, 24 Nov 1999 01:19:04 +0000 (01:19 +0000)]
tree.h (unsave_expr_1): New function.
* tree.h (unsave_expr_1): New function.
(lang_unsave): New variable.
(get_callee_fndecl): New function.
* tree.c (unsave_expr_now_r): New function.
(lang_unsave): Define.
(unsave_expr_1): Likewise.
(unsave_expr_now_r): Split out from unsave_expr_now.
(unsave_expr_now): Call lang_unsave if it is non-NULL. Otherwise,
call unsave_expr_now_r.
(get_callee_fndecl): Define.
Mark Mitchell [Tue, 23 Nov 1999 20:48:38 +0000 (20:48 +0000)]
integrate.h (copy_decl_for_inlining): New declaration.
1999-11-23 Mark Mitchell <mark@codesourcery.com>
* integrate.h (copy_decl_for_inlining): New declaration.
* integrate.c (copy_and_set_decl_abstract_origin): Remove.
(copy_decl_for_inlining): New function.
(integrate_parm_decls): Use it.
(integrate_decl_tree): Likewise.
Gavin Romig-Koch [Tue, 23 Nov 1999 19:18:48 +0000 (19:18 +0000)]
mips.h (ISA_HAS_FP4,ISA_HAS_CONDMOVE,ISA_HAS_8CC): Split the second two from the first.
* config/mips/mips.h (ISA_HAS_FP4,ISA_HAS_CONDMOVE,ISA_HAS_8CC): Split
the second two from the first.
(CONDITIONAL_REGISTER_USAGE): Use ISA_HAS_8CC rather than ISA_HAS_FP4.
* config/mips/mips.md (movcc,reload_incc,reload_outcc,
conditional move): Use ISA_HAS_CONDMOVE or ISA_HAS_8CC rather than
ISA_HAS_FP4.
* config/mips/mips.c (mips_move_1word,gen_conditional_branch,
override_options): Use ISA_HAS_CONDMOVE or ISA_HAS_8CC rather than
ISA_HAS_FP4.
Jeffrey A Law [Tue, 23 Nov 1999 18:17:00 +0000 (18:17 +0000)]
pa.md (call_internal_symref, [...]): No mode needed on the address operand.
* pa.md (call_internal_symref, call_value_internal_symref): No mode
needed on the address operand.
* pa.c (call_operand_address): Check for the correct mode.
Mark Mitchell [Tue, 23 Nov 1999 08:07:09 +0000 (08:07 +0000)]
cp-tree.def (CTOR_COMPLETE): New tree node.
* cp-tree.def (CTOR_COMPLETE): New tree node.
* decl.c (finish_constructor_body): Add it, to mark the end of the
constructor.
(finish_function): Don't call end_protect_partials here.
* ir.texi (CTOR_COMPLETE): Document it.
* semantics.c (expand_stmt): Handle it.
* Makefile.in (gencheck.o): Depend on gencheck.h.
(insn-emit.o): Depend on flags.h, hard-reg-set.h and resource.h.
(insn-peep.o): Depend on except.h and function.h.
(insn-attrtab.o): Depend on RECOG_H.
(insn-output.o): Depend on toplev.h and flags.h.
(gengenrtl.o): Depend on real.h.
(gen-protos.o): Depend on cpplib.h and cpphash.h.
Unify all dependencies to be on RECOG_H rather than recog.h.
Mark Mitchell [Tue, 23 Nov 1999 07:31:07 +0000 (07:31 +0000)]
cp-tree.def (CTOR_COMPLETE): New tree node.
* cp-tree.def (CTOR_COMPLETE): New tree node.
(finish_constructor_body): Add it, to mark the end of the
constructor.
(finish_function): Don't call end_protect_partials here.
* ir.texi (CTOR_COMPLETE): Document it.
* semantics.c (expand_stmt): Handle it.
* config/freebsd.h: New, FreeBSD architecture independent file.
* config/i386/freebsd-elf.h: removed FreeBSD architecturally
independent pieces.
* config/i386/freebsd.h: include i386/perform.h via tm.h rather than
directly by i386/freebsd.h.
* configure.in (*-*-freebsdelf): Include new FreeBSD architecturally
independent configuration file.
(*-*-freebsdelf): Include i386/perform.h via tm.h rather than
directly by i386/freebsd.h.
* configure: Rebuilt.
*POTFILES.in: Add config/freebsd.h
David O'Brien [Tue, 23 Nov 1999 06:09:34 +0000 (06:09 +0000)]
xm-i386.h: Define `__i386__' if not defined...
* xm-i386.h: Define `__i386__' if not defined, rather than `i386'
which is in the user's namespace.
* libgcc2.c: Look for the ANSI-C approved `__i386__' symbol, vs.
`i386' which is not in our namespace.
Mark Mitchell [Tue, 23 Nov 1999 02:49:41 +0000 (02:49 +0000)]
cp-tree.def (FUNCTION_NAME): New tree node.
* cp-tree.def (FUNCTION_NAME): New tree node.
* cp-tree.h (current_function_name_declared): Tweak documentation.
(lang_decl_flags): Add pretty_function_p, adjust dummy.
(DECL_PRETTY_FUNCTION_P): New macro.
* decl.c (cp_finish_decl): Handle declarations of __FUNCTION__,
etc., in a template function. Use at_function_scope_p instead of
expanding it inline.
* pt.c (tsubst_decl): Handle DECL_PRETTY_FUNCTION_P declarations
specially.
(tsubst): Handle FUNCTION_NAME.
(tsubst_copy): Likewise.
(instantiate_decl): Prevent redeclarations of __PRETTY_FUNCTION__,
etc. in instantiation.
* semantics.c (begin_compound_stmt): Declare __FUNCTION__, etc.,
even in template functions.
(setup_vtbl_ptr): Don't declare __PRETTY_FUNCTION in the
conditional scope at the top of a destructor.
* error.c (dump_function_decl): Use `[ with ... ]' syntax for
specializations too.
Jason Merrill [Tue, 23 Nov 1999 01:50:36 +0000 (01:50 +0000)]
dwarf2out.c (die_struct): Remove die_attr_last and die_child_last.
* dwarf2out.c (die_struct): Remove die_attr_last and die_child_last.
(add_dwarf_attr, add_child_die): Just push onto the front.
(reverse_die_lists): New fn.
(add_sibling_attributes): Use it.
(push_decl_scope): Reorganize.
(gen_struct_or_union_type_die): Don't add a DW_AT_containing_type
that points to ourself.
(add_name_and_src_coords_attributes): Don't set file and line for
an artificial decl.
(gen_subprogram_die): An artificial function doesn't need to match
file and line.
(gen_compile_unit_die): Return the generated die. Only add
AT_comp_dir if the filename is relative.
(remove_AT): Simplify loop. Also free string values.
(output_die): A DIE ref can't be null.
(output_value_format, value_format): Take a dw_attr_ref.
(dwarf_last_decl, is_extern_subr_die, sibling_offset): Remove.
(AT_class, AT_flag, AT_int, AT_unsigned, AT_string, AT_ref, AT_loc,
AT_addr, AT_lbl): New fns.
(various): Use them.
(various): Constify.
Nathan Sidwell [Mon, 22 Nov 1999 15:51:14 +0000 (15:51 +0000)]
cleanup2.C: New test.
* g++.old-deja/g++.eh/cleanup2.C: New test.
* g++.old-deja/g++.ext/pretty2.C: New test.
* g++.old-deja/g++.ext/pretty3.C: New test.
* g++.old-deja/g++.other/debug6.C: New test.
Andrew Haley [Mon, 22 Nov 1999 14:20:35 +0000 (14:20 +0000)]
varasm.c (function_defined): Remove.
1999-11-22 Andrew Haley <aph@cygnus.com>
* varasm.c (function_defined): Remove.
(make_function_rtl): Don't set function_defined.
(make_decl_rtl): Remove global register warning.
* regclass.c (no_global_reg_vars): New variable.
(globalize_reg): Warn if function has already been defined.
(regclass_init): Set no_global_reg_vars.
Jan Hubicka [Mon, 22 Nov 1999 13:43:39 +0000 (14:43 +0100)]
regclass.c (reg_pref): New structure and static variable
* regclass.c (reg_pref): New structure and static variable
(prefclass): Delete.
(altclass): Delete.
(all uses of prefclass and altclass): Use reg_pref instead.
Anthony Green [Sun, 21 Nov 1999 23:37:58 +0000 (23:37 +0000)]
constants.c (find_methodref_index): Unwrap method names before inserting them in the constant pool.
* constants.c (find_methodref_index): Unwrap method names before
inserting them in the constant pool.
* jcf-parse.c (jcf_parse): Display `interface' when appropriate.
* class.c (assume_compiled_node): New typedef.
(assume_compiled_tree): New static data.
(find_assume_compiled_node): New function.
(add_assume_compiled): New function.
(assume_compiled): New function.
* class.c (make_class_data): Use assume_compiled.
(is_compiled_class): Use assume_compiled.
Jan Hubicka [Sun, 21 Nov 1999 12:40:47 +0000 (12:40 +0000)]
regclass.c (may_move_in_cost): Rename from may_move_cost, all references updated.
* regclass.c (may_move_in_cost): Rename from may_move_cost, all
references updated.
(may_move_out_cost): New variable.
(init_reg_sets_1): Initialize may_move_out_cost.
(record_reg_classes): Use may_move_out_cost.
Jan Hubicka [Sun, 21 Nov 1999 01:34:22 +0000 (02:34 +0100)]
i386.md (neg, [...]): Revmap to use ix86_expand_unary_operator and ix86_unary_operator_ok.
* i386.md (neg, not and abs patterns): Revmap to use
ix86_expand_unary_operator and ix86_unary_operator_ok.
(add?f and sub?f expanders): Force operand 1 to register.
* i386.c (ix86_expand_unary_operator): Rewrite.
(ix86_unary_operator_ok): Ensure that memory operands
match real opcode.
(ix86_binary_operator_ok): Do not allow operand 1 to
come into memory and operand 0 not.
(ix86_expand_binary_operator): Ensure that
src1 is not non-matching memory.
Mark Mitchell [Thu, 18 Nov 1999 17:50:56 +0000 (17:50 +0000)]
except.h (struct eh_entry): Add goto_entry_p.
* except.h (struct eh_entry): Add goto_entry_p.
(eh_region_from_symbol): Remove prototype.
* except.c (find_func_region_from_symbol): New function.
(emit_cleanup_handler): Likewise.
(eh_region_from_symbol): Make it static.
(add_new_handler): Verify the argument.
(find_func_region): Update comment.
(expand_eh_region_end): Expand handlers here, rater than waiting
until expand_leftover_cleanups or start_all_catch.
(expand_leftover_cleanups): Don't expand here.
(expand_start_all_catch): Or here.
(expand_rethrow): Check the return value from find_func_region.
* function.c (expand_function_end): Emit the catch_clauses.