gcc/gcc/ggc-common.c

623 lines
14 KiB
C
Raw Normal View History

/* Simple garbage collection for the GNU compiler.
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
[multiple changes] Fri Oct 29 15:25:07 1999 Arnaud Charlet <charlet@ACT-Europe.FR> * gcov.c (DIR_SEPARATOR): Provide default. (output_data): Add test for MS-DOS format absolute filename. (fancy_abort): Correct program name. (open_files): Open all files in binary mode. * libgcc2.c (__bb_exit_func): Likewise. * profile.c (init_branch_prob): Specify binary when opening files. * flags.h (flag_unwind_tables): New decl. * toplev.c (flag_unwind_table): New definition. (f_options): Add -funwind-tables. (decode_g_option): Clarify warning when unknown -g option is given. (rest_of_compilation): If inside an inlined external function, pretend we are just being declared. * dwarf2out.c (dwarf2out_do_frame): Check -funwind_tables. (dwarf2out_frame_finish): Likewise. Fri Oct 29 06:32:44 1999 Geoffrey Keating <geoffk@cygnus.com> * flow.c (propagate_block): When the last reference to a label before an ADDR_VEC is deleted because the reference is a dead store, delete the ADDR_VEC. Fri Oct 29 07:44:26 1999 Vasco Pedro <vp@di.fct.unl.pt> * fold-const.c (merge_ranges): In not in0, but in1, handle upper bounds equal like subset case. Thu Oct 28 19:22:24 1999 Douglas Rupp <rupp@gnat.com> * dbxout.c (dbxout_parms): Generate a second stabs line for parameters passed in a register but moved to the stack. Thu Oct 28 19:12:57 1999 Sam Tardieu <tardieu@act-europe.fr> * gcc.c (pass_exit_codes, greatest_status): New variables. (struct option_map): Add entry for "--pass-exit-codes". (execute): Update greatest_status if error. (display_help): Add documentation for -pass-exit-codes. (process_command): Handle -pass-exit-codes. (main): Look at pass_exit_codes and greatest_status on call to exit. Thu Oct 28 18:06:50 1999 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> * reload.c (find_reloads): Refine test for no input reload case to not includes reloads emitted after insn. * function.c (find_temp_slots_from_address): Handle sum involving a register that points to a temp slot. (update_temp_slot_address): Make recursive call if both old and new are PLUS with a common operand. * calls.c (expand_call): Mark temp slot for result as having address taken. * rtlanal.c (reg_referenced_p, case IF_THEN_ELSE): New case. * gcc.c (process_command): Add standard_exec_prefix with "GCC" component as well as "BINUTILS". * integrate.h (copy_rtx_and_substitute): New arg, FOR_LHS. * integrate.c (copy_rtx_and_substitute): Likewise. (expand_inline_function, integrate_parm_decls, integrate_decl_tree): All callers changed. * unroll.c (inital_reg_note_copy, copy_loop_body): Likewise. * dbxout.c (dbxout_type, case INTEGER_TYPE_NODE): If can use gdb extensions, write size of type; also be more consistent in using references when this is a subtype. * pa.md (extv, extzv, insv): Use define_expand to reject constant that is out of range. * loop.c (unknown_constant_address_altered): New variable. (prescan_loop): Initialize it. (note_addr_stored): Set it for RTX_UNCHANGING_P MEM. (invariant_p, case MEM): Remove handling for volatile and readony; check new variable if readonly. (check_dbra_loop): Chdeck unknown_constant_address_altered. * cse.c (canon_hash, case MEM): Do not record if BLKmode. (addr_affects_sp_p): Removed from note_mem_written and only define #ifdef AUTO_INC_DEC. * alpha.c (input_operand, case ADDRESSOF): Treat as REG. * regclass.c (record_reg_classes): Properly handle register move directions. * varasm.c (initializer_constant_valid_p, case MINUS_EXPR): Don't think valid if both operands are invalid. (struct constant_descriptor): New field RTL. (mark_const_hash_entry): Mark it. (record_constant{,_rtx}): Initialize it. (output_constant_def): Allocate RTL in permanent obstack and save in table. ({record,compare}_constant_1): Modes must match for CONSTRUCTOR of ARRAY_TYPE. * c-common.h (initializer_constant_valid_p): Delete decl from here. * output.h (initializer_constant_valid_p): Move decl to here. * c-common.c (initializer_constant_valid_p): Delete function from here. * varasm.c (initializer_constant_valid_p): Move function to here. * tree.h (STRIP_SIGN_NOPS): New macro. * fold-const.c (optimize_minmax_comparison): New function. (invert_truthvalue, case WITH_RECORD_EXPR): New case. (fold): Use STRIP_SIGN_NOPS instead of STRIP_TYPE_NOPS. (fold, case EQ_EXPR): Call optimize_minmax_comparison and add cases with ABS_EXPR, NEGATE_EXPR, PLUS_EXPR, MINUS_EXPR, and widening conversions. (fold, case LE_EXPR): Rework changing unsigned to signed comparisons to look at size of mode, not precision of type; also add missing cases. (optimize_bit_field_compare, decode_field_reference): Don't try to optimize COMPONENT_REF of a PLACEHOLDER_EXPR. * dwarf2out.c (ctype.h): Include. (dwarf2out_set_demangle_name_func): New function. (size_of_line_info): Deleted. (output_line_info): Compute size of line info table from difference of labels. (base_type_die, add_name_attribute): Call demangle function, if any. (field_byte_offset): Use bits per word for variable length fields. (gen_array_type_die): Add array name. (gen_subprogram_die): Ignore DECL_INLINE if -fno-inline. (dwarf2out_add_library_unit_info): New function. * explow.c (set_stack_check_libfunc): New function. (stack_check_libfunc): New static variable. (probe_stack_range): Allow front-end to set up a libfunc to call. * combine.c (simplify_comparison): When making comparison in wider mode, check for having commuted an AND and a SUBREG. (contains_muldiv): New function. (try_combine): Call it when dividing a PARALLEL. (simplify_rtx, case TRUNCATE): Don't remove for umulsi3_highpart. (simplify_comparison, case ASHIFTRT): Recognize sign-extension of a PLUS. (record_value_for_reg): If TEM is a binary operation with two CLOBBERs, use one of the CLOBBERs instead. (if_then_else_cond): If comparing against zero, just return thing being compared. * optabs.c (expand_abs): If machine has MAX, ABS (x) is MAX (x, -x). Don't generate shifts and subtract if have conditional arithmetic. * rtl.h (delete_barrier): New declaration. * jump.c (jump_optimize): Set up to handle conditional call. In conditional arithmetic case, handle CALL_INSN followed by a BARRIER. (delete_barrier): New function. * rtl.c (read_rtx): Call fatal if bad RTL code; check for bad mode. * recog.c (nonmemory_operand): Accept ADDRESSOF. * tree.c (build_type_attribute_variant): Push to obstack of ttype around type_hash_canon call. * expr.c (placeholder_list): Move decl to file scope. (expand_expr): Don't force access to volatile just because its address is taken. If ignoring reference operations, just expand the operands. (expand_expr, case COMPONENT_REF): Propagate EXPAND_CONST_ADDRESS to recursive call when expanding inner. Refine test for using bitfield operations vs pointer punning. (expand_expr, case CONVERT_EXPR): If converting to BLKmode UNION_TYPE from BLKmode, just return inner object. Use proper mode in store_field call. Properly set sizes of object to store and total size in store_field call for convert to union. (expand_expr, case ARRAY_REF): If OP0 is in a register, put it in memory (like for ADDR_EXPR). Also, don't put constant in register if we'll want it in memory. (readonly_fields_p): New function. (expand_expr, case INDIRECT_REF): Call it if LHS. (expand_assignment): Handle a RESULT_DECL where DECL_RTL is a PARALLEL. (do_jump, case WITH_RECORD_EXPR): New case. (get_inner_reference): Always go inside a CONVERT_EXPR and NOP_EXPR if both modes are the same. (store_field): Use bitfield operations if size of bitsize is not same as size of RHS's type. Check for bitpos not a multiple of alignment in BLKmode case. Do block move in largest possible alignment. (store_constructor): Set BITSIZE to -1 for variable size and properly in case of array of BLKmode. (expand_expr_unaligned): New function. (do_compare_and_jump): Call it. * mips/iris5.h (SWITCHES_NEED_SPACES): New macro. * collect2.c (main): Only allow -ofoo if SWITCHES_NEED_SPACES does not include 'o'. * function.c (instantiate_virtual_regs_1, case SET): Handle case where both SET_DEST and SET_SRC reference a virtual register. (gen_mem_addressof): Copy RTX_UNCHANGING_P from new REG to old REG. * integrate.c (expand_inline_function): Handle case of setting virtual stack vars register (from built in setjmp); when parameter lives in memory, expand virtual_{stack_vars,incoming_args}_rtx early. (subst_constant): Add new parm, MEMONLY. (expand_inline_function, integrate_parm_decls): Pass new parm. (integrate_decl_tree): Likewise. (copy_rtx_and_substitute, case MEM): Do copy RTX_UNCHANGING_P. (try_constants): Call subst_constants twice, with MEMONLY 0 and 1. (copy_rtx_and_substitute, case SET): Add explicit calls to copy_rtx_and_substitute for both sides. * stmt.c (expand_asm_operands): Don't use TREE_STRING_LENGTH for constraints. (pushcase{,_range}): Convert to NOMINAL_TYPE after checking for within INDEX_TYPE, instead of before. (fixup_gotos): Use f->target_rtl, not the next insn, since latter may be from a later fixup. (expand_value_return): Correctly convert VAL when promoting function return; support RETURN_REG being a PARALLEL. (expand_return): When checking for result in regs and having cleanup, consider PARALLEL in DECL_RTL as being in regs. From-SVN: r30299
1999-11-01 02:11:22 +01:00
This file is part of GNU CC.
[multiple changes] Fri Oct 29 15:25:07 1999 Arnaud Charlet <charlet@ACT-Europe.FR> * gcov.c (DIR_SEPARATOR): Provide default. (output_data): Add test for MS-DOS format absolute filename. (fancy_abort): Correct program name. (open_files): Open all files in binary mode. * libgcc2.c (__bb_exit_func): Likewise. * profile.c (init_branch_prob): Specify binary when opening files. * flags.h (flag_unwind_tables): New decl. * toplev.c (flag_unwind_table): New definition. (f_options): Add -funwind-tables. (decode_g_option): Clarify warning when unknown -g option is given. (rest_of_compilation): If inside an inlined external function, pretend we are just being declared. * dwarf2out.c (dwarf2out_do_frame): Check -funwind_tables. (dwarf2out_frame_finish): Likewise. Fri Oct 29 06:32:44 1999 Geoffrey Keating <geoffk@cygnus.com> * flow.c (propagate_block): When the last reference to a label before an ADDR_VEC is deleted because the reference is a dead store, delete the ADDR_VEC. Fri Oct 29 07:44:26 1999 Vasco Pedro <vp@di.fct.unl.pt> * fold-const.c (merge_ranges): In not in0, but in1, handle upper bounds equal like subset case. Thu Oct 28 19:22:24 1999 Douglas Rupp <rupp@gnat.com> * dbxout.c (dbxout_parms): Generate a second stabs line for parameters passed in a register but moved to the stack. Thu Oct 28 19:12:57 1999 Sam Tardieu <tardieu@act-europe.fr> * gcc.c (pass_exit_codes, greatest_status): New variables. (struct option_map): Add entry for "--pass-exit-codes". (execute): Update greatest_status if error. (display_help): Add documentation for -pass-exit-codes. (process_command): Handle -pass-exit-codes. (main): Look at pass_exit_codes and greatest_status on call to exit. Thu Oct 28 18:06:50 1999 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> * reload.c (find_reloads): Refine test for no input reload case to not includes reloads emitted after insn. * function.c (find_temp_slots_from_address): Handle sum involving a register that points to a temp slot. (update_temp_slot_address): Make recursive call if both old and new are PLUS with a common operand. * calls.c (expand_call): Mark temp slot for result as having address taken. * rtlanal.c (reg_referenced_p, case IF_THEN_ELSE): New case. * gcc.c (process_command): Add standard_exec_prefix with "GCC" component as well as "BINUTILS". * integrate.h (copy_rtx_and_substitute): New arg, FOR_LHS. * integrate.c (copy_rtx_and_substitute): Likewise. (expand_inline_function, integrate_parm_decls, integrate_decl_tree): All callers changed. * unroll.c (inital_reg_note_copy, copy_loop_body): Likewise. * dbxout.c (dbxout_type, case INTEGER_TYPE_NODE): If can use gdb extensions, write size of type; also be more consistent in using references when this is a subtype. * pa.md (extv, extzv, insv): Use define_expand to reject constant that is out of range. * loop.c (unknown_constant_address_altered): New variable. (prescan_loop): Initialize it. (note_addr_stored): Set it for RTX_UNCHANGING_P MEM. (invariant_p, case MEM): Remove handling for volatile and readony; check new variable if readonly. (check_dbra_loop): Chdeck unknown_constant_address_altered. * cse.c (canon_hash, case MEM): Do not record if BLKmode. (addr_affects_sp_p): Removed from note_mem_written and only define #ifdef AUTO_INC_DEC. * alpha.c (input_operand, case ADDRESSOF): Treat as REG. * regclass.c (record_reg_classes): Properly handle register move directions. * varasm.c (initializer_constant_valid_p, case MINUS_EXPR): Don't think valid if both operands are invalid. (struct constant_descriptor): New field RTL. (mark_const_hash_entry): Mark it. (record_constant{,_rtx}): Initialize it. (output_constant_def): Allocate RTL in permanent obstack and save in table. ({record,compare}_constant_1): Modes must match for CONSTRUCTOR of ARRAY_TYPE. * c-common.h (initializer_constant_valid_p): Delete decl from here. * output.h (initializer_constant_valid_p): Move decl to here. * c-common.c (initializer_constant_valid_p): Delete function from here. * varasm.c (initializer_constant_valid_p): Move function to here. * tree.h (STRIP_SIGN_NOPS): New macro. * fold-const.c (optimize_minmax_comparison): New function. (invert_truthvalue, case WITH_RECORD_EXPR): New case. (fold): Use STRIP_SIGN_NOPS instead of STRIP_TYPE_NOPS. (fold, case EQ_EXPR): Call optimize_minmax_comparison and add cases with ABS_EXPR, NEGATE_EXPR, PLUS_EXPR, MINUS_EXPR, and widening conversions. (fold, case LE_EXPR): Rework changing unsigned to signed comparisons to look at size of mode, not precision of type; also add missing cases. (optimize_bit_field_compare, decode_field_reference): Don't try to optimize COMPONENT_REF of a PLACEHOLDER_EXPR. * dwarf2out.c (ctype.h): Include. (dwarf2out_set_demangle_name_func): New function. (size_of_line_info): Deleted. (output_line_info): Compute size of line info table from difference of labels. (base_type_die, add_name_attribute): Call demangle function, if any. (field_byte_offset): Use bits per word for variable length fields. (gen_array_type_die): Add array name. (gen_subprogram_die): Ignore DECL_INLINE if -fno-inline. (dwarf2out_add_library_unit_info): New function. * explow.c (set_stack_check_libfunc): New function. (stack_check_libfunc): New static variable. (probe_stack_range): Allow front-end to set up a libfunc to call. * combine.c (simplify_comparison): When making comparison in wider mode, check for having commuted an AND and a SUBREG. (contains_muldiv): New function. (try_combine): Call it when dividing a PARALLEL. (simplify_rtx, case TRUNCATE): Don't remove for umulsi3_highpart. (simplify_comparison, case ASHIFTRT): Recognize sign-extension of a PLUS. (record_value_for_reg): If TEM is a binary operation with two CLOBBERs, use one of the CLOBBERs instead. (if_then_else_cond): If comparing against zero, just return thing being compared. * optabs.c (expand_abs): If machine has MAX, ABS (x) is MAX (x, -x). Don't generate shifts and subtract if have conditional arithmetic. * rtl.h (delete_barrier): New declaration. * jump.c (jump_optimize): Set up to handle conditional call. In conditional arithmetic case, handle CALL_INSN followed by a BARRIER. (delete_barrier): New function. * rtl.c (read_rtx): Call fatal if bad RTL code; check for bad mode. * recog.c (nonmemory_operand): Accept ADDRESSOF. * tree.c (build_type_attribute_variant): Push to obstack of ttype around type_hash_canon call. * expr.c (placeholder_list): Move decl to file scope. (expand_expr): Don't force access to volatile just because its address is taken. If ignoring reference operations, just expand the operands. (expand_expr, case COMPONENT_REF): Propagate EXPAND_CONST_ADDRESS to recursive call when expanding inner. Refine test for using bitfield operations vs pointer punning. (expand_expr, case CONVERT_EXPR): If converting to BLKmode UNION_TYPE from BLKmode, just return inner object. Use proper mode in store_field call. Properly set sizes of object to store and total size in store_field call for convert to union. (expand_expr, case ARRAY_REF): If OP0 is in a register, put it in memory (like for ADDR_EXPR). Also, don't put constant in register if we'll want it in memory. (readonly_fields_p): New function. (expand_expr, case INDIRECT_REF): Call it if LHS. (expand_assignment): Handle a RESULT_DECL where DECL_RTL is a PARALLEL. (do_jump, case WITH_RECORD_EXPR): New case. (get_inner_reference): Always go inside a CONVERT_EXPR and NOP_EXPR if both modes are the same. (store_field): Use bitfield operations if size of bitsize is not same as size of RHS's type. Check for bitpos not a multiple of alignment in BLKmode case. Do block move in largest possible alignment. (store_constructor): Set BITSIZE to -1 for variable size and properly in case of array of BLKmode. (expand_expr_unaligned): New function. (do_compare_and_jump): Call it. * mips/iris5.h (SWITCHES_NEED_SPACES): New macro. * collect2.c (main): Only allow -ofoo if SWITCHES_NEED_SPACES does not include 'o'. * function.c (instantiate_virtual_regs_1, case SET): Handle case where both SET_DEST and SET_SRC reference a virtual register. (gen_mem_addressof): Copy RTX_UNCHANGING_P from new REG to old REG. * integrate.c (expand_inline_function): Handle case of setting virtual stack vars register (from built in setjmp); when parameter lives in memory, expand virtual_{stack_vars,incoming_args}_rtx early. (subst_constant): Add new parm, MEMONLY. (expand_inline_function, integrate_parm_decls): Pass new parm. (integrate_decl_tree): Likewise. (copy_rtx_and_substitute, case MEM): Do copy RTX_UNCHANGING_P. (try_constants): Call subst_constants twice, with MEMONLY 0 and 1. (copy_rtx_and_substitute, case SET): Add explicit calls to copy_rtx_and_substitute for both sides. * stmt.c (expand_asm_operands): Don't use TREE_STRING_LENGTH for constraints. (pushcase{,_range}): Convert to NOMINAL_TYPE after checking for within INDEX_TYPE, instead of before. (fixup_gotos): Use f->target_rtl, not the next insn, since latter may be from a later fixup. (expand_value_return): Correctly convert VAL when promoting function return; support RETURN_REG being a PARALLEL. (expand_return): When checking for result in regs and having cleanup, consider PARALLEL in DECL_RTL as being in regs. From-SVN: r30299
1999-11-01 02:11:22 +01:00
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.
[multiple changes] Fri Oct 29 15:25:07 1999 Arnaud Charlet <charlet@ACT-Europe.FR> * gcov.c (DIR_SEPARATOR): Provide default. (output_data): Add test for MS-DOS format absolute filename. (fancy_abort): Correct program name. (open_files): Open all files in binary mode. * libgcc2.c (__bb_exit_func): Likewise. * profile.c (init_branch_prob): Specify binary when opening files. * flags.h (flag_unwind_tables): New decl. * toplev.c (flag_unwind_table): New definition. (f_options): Add -funwind-tables. (decode_g_option): Clarify warning when unknown -g option is given. (rest_of_compilation): If inside an inlined external function, pretend we are just being declared. * dwarf2out.c (dwarf2out_do_frame): Check -funwind_tables. (dwarf2out_frame_finish): Likewise. Fri Oct 29 06:32:44 1999 Geoffrey Keating <geoffk@cygnus.com> * flow.c (propagate_block): When the last reference to a label before an ADDR_VEC is deleted because the reference is a dead store, delete the ADDR_VEC. Fri Oct 29 07:44:26 1999 Vasco Pedro <vp@di.fct.unl.pt> * fold-const.c (merge_ranges): In not in0, but in1, handle upper bounds equal like subset case. Thu Oct 28 19:22:24 1999 Douglas Rupp <rupp@gnat.com> * dbxout.c (dbxout_parms): Generate a second stabs line for parameters passed in a register but moved to the stack. Thu Oct 28 19:12:57 1999 Sam Tardieu <tardieu@act-europe.fr> * gcc.c (pass_exit_codes, greatest_status): New variables. (struct option_map): Add entry for "--pass-exit-codes". (execute): Update greatest_status if error. (display_help): Add documentation for -pass-exit-codes. (process_command): Handle -pass-exit-codes. (main): Look at pass_exit_codes and greatest_status on call to exit. Thu Oct 28 18:06:50 1999 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> * reload.c (find_reloads): Refine test for no input reload case to not includes reloads emitted after insn. * function.c (find_temp_slots_from_address): Handle sum involving a register that points to a temp slot. (update_temp_slot_address): Make recursive call if both old and new are PLUS with a common operand. * calls.c (expand_call): Mark temp slot for result as having address taken. * rtlanal.c (reg_referenced_p, case IF_THEN_ELSE): New case. * gcc.c (process_command): Add standard_exec_prefix with "GCC" component as well as "BINUTILS". * integrate.h (copy_rtx_and_substitute): New arg, FOR_LHS. * integrate.c (copy_rtx_and_substitute): Likewise. (expand_inline_function, integrate_parm_decls, integrate_decl_tree): All callers changed. * unroll.c (inital_reg_note_copy, copy_loop_body): Likewise. * dbxout.c (dbxout_type, case INTEGER_TYPE_NODE): If can use gdb extensions, write size of type; also be more consistent in using references when this is a subtype. * pa.md (extv, extzv, insv): Use define_expand to reject constant that is out of range. * loop.c (unknown_constant_address_altered): New variable. (prescan_loop): Initialize it. (note_addr_stored): Set it for RTX_UNCHANGING_P MEM. (invariant_p, case MEM): Remove handling for volatile and readony; check new variable if readonly. (check_dbra_loop): Chdeck unknown_constant_address_altered. * cse.c (canon_hash, case MEM): Do not record if BLKmode. (addr_affects_sp_p): Removed from note_mem_written and only define #ifdef AUTO_INC_DEC. * alpha.c (input_operand, case ADDRESSOF): Treat as REG. * regclass.c (record_reg_classes): Properly handle register move directions. * varasm.c (initializer_constant_valid_p, case MINUS_EXPR): Don't think valid if both operands are invalid. (struct constant_descriptor): New field RTL. (mark_const_hash_entry): Mark it. (record_constant{,_rtx}): Initialize it. (output_constant_def): Allocate RTL in permanent obstack and save in table. ({record,compare}_constant_1): Modes must match for CONSTRUCTOR of ARRAY_TYPE. * c-common.h (initializer_constant_valid_p): Delete decl from here. * output.h (initializer_constant_valid_p): Move decl to here. * c-common.c (initializer_constant_valid_p): Delete function from here. * varasm.c (initializer_constant_valid_p): Move function to here. * tree.h (STRIP_SIGN_NOPS): New macro. * fold-const.c (optimize_minmax_comparison): New function. (invert_truthvalue, case WITH_RECORD_EXPR): New case. (fold): Use STRIP_SIGN_NOPS instead of STRIP_TYPE_NOPS. (fold, case EQ_EXPR): Call optimize_minmax_comparison and add cases with ABS_EXPR, NEGATE_EXPR, PLUS_EXPR, MINUS_EXPR, and widening conversions. (fold, case LE_EXPR): Rework changing unsigned to signed comparisons to look at size of mode, not precision of type; also add missing cases. (optimize_bit_field_compare, decode_field_reference): Don't try to optimize COMPONENT_REF of a PLACEHOLDER_EXPR. * dwarf2out.c (ctype.h): Include. (dwarf2out_set_demangle_name_func): New function. (size_of_line_info): Deleted. (output_line_info): Compute size of line info table from difference of labels. (base_type_die, add_name_attribute): Call demangle function, if any. (field_byte_offset): Use bits per word for variable length fields. (gen_array_type_die): Add array name. (gen_subprogram_die): Ignore DECL_INLINE if -fno-inline. (dwarf2out_add_library_unit_info): New function. * explow.c (set_stack_check_libfunc): New function. (stack_check_libfunc): New static variable. (probe_stack_range): Allow front-end to set up a libfunc to call. * combine.c (simplify_comparison): When making comparison in wider mode, check for having commuted an AND and a SUBREG. (contains_muldiv): New function. (try_combine): Call it when dividing a PARALLEL. (simplify_rtx, case TRUNCATE): Don't remove for umulsi3_highpart. (simplify_comparison, case ASHIFTRT): Recognize sign-extension of a PLUS. (record_value_for_reg): If TEM is a binary operation with two CLOBBERs, use one of the CLOBBERs instead. (if_then_else_cond): If comparing against zero, just return thing being compared. * optabs.c (expand_abs): If machine has MAX, ABS (x) is MAX (x, -x). Don't generate shifts and subtract if have conditional arithmetic. * rtl.h (delete_barrier): New declaration. * jump.c (jump_optimize): Set up to handle conditional call. In conditional arithmetic case, handle CALL_INSN followed by a BARRIER. (delete_barrier): New function. * rtl.c (read_rtx): Call fatal if bad RTL code; check for bad mode. * recog.c (nonmemory_operand): Accept ADDRESSOF. * tree.c (build_type_attribute_variant): Push to obstack of ttype around type_hash_canon call. * expr.c (placeholder_list): Move decl to file scope. (expand_expr): Don't force access to volatile just because its address is taken. If ignoring reference operations, just expand the operands. (expand_expr, case COMPONENT_REF): Propagate EXPAND_CONST_ADDRESS to recursive call when expanding inner. Refine test for using bitfield operations vs pointer punning. (expand_expr, case CONVERT_EXPR): If converting to BLKmode UNION_TYPE from BLKmode, just return inner object. Use proper mode in store_field call. Properly set sizes of object to store and total size in store_field call for convert to union. (expand_expr, case ARRAY_REF): If OP0 is in a register, put it in memory (like for ADDR_EXPR). Also, don't put constant in register if we'll want it in memory. (readonly_fields_p): New function. (expand_expr, case INDIRECT_REF): Call it if LHS. (expand_assignment): Handle a RESULT_DECL where DECL_RTL is a PARALLEL. (do_jump, case WITH_RECORD_EXPR): New case. (get_inner_reference): Always go inside a CONVERT_EXPR and NOP_EXPR if both modes are the same. (store_field): Use bitfield operations if size of bitsize is not same as size of RHS's type. Check for bitpos not a multiple of alignment in BLKmode case. Do block move in largest possible alignment. (store_constructor): Set BITSIZE to -1 for variable size and properly in case of array of BLKmode. (expand_expr_unaligned): New function. (do_compare_and_jump): Call it. * mips/iris5.h (SWITCHES_NEED_SPACES): New macro. * collect2.c (main): Only allow -ofoo if SWITCHES_NEED_SPACES does not include 'o'. * function.c (instantiate_virtual_regs_1, case SET): Handle case where both SET_DEST and SET_SRC reference a virtual register. (gen_mem_addressof): Copy RTX_UNCHANGING_P from new REG to old REG. * integrate.c (expand_inline_function): Handle case of setting virtual stack vars register (from built in setjmp); when parameter lives in memory, expand virtual_{stack_vars,incoming_args}_rtx early. (subst_constant): Add new parm, MEMONLY. (expand_inline_function, integrate_parm_decls): Pass new parm. (integrate_decl_tree): Likewise. (copy_rtx_and_substitute, case MEM): Do copy RTX_UNCHANGING_P. (try_constants): Call subst_constants twice, with MEMONLY 0 and 1. (copy_rtx_and_substitute, case SET): Add explicit calls to copy_rtx_and_substitute for both sides. * stmt.c (expand_asm_operands): Don't use TREE_STRING_LENGTH for constraints. (pushcase{,_range}): Convert to NOMINAL_TYPE after checking for within INDEX_TYPE, instead of before. (fixup_gotos): Use f->target_rtl, not the next insn, since latter may be from a later fixup. (expand_value_return): Correctly convert VAL when promoting function return; support RETURN_REG being a PARALLEL. (expand_return): When checking for result in regs and having cleanup, consider PARALLEL in DECL_RTL as being in regs. From-SVN: r30299
1999-11-01 02:11:22 +01:00
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.
[multiple changes] Fri Oct 29 15:25:07 1999 Arnaud Charlet <charlet@ACT-Europe.FR> * gcov.c (DIR_SEPARATOR): Provide default. (output_data): Add test for MS-DOS format absolute filename. (fancy_abort): Correct program name. (open_files): Open all files in binary mode. * libgcc2.c (__bb_exit_func): Likewise. * profile.c (init_branch_prob): Specify binary when opening files. * flags.h (flag_unwind_tables): New decl. * toplev.c (flag_unwind_table): New definition. (f_options): Add -funwind-tables. (decode_g_option): Clarify warning when unknown -g option is given. (rest_of_compilation): If inside an inlined external function, pretend we are just being declared. * dwarf2out.c (dwarf2out_do_frame): Check -funwind_tables. (dwarf2out_frame_finish): Likewise. Fri Oct 29 06:32:44 1999 Geoffrey Keating <geoffk@cygnus.com> * flow.c (propagate_block): When the last reference to a label before an ADDR_VEC is deleted because the reference is a dead store, delete the ADDR_VEC. Fri Oct 29 07:44:26 1999 Vasco Pedro <vp@di.fct.unl.pt> * fold-const.c (merge_ranges): In not in0, but in1, handle upper bounds equal like subset case. Thu Oct 28 19:22:24 1999 Douglas Rupp <rupp@gnat.com> * dbxout.c (dbxout_parms): Generate a second stabs line for parameters passed in a register but moved to the stack. Thu Oct 28 19:12:57 1999 Sam Tardieu <tardieu@act-europe.fr> * gcc.c (pass_exit_codes, greatest_status): New variables. (struct option_map): Add entry for "--pass-exit-codes". (execute): Update greatest_status if error. (display_help): Add documentation for -pass-exit-codes. (process_command): Handle -pass-exit-codes. (main): Look at pass_exit_codes and greatest_status on call to exit. Thu Oct 28 18:06:50 1999 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> * reload.c (find_reloads): Refine test for no input reload case to not includes reloads emitted after insn. * function.c (find_temp_slots_from_address): Handle sum involving a register that points to a temp slot. (update_temp_slot_address): Make recursive call if both old and new are PLUS with a common operand. * calls.c (expand_call): Mark temp slot for result as having address taken. * rtlanal.c (reg_referenced_p, case IF_THEN_ELSE): New case. * gcc.c (process_command): Add standard_exec_prefix with "GCC" component as well as "BINUTILS". * integrate.h (copy_rtx_and_substitute): New arg, FOR_LHS. * integrate.c (copy_rtx_and_substitute): Likewise. (expand_inline_function, integrate_parm_decls, integrate_decl_tree): All callers changed. * unroll.c (inital_reg_note_copy, copy_loop_body): Likewise. * dbxout.c (dbxout_type, case INTEGER_TYPE_NODE): If can use gdb extensions, write size of type; also be more consistent in using references when this is a subtype. * pa.md (extv, extzv, insv): Use define_expand to reject constant that is out of range. * loop.c (unknown_constant_address_altered): New variable. (prescan_loop): Initialize it. (note_addr_stored): Set it for RTX_UNCHANGING_P MEM. (invariant_p, case MEM): Remove handling for volatile and readony; check new variable if readonly. (check_dbra_loop): Chdeck unknown_constant_address_altered. * cse.c (canon_hash, case MEM): Do not record if BLKmode. (addr_affects_sp_p): Removed from note_mem_written and only define #ifdef AUTO_INC_DEC. * alpha.c (input_operand, case ADDRESSOF): Treat as REG. * regclass.c (record_reg_classes): Properly handle register move directions. * varasm.c (initializer_constant_valid_p, case MINUS_EXPR): Don't think valid if both operands are invalid. (struct constant_descriptor): New field RTL. (mark_const_hash_entry): Mark it. (record_constant{,_rtx}): Initialize it. (output_constant_def): Allocate RTL in permanent obstack and save in table. ({record,compare}_constant_1): Modes must match for CONSTRUCTOR of ARRAY_TYPE. * c-common.h (initializer_constant_valid_p): Delete decl from here. * output.h (initializer_constant_valid_p): Move decl to here. * c-common.c (initializer_constant_valid_p): Delete function from here. * varasm.c (initializer_constant_valid_p): Move function to here. * tree.h (STRIP_SIGN_NOPS): New macro. * fold-const.c (optimize_minmax_comparison): New function. (invert_truthvalue, case WITH_RECORD_EXPR): New case. (fold): Use STRIP_SIGN_NOPS instead of STRIP_TYPE_NOPS. (fold, case EQ_EXPR): Call optimize_minmax_comparison and add cases with ABS_EXPR, NEGATE_EXPR, PLUS_EXPR, MINUS_EXPR, and widening conversions. (fold, case LE_EXPR): Rework changing unsigned to signed comparisons to look at size of mode, not precision of type; also add missing cases. (optimize_bit_field_compare, decode_field_reference): Don't try to optimize COMPONENT_REF of a PLACEHOLDER_EXPR. * dwarf2out.c (ctype.h): Include. (dwarf2out_set_demangle_name_func): New function. (size_of_line_info): Deleted. (output_line_info): Compute size of line info table from difference of labels. (base_type_die, add_name_attribute): Call demangle function, if any. (field_byte_offset): Use bits per word for variable length fields. (gen_array_type_die): Add array name. (gen_subprogram_die): Ignore DECL_INLINE if -fno-inline. (dwarf2out_add_library_unit_info): New function. * explow.c (set_stack_check_libfunc): New function. (stack_check_libfunc): New static variable. (probe_stack_range): Allow front-end to set up a libfunc to call. * combine.c (simplify_comparison): When making comparison in wider mode, check for having commuted an AND and a SUBREG. (contains_muldiv): New function. (try_combine): Call it when dividing a PARALLEL. (simplify_rtx, case TRUNCATE): Don't remove for umulsi3_highpart. (simplify_comparison, case ASHIFTRT): Recognize sign-extension of a PLUS. (record_value_for_reg): If TEM is a binary operation with two CLOBBERs, use one of the CLOBBERs instead. (if_then_else_cond): If comparing against zero, just return thing being compared. * optabs.c (expand_abs): If machine has MAX, ABS (x) is MAX (x, -x). Don't generate shifts and subtract if have conditional arithmetic. * rtl.h (delete_barrier): New declaration. * jump.c (jump_optimize): Set up to handle conditional call. In conditional arithmetic case, handle CALL_INSN followed by a BARRIER. (delete_barrier): New function. * rtl.c (read_rtx): Call fatal if bad RTL code; check for bad mode. * recog.c (nonmemory_operand): Accept ADDRESSOF. * tree.c (build_type_attribute_variant): Push to obstack of ttype around type_hash_canon call. * expr.c (placeholder_list): Move decl to file scope. (expand_expr): Don't force access to volatile just because its address is taken. If ignoring reference operations, just expand the operands. (expand_expr, case COMPONENT_REF): Propagate EXPAND_CONST_ADDRESS to recursive call when expanding inner. Refine test for using bitfield operations vs pointer punning. (expand_expr, case CONVERT_EXPR): If converting to BLKmode UNION_TYPE from BLKmode, just return inner object. Use proper mode in store_field call. Properly set sizes of object to store and total size in store_field call for convert to union. (expand_expr, case ARRAY_REF): If OP0 is in a register, put it in memory (like for ADDR_EXPR). Also, don't put constant in register if we'll want it in memory. (readonly_fields_p): New function. (expand_expr, case INDIRECT_REF): Call it if LHS. (expand_assignment): Handle a RESULT_DECL where DECL_RTL is a PARALLEL. (do_jump, case WITH_RECORD_EXPR): New case. (get_inner_reference): Always go inside a CONVERT_EXPR and NOP_EXPR if both modes are the same. (store_field): Use bitfield operations if size of bitsize is not same as size of RHS's type. Check for bitpos not a multiple of alignment in BLKmode case. Do block move in largest possible alignment. (store_constructor): Set BITSIZE to -1 for variable size and properly in case of array of BLKmode. (expand_expr_unaligned): New function. (do_compare_and_jump): Call it. * mips/iris5.h (SWITCHES_NEED_SPACES): New macro. * collect2.c (main): Only allow -ofoo if SWITCHES_NEED_SPACES does not include 'o'. * function.c (instantiate_virtual_regs_1, case SET): Handle case where both SET_DEST and SET_SRC reference a virtual register. (gen_mem_addressof): Copy RTX_UNCHANGING_P from new REG to old REG. * integrate.c (expand_inline_function): Handle case of setting virtual stack vars register (from built in setjmp); when parameter lives in memory, expand virtual_{stack_vars,incoming_args}_rtx early. (subst_constant): Add new parm, MEMONLY. (expand_inline_function, integrate_parm_decls): Pass new parm. (integrate_decl_tree): Likewise. (copy_rtx_and_substitute, case MEM): Do copy RTX_UNCHANGING_P. (try_constants): Call subst_constants twice, with MEMONLY 0 and 1. (copy_rtx_and_substitute, case SET): Add explicit calls to copy_rtx_and_substitute for both sides. * stmt.c (expand_asm_operands): Don't use TREE_STRING_LENGTH for constraints. (pushcase{,_range}): Convert to NOMINAL_TYPE after checking for within INDEX_TYPE, instead of before. (fixup_gotos): Use f->target_rtl, not the next insn, since latter may be from a later fixup. (expand_value_return): Correctly convert VAL when promoting function return; support RETURN_REG being a PARALLEL. (expand_return): When checking for result in regs and having cleanup, consider PARALLEL in DECL_RTL as being in regs. From-SVN: r30299
1999-11-01 02:11:22 +01:00
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. */
/* Generic garbage collection (GC) functions and data, not specific to
any particular GC implementation. */
#include "config.h"
#include "system.h"
#include "rtl.h"
#include "tree.h"
#include "tm_p.h"
#include "hash.h"
#include "varray.h"
#include "ggc.h"
/* Statistics about the allocation. */
static ggc_statistics *ggc_stats;
c-decl.c (c_expand_body): Don't generate RTL if flag_syntax_only. * c-decl.c (c_expand_body): Don't generate RTL if flag_syntax_only. (lang_mark_false_label_stack): Remove. * c-lex.c (init_c_lex): Add file_info_tree as GC root. Allocate <top level> string in GC area. (mark_splay_tree_node): New function. (mark_splay_tree): Likewise. * except.c (mark_eh_status): Only call lang_mark_false_label_stack if it exists. * ggc-callbacks.c (lang_mark_false_label_stack): Remove. * ggc-common.c (lang_mark_false_label_stack): Change type. * ggc.h (ggc_alloc_string): Add comment. (ggc_strdup): New function. * decl.c (lang_mark_false_label_stack): Remove. * lex.c (cp_mang_lang_type): Use ggc_alloc_cleared. * com.c (lang_mark_false_label_stack): Remove. Convert to GC. * Make-lang.in (s-java): Don't depend on ggc-callbacks.o. * Makefile.in (BACKEND): Don't include ggc-callbacks.o. (typeck.o): Depend on ggc.h. * class.c (add_method_1): Use GC functions for allocation. (init_class_processing): Register roots. * decl.c (ggc_p): Set to 1. (pending_local_decls): Make it static. (push_jvm_slot): Use GC functions for allocation. (init_decl_processing): Register roots. (give_name_to_locals): Use GC functions for allocation. (lang_mark_tree): New function. * java-tree.h (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Use GC functions for allocation. * jcf-parse.c (jcf_parse_source): Use ggc_strdup. * lex.c (java_lex): Use build_string, rather than replicating it inline. * parse.y (goal): Add more roots. (mark_parser_ctxt): New function. * typeck.c: Include ggc.h. * splay-tree.c (splay_tree_insert): Fix formatting. From-SVN: r36687
2000-10-01 21:19:30 +02:00
/* The FALSE_LABEL_STACK, declared in except.h, has language-dependent
semantics. If a front-end needs to mark the false label stack, it
should set this pointer to a non-NULL value. Otherwise, no marking
will be done. */
void (*lang_mark_false_label_stack) PARAMS ((struct label_node *));
/* Trees that have been marked, but whose children still need marking. */
varray_type ggc_pending_trees;
static void ggc_mark_rtx_ptr PARAMS ((void *));
static void ggc_mark_tree_ptr PARAMS ((void *));
static void ggc_mark_rtx_varray_ptr PARAMS ((void *));
static void ggc_mark_tree_varray_ptr PARAMS ((void *));
static void ggc_mark_tree_hash_table_ptr PARAMS ((void *));
static void ggc_mark_trees PARAMS ((void));
xm-lynx.h, [...]: Do not define TRUE or FALSE. * config/xm-lynx.h, config/xm-std32.h, config/a29k/xm-a29k.h, config/a29k/xm-unix.h, config/alpha/xm-alpha.h, config/arc/xm-arc.h, config/arm/xm-arm.h, config/c4x/xm-c4x.h, config/clipper/xm-clix.h, config/convex/xm-convex.h, config/d30v/xm-d30v.h, config/dsp16xx/xm-dsp16xx.h, config/elxsi/xm-elxsi.h, config/fr30/xm-fr30.h, config/h8300/xm-h8300.h, config/i370/xm-i370.h, config/i370/xm-linux.h, config/i370/xm-mvs.h, config/i370/xm-oe.h, config/i386/xm-aix.h, config/i386/xm-i386.h, config/i386/xm-osf.h, config/i860/xm-i860.h, config/i960/xm-i960.h, config/ia64/xm-ia64.h, config/m32r/xm-m32r.h, config/m68k/xm-m68k.h, config/m88k/xm-m88k.h, config/mcore/xm-mcore.h, config/mips/xm-mips.h, config/mn10200/xm-mn10200.h, config/mn10300/xm-mn10300.h, config/ns32k/xm-ns32k.h, config/pa/xm-linux.h, config/pa/xm-pa.h, config/pa/xm-pa64hpux.h, config/pa/xm-pahpux.h, config/pa/xm-papro.h, config/pj/xm-pj.h, config/romp/xm-romp.h, config/rs6000/xm-beos.h, config/rs6000/xm-rs6000.h, config/rs6000/xm-sysv4.h, config/sh/xm-sh.h, config/sparc/xm-sparc.h, config/sparc/xm-sysv4.h, config/v850/xm-v850.h, config/vax/xm-vax.h, config/vax/xm-vms.h, config/we32k/xm-we32k.h: Do not define TRUE or FALSE. * config/i386/xm-aix.h, config/i386/xm-osf.h: Delete; made empty by above change. * config.gcc: Remove references to these files. * configure.in: Detect stdbool.h. * configure, config.in: Regenerate. * system.h: Include stddef.h here if available. Set HAVE__BOOL based on GCC_VERSION and __STDC_VERSION__. Then set up a sensible boolean type at the very end. * combine.c, cse.c, expr.c, fold-const.c, gensupport.c, f/com.c, config/mcore/mcore.c: Rename variables named 'true' and/or 'false'. * hash.h: Delete 'boolean' typedef and related #undefs. * f/proj.h: Delete 'bool' type. Don't include stddef.h here. * function.c, ggc-common.c, hash.h, hash.c, tlink.c, cp/decl.c, java/class.c, java/decl.c, java/java-tree.h: Replace all uses of 'boolean' with 'bool'. From-SVN: r40176
2001-03-02 02:51:02 +01:00
static bool ggc_mark_tree_hash_table_entry PARAMS ((struct hash_entry *,
hash_table_key));
/* Maintain global roots that are preserved during GC. */
/* Global roots that are preserved during calls to gc. */
struct ggc_root
{
struct ggc_root *next;
void *base;
int nelt;
int size;
void (*cb) PARAMS ((void *));
};
static struct ggc_root *roots;
/* Add BASE as a new garbage collection root. It is an array of
length NELT with each element SIZE bytes long. CB is a
function that will be called with a pointer to each element
of the array; it is the intention that CB call the appropriate
routine to mark gc-able memory for that element. */
void
ggc_add_root (base, nelt, size, cb)
void *base;
int nelt, size;
void (*cb) PARAMS ((void *));
{
struct ggc_root *x = (struct ggc_root *) xmalloc (sizeof (*x));
x->next = roots;
x->base = base;
x->nelt = nelt;
x->size = size;
x->cb = cb;
roots = x;
}
/* Register an array of rtx as a GC root. */
void
ggc_add_rtx_root (base, nelt)
rtx *base;
int nelt;
{
ggc_add_root (base, nelt, sizeof (rtx), ggc_mark_rtx_ptr);
}
/* Register an array of trees as a GC root. */
void
ggc_add_tree_root (base, nelt)
tree *base;
int nelt;
{
ggc_add_root (base, nelt, sizeof (tree), ggc_mark_tree_ptr);
}
/* Register a varray of rtxs as a GC root. */
void
ggc_add_rtx_varray_root (base, nelt)
varray_type *base;
int nelt;
{
ggc_add_root (base, nelt, sizeof (varray_type),
ggc_mark_rtx_varray_ptr);
}
/* Register a varray of trees as a GC root. */
void
ggc_add_tree_varray_root (base, nelt)
varray_type *base;
int nelt;
{
ggc_add_root (base, nelt, sizeof (varray_type),
ggc_mark_tree_varray_ptr);
}
/* Register a hash table of trees as a GC root. */
void
ggc_add_tree_hash_table_root (base, nelt)
struct hash_table **base;
int nelt;
{
ggc_add_root (base, nelt, sizeof (struct hash_table *),
ggc_mark_tree_hash_table_ptr);
}
/* Remove the previously registered GC root at BASE. */
void
ggc_del_root (base)
void *base;
{
struct ggc_root *x, **p;
p = &roots, x = roots;
while (x)
{
if (x->base == base)
{
*p = x->next;
free (x);
return;
}
p = &x->next;
x = x->next;
}
abort();
}
/* Iterate through all registered roots and mark each element. */
void
ggc_mark_roots ()
{
struct ggc_root* x;
VARRAY_TREE_INIT (ggc_pending_trees, 4096, "ggc_pending_trees");
for (x = roots; x != NULL; x = x->next)
{
char *elt = x->base;
int s = x->size, n = x->nelt;
void (*cb) PARAMS ((void *)) = x->cb;
int i;
for (i = 0; i < n; ++i, elt += s)
(*cb)(elt);
}
/* Mark all the queued up trees, and their children. */
ggc_mark_trees ();
VARRAY_FREE (ggc_pending_trees);
}
/* R had not been previously marked, but has now been marked via
ggc_set_mark. Now recurse and process the children. */
void
ggc_mark_rtx_children (r)
rtx r;
{
const char *fmt;
int i;
rtx next_rtx;
do
{
enum rtx_code code = GET_CODE (r);
/* This gets set to a child rtx to eliminate tail recursion. */
next_rtx = NULL;
/* Collect statistics, if appropriate. */
if (ggc_stats)
{
++ggc_stats->num_rtxs[(int) code];
ggc_stats->size_rtxs[(int) code] += ggc_get_size (r);
}
/* ??? If (some of) these are really pass-dependent info, do we
have any right poking our noses in? */
switch (code)
{
case JUMP_INSN:
ggc_mark_rtx (JUMP_LABEL (r));
break;
case CODE_LABEL:
ggc_mark_rtx (LABEL_REFS (r));
break;
case LABEL_REF:
ggc_mark_rtx (LABEL_NEXTREF (r));
ggc_mark_rtx (CONTAINING_INSN (r));
break;
case ADDRESSOF:
ggc_mark_tree (ADDRESSOF_DECL (r));
break;
case CONST_DOUBLE:
ggc_mark_rtx (CONST_DOUBLE_CHAIN (r));
break;
case NOTE:
switch (NOTE_LINE_NUMBER (r))
{
case NOTE_INSN_RANGE_BEG:
case NOTE_INSN_RANGE_END:
case NOTE_INSN_LIVE:
case NOTE_INSN_EXPECTED_VALUE:
ggc_mark_rtx (NOTE_RANGE_INFO (r));
break;
case NOTE_INSN_BLOCK_BEG:
case NOTE_INSN_BLOCK_END:
ggc_mark_tree (NOTE_BLOCK (r));
break;
default:
break;
}
break;
default:
break;
}
for (fmt = GET_RTX_FORMAT (GET_CODE (r)), i = 0; *fmt ; ++fmt, ++i)
{
rtx exp;
switch (*fmt)
{
case 'e': case 'u':
exp = XEXP (r, i);
if (ggc_test_and_set_mark (exp))
{
if (next_rtx == NULL)
next_rtx = exp;
else
ggc_mark_rtx_children (exp);
}
break;
case 'V': case 'E':
ggc_mark_rtvec (XVEC (r, i));
break;
}
}
}
while ((r = next_rtx) != NULL);
}
/* V had not been previously marked, but has now been marked via
ggc_set_mark. Now recurse and process the children. */
void
ggc_mark_rtvec_children (v)
rtvec v;
{
int i;
i = GET_NUM_ELEM (v);
while (--i >= 0)
ggc_mark_rtx (RTVEC_ELT (v, i));
}
/* Recursively set marks on all of the children of the
GCC_PENDING_TREES. */
static void
ggc_mark_trees ()
{
while (ggc_pending_trees->elements_used)
{
tree t;
enum tree_code code;
t = VARRAY_TOP_TREE (ggc_pending_trees);
VARRAY_POP (ggc_pending_trees);
code = TREE_CODE (t);
/* Collect statistics, if appropriate. */
if (ggc_stats)
{
++ggc_stats->num_trees[(int) code];
ggc_stats->size_trees[(int) code] += ggc_get_size (t);
}
/* Bits from common. */
ggc_mark_tree (TREE_TYPE (t));
ggc_mark_tree (TREE_CHAIN (t));
/* Some nodes require special handling. */
switch (code)
{
case TREE_LIST:
ggc_mark_tree (TREE_PURPOSE (t));
ggc_mark_tree (TREE_VALUE (t));
continue;
case TREE_VEC:
{
int i = TREE_VEC_LENGTH (t);
while (--i >= 0)
ggc_mark_tree (TREE_VEC_ELT (t, i));
continue;
}
case COMPLEX_CST:
ggc_mark_tree (TREE_REALPART (t));
ggc_mark_tree (TREE_IMAGPART (t));
break;
case PARM_DECL:
ggc_mark_rtx (DECL_INCOMING_RTL (t));
break;
case FIELD_DECL:
ggc_mark_tree (DECL_FIELD_BIT_OFFSET (t));
break;
case IDENTIFIER_NODE:
lang_mark_tree (t);
continue;
default:
break;
}
/* But in general we can handle them by class. */
switch (TREE_CODE_CLASS (code))
{
case 'd': /* A decl node. */
ggc_mark_tree (DECL_SIZE (t));
ggc_mark_tree (DECL_SIZE_UNIT (t));
ggc_mark_tree (DECL_NAME (t));
ggc_mark_tree (DECL_CONTEXT (t));
ggc_mark_tree (DECL_ARGUMENTS (t));
ggc_mark_tree (DECL_RESULT_FLD (t));
ggc_mark_tree (DECL_INITIAL (t));
ggc_mark_tree (DECL_ABSTRACT_ORIGIN (t));
ggc_mark_tree (DECL_SECTION_NAME (t));
ggc_mark_tree (DECL_MACHINE_ATTRIBUTES (t));
varasm.c (assemble_alias): Use DECL_ASSEMBLER_NAME... * varasm.c (assemble_alias): Use DECL_ASSEMBLER_NAME, not the contents of the RTL, to determine the name of the object. * tree.h (DECL_RTL): Allocate RTL lazily. (SET_DECL_RTL): New macro. (DECL_RTL_SET_P): Likewise. (COPY_DECL_RTL): Likewise. (DECL_RTL_IF_SET): Likewise. * varasm.c (make_decl_rtl): Add assertions about the kind of declaration we are processing. * c-decl.c (duplicate_decls): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc. (start_decl): Likewise. (finish_decl): Likewise. * c-semantics.c (emit_local_var): Likewise. * calls.c (expand_call): Likewise. * dbxout.c (dbxout_symbol): Likewise. * emit-rtl.c (unshare_all_rtl): Likewise. (unshare_all_decls): Likewise. (reset_used_decls): Likewise. * expr.c (store_constructor): Likewise. (safe_from_p): Likewise. (expand_expr): Likewise. * function.c (put_var_into_stack): Likewise. (instantiate_decls_1): Likewise. (assign_parms): Likewise. (expand_function_start): Likewise. (expand_function_end): Likewise. * ggc-common.c (gcc_mark_trees): Likewise. * integrate.c (function_cannot_inline_p): Likewise. (copy_decl_for_inlining): Likewise. (expand_inline_function): Likewise. (integrate_parm_decls): Likewise. (integrate_decl_tree): Likewise. * print-tree.c (print_node): Likewise. * reg-stack.c (stack_result): Likewise. * stmt.c (label_rtx): Likewise. (expand_return): Likewise. (expand_decl): Likewise. (expand_decl_cleanup): Likewise. (expand_anon_union_decl): Likewise. * toplev.c (check_global_declarations): Likewise. (rest_of_decl_compilation): Likewise. * tree.c (simple_cst_equal): Likewise. * objc/objc-act.c (generate_static_references): Likewise. * class.c (build_clone): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc. * cp-tree.h (DECL_IN_MEMORY_P): Likewise. * decl.c (duplicate_decls): Likewise. (builtin_function): Likewise. (build_library_fn): Likewise. (build_cp_library_fn): Likewise. (check_initializer): Likewise. (cp_finish_decl): Likewise. * decl2.c (grokfield): Likewise. (grok_function_init): Remove #if 0'd code. (finish_anon_union): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc. * friend.c (do_friend): Likewise. * init.c (get_temp_regvar): Likewise. * method.c (make_thunk): Likewise. * pt.c (tsubst_friend_function): Likewise. (tsubst_decl): Likewise. (regenerate_decl_from_template): Likewise. * semantics.c (genrtl_named_return_value): Likewise. (expand_body): Likewise. (genrtl_finish_function): Likewise. * tree.c (cp_tree_equal): Likewise. * com.c (ffecom_member_phase_2): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc. (duplicate_decls): Likewise. (start_decl): Likewise. * class.c (build_static_field_ref): Likewise. (make_method_value): Likewise. (get_dispatch_table): Likewise. * decl.c (push_jvm_slot): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc. From-SVN: r40482
2001-03-15 03:51:03 +01:00
if (DECL_RTL_SET_P (t))
ggc_mark_rtx (DECL_RTL (t));
ggc_mark_rtx (DECL_LIVE_RANGE_RTL (t));
ggc_mark_tree (DECL_VINDEX (t));
Compute DECL_ASSEMBLER_NAME lazily. * tree.h (DECL_ASSEMBLER_NAME): Compute it lazily. (DECL_ASSEMBLER_NAME_SET_P): New macro. (SET_DECL_ASSEMBLER_NAME): Likewise. (COPY_DECL_ASSEMBLER_NAME): Likewise. (set_decl_assembler_name): Declare. (lang_set_decl_assembler_name): Likewise. * tree.c (lang_set_decl_assembler_name): New variab.e (set_decl_assembler_name): New function. (init_obstacks): Set lang_set_decl_assembler_name. (build_decl): Don't set DECL_ASSEMBLER_NAME. * c-decl.c (duplicate_decls): Use SET_DECL_ASSEMBLER_NAME, COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME where it's not necessary. (builtin_function): Likewise. (finish_decl): Likewise. * dbxout.c (dbxout_type_methods): Likewise. * ggc-common.c (ggc_mark_trees): Likewise. * profile.c (output_func_start_profiler): Likewise. * varasm.c (make_decl_rtl): Likewise. * class.c (get_vtable_decl): Use SET_DECL_ASSEMBLER_NAME, COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME where it's not necessary. (add_method): Remove optimization involving comparison of DECL_ASSEMBLER_NAME. (build_vtbl_or_vbase_field): Use SET_DECL_ASSEMBLER_NAME, COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME where it's not necessary. (check_methods): Likewise. (build_clone): Likewise. (built_vtt): Likewise. * cp-tree.h (DECL_NEEDED_P): Likewise. * decl.c (pushtag): Likewise. (duplicate_decls): Likewise. (pushdecl): Likewise. (builtin_function): Likewise. (build_library_fn_1): Set DECL_LANGUAGE for library functions. (build_cp_library_fn): Likewise. (maybe_commonize_var): Use SET_DECL_ASSEMBLER_NAME, COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME where it's not necessary. (make_rtl_for_nonlocal_decl): Likewise. (cp_finish_decl): Likewise. (grokfndecl): Likewise. (grokvardecl): Likewise. (grokdeclarator): Likewise. (start_function): Likewise. (cp_missing_return_ok_p): Likewise. * decl2.c (grokclassfn): Likewise. (check_classfn): Likewise. (finish_static_data_member_decl): Likewise. (grokfield): Likewise. * error.c (GLOBAL_IORD_P): Remove. (dump_global_iord): Improve output. (dump_decl): Avoid using DECL_ASSEMBLER_NAME. * except.c (nothrow_libfn_p): Summarily reject any function not in namespace-scope. * init.c (build_java_class_ref): Don't explicitly set DECL_ASSEMBLER_NAME after calling mangle_decl. * mangle.c (mangle_decl_string): Handle extern "C" functions. (mangle_decl): Set the DECL_ASSEMBLER_NAME for the decl. * method.c (set_mangled_name_for_decl): Don't explicitly set DECL_ASSEMBLER_NAME after calling mangle_decl. (make_thunk): Explicitly set the DECL_ASSEMBLER_NAME and IDENTIFIER_GLOBAL_VALUE for the thunk. * pt.c (set_mangled_name_for_template_decl): Remove. (check_explicit_specialization): Don't use it. (looup_template_class): Don't set DECL_ASSEMBLER_NAME. (tsubst_friend_function): Likewise. (tsubst_decl): Likewise. (regenerate_decl_from_template): Use COPY_DECL_ASSEMBLER_NAME. * rtti.c (get_tinfo_decl): Use SET_DECL_ASSEMBLER_NAME, COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME where it's not necessary. (tinfo_base_init): Likewise. (create_real_tinfo_var): Likewise. * search.c (looup_field_1): Likewise. * semantics.c (finish_named_return_value): Likewise. * tree.c (init_tree): Set lang_set_decl_assembler_name. * com.c (builtin_function): Use SET_DECL_ASSEMBLER_NAME. * class.c (build_class_ref): Use SET_DECL_ASSEMBLER_NAME. (layout_class): Likewise. (layout_class_method): Likewise. (emit_register_classes): Likewise. * decl.c (builtin_function): Likewise. (give_name_to_locals): Likewise. From-SVN: r40642
2001-03-20 00:50:04 +01:00
if (DECL_ASSEMBLER_NAME_SET_P (t))
ggc_mark_tree (DECL_ASSEMBLER_NAME (t));
lang_mark_tree (t);
break;
case 't': /* A type node. */
ggc_mark_tree (TYPE_SIZE (t));
ggc_mark_tree (TYPE_SIZE_UNIT (t));
ggc_mark_tree (TYPE_ATTRIBUTES (t));
ggc_mark_tree (TYPE_VALUES (t));
ggc_mark_tree (TYPE_POINTER_TO (t));
ggc_mark_tree (TYPE_REFERENCE_TO (t));
ggc_mark_tree (TYPE_NAME (t));
ggc_mark_tree (TYPE_MIN_VALUE (t));
ggc_mark_tree (TYPE_MAX_VALUE (t));
ggc_mark_tree (TYPE_NEXT_VARIANT (t));
ggc_mark_tree (TYPE_MAIN_VARIANT (t));
ggc_mark_tree (TYPE_BINFO (t));
ggc_mark_tree (TYPE_NONCOPIED_PARTS (t));
ggc_mark_tree (TYPE_CONTEXT (t));
lang_mark_tree (t);
break;
case 'b': /* A lexical block. */
ggc_mark_tree (BLOCK_VARS (t));
ggc_mark_tree (BLOCK_SUBBLOCKS (t));
ggc_mark_tree (BLOCK_SUPERCONTEXT (t));
ggc_mark_tree (BLOCK_ABSTRACT_ORIGIN (t));
break;
case 'c': /* A constant. */
ggc_mark_rtx (TREE_CST_RTL (t));
break;
case 'r': case '<': case '1':
case '2': case 'e': case 's': /* Expressions. */
{
int i = TREE_CODE_LENGTH (TREE_CODE (t));
int first_rtl = first_rtl_op (TREE_CODE (t));
while (--i >= 0)
{
if (i >= first_rtl)
ggc_mark_rtx ((rtx) TREE_OPERAND (t, i));
else
ggc_mark_tree (TREE_OPERAND (t, i));
}
break;
}
case 'x':
lang_mark_tree (t);
break;
}
}
}
/* Mark all the elements of the varray V, which contains rtxs. */
void
ggc_mark_rtx_varray (v)
varray_type v;
{
int i;
if (v)
for (i = v->num_elements - 1; i >= 0; --i)
ggc_mark_rtx (VARRAY_RTX (v, i));
}
/* Mark all the elements of the varray V, which contains trees. */
void
ggc_mark_tree_varray (v)
varray_type v;
{
int i;
if (v)
for (i = v->num_elements - 1; i >= 0; --i)
ggc_mark_tree (VARRAY_TREE (v, i));
}
/* Mark the hash table-entry HE. It's key field is really a tree. */
xm-lynx.h, [...]: Do not define TRUE or FALSE. * config/xm-lynx.h, config/xm-std32.h, config/a29k/xm-a29k.h, config/a29k/xm-unix.h, config/alpha/xm-alpha.h, config/arc/xm-arc.h, config/arm/xm-arm.h, config/c4x/xm-c4x.h, config/clipper/xm-clix.h, config/convex/xm-convex.h, config/d30v/xm-d30v.h, config/dsp16xx/xm-dsp16xx.h, config/elxsi/xm-elxsi.h, config/fr30/xm-fr30.h, config/h8300/xm-h8300.h, config/i370/xm-i370.h, config/i370/xm-linux.h, config/i370/xm-mvs.h, config/i370/xm-oe.h, config/i386/xm-aix.h, config/i386/xm-i386.h, config/i386/xm-osf.h, config/i860/xm-i860.h, config/i960/xm-i960.h, config/ia64/xm-ia64.h, config/m32r/xm-m32r.h, config/m68k/xm-m68k.h, config/m88k/xm-m88k.h, config/mcore/xm-mcore.h, config/mips/xm-mips.h, config/mn10200/xm-mn10200.h, config/mn10300/xm-mn10300.h, config/ns32k/xm-ns32k.h, config/pa/xm-linux.h, config/pa/xm-pa.h, config/pa/xm-pa64hpux.h, config/pa/xm-pahpux.h, config/pa/xm-papro.h, config/pj/xm-pj.h, config/romp/xm-romp.h, config/rs6000/xm-beos.h, config/rs6000/xm-rs6000.h, config/rs6000/xm-sysv4.h, config/sh/xm-sh.h, config/sparc/xm-sparc.h, config/sparc/xm-sysv4.h, config/v850/xm-v850.h, config/vax/xm-vax.h, config/vax/xm-vms.h, config/we32k/xm-we32k.h: Do not define TRUE or FALSE. * config/i386/xm-aix.h, config/i386/xm-osf.h: Delete; made empty by above change. * config.gcc: Remove references to these files. * configure.in: Detect stdbool.h. * configure, config.in: Regenerate. * system.h: Include stddef.h here if available. Set HAVE__BOOL based on GCC_VERSION and __STDC_VERSION__. Then set up a sensible boolean type at the very end. * combine.c, cse.c, expr.c, fold-const.c, gensupport.c, f/com.c, config/mcore/mcore.c: Rename variables named 'true' and/or 'false'. * hash.h: Delete 'boolean' typedef and related #undefs. * f/proj.h: Delete 'bool' type. Don't include stddef.h here. * function.c, ggc-common.c, hash.h, hash.c, tlink.c, cp/decl.c, java/class.c, java/decl.c, java/java-tree.h: Replace all uses of 'boolean' with 'bool'. From-SVN: r40176
2001-03-02 02:51:02 +01:00
static bool
ggc_mark_tree_hash_table_entry (he, k)
struct hash_entry *he;
hash_table_key k ATTRIBUTE_UNUSED;
{
ggc_mark_tree ((tree) he->key);
return true;
}
/* Mark all the elements of the hash-table H, which contains trees. */
void
ggc_mark_tree_hash_table (ht)
struct hash_table *ht;
{
hash_traverse (ht, ggc_mark_tree_hash_table_entry, /*info=*/0);
}
/* Type-correct function to pass to ggc_add_root. It just forwards
*ELT (which is an rtx) to ggc_mark_rtx. */
static void
ggc_mark_rtx_ptr (elt)
void *elt;
{
ggc_mark_rtx (*(rtx *) elt);
}
/* Type-correct function to pass to ggc_add_root. It just forwards
*ELT (which is a tree) to ggc_mark_tree. */
static void
ggc_mark_tree_ptr (elt)
void *elt;
{
ggc_mark_tree (*(tree *) elt);
}
/* Type-correct function to pass to ggc_add_root. It just forwards
ELT (which is really a varray_type *) to ggc_mark_rtx_varray. */
static void
ggc_mark_rtx_varray_ptr (elt)
void *elt;
{
ggc_mark_rtx_varray (*(varray_type *) elt);
}
/* Type-correct function to pass to ggc_add_root. It just forwards
ELT (which is really a varray_type *) to ggc_mark_tree_varray. */
static void
ggc_mark_tree_varray_ptr (elt)
void *elt;
{
ggc_mark_tree_varray (*(varray_type *) elt);
}
/* Type-correct function to pass to ggc_add_root. It just forwards
ELT (which is really a struct hash_table **) to
ggc_mark_tree_hash_table. */
static void
ggc_mark_tree_hash_table_ptr (elt)
void *elt;
{
ggc_mark_tree_hash_table (*(struct hash_table **) elt);
}
ggc-none.c, [...] (ggc_alloc_obj): Rename it ggc_alloc, drop second argument, never clear returned memory. toplevel: * ggc-none.c, ggc-simple.c, ggc-page.c (ggc_alloc_obj): Rename it ggc_alloc, drop second argument, never clear returned memory. * ggc-common.c (ggc_alloc_string): Use ggc_alloc. (ggc_alloc_cleared): New. * ggc.h: Prototype ggc_alloc and ggc_alloc_cleared, not ggc_alloc_obj. Remove ggc_alloc macro. (ggc_alloc_rtx, ggc_alloc_rtvec, ggc_alloc_tree): Use ggc_alloc. * rtl.c (rtvec_alloc): Clear the vector always. (rtx_alloc): Clear the first word always. Remove dirty obstack tricks (this routine is no longer a bottleneck). * tree.c (make_node): Clear the new node always. (make_tree_vec): Likewise. (tree_cons): Clear the common structure always. (build1): Likewise; also, clear TREE_COMPLEXITY. * gengenrtl.c: Use puts wherever possible. Remove extra newlines. (gendef): Clear the first word of an RTX in the generator function, irrespective of ggc_p. Initialize '0' slots to NULL. (genlegend): Don't generate obstack_alloc_rtx routine, just a thin wrapper macro around obstack_alloc. * stmt.c (expand_fixup): Use ggc_alloc. * c-typeck.c (add_pending_init): Use ggc_alloc. * emit-rtl.c (init_emit_once): Clear CONST_DOUBLE_CHAIN(tem). * varasm.c (immed_double_const): Set CONST_DOUBLE_MEM(r) to const0_rtx when it is created. (immed_real_const_1): Set CONST_DOUBLE_CHAIN(r) to NULL_RTX if we are not in a function. * tree.c (tree_class_check_failed): Make second arg an int. * tree.h: Update prototype. cp: * call.c (add_candidate): Use ggc_alloc_cleared. * decl.c (lookup_label): Likewise. * lex.c (retrofit_lang_decl): Likewise. From-SVN: r34478
2000-06-09 23:47:40 +02:00
/* Allocate a block of memory, then clear it. */
void *
ggc_alloc_cleared (size)
size_t size;
{
void *buf = ggc_alloc (size);
memset (buf, 0, size);
return buf;
}
/* Print statistics that are independent of the collector in use. */
#define SCALE(x) ((unsigned long) ((x) < 1024*10 \
? (x) \
: ((x) < 1024*1024*10 \
? (x) / 1024 \
: (x) / (1024*1024))))
#define LABEL(x) ((x) < 1024*10 ? ' ' : ((x) < 1024*1024*10 ? 'k' : 'M'))
void
ggc_print_common_statistics (stream, stats)
FILE *stream;
ggc_statistics *stats;
{
int code;
/* Set the pointer so that during collection we will actually gather
the statistics. */
ggc_stats = stats;
/* Then do one collection to fill in the statistics. */
ggc_collect ();
/* Total the statistics. */
for (code = 0; code < MAX_TREE_CODES; ++code)
{
stats->total_num_trees += stats->num_trees[code];
stats->total_size_trees += stats->size_trees[code];
}
for (code = 0; code < NUM_RTX_CODE; ++code)
{
stats->total_num_rtxs += stats->num_rtxs[code];
stats->total_size_rtxs += stats->size_rtxs[code];
}
/* Print the statistics for trees. */
fprintf (stream, "\n%-17s%10s %16s %10s\n", "Tree",
"Number", "Bytes", "% Total");
for (code = 0; code < MAX_TREE_CODES; ++code)
if (ggc_stats->num_trees[code])
{
fprintf (stream, "%-17s%10u%16ld%c %10.3f\n",
tree_code_name[code],
ggc_stats->num_trees[code],
SCALE (ggc_stats->size_trees[code]),
LABEL (ggc_stats->size_trees[code]),
(100 * ((double) ggc_stats->size_trees[code])
/ ggc_stats->total_size_trees));
}
fprintf (stream,
"%-17s%10u%16ld%c\n", "Total",
ggc_stats->total_num_trees,
SCALE (ggc_stats->total_size_trees),
LABEL (ggc_stats->total_size_trees));
/* Print the statistics for RTL. */
fprintf (stream, "\n%-17s%10s %16s %10s\n", "RTX",
"Number", "Bytes", "% Total");
for (code = 0; code < NUM_RTX_CODE; ++code)
if (ggc_stats->num_rtxs[code])
{
fprintf (stream, "%-17s%10u%16ld%c %10.3f\n",
rtx_name[code],
ggc_stats->num_rtxs[code],
SCALE (ggc_stats->size_rtxs[code]),
LABEL (ggc_stats->size_rtxs[code]),
(100 * ((double) ggc_stats->size_rtxs[code])
/ ggc_stats->total_size_rtxs));
}
fprintf (stream,
"%-17s%10u%16ld%c\n", "Total",
ggc_stats->total_num_rtxs,
SCALE (ggc_stats->total_size_rtxs),
LABEL (ggc_stats->total_size_rtxs));
/* Don't gather statistics any more. */
ggc_stats = NULL;
}