1999-09-11 21:48:37 +02:00
|
|
|
/* Simple garbage collection for the GNU compiler.
|
2000-01-17 18:16:21 +01:00
|
|
|
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
1999-09-11 21:48:37 +02:00
|
|
|
|
[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.
|
1999-09-11 21:48:37 +02:00
|
|
|
|
[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.
|
1999-09-11 21:48:37 +02:00
|
|
|
|
[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.
|
1999-09-11 21:48:37 +02:00
|
|
|
|
[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. */
|
1999-09-11 21:48:37 +02:00
|
|
|
|
|
|
|
/* 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"
|
1999-10-05 17:42:18 +02:00
|
|
|
#include "tm_p.h"
|
|
|
|
#include "hash.h"
|
1999-09-11 21:48:37 +02:00
|
|
|
#include "varray.h"
|
1999-10-05 17:42:18 +02:00
|
|
|
#include "ggc.h"
|
1999-09-11 21:48:37 +02:00
|
|
|
|
1999-10-29 06:17:33 +02:00
|
|
|
/* Statistics about the allocation. */
|
|
|
|
static ggc_statistics *ggc_stats;
|
|
|
|
|
2000-04-06 02:51:25 +02:00
|
|
|
/* Trees that have been marked, but whose children still need marking. */
|
|
|
|
varray_type ggc_pending_trees;
|
|
|
|
|
cpplib.c (if_directive_nameo): Add static prototype.
* cpplib.c (if_directive_nameo): Add static prototype.
* cse.c (cse_insn): Remove unused variable `p'.
* except.c (create_rethrow_ref, push_entry,
receive_exception_label, new_eh_region_entry, find_func_region,
clear_function_eh_region, process_nestinfo): Add static prototypes.
(get_reg_for_handler): Hide definition.
(process_nestinfo): Initialize variable `extra_handlers'.
* expr.h (expand_builtin_longjmp): Add extern prototype.
* final.c (final_addr_vec_align, align_fuzz): Add static prototypes.
* function.c (prepare_function_start): Likewise.
(pop_function_context_from): Mark parameter `context' with
ATTRIBUTE_UNUSED.
(push_temp_slots_for_block, flush_addressof): Hide definition.
* gcov.c (init_arc, reverse_arcs, create_program_flow_graph,
solve_program_flow_graph, calculate_branch_probs,
function_summary, main, fancy_abort): Add prototypes.
* gen-protos.c (add_hash, parse_fn_proto, main): Likewise.
(add_hash): Constify a char*.
* ggc-common.c (ggc_mark_rtx_ptr, ggc_mark_tree_ptr,
ggc_mark_tree_varray_ptr, ggc_mark_tree_hash_table_ptr,
ggc_mark_string_ptr, ggc_mark_tree_hash_table_entry): Add prototypes.
* integrate.c (expand_inline_function_eh_labelmap): Likewise.
* lists.c (free_list, zap_lists): Likewise.
From-SVN: r29783
1999-10-03 18:28:33 +02:00
|
|
|
static void ggc_mark_rtx_ptr PARAMS ((void *));
|
|
|
|
static void ggc_mark_tree_ptr PARAMS ((void *));
|
2000-01-25 11:47:46 +01:00
|
|
|
static void ggc_mark_rtx_varray_ptr PARAMS ((void *));
|
cpplib.c (if_directive_nameo): Add static prototype.
* cpplib.c (if_directive_nameo): Add static prototype.
* cse.c (cse_insn): Remove unused variable `p'.
* except.c (create_rethrow_ref, push_entry,
receive_exception_label, new_eh_region_entry, find_func_region,
clear_function_eh_region, process_nestinfo): Add static prototypes.
(get_reg_for_handler): Hide definition.
(process_nestinfo): Initialize variable `extra_handlers'.
* expr.h (expand_builtin_longjmp): Add extern prototype.
* final.c (final_addr_vec_align, align_fuzz): Add static prototypes.
* function.c (prepare_function_start): Likewise.
(pop_function_context_from): Mark parameter `context' with
ATTRIBUTE_UNUSED.
(push_temp_slots_for_block, flush_addressof): Hide definition.
* gcov.c (init_arc, reverse_arcs, create_program_flow_graph,
solve_program_flow_graph, calculate_branch_probs,
function_summary, main, fancy_abort): Add prototypes.
* gen-protos.c (add_hash, parse_fn_proto, main): Likewise.
(add_hash): Constify a char*.
* ggc-common.c (ggc_mark_rtx_ptr, ggc_mark_tree_ptr,
ggc_mark_tree_varray_ptr, ggc_mark_tree_hash_table_ptr,
ggc_mark_string_ptr, ggc_mark_tree_hash_table_entry): Add prototypes.
* integrate.c (expand_inline_function_eh_labelmap): Likewise.
* lists.c (free_list, zap_lists): Likewise.
From-SVN: r29783
1999-10-03 18:28:33 +02:00
|
|
|
static void ggc_mark_tree_varray_ptr PARAMS ((void *));
|
|
|
|
static void ggc_mark_tree_hash_table_ptr PARAMS ((void *));
|
|
|
|
static void ggc_mark_string_ptr PARAMS ((void *));
|
2000-04-06 02:51:25 +02:00
|
|
|
static void ggc_mark_trees PARAMS ((void));
|
cpplib.c (if_directive_nameo): Add static prototype.
* cpplib.c (if_directive_nameo): Add static prototype.
* cse.c (cse_insn): Remove unused variable `p'.
* except.c (create_rethrow_ref, push_entry,
receive_exception_label, new_eh_region_entry, find_func_region,
clear_function_eh_region, process_nestinfo): Add static prototypes.
(get_reg_for_handler): Hide definition.
(process_nestinfo): Initialize variable `extra_handlers'.
* expr.h (expand_builtin_longjmp): Add extern prototype.
* final.c (final_addr_vec_align, align_fuzz): Add static prototypes.
* function.c (prepare_function_start): Likewise.
(pop_function_context_from): Mark parameter `context' with
ATTRIBUTE_UNUSED.
(push_temp_slots_for_block, flush_addressof): Hide definition.
* gcov.c (init_arc, reverse_arcs, create_program_flow_graph,
solve_program_flow_graph, calculate_branch_probs,
function_summary, main, fancy_abort): Add prototypes.
* gen-protos.c (add_hash, parse_fn_proto, main): Likewise.
(add_hash): Constify a char*.
* ggc-common.c (ggc_mark_rtx_ptr, ggc_mark_tree_ptr,
ggc_mark_tree_varray_ptr, ggc_mark_tree_hash_table_ptr,
ggc_mark_string_ptr, ggc_mark_tree_hash_table_entry): Add prototypes.
* integrate.c (expand_inline_function_eh_labelmap): Likewise.
* lists.c (free_list, zap_lists): Likewise.
From-SVN: r29783
1999-10-03 18:28:33 +02:00
|
|
|
static boolean ggc_mark_tree_hash_table_entry PARAMS ((struct hash_entry *,
|
|
|
|
hash_table_key));
|
1999-09-11 21:48:37 +02:00
|
|
|
|
|
|
|
/* Maintain global roots that are preserved during GC. */
|
|
|
|
|
1999-09-16 21:27:01 +02:00
|
|
|
/* Global roots that are preserved during calls to gc. */
|
|
|
|
|
|
|
|
struct ggc_root
|
|
|
|
{
|
|
|
|
struct ggc_root *next;
|
|
|
|
void *base;
|
|
|
|
int nelt;
|
|
|
|
int size;
|
2000-01-17 16:28:05 +01:00
|
|
|
void (*cb) PARAMS ((void *));
|
1999-09-16 21:27:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct ggc_root *roots;
|
1999-09-11 21:48:37 +02:00
|
|
|
|
1999-10-30 23:36:13 +02:00
|
|
|
/* 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. */
|
|
|
|
|
1999-09-11 21:48:37 +02:00
|
|
|
void
|
|
|
|
ggc_add_root (base, nelt, size, cb)
|
|
|
|
void *base;
|
|
|
|
int nelt, size;
|
2000-01-17 16:28:05 +01:00
|
|
|
void (*cb) PARAMS ((void *));
|
1999-09-11 21:48:37 +02:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
1999-10-30 23:36:13 +02:00
|
|
|
/* Register an array of rtx as a GC root. */
|
|
|
|
|
1999-09-11 21:48:37 +02:00
|
|
|
void
|
|
|
|
ggc_add_rtx_root (base, nelt)
|
|
|
|
rtx *base;
|
|
|
|
int nelt;
|
|
|
|
{
|
2000-04-18 21:35:09 +02:00
|
|
|
ggc_add_root (base, nelt, sizeof (rtx), ggc_mark_rtx_ptr);
|
1999-09-11 21:48:37 +02:00
|
|
|
}
|
|
|
|
|
1999-10-30 23:36:13 +02:00
|
|
|
/* Register an array of trees as a GC root. */
|
|
|
|
|
1999-09-11 21:48:37 +02:00
|
|
|
void
|
|
|
|
ggc_add_tree_root (base, nelt)
|
|
|
|
tree *base;
|
|
|
|
int nelt;
|
|
|
|
{
|
2000-04-18 21:35:09 +02:00
|
|
|
ggc_add_root (base, nelt, sizeof (tree), ggc_mark_tree_ptr);
|
1999-09-11 21:48:37 +02:00
|
|
|
}
|
|
|
|
|
2000-01-25 11:47:46 +01:00
|
|
|
/* 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);
|
|
|
|
}
|
|
|
|
|
1999-10-30 23:36:13 +02:00
|
|
|
/* Register a varray of trees as a GC root. */
|
1999-09-11 21:48:37 +02:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
1999-10-30 23:36:13 +02:00
|
|
|
/* Register a hash table of trees as a GC root. */
|
1999-09-11 21:48:37 +02:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
1999-10-30 23:36:13 +02:00
|
|
|
/* Register an array of strings as a GC root. */
|
|
|
|
|
1999-09-11 21:48:37 +02:00
|
|
|
void
|
|
|
|
ggc_add_string_root (base, nelt)
|
|
|
|
char **base;
|
|
|
|
int nelt;
|
|
|
|
{
|
|
|
|
ggc_add_root (base, nelt, sizeof (char *), ggc_mark_string_ptr);
|
|
|
|
}
|
|
|
|
|
1999-10-30 23:36:13 +02:00
|
|
|
/* Remove the previously registered GC root at BASE. */
|
1999-09-11 21:48:37 +02:00
|
|
|
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
1999-10-30 23:36:13 +02:00
|
|
|
/* Iterate through all registered roots and mark each element. */
|
|
|
|
|
1999-09-11 21:48:37 +02:00
|
|
|
void
|
1999-09-16 21:27:01 +02:00
|
|
|
ggc_mark_roots ()
|
|
|
|
{
|
|
|
|
struct ggc_root* x;
|
|
|
|
|
2000-04-06 02:51:25 +02:00
|
|
|
VARRAY_TREE_INIT (ggc_pending_trees, 4096, "ggc_pending_trees");
|
|
|
|
|
1999-09-16 21:27:01 +02:00
|
|
|
for (x = roots; x != NULL; x = x->next)
|
|
|
|
{
|
|
|
|
char *elt = x->base;
|
|
|
|
int s = x->size, n = x->nelt;
|
2000-01-17 16:28:05 +01:00
|
|
|
void (*cb) PARAMS ((void *)) = x->cb;
|
1999-09-16 21:27:01 +02:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < n; ++i, elt += s)
|
|
|
|
(*cb)(elt);
|
|
|
|
}
|
2000-04-06 02:51:25 +02:00
|
|
|
|
|
|
|
/* Mark all the queued up trees, and their children. */
|
|
|
|
ggc_mark_trees ();
|
|
|
|
VARRAY_FREE (ggc_pending_trees);
|
1999-09-16 21:27:01 +02:00
|
|
|
}
|
|
|
|
|
1999-10-30 23:36:13 +02:00
|
|
|
/* R had not been previously marked, but has now been marked via
|
|
|
|
ggc_set_mark. Now recurse and process the children. */
|
|
|
|
|
1999-09-16 21:27:01 +02:00
|
|
|
void
|
|
|
|
ggc_mark_rtx_children (r)
|
1999-09-11 21:48:37 +02:00
|
|
|
rtx r;
|
|
|
|
{
|
|
|
|
const char *fmt;
|
|
|
|
int i;
|
1999-12-01 09:13:54 +01:00
|
|
|
rtx next_rtx;
|
1999-10-29 06:17:33 +02:00
|
|
|
|
1999-12-01 09:13:54 +01:00
|
|
|
do
|
1999-10-29 06:17:33 +02:00
|
|
|
{
|
1999-12-01 09:13:54 +01:00
|
|
|
enum rtx_code code = GET_CODE (r);
|
|
|
|
/* This gets set to a child rtx to eliminate tail recursion. */
|
|
|
|
next_rtx = NULL;
|
1999-09-11 21:48:37 +02:00
|
|
|
|
1999-12-01 09:13:54 +01:00
|
|
|
/* Collect statistics, if appropriate. */
|
|
|
|
if (ggc_stats)
|
1999-09-11 21:48:37 +02:00
|
|
|
{
|
1999-12-01 09:13:54 +01:00
|
|
|
++ggc_stats->num_rtxs[(int) code];
|
|
|
|
ggc_stats->size_rtxs[(int) code] += ggc_get_size (r);
|
|
|
|
}
|
1999-09-11 21:48:37 +02:00
|
|
|
|
1999-12-01 09:13:54 +01:00
|
|
|
/* ??? If (some of) these are really pass-dependant 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));
|
|
|
|
ggc_mark_string (LABEL_ALTERNATE_NAME (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))
|
|
|
|
{
|
2000-04-21 21:32:10 +02:00
|
|
|
case NOTE_INSN_RANGE_BEG:
|
1999-12-01 09:13:54 +01:00
|
|
|
case NOTE_INSN_RANGE_END:
|
|
|
|
case NOTE_INSN_LIVE:
|
2000-05-18 21:24:37 +02:00
|
|
|
case NOTE_INSN_EXPECTED_VALUE:
|
1999-12-01 09:13:54 +01:00
|
|
|
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:
|
|
|
|
if (NOTE_LINE_NUMBER (r) >= 0)
|
2000-05-18 21:24:37 +02:00
|
|
|
{
|
|
|
|
case NOTE_INSN_DELETED_LABEL:
|
|
|
|
ggc_mark_string (NOTE_SOURCE_FILE (r));
|
|
|
|
}
|
1999-12-01 09:13:54 +01:00
|
|
|
break;
|
|
|
|
}
|
1999-09-16 01:05:05 +02:00
|
|
|
break;
|
|
|
|
|
1999-09-11 21:48:37 +02:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
1999-12-01 09:13:54 +01:00
|
|
|
for (fmt = GET_RTX_FORMAT (GET_CODE (r)), i = 0; *fmt ; ++fmt, ++i)
|
1999-09-11 21:48:37 +02:00
|
|
|
{
|
1999-12-01 09:13:54 +01:00
|
|
|
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;
|
|
|
|
case 'S': case 's':
|
|
|
|
ggc_mark_if_gcable (XSTR (r, i));
|
|
|
|
break;
|
|
|
|
}
|
1999-09-11 21:48:37 +02:00
|
|
|
}
|
|
|
|
}
|
1999-12-01 09:13:54 +01:00
|
|
|
while ((r = next_rtx) != NULL);
|
1999-09-11 21:48:37 +02:00
|
|
|
}
|
|
|
|
|
1999-10-30 23:36:13 +02:00
|
|
|
/* V had not been previously marked, but has now been marked via
|
|
|
|
ggc_set_mark. Now recurse and process the children. */
|
|
|
|
|
1999-09-11 21:48:37 +02:00
|
|
|
void
|
1999-10-13 19:09:18 +02:00
|
|
|
ggc_mark_rtvec_children (v)
|
1999-09-11 21:48:37 +02:00
|
|
|
rtvec v;
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = GET_NUM_ELEM (v);
|
|
|
|
while (--i >= 0)
|
|
|
|
ggc_mark_rtx (RTVEC_ELT (v, i));
|
|
|
|
}
|
|
|
|
|
2000-04-06 02:51:25 +02:00
|
|
|
/* Recursively set marks on all of the children of the
|
|
|
|
GCC_PENDING_TREES. */
|
1999-10-30 23:36:13 +02:00
|
|
|
|
2000-04-06 02:51:25 +02:00
|
|
|
static void
|
|
|
|
ggc_mark_trees ()
|
1999-09-11 21:48:37 +02:00
|
|
|
{
|
2000-04-06 02:51:25 +02:00
|
|
|
while (ggc_pending_trees->elements_used)
|
1999-10-29 06:17:33 +02:00
|
|
|
{
|
2000-04-06 02:51:25 +02:00
|
|
|
tree t;
|
|
|
|
enum tree_code code;
|
1999-10-29 06:17:33 +02:00
|
|
|
|
2000-04-06 02:51:25 +02:00
|
|
|
t = VARRAY_TOP_TREE (ggc_pending_trees);
|
|
|
|
VARRAY_POP (ggc_pending_trees);
|
|
|
|
code = TREE_CODE (t);
|
1999-09-11 21:48:37 +02:00
|
|
|
|
2000-04-06 02:51:25 +02:00
|
|
|
/* 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 SAVE_EXPR:
|
|
|
|
ggc_mark_tree (TREE_OPERAND (t, 0));
|
|
|
|
ggc_mark_tree (SAVE_EXPR_CONTEXT (t));
|
|
|
|
ggc_mark_rtx (SAVE_EXPR_RTL (t));
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case RTL_EXPR:
|
|
|
|
ggc_mark_rtx (RTL_EXPR_SEQUENCE (t));
|
|
|
|
ggc_mark_rtx (RTL_EXPR_RTL (t));
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case CALL_EXPR:
|
|
|
|
ggc_mark_tree (TREE_OPERAND (t, 0));
|
|
|
|
ggc_mark_tree (TREE_OPERAND (t, 1));
|
|
|
|
ggc_mark_rtx (CALL_EXPR_RTL (t));
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case COMPLEX_CST:
|
|
|
|
ggc_mark_tree (TREE_REALPART (t));
|
|
|
|
ggc_mark_tree (TREE_IMAGPART (t));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STRING_CST:
|
|
|
|
ggc_mark_string (TREE_STRING_POINTER (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:
|
|
|
|
ggc_mark_string (IDENTIFIER_POINTER (t));
|
|
|
|
lang_mark_tree (t);
|
|
|
|
continue;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
1999-09-11 21:48:37 +02:00
|
|
|
|
2000-04-06 02:51:25 +02:00
|
|
|
/* But in general we can handle them by class. */
|
|
|
|
switch (TREE_CODE_CLASS (code))
|
|
|
|
{
|
|
|
|
case 'd': /* A decl node. */
|
|
|
|
ggc_mark_string (DECL_SOURCE_FILE (t));
|
|
|
|
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_ASSEMBLER_NAME (t));
|
|
|
|
ggc_mark_tree (DECL_SECTION_NAME (t));
|
|
|
|
ggc_mark_tree (DECL_MACHINE_ATTRIBUTES (t));
|
|
|
|
ggc_mark_rtx (DECL_RTL (t));
|
|
|
|
ggc_mark_rtx (DECL_LIVE_RANGE_RTL (t));
|
|
|
|
ggc_mark_tree (DECL_VINDEX (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)];
|
|
|
|
while (--i >= 0)
|
|
|
|
ggc_mark_tree (TREE_OPERAND (t, i));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 'x':
|
|
|
|
lang_mark_tree (t);
|
|
|
|
break;
|
|
|
|
}
|
1999-09-11 21:48:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-01-25 11:47:46 +01:00
|
|
|
/* 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));
|
|
|
|
}
|
|
|
|
|
1999-09-11 21:48:37 +02:00
|
|
|
/* 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. */
|
|
|
|
|
|
|
|
static boolean
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2000-01-25 11:47:46 +01:00
|
|
|
/* 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);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Type-correct function to pass to ggc_add_root. It just forwards
|
|
|
|
ELT (which is really a char **) to ggc_mark_string. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
ggc_mark_string_ptr (elt)
|
|
|
|
void *elt;
|
|
|
|
{
|
|
|
|
ggc_mark_string (*(char **) elt);
|
|
|
|
}
|
|
|
|
|
1999-10-30 23:36:13 +02:00
|
|
|
/* Allocate a gc-able string. If CONTENTS is null, then the memory will
|
|
|
|
be uninitialized. If LENGTH is -1, then CONTENTS is assumed to be a
|
|
|
|
null-terminated string and the memory sized accordingly. Otherwise,
|
|
|
|
the memory is filled with LENGTH bytes from CONTENTS. */
|
1999-10-13 19:09:18 +02:00
|
|
|
|
|
|
|
char *
|
|
|
|
ggc_alloc_string (contents, length)
|
|
|
|
const char *contents;
|
|
|
|
int length;
|
|
|
|
{
|
|
|
|
char *string;
|
|
|
|
|
|
|
|
if (length < 0)
|
|
|
|
{
|
|
|
|
if (contents == NULL)
|
|
|
|
return NULL;
|
|
|
|
length = strlen (contents);
|
|
|
|
}
|
|
|
|
|
|
|
|
string = (char *) ggc_alloc_obj (length + 1, 0);
|
|
|
|
if (contents != NULL)
|
|
|
|
memcpy (string, contents, length);
|
|
|
|
string[length] = 0;
|
|
|
|
|
|
|
|
return string;
|
|
|
|
}
|
1999-10-29 06:17:33 +02:00
|
|
|
|
|
|
|
/* Print statistics that are independent of the collector in use. */
|
|
|
|
|
|
|
|
void
|
|
|
|
ggc_print_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, "%-22s%-16s%-16s%-7s\n", "Code",
|
|
|
|
"Number", "Bytes", "% Total");
|
|
|
|
for (code = 0; code < MAX_TREE_CODES; ++code)
|
|
|
|
if (ggc_stats->num_trees[code])
|
|
|
|
{
|
1999-10-30 23:26:13 +02:00
|
|
|
fprintf (stream, "%s%*s%-15u %-15lu %7.3f\n",
|
1999-10-29 06:17:33 +02:00
|
|
|
tree_code_name[code],
|
1999-10-30 23:26:13 +02:00
|
|
|
22 - (int) strlen (tree_code_name[code]), "",
|
1999-10-29 06:17:33 +02:00
|
|
|
ggc_stats->num_trees[code],
|
1999-10-30 23:26:13 +02:00
|
|
|
(unsigned long) ggc_stats->size_trees[code],
|
1999-10-29 06:17:33 +02:00
|
|
|
(100 * ((double) ggc_stats->size_trees[code])
|
|
|
|
/ ggc_stats->total_size_trees));
|
|
|
|
}
|
|
|
|
fprintf (stream,
|
1999-11-16 05:55:19 +01:00
|
|
|
"%-22s%-15u %-15lu\n", "Total",
|
1999-10-29 06:17:33 +02:00
|
|
|
ggc_stats->total_num_trees,
|
1999-11-16 05:55:19 +01:00
|
|
|
(unsigned long) ggc_stats->total_size_trees);
|
1999-10-29 06:17:33 +02:00
|
|
|
|
|
|
|
/* Print the statistics for RTL. */
|
|
|
|
fprintf (stream, "\n%-22s%-16s%-16s%-7s\n", "Code",
|
|
|
|
"Number", "Bytes", "% Total");
|
|
|
|
for (code = 0; code < NUM_RTX_CODE; ++code)
|
|
|
|
if (ggc_stats->num_rtxs[code])
|
|
|
|
{
|
1999-10-30 23:26:13 +02:00
|
|
|
fprintf (stream, "%s%*s%-15u %-15lu %7.3f\n",
|
1999-10-29 06:17:33 +02:00
|
|
|
rtx_name[code],
|
1999-10-30 23:26:13 +02:00
|
|
|
22 - (int) strlen (rtx_name[code]), "",
|
1999-10-29 06:17:33 +02:00
|
|
|
ggc_stats->num_rtxs[code],
|
1999-10-30 23:26:13 +02:00
|
|
|
(unsigned long) ggc_stats->size_rtxs[code],
|
1999-10-29 06:17:33 +02:00
|
|
|
(100 * ((double) ggc_stats->size_rtxs[code])
|
|
|
|
/ ggc_stats->total_size_rtxs));
|
|
|
|
}
|
|
|
|
fprintf (stream,
|
1999-11-16 05:55:19 +01:00
|
|
|
"%-22s%-15u %-15lu\n", "Total",
|
1999-10-29 06:17:33 +02:00
|
|
|
ggc_stats->total_num_rtxs,
|
1999-11-16 05:55:19 +01:00
|
|
|
(unsigned long) ggc_stats->total_size_rtxs);
|
1999-10-29 06:17:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* Don't gather statistics any more. */
|
|
|
|
ggc_stats = NULL;
|
|
|
|
}
|