diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-10-13 06:26:46 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-10-13 06:26:46 +0000 |
commit | d7c47c0ef0309b9b24b450072b3fbbebf52f7b5a (patch) | |
tree | cd4e3b39aeeef559afdffecc5526c482b9b80b01 | |
parent | a2d421410ebac81ab3d874b79c72fc1d6dc2d60c (diff) | |
download | gcc-d7c47c0ef0309b9b24b450072b3fbbebf52f7b5a.tar.gz |
Remove obstacks.
* Makefile.in (ggc-callbacks.o): Remove target.
(flow.o): Depend on GGC_H.
* alias.c (init_alias_analysis):
Remove ggc_p conditionals.
(end_alias_analysis): Likewise.
* basic-block.h (init_flow): New function.
(allocate_reg_life_data): Declare.
* bb-reorder.c (function_obstack): Replace with ...
(flow_obstack): ... new variable.
(fixup_reorder_chain): Use it.
* c-decl.c (ggc_p): Remove.
(caller-save.c): Don't call oballoc/obfree.
* combine.c (struct
undobuf): Remove storage.
(try_combine): Don't call oballoc.
(undo_all): Don't call obfree.
* cse.c (insert): Use xmalloc, not
oballoc.
(cse_main): Adjust accordingly.
* dwarf2out.c (save_rtx): Remove
obstack code.
(dwarf2out_init): Remove ggc_p conditionals.
* emit-rtl.c (rtl_obstack): Remove.
(gen_rtx_CONST_INT): Remove ggc_p conditionals.
(make_insn_raw): Likewise.
(emit_insn_before): Likewise.
(emit_insn_after): Likewise.
(emit_insn): Likewise.
(gen_sequence): Likewise.
(copy_insn_1): Remove handling of `b' RTL components.
(init_emit_once): Remove ggc_p conditionals.
* except.c (create_rethrow_ref): Don't fool with obstacks.
(add_partial_entry): Likewise.
(call_get_eh_context): Likewise.
(begin_protect_partials): Likewise.
(protect_with_terminate): Likewise.
* explow.c
(plus_constant_wide): Likewise.
* expr.c (init_expr_once):
Likewise.
(emit_block_move): Likewise.
(clear_storage): Likewise.
(expand_expr): Likewise.
* flow.c (function_obstack): Remove.
(flow_obstack): New variable.
(flow_firstobj): Likewise.
(create_base_block): Use the flow_obstack.
(split_block): Likewise.
(split_edge): Likewise.
(calculate_global_regs_live): Likewise.
(allocate_bb_life_data): Make it static. Likewiwse.
(init_flow): New function.
(size_int_type_wide): Remove ggc_p conditionals.
* function.c
(push_function_context_to): Don't call save_tree_status.
(pop_function_context_from): Or restore_tree_status.
(assign_stack_local_1): Don't call push_obstacks.
(find_fixup_replacement): Use xmalloc.
(fixup_var_refs_insns): Free the storage.
(insns_for_mem_walk): Don't mess with obstacks.
(instantiate_decls): Likewise.
(trampoline_address): Likewise.
(expand_function_end): Likewise.
* function.h (sturct function):
Remove obstack-related variables.
(save_tree_status): Don't declare.
(restore_tree_status): Likewise.
* gcse.c (compute_can_copy):
Don't call oballoc/obfree.
* genattrtab.c (operate_exp): Remove
ggc_p conditionals.
(simplify_cond): Likewise.
(simplify_test_exp): Don't mess with obstacks.
(optimize_attrs): Likewise.
* gengenrtl.c (gendef): Don't include
ggc_p conditionals.
* ggc-callbacks.c (ggc_p): Remove.
* ggc-none.c (ggc_p): Remove.
* ggc.h (ggc_p): Don't declare.
* integrate.c (save_for_inline): Don't mess with obstacks.
(integrate_decl_tree): Likewise.
(output_inline_function): Likewise.
* lists.c
(init_EXPR_INSN_LIST_cache): Likewise.
* loop.c (temp_obstack):
Remove.
(rtl_obstack): Likewise.
(init_loop): Don't mess with obstacks.
(reg_address_cost): Free BIVs and GIVs.
(check_insns_for_bivs): Use xmalloc, not oballoc.
(find_mem_givs): Likewise.
(record_biv): Likewise.
(general_induction_var): Likewise.
(product_cheap_p): Likewse.
* optabs.c (init_one_libfunc): Remove
ggc_p conditional.
* print-tree.c (debug_tree): Don't use
oballoc/obfree.
(print_node): Likewise.
* profile.c (output_func_start_profiler):
Remove call to temporary_allocation.
* reload1.c
(eliminate_regs_in_insn): Don't mess with obstacks.
* resource.c
(mark_target_live_regs): Use xmalloc.
(free_resource_info): Free the memory.
* rtl.c (rtl_obstack):
Remove.
(rtvec_alloc): Don't mess with obstacks.
(rtx_alloc): Likewise.
(rtx_free): Remove.
(copy_rtx): Don't handle `b' cases.
(read_rtx): Use a local rtl_obstack.
* rtl.h (oballoc): Remove.
(obfree): Likewise.
(pop_obstacks): Likewise.
(push_obstacks): Likewise.
(allocate_bb_life_data): Likewise.
(allocate_reg_life_data): Likewise.
(rtx_free): Likewise.
* sdbout.c (sdbout_queue_anonymous_type):
Use tree_cons, not saveable_tree_cons.
* simplify-rtx.c
(cselib_init): Don't mess with obstacks.
* stmt.c
(mark_block_nesting): Mark the label_chain.
(epxand_label): Use ggc_alloc, not oballoc.
(clear_last_expr): Don't mess with obstacks.
(expand_decl_cleanup): Likewise.
(expand_dcc_cleanup): Likewise.
(expand_dhc_cleanup): Likewise.
(expand_anon_union_decl): Likewise.
(add_case_node): Use xmalloc, not oballoc.
(free_case_nodes): New function.
(expand_end_case): Call it.
* stor-layout.c (layout_type): Don't
mess with obstacks.
(layout_type): Likewise.
* toplev.c (wrapup_global_declarations):
Likewise.
(compile_file): Remove ggc_p conditionals.
(rest_of_compilation): Call init_flow. Remove ggc_p conditionals.
(decode_f_option): Remove ggc_p conditionals.
* tree.c
(function_maybepermanent_obstack): Remove.
(maybepermanent_obstack): Likewise.
(function_obstack): Likewise.
(tmeporary_obstack): Likewise.
(momentary_obstack): Likewise.
(temp_decl_obstack): Likewise.
(saveable_obstack): Likewise.
(rtl_obstack): Likewise.
(current_obstack): Likewise.
(expression_obstack): Likewise.
(struct obstack_stack): Likewise.
(obstack_stack): Likewise.
(obstack_stack_obstack): Likewise.
(maybepermanent_firstobj): Likewise.
(temporary_firstobj): Likewise.
(momentary_firstobj): Likewise.
(temp_decl_firstobj): Likewise.
(momentary_function_firstobj): Likewise.
(all_types_permanent): Likewise.
(struct momentary_level): Likewise.
(momentary_stack): Likewise.
(init_obstacks): Remove initialization of removed obstacks.
(save_tree_status): Remove.
(restore_tree_status): Likewise.
(temporary_allocation): Liekwise.
(end_temporary_allocation): Liekwise.
(resume_temporary_allocation): Likewise.
(saveable_allocation): Likewise.
(push_obstacks): Likewise.
(push_obstacks_nochange): Likewise.
(pop_obstacks): Likewise.
(allocation_temporary_p): Likewise.
(permanent_allocation): Likewise.
(preserve_data): Likewise.
(preserve_initializer): Likewise.
(rtl_in_current_obstack): Likewise.
(rtl_in_saveable_obstack): Likewise.
(oballoc): Likewise.
(obfree): Likewise.
(savealloc): Likewise.
(expralloc): Likewise.
(print_obstack_name): Likewise.
(debug_obstack): Likewise.
(object_permanent_p): Likewise.
(push_momentary): Likewise.
(perserve_momentary): Likewise.
(clear_momentary): Likewise.
(pop_momentary): Likewise.
(pop_momentary_nofree): Likewise.
(suspend_momentary): Likewise.
(resume_momentary): Likewise.
(make_node): Don't set TREE_PERMANENT.
(copy_node): Remove ggc_p conditionals. Don't set TYPE_OBSTACK.
Don't set TREE_PERMANENT.
(get_identifier): Remove ggc_p conditionals.
(build_string): Likewise.
(make_tree_vec): Likewise.
(build_decl_list): Remove.
(build_expr_list): Likewise.
(tree_cons): Remove ggc_p conditionals.
(decl_tree_cons): Remove.
(expr_tree_cons): Likewise.
(perm_tree_cons): Likewise.
(temp_tree_cons): Likewise.
(saveable_tree_cons): Likewise.
(build1): Remove ggc_p conditionals.
(build_parse_node): Likewise.
(build_type_attribute_variant): Don't mess with obstacks.
(build_type_copy): Likewise.
(type_hash_canon): Likewise.
(build_pointer_type): Likewise.
(build_reference_type): Likewise.
(build_index_type): Likewise.
(build_range_type): Likewise.
(dump_tree_statistics): Don't print obstack information.
* tree.h
(struct tree_common): Remove permanent_flag.
(TREE_PERMANENT): Remove.
(TREE_SET_PERMANENT): Likewise.
(TYPE_OBSTACK): Likewise.
(struct tree_type): Remove obstack.
(oballoc): Remove.
(savealloc): Likewise.
(build_decl_list): Likewise.
(build_expr_list): Likewise.
(perm_tree_cons): Likewise.
(temp_tree_cons): Likewise.
(saveable_tree_cons): Likewise.
(decl_tree_cons): Likewise.
(expr_tree_cons): Likewise.
(suspend_momentary): Likewise.
(allocation_temporary_p): Likewise.
(resume_momentary): Likewise.
(push_obstacks_nochange): Likewise.
(permanent_allocation): Likewise.
(push_momentary): Likewise.
(clear_momentary): Likewise.
(pop_momentary): Likewise.
(end_temporary_allocation): Likewise.
(pop_obstacks): Likewise.
(push_obstacks): Likewise.
(pop_momentary_nofree): LIkewise.
(preserve_momentary): Likewise.
(saveable_allocation): Likewise.
(temporary_allocation): Likewise.
(resume_temporary_allocation): Likewise.
(perserve_initializer): Likewise.
(debug_obstack): Likewise.
(rtl_in_current_obstack): Likewise.
(rtl_in_saveable_obstack): Likewise.
(obfree): Likewise.
* varasm.c (current_obstack): Remove.
(saveable_obstack): Remove.
(rtl_obstack): Remove.
(immed_double_const): Don't mess with obstacks.
(immed_real_cons): Likewise.
(output_constant_def): Likewise.
(init_varasm_status): Use xcalloc.
(mark_pool_constant): Mark the pool constant itself.
(free_varasm_status): Free memory.
(decode_rtx_const): Call bzero directly, rather than expanding it
inline.
(record_rtx_const): Don't mess with obstacks.
(force_const_mem): Likewise.
* config/arm/arm.c (arm_encode_call_attribute): Remove ggc_p
conditionals.
(aof_pic_entry): Likewise.
* config/ia64/ia64.c (ia64_encode_section_info): Likewise.
* config/m32r/m32r.c (m32r_encode_section_info): Likewise.
* config/pa/pa.c (saveable_obstack): Remove.
(rtl_obstack): Likewise.
(current_obstack): Likewise.
(output_call): Don't mess with obstacks.
(hppa_encode_label): Remove ggc_p conditionals.
* config/romp/romp.c (get_symref): Don't mess with obstacks.
* config/rs6000/rs6000.c (output_toc): Remove ggc_p conditional.
(rs6000_encode_section_info): Likewise.
* config/sh/sh.c (get_fpscr_rtx): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36856 138bc75d-0d04-0410-961f-82ee72b054a4
76 files changed, 836 insertions, 2121 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0769c81e46f..c6779afb7b5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,291 @@ +2000-10-12 Mark Mitchell <mark@codesourcery.com> + + Remove obstacks. + * Makefile.in (ggc-callbacks.o): Remove target. + (flow.o): Depend on GGC_H. + * alias.c (init_alias_analysis): + Remove ggc_p conditionals. + (end_alias_analysis): Likewise. + * basic-block.h (init_flow): New function. + (allocate_reg_life_data): Declare. + * bb-reorder.c (function_obstack): Replace with ... + (flow_obstack): ... new variable. + (fixup_reorder_chain): Use it. + * c-decl.c (ggc_p): Remove. + (caller-save.c): Don't call oballoc/obfree. + * combine.c (struct + undobuf): Remove storage. + (try_combine): Don't call oballoc. + (undo_all): Don't call obfree. + * cse.c (insert): Use xmalloc, not + oballoc. + (cse_main): Adjust accordingly. + * dwarf2out.c (save_rtx): Remove + obstack code. + (dwarf2out_init): Remove ggc_p conditionals. + * emit-rtl.c (rtl_obstack): Remove. + (gen_rtx_CONST_INT): Remove ggc_p conditionals. + (make_insn_raw): Likewise. + (emit_insn_before): Likewise. + (emit_insn_after): Likewise. + (emit_insn): Likewise. + (gen_sequence): Likewise. + (copy_insn_1): Remove handling of `b' RTL components. + (init_emit_once): Remove ggc_p conditionals. + * except.c (create_rethrow_ref): Don't fool with obstacks. + (add_partial_entry): Likewise. + (call_get_eh_context): Likewise. + (begin_protect_partials): Likewise. + (protect_with_terminate): Likewise. + * explow.c + (plus_constant_wide): Likewise. + * expr.c (init_expr_once): + Likewise. + (emit_block_move): Likewise. + (clear_storage): Likewise. + (expand_expr): Likewise. + * flow.c (function_obstack): Remove. + (flow_obstack): New variable. + (flow_firstobj): Likewise. + (create_base_block): Use the flow_obstack. + (split_block): Likewise. + (split_edge): Likewise. + (calculate_global_regs_live): Likewise. + (allocate_bb_life_data): Make it static. Likewiwse. + (init_flow): New function. + (size_int_type_wide): Remove ggc_p conditionals. + * function.c + (push_function_context_to): Don't call save_tree_status. + (pop_function_context_from): Or restore_tree_status. + (assign_stack_local_1): Don't call push_obstacks. + (find_fixup_replacement): Use xmalloc. + (fixup_var_refs_insns): Free the storage. + (insns_for_mem_walk): Don't mess with obstacks. + (instantiate_decls): Likewise. + (trampoline_address): Likewise. + (expand_function_end): Likewise. + * function.h (sturct function): + Remove obstack-related variables. + (save_tree_status): Don't declare. + (restore_tree_status): Likewise. + * gcse.c (compute_can_copy): + Don't call oballoc/obfree. + * genattrtab.c (operate_exp): Remove + ggc_p conditionals. + (simplify_cond): Likewise. + (simplify_test_exp): Don't mess with obstacks. + (optimize_attrs): Likewise. + * gengenrtl.c (gendef): Don't include + ggc_p conditionals. + * ggc-callbacks.c (ggc_p): Remove. + * + ggc-none.c (ggc_p): Remove. + * ggc.h (ggc_p): Don't declare. + * + integrate.c (save_for_inline): Don't mess with obstacks. + (integrate_decl_tree): Likewise. + (output_inline_function): Likewise. + * lists.c + (init_EXPR_INSN_LIST_cache): Likewise. + * loop.c (temp_obstack): + Remove. + (rtl_obstack): Likewise. + (init_loop): Don't mess with obstacks. + (reg_address_cost): Free BIVs and GIVs. + (check_insns_for_bivs): Use xmalloc, not oballoc. + (find_mem_givs): Likewise. + (record_biv): Likewise. + (general_induction_var): Likewise. + (product_cheap_p): Likewse. + * optabs.c (init_one_libfunc): Remove + ggc_p conditional. + * print-tree.c (debug_tree): Don't use + oballoc/obfree. + (print_node): Likewise. + * profile.c (output_func_start_profiler): + Remove call to temporary_allocation. + * reload1.c + (eliminate_regs_in_insn): Don't mess with obstacks. + * resource.c + (mark_target_live_regs): Use xmalloc. + (free_resource_info): Free the memory. + * rtl.c (rtl_obstack): + Remove. + (rtvec_alloc): Don't mess with obstacks. + (rtx_alloc): Likewise. + (rtx_free): Remove. + (copy_rtx): Don't handle `b' cases. + (read_rtx): Use a local rtl_obstack. + * rtl.h (oballoc): Remove. + (obfree): Likewise. + (pop_obstacks): Likewise. + (push_obstacks): Likewise. + (allocate_bb_life_data): Likewise. + (allocate_reg_life_data): Likewise. + (rtx_free): Likewise. + * sdbout.c (sdbout_queue_anonymous_type): + Use tree_cons, not saveable_tree_cons. + * simplify-rtx.c + (cselib_init): Don't mess with obstacks. + * stmt.c + (mark_block_nesting): Mark the label_chain. + (epxand_label): Use ggc_alloc, not oballoc. + (clear_last_expr): Don't mess with obstacks. + (expand_decl_cleanup): Likewise. + (expand_dcc_cleanup): Likewise. + (expand_dhc_cleanup): Likewise. + (expand_anon_union_decl): Likewise. + (add_case_node): Use xmalloc, not oballoc. + (free_case_nodes): New function. + (expand_end_case): Call it. + * stor-layout.c (layout_type): Don't + mess with obstacks. + (layout_type): Likewise. + * toplev.c (wrapup_global_declarations): + Likewise. + (compile_file): Remove ggc_p conditionals. + (rest_of_compilation): Call init_flow. Remove ggc_p conditionals. + (decode_f_option): Remove ggc_p conditionals. + * tree.c + (function_maybepermanent_obstack): Remove. + (maybepermanent_obstack): Likewise. + (function_obstack): Likewise. + (tmeporary_obstack): Likewise. + (momentary_obstack): Likewise. + (temp_decl_obstack): Likewise. + (saveable_obstack): Likewise. + (rtl_obstack): Likewise. + (current_obstack): Likewise. + (expression_obstack): Likewise. + (struct obstack_stack): Likewise. + (obstack_stack): Likewise. + (obstack_stack_obstack): Likewise. + (maybepermanent_firstobj): Likewise. + (temporary_firstobj): Likewise. + (momentary_firstobj): Likewise. + (temp_decl_firstobj): Likewise. + (momentary_function_firstobj): Likewise. + (all_types_permanent): Likewise. + (struct momentary_level): Likewise. + (momentary_stack): Likewise. + (init_obstacks): Remove initialization of removed obstacks. + (save_tree_status): Remove. + (restore_tree_status): Likewise. + (temporary_allocation): Liekwise. + (end_temporary_allocation): Liekwise. + (resume_temporary_allocation): Likewise. + (saveable_allocation): Likewise. + (push_obstacks): Likewise. + (push_obstacks_nochange): Likewise. + (pop_obstacks): Likewise. + (allocation_temporary_p): Likewise. + (permanent_allocation): Likewise. + (preserve_data): Likewise. + (preserve_initializer): Likewise. + (rtl_in_current_obstack): Likewise. + (rtl_in_saveable_obstack): Likewise. + (oballoc): Likewise. + (obfree): Likewise. + (savealloc): Likewise. + (expralloc): Likewise. + (print_obstack_name): Likewise. + (debug_obstack): Likewise. + (object_permanent_p): Likewise. + (push_momentary): Likewise. + (perserve_momentary): Likewise. + (clear_momentary): Likewise. + (pop_momentary): Likewise. + (pop_momentary_nofree): Likewise. + (suspend_momentary): Likewise. + (resume_momentary): Likewise. + (make_node): Don't set TREE_PERMANENT. + (copy_node): Remove ggc_p conditionals. Don't set TYPE_OBSTACK. + Don't set TREE_PERMANENT. + (get_identifier): Remove ggc_p conditionals. + (build_string): Likewise. + (make_tree_vec): Likewise. + (build_decl_list): Remove. + (build_expr_list): Likewise. + (tree_cons): Remove ggc_p conditionals. + (decl_tree_cons): Remove. + (expr_tree_cons): Likewise. + (perm_tree_cons): Likewise. + (temp_tree_cons): Likewise. + (saveable_tree_cons): Likewise. + (build1): Remove ggc_p conditionals. + (build_parse_node): Likewise. + (build_type_attribute_variant): Don't mess with obstacks. + (build_type_copy): Likewise. + (type_hash_canon): Likewise. + (build_pointer_type): Likewise. + (build_reference_type): Likewise. + (build_index_type): Likewise. + (build_range_type): Likewise. + (dump_tree_statistics): Don't print obstack information. + * tree.h + (struct tree_common): Remove permanent_flag. + (TREE_PERMANENT): Remove. + (TREE_SET_PERMANENT): Likewise. + (TYPE_OBSTACK): Likewise. + (struct tree_type): Remove obstack. + (oballoc): Remove. + (savealloc): Likewise. + (build_decl_list): Likewise. + (build_expr_list): Likewise. + (perm_tree_cons): Likewise. + (temp_tree_cons): Likewise. + (saveable_tree_cons): Likewise. + (decl_tree_cons): Likewise. + (expr_tree_cons): Likewise. + (suspend_momentary): Likewise. + (allocation_temporary_p): Likewise. + (resume_momentary): Likewise. + (push_obstacks_nochange): Likewise. + (permanent_allocation): Likewise. + (push_momentary): Likewise. + (clear_momentary): Likewise. + (pop_momentary): Likewise. + (end_temporary_allocation): Likewise. + (pop_obstacks): Likewise. + (push_obstacks): Likewise. + (pop_momentary_nofree): LIkewise. + (preserve_momentary): Likewise. + (saveable_allocation): Likewise. + (temporary_allocation): Likewise. + (resume_temporary_allocation): Likewise. + (perserve_initializer): Likewise. + (debug_obstack): Likewise. + (rtl_in_current_obstack): Likewise. + (rtl_in_saveable_obstack): Likewise. + (obfree): Likewise. + * varasm.c (current_obstack): Remove. + (saveable_obstack): Remove. + (rtl_obstack): Remove. + (immed_double_const): Don't mess with obstacks. + (immed_real_cons): Likewise. + (output_constant_def): Likewise. + (init_varasm_status): Use xcalloc. + (mark_pool_constant): Mark the pool constant itself. + (free_varasm_status): Free memory. + (decode_rtx_const): Call bzero directly, rather than expanding it + inline. + (record_rtx_const): Don't mess with obstacks. + (force_const_mem): Likewise. + * config/arm/arm.c (arm_encode_call_attribute): Remove ggc_p + conditionals. + (aof_pic_entry): Likewise. + * config/ia64/ia64.c (ia64_encode_section_info): Likewise. + * config/m32r/m32r.c (m32r_encode_section_info): Likewise. + * config/pa/pa.c (saveable_obstack): Remove. + (rtl_obstack): Likewise. + (current_obstack): Likewise. + (output_call): Don't mess with obstacks. + (hppa_encode_label): Remove ggc_p conditionals. + * config/romp/romp.c (get_symref): Don't mess with obstacks. + * config/rs6000/rs6000.c (output_toc): Remove ggc_p conditional. + (rs6000_encode_section_info): Likewise. + * config/sh/sh.c (get_fpscr_rtx): Likewise. + Thu Oct 12 16:02:31 MET DST 2000 Jan Hubicka <jh@suse.cz> * i386.md (adddi3, subdi3 splitters): Update for new pattern. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index bbfb14e43f5..eeb1e191c06 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1232,8 +1232,6 @@ ggc-page.o: ggc-page.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h toplev.h \ ggc-none.o: ggc-none.c $(CONFIG_H) $(RTL_H) $(GGC_H) -ggc-callbacks.o: ggc-callbacks.c $(CONFIG_H) $(RTL_H) $(TREE_H) $(GGC_H) - obstack.o: $(srcdir)/../libiberty/obstack.c $(CONFIG_H) rm -f obstack.c $(LN_S) $(srcdir)/../libiberty/obstack.c obstack.c @@ -1365,7 +1363,7 @@ unroll.o : unroll.c $(CONFIG_H) system.h $(RTL_H) insn-config.h function.h \ hard-reg-set.h varray.h $(BASIC_BLOCK_H) flow.o : flow.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h insn-config.h \ $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h $(RECOG_H) \ - insn-flags.h function.h except.h $(EXPR_H) ssa.h + insn-flags.h function.h except.h $(EXPR_H) ssa.h $(GGC_H) combine.o : combine.c $(CONFIG_H) system.h $(RTL_H) flags.h function.h \ insn-config.h insn-flags.h insn-codes.h $(INSN_ATTR_H) $(REGS_H) $(EXPR_H) \ $(BASIC_BLOCK_H) $(RECOG_H) real.h hard-reg-set.h toplev.h diff --git a/gcc/alias.c b/gcc/alias.c index 65b053f649b..c1158928eed 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -1935,8 +1935,7 @@ init_alias_analysis () registers. */ reg_base_value_size = maxreg * 2; reg_base_value = (rtx *) xcalloc (reg_base_value_size, sizeof (rtx)); - if (ggc_p) - ggc_add_rtx_root (reg_base_value, reg_base_value_size); + ggc_add_rtx_root (reg_base_value, reg_base_value_size); new_reg_base_value = (rtx *) xmalloc (reg_base_value_size * sizeof (rtx)); reg_seen = (char *) xmalloc (reg_base_value_size); @@ -2129,8 +2128,7 @@ end_alias_analysis () reg_known_equiv_p = 0; if (reg_base_value) { - if (ggc_p) - ggc_del_root (reg_base_value); + ggc_del_root (reg_base_value); free (reg_base_value); reg_base_value = 0; } diff --git a/gcc/basic-block.h b/gcc/basic-block.h index b04352fc8ea..2d6e2d42294 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -521,12 +521,14 @@ extern void estimate_probability PARAMS ((struct loops *)); extern void expected_value_to_br_prob PARAMS ((void)); /* In flow.c */ +extern void init_flow PARAMS ((void)); extern void reorder_basic_blocks PARAMS ((void)); extern void dump_bb PARAMS ((basic_block, FILE *)); extern void debug_bb PARAMS ((basic_block)); extern void debug_bb_n PARAMS ((int)); extern void dump_regset PARAMS ((regset, FILE *)); extern void debug_regset PARAMS ((regset)); +extern void allocate_reg_life_data PARAMS ((void)); /* This function is always defined so it can be called from the debugger, and it is declared extern so we don't get warnings about diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c index 3fa8a590276..d2ea95d1f4e 100644 --- a/gcc/bb-reorder.c +++ b/gcc/bb-reorder.c @@ -110,7 +110,7 @@ For top-level functions, this is temporary_obstack. Separate obstacks are made for nested functions. */ -extern struct obstack *function_obstack; +extern struct obstack flow_obstack; /* Structure to hold information about lexical scopes. */ @@ -676,8 +676,8 @@ fixup_reorder_chain () create_basic_block (n_basic_blocks - 1, jump_insn, jump_insn, NULL); nb = BASIC_BLOCK (n_basic_blocks - 1); - nb->global_live_at_start = OBSTACK_ALLOC_REG_SET (function_obstack); - nb->global_live_at_end = OBSTACK_ALLOC_REG_SET (function_obstack); + nb->global_live_at_start = OBSTACK_ALLOC_REG_SET (&flow_obstack); + nb->global_live_at_end = OBSTACK_ALLOC_REG_SET (&flow_obstack); nb->local_set = 0; COPY_REG_SET (nb->global_live_at_start, bb->global_live_at_start); diff --git a/gcc/c-decl.c b/gcc/c-decl.c index de45da78213..419d85f3c59 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -94,9 +94,6 @@ enum decl_context : "long long unsigned int")) #endif -/* Do GC. */ -int ggc_p = 1; - /* Nonzero if we have seen an invalid cross reference to a struct, union, or enum, but not yet printed the message. */ diff --git a/gcc/caller-save.c b/gcc/caller-save.c index 8a411e17c78..c8302ae6a7e 100644 --- a/gcc/caller-save.c +++ b/gcc/caller-save.c @@ -109,7 +109,6 @@ static void add_stored_regs PARAMS ((rtx, rtx, void *)); void init_caller_save () { - char *first_obj = (char *) oballoc (0); rtx addr_reg; int offset; rtx address; @@ -218,8 +217,6 @@ init_caller_save () } end_sequence (); - - obfree (first_obj); } /* Initialize save areas by showing that we haven't allocated any yet. */ diff --git a/gcc/combine.c b/gcc/combine.c index 9f59837ccee..03780ba976f 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -337,9 +337,6 @@ struct undo /* Record a bunch of changes to be undone, up to MAX_UNDO of them. num_undo says how many are currently recorded. - storage is nonzero if we must undo the allocation of new storage. - The value of storage is what to pass to obfree. - other_insn is nonzero if we have modified some other insn in the process of working on subst_insn. It must be verified too. @@ -350,7 +347,6 @@ struct undo struct undobuf { - char *storage; struct undo *undos; struct undo *frees; struct undo *previous_undos; @@ -1530,10 +1526,6 @@ try_combine (i3, i2, i1, new_direct_jump_p) combine_attempts++; undobuf.other_insn = 0; - /* Save the current high-water-mark so we can free storage if we didn't - accept this combination. */ - undobuf.storage = (char *) oballoc (0); - /* Reset the hard register usage information. */ CLEAR_HARD_REG_SET (newpat_used_regs); @@ -2784,7 +2776,6 @@ undo_all () undobuf.frees = undo; } - obfree (undobuf.storage); undobuf.undos = undobuf.previous_undos = 0; /* Clear this here, so that subsequent get_last_value calls are not diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 217306113cd..777c6a5b29f 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -1717,10 +1717,7 @@ arm_encode_call_attribute (decl, flag) if (DECL_WEAK (decl) && flag == SHORT_CALL_FLAG_CHAR) return; - if (ggc_p) - newstr = ggc_alloc_string (NULL, len + 2); - else - newstr = permalloc (len + 2); + newstr = ggc_alloc_string (NULL, len + 2); sprintf (newstr, "%c%s", flag, str); @@ -9743,10 +9740,7 @@ aof_pic_entry (x) polluting even more code with ifdefs, and because it never contains anything useful until we assign to it here. */ ggc_add_rtx_root (&aof_pic_label, 1); - /* This needs to persist throughout the compilation. */ - end_temporary_allocation (); aof_pic_label = gen_rtx_SYMBOL_REF (Pmode, "x$adcons"); - resume_temporary_allocation (); } for (offset = 0, chainp = &aof_pic_chain; *chainp; diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 2d77d89dde0..2026e9999b6 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -4642,11 +4642,7 @@ ia64_encode_section_info (decl) size_t len = strlen (symbol_str); char *newstr; - if (ggc_p) - newstr = ggc_alloc_string (NULL, len + 1); - else - newstr = obstack_alloc (saveable_obstack, len + 2); - + newstr = ggc_alloc_string (NULL, len + 1); *newstr = SDATA_NAME_FLAG_CHAR; memcpy (newstr + 1, symbol_str, len + 1); @@ -4659,11 +4655,8 @@ ia64_encode_section_info (decl) ENCODE_SECTION_INFO was first called. Remove the '@'.*/ else if (symbol_str[0] == SDATA_NAME_FLAG_CHAR) { - if (ggc_p) - XSTR (XEXP (DECL_RTL (decl), 0), 0) - = ggc_alloc_string (symbol_str + 1, -1); - else - XSTR (XEXP (DECL_RTL (decl), 0), 0) = symbol_str + 1; + XSTR (XEXP (DECL_RTL (decl), 0), 0) + = ggc_alloc_string (symbol_str + 1, -1); } } diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c index 52291016772..09b7e43e6c5 100644 --- a/gcc/config/m32r/m32r.c +++ b/gcc/config/m32r/m32r.c @@ -436,7 +436,7 @@ m32r_encode_section_info (decl) ? TREE_CST_RTL (decl) : DECL_RTL (decl)); const char *str = XSTR (XEXP (rtl, 0), 0); int len = strlen (str); - char *newstr = savealloc (len + 2); + char *newstr = ggc_alloc (len + 2); strcpy (newstr + 1, str); *newstr = prefix; XSTR (XEXP (rtl, 0), 0) = newstr; diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 8cdd43e115d..c74fb62af05 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -5674,9 +5674,6 @@ output_millicode_call (insn, call_dest) } extern struct obstack permanent_obstack; -extern struct obstack *saveable_obstack; -extern struct obstack *rtl_obstack; -extern struct obstack *current_obstack; /* INSN is either a function call. It may have an unconditional jump in its delay slot. @@ -5792,16 +5789,8 @@ output_call (insn, call_dest, sibcall) not found on the list, create a new entry on the list. */ if (deferred_plabels == NULL || i == n_deferred_plabels) { - struct obstack *ambient_obstack = current_obstack; - struct obstack *ambient_rtl_obstack = rtl_obstack; const char *real_name; - /* Any RTL we create here needs to live until the end of - the compilation unit and therefore must live on the - permanent obstack. */ - current_obstack = &permanent_obstack; - rtl_obstack = &permanent_obstack; - if (deferred_plabels == 0) deferred_plabels = (struct deferred_plabel *) xmalloc (1 * sizeof (struct deferred_plabel)); @@ -5817,10 +5806,6 @@ output_call (insn, call_dest, sibcall) strlen (name) + 1); strcpy (deferred_plabels[i].name, name); - /* Switch back to normal obstack allocation. */ - current_obstack = ambient_obstack; - rtl_obstack = ambient_rtl_obstack; - /* Gross. We have just implicitly taken the address of this function, mark it as such. */ STRIP_NAME_ENCODING (real_name, name); @@ -5965,11 +5950,7 @@ hppa_encode_label (sym, permanent) int len = strlen (str); char *newstr; - if (ggc_p) - newstr = ggc_alloc_string (NULL, len + 1); - else - newstr = obstack_alloc ((permanent ? &permanent_obstack : saveable_obstack), - len + 2); + newstr = ggc_alloc_string (NULL, len + 1); if (str[0] == '*') *newstr++ = *str++; diff --git a/gcc/config/romp/romp.c b/gcc/config/romp/romp.c index 9825905cb21..33e8e90bb7e 100644 --- a/gcc/config/romp/romp.c +++ b/gcc/config/romp/romp.c @@ -1352,14 +1352,12 @@ get_symref (name) if (p == 0) { /* Ensure SYMBOL_REF will stay around. */ - end_temporary_allocation (); p = *last_p = (struct symref_hashent *) permalloc (sizeof (struct symref_hashent)); p->symref = gen_rtx_SYMBOL_REF (Pmode, obstack_copy0 (&permanent_obstack, name, strlen (name))); p->next = 0; - resume_temporary_allocation (); } return p->symref; diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index e0bacdd7757..9250bc1695e 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -6705,10 +6705,8 @@ output_toc (file, x, labelno, mode) /* When the linker won't eliminate them, don't output duplicate TOC entries (this happens on AIX if there is any kind of TOC, - and on SVR4 under -fPIC or -mrelocatable). - This won't work if we are not garbage collecting, so - we don't do it, sorry. */ - if (TARGET_TOC && ggc_p) + and on SVR4 under -fPIC or -mrelocatable). */ + if (TARGET_TOC) { struct toc_hash_struct *h; void * * found; @@ -7583,11 +7581,7 @@ rs6000_encode_section_info (decl) size_t len2 = strlen (XSTR (sym_ref, 0)); char *str; - if (ggc_p) - str = ggc_alloc_string (NULL, len1 + len2); - else - str = permalloc (len1 + len2 + 1); - + str = ggc_alloc_string (NULL, len1 + len2); str[0] = '.'; str[1] = '.'; memcpy (str + len1, XSTR (sym_ref, 0), len2 + 1); @@ -7634,10 +7628,7 @@ rs6000_encode_section_info (decl) size_t len = strlen (XSTR (sym_ref, 0)); char *str; - if (ggc_p) - str = ggc_alloc_string (NULL, len + 1); - else - str = permalloc (len + 2); + str = ggc_alloc_string (NULL, len + 1); str[0] = '@'; memcpy (str + 1, XSTR (sym_ref, 0), len + 1); diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index a945666b34e..5c7c81c646a 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -5032,10 +5032,8 @@ get_fpscr_rtx () if (! fpscr_rtx) { - push_obstacks (&permanent_obstack, &permanent_obstack); fpscr_rtx = gen_rtx (REG, PSImode, 48); REG_USERVAR_P (fpscr_rtx) = 1; - pop_obstacks (); ggc_add_rtx_root (&fpscr_rtx, 1); mark_user_reg (fpscr_rtx); } diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a5a1b5e4764..d068eeba16a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,36 @@ +2000-10-12 Mark Mitchell <mark@codesourcery.com> + + * class.c (current_obstack): Remove. + * decl.c (ggc_p): Remove. + (start_decl): Don't use decl_tree_cons. + (grokdeclarator): Don't use build_decl_list. + (start_function): Don't use decl_tree_cons. + (finish_function): Don't mess with obstacks. + * decl2.c (grok_x_components): Don't use build_decl_list. + * lex.c (make_call_declarator): Don't call decl_tree_cons. + (implicitly_declare_fn): Don't call build_decl_list. + * parse.y (frob_specs): Don't call build_decl_list or + decl_tree_cons. + (expr_or_declarator_intern): Don't call decl_tree_cons. + (primary): Don't call build_decl_list. + (fcast_or_absdcl): Likewise. + (typed_declspecs): Don't call decl_tree_cons. + (reserved_declspecs): Don't call build_decl_list. + (declmods): Likewise. + (reserved_typespecquals): Likewise. + (aggr): Likewise. + (new_type_id): Likewise. + (cv_qualifiers): Likewise. + (after_type_declarator_intern): Likewise. + (notype_declarator_intern): Likewise. + (absdcl_intern): Likewise. + (named_parm): Likewise. + * pt.c (most_specialized_class): Likewise. + * repo.c (temporary_obstack): Make it a structure, not a pointer. + (init_repo): Initialize it. + * search.c (current_obstack): Remove. + * typeck2.c (add_exception_specifier): Don't call build_decl_list. + 2000-10-09 Richard Henderson <rth@cygnus.com> * Make-lang.in (CXX_EXTRA_HEADERS): Remove. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 6477261b9a0..d8f653d241e 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1155,8 +1155,6 @@ add_virtual_function (new_virtuals_p, overridden_virtuals_p, } } -extern struct obstack *current_obstack; - /* Add method METHOD to class TYPE. If ERROR_P is true, we are adding the method after the class has already been defined because a declaration for it was seen. (Even though that is erroneous, we diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 16d6ebd37c9..ba99c3bd502 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -50,10 +50,6 @@ extern tree global_namespace; extern int (*valid_lang_attribute) PARAMS ((tree, tree, tree, tree)); -/* Use garbage collection. */ - -int ggc_p = 1; - #ifndef BOOL_TYPE_SIZE #ifdef SLOW_BYTE_ACCESS /* In the new ABI, `bool' has size and alignment `1', on all @@ -7150,8 +7146,8 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes) /* This should only be done once on the top most decl. */ if (have_extern_spec && !used_extern_spec) { - declspecs = decl_tree_cons (NULL_TREE, get_identifier ("extern"), - declspecs); + declspecs = tree_cons (NULL_TREE, get_identifier ("extern"), + declspecs); used_extern_spec = 1; } @@ -11043,7 +11039,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) else if (attrlist) TREE_VALUE (attrlist) = chainon (inner_attrs, TREE_VALUE (attrlist)); else - attrlist = build_decl_list (NULL_TREE, inner_attrs); + attrlist = build_tree_list (NULL_TREE, inner_attrs); } /* Now TYPE has the actual type. */ @@ -13530,7 +13526,7 @@ start_function (declspecs, declarator, attrs, flags) /* This should only be done once on the top most decl. */ if (have_extern_spec && !used_extern_spec) { - declspecs = decl_tree_cons (NULL_TREE, get_identifier ("extern"), declspecs); + declspecs = tree_cons (NULL_TREE, get_identifier ("extern"), declspecs); used_extern_spec = 1; } @@ -14285,15 +14281,10 @@ finish_function (flags) /* Clean up. */ if (! nested) - { - /* Let the error reporting routines know that we're outside a - function. For a nested function, this value is used in - pop_cp_function_context and then reset via pop_function_context. */ - current_function_decl = NULL_TREE; - /* We don't really care about obstacks, but the middle-end - sometimes cares on what obstck things are located. */ - permanent_allocation (1); - } + /* Let the error reporting routines know that we're outside a + function. For a nested function, this value is used in + pop_cp_function_context and then reset via pop_function_context. */ + current_function_decl = NULL_TREE; return fndecl; } diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 42493ade77f..93c1be4b13d 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -926,7 +926,7 @@ grok_x_components (specs) specs = strip_attrs (specs); check_tag_decl (specs); - t = groktypename (build_decl_list (specs, NULL_TREE)); + t = groktypename (build_tree_list (specs, NULL_TREE)); /* The only case where we need to do anything additional here is an anonymous union field, e.g.: `struct S { union { int i; }; };'. */ diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 2b32d01f4b3..cf6a9e33f19 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -200,7 +200,7 @@ make_call_declarator (target, parms, cv_qualifiers, exception_specification) tree target, parms, cv_qualifiers, exception_specification; { target = build_parse_node (CALL_EXPR, target, - decl_tree_cons (parms, cv_qualifiers, NULL_TREE), + tree_cons (parms, cv_qualifiers, NULL_TREE), /* The third operand is really RTL. We shouldn't put anything there. */ NULL_TREE); diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 8bcc33377df..c3897482b01 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -2609,7 +2609,7 @@ implicitly_declare_fn (kind, type, const_p) case sfk_assignment_operator: retref = 1; - declspecs = build_decl_list (NULL_TREE, type); + declspecs = build_tree_list (NULL_TREE, type); if (const_p) type = build_qualified_type (type, TYPE_QUAL_CONST); diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y index 75930f3469f..27075e84df2 100644 --- a/gcc/cp/parse.y +++ b/gcc/cp/parse.y @@ -120,12 +120,12 @@ frob_specs (specs_attrs, lookups) split_specs_attrs (specs_attrs, ¤t_declspecs, &prefix_attributes); if (current_declspecs && TREE_CODE (current_declspecs) != TREE_LIST) - current_declspecs = build_decl_list (NULL_TREE, current_declspecs); + current_declspecs = build_tree_list (NULL_TREE, current_declspecs); if (have_extern_spec && !used_extern_spec) { - current_declspecs = decl_tree_cons (NULL_TREE, - get_identifier ("extern"), - current_declspecs); + current_declspecs = tree_cons (NULL_TREE, + get_identifier ("extern"), + current_declspecs); used_extern_spec = 1; } } @@ -1472,7 +1472,7 @@ expr_or_declarator_intern: { /* Provide support for '(' attributes '*' declarator ')' etc */ - $$ = decl_tree_cons ($1, $2, NULL_TREE); + $$ = tree_cons ($1, $2, NULL_TREE); } ; @@ -1571,7 +1571,7 @@ primary: tree type; type = hash_tree_cons (NULL_TREE, $1, NULL_TREE); - type = groktypename (build_decl_list (type, NULL_TREE)); + type = groktypename (build_tree_list (type, NULL_TREE)); $$ = build_functional_cast (type, $3); } | functional_cast @@ -1776,20 +1776,20 @@ fcast_or_absdcl: /* ISO type-id (8.1) */ type_id: typed_typespecs absdcl - { $$.t = build_decl_list ($1.t, $2); + { $$.t = build_tree_list ($1.t, $2); $$.new_type_flag = $1.new_type_flag; } | nonempty_cv_qualifiers absdcl - { $$.t = build_decl_list ($1.t, $2); + { $$.t = build_tree_list ($1.t, $2); $$.new_type_flag = $1.new_type_flag; } | typespec absdcl - { $$.t = build_decl_list (build_decl_list (NULL_TREE, $1.t), + { $$.t = build_tree_list (build_tree_list (NULL_TREE, $1.t), $2); $$.new_type_flag = $1.new_type_flag; } | typed_typespecs %prec EMPTY - { $$.t = build_decl_list ($1.t, NULL_TREE); + { $$.t = build_tree_list ($1.t, NULL_TREE); $$.new_type_flag = $1.new_type_flag; } | nonempty_cv_qualifiers %prec EMPTY - { $$.t = build_decl_list ($1.t, NULL_TREE); + { $$.t = build_tree_list ($1.t, NULL_TREE); $$.new_type_flag = $1.new_type_flag; } ; @@ -1807,23 +1807,23 @@ typed_declspecs: typed_declspecs1: declmods typespec - { $$.t = decl_tree_cons (NULL_TREE, $2.t, $1.t); + { $$.t = tree_cons (NULL_TREE, $2.t, $1.t); $$.new_type_flag = $2.new_type_flag; } | typespec reserved_declspecs %prec HYPERUNARY - { $$.t = decl_tree_cons (NULL_TREE, $1.t, $2); + { $$.t = tree_cons (NULL_TREE, $1.t, $2); $$.new_type_flag = $1.new_type_flag; } | typespec reserved_typespecquals reserved_declspecs - { $$.t = decl_tree_cons (NULL_TREE, $1.t, chainon ($2, $3)); + { $$.t = tree_cons (NULL_TREE, $1.t, chainon ($2, $3)); $$.new_type_flag = $1.new_type_flag; } | declmods typespec reserved_declspecs - { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t)); + { $$.t = tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t)); $$.new_type_flag = $2.new_type_flag; } | declmods typespec reserved_typespecquals - { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t)); + { $$.t = tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t)); $$.new_type_flag = $2.new_type_flag; } | declmods typespec reserved_typespecquals reserved_declspecs - { $$.t = decl_tree_cons (NULL_TREE, $2.t, - chainon ($3, chainon ($4, $1.t))); + { $$.t = tree_cons (NULL_TREE, $2.t, + chainon ($3, chainon ($4, $1.t))); $$.new_type_flag = $2.new_type_flag; } ; @@ -1832,18 +1832,18 @@ reserved_declspecs: { if (extra_warnings) warning ("`%s' is not at beginning of declaration", IDENTIFIER_POINTER ($$)); - $$ = build_decl_list (NULL_TREE, $$); } + $$ = build_tree_list (NULL_TREE, $$); } | reserved_declspecs typespecqual_reserved - { $$ = decl_tree_cons (NULL_TREE, $2.t, $$); } + { $$ = tree_cons (NULL_TREE, $2.t, $$); } | reserved_declspecs SCSPEC { if (extra_warnings) warning ("`%s' is not at beginning of declaration", IDENTIFIER_POINTER ($2)); - $$ = decl_tree_cons (NULL_TREE, $2, $$); } + $$ = tree_cons (NULL_TREE, $2, $$); } | reserved_declspecs attributes - { $$ = decl_tree_cons ($2, NULL_TREE, $1); } + { $$ = tree_cons ($2, NULL_TREE, $1); } | attributes - { $$ = decl_tree_cons ($1, NULL_TREE, NULL_TREE); } + { $$ = tree_cons ($1, NULL_TREE, NULL_TREE); } ; /* List of just storage classes and type modifiers. @@ -1898,24 +1898,24 @@ declmods: typed_typespecs: typespec %prec EMPTY - { $$.t = build_decl_list (NULL_TREE, $1.t); + { $$.t = build_tree_list (NULL_TREE, $1.t); $$.new_type_flag = $1.new_type_flag; } | nonempty_cv_qualifiers typespec - { $$.t = decl_tree_cons (NULL_TREE, $2.t, $1.t); + { $$.t = tree_cons (NULL_TREE, $2.t, $1.t); $$.new_type_flag = $2.new_type_flag; } | typespec reserved_typespecquals - { $$.t = decl_tree_cons (NULL_TREE, $1.t, $2); + { $$.t = tree_cons (NULL_TREE, $1.t, $2); $$.new_type_flag = $1.new_type_flag; } | nonempty_cv_qualifiers typespec reserved_typespecquals - { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t)); + { $$.t = tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t)); $$.new_type_flag = $2.new_type_flag; } ; reserved_typespecquals: typespecqual_reserved - { $$ = build_decl_list (NULL_TREE, $1.t); } + { $$ = build_tree_list (NULL_TREE, $1.t); } | reserved_typespecquals typespecqual_reserved - { $$ = decl_tree_cons (NULL_TREE, $2.t, $1); } + { $$ = tree_cons (NULL_TREE, $2.t, $1); } ; /* A typespec (but not a type qualifier). @@ -2304,7 +2304,7 @@ aggr: | aggr AGGR { error ("no body nor ';' separates two class, struct or union declarations"); } | aggr attributes - { $$ = build_decl_list ($2, $1); } + { $$ = build_tree_list ($2, $1); } ; named_class_head_sans_basetype: @@ -2734,10 +2734,10 @@ enumerator: /* ISO new-type-id (5.3.4) */ new_type_id: type_specifier_seq new_declarator - { $$.t = build_decl_list ($1.t, $2); + { $$.t = build_tree_list ($1.t, $2); $$.new_type_flag = $1.new_type_flag; } | type_specifier_seq %prec EMPTY - { $$.t = build_decl_list ($1.t, NULL_TREE); + { $$.t = build_tree_list ($1.t, NULL_TREE); $$.new_type_flag = $1.new_type_flag; } /* GNU extension to allow arrays of arbitrary types with non-constant dimension. */ @@ -2746,7 +2746,7 @@ new_type_id: if (pedantic) pedwarn ("ISO C++ forbids array dimensions with parenthesized type in new"); $$.t = build_parse_node (ARRAY_REF, TREE_VALUE ($2.t), $5); - $$.t = build_decl_list (TREE_PURPOSE ($2.t), $$.t); + $$.t = build_tree_list (TREE_PURPOSE ($2.t), $$.t); $$.new_type_flag = $2.new_type_flag; } ; @@ -2755,7 +2755,7 @@ cv_qualifiers: /* empty */ %prec EMPTY { $$ = NULL_TREE; } | cv_qualifiers CV_QUALIFIER - { $$ = decl_tree_cons (NULL_TREE, $2, $$); } + { $$ = tree_cons (NULL_TREE, $2, $$); } ; nonempty_cv_qualifiers: @@ -2790,7 +2790,7 @@ after_type_declarator_intern: { /* Provide support for '(' attributes '*' declarator ')' etc */ - $$ = decl_tree_cons ($1, $2, NULL_TREE); + $$ = tree_cons ($1, $2, NULL_TREE); } ; @@ -2869,7 +2869,7 @@ notype_declarator_intern: { /* Provide support for '(' attributes '*' declarator ')' etc */ - $$ = decl_tree_cons ($1, $2, NULL_TREE); + $$ = tree_cons ($1, $2, NULL_TREE); } ; @@ -3170,7 +3170,7 @@ absdcl_intern: { /* Provide support for '(' attributes '*' declarator ')' etc */ - $$ = decl_tree_cons ($1, $2, NULL_TREE); + $$ = tree_cons ($1, $2, NULL_TREE); } ; @@ -3653,7 +3653,7 @@ named_parm: { $$.t = build_tree_list ($1.t, $2); $$.new_type_flag = $1.new_type_flag; } | typespec declarator - { $$.t = build_tree_list (build_decl_list (NULL_TREE, $1.t), + { $$.t = build_tree_list (build_tree_list (NULL_TREE, $1.t), $2); $$.new_type_flag = $1.new_type_flag; } | typed_declspecs1 absdcl diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 7c12f9c597a..f7e27ce5d02 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -9070,7 +9070,7 @@ most_specialized_class (tmpl, args) = get_class_bindings (TREE_VALUE (t), TREE_PURPOSE (t), args); if (spec_args) { - list = decl_tree_cons (TREE_PURPOSE (t), TREE_VALUE (t), list); + list = tree_cons (TREE_PURPOSE (t), TREE_VALUE (t), list); TREE_TYPE (list) = TREE_TYPE (t); } } diff --git a/gcc/cp/repo.c b/gcc/cp/repo.c index add13dd0996..32812ec7584 100644 --- a/gcc/cp/repo.c +++ b/gcc/cp/repo.c @@ -49,7 +49,7 @@ static FILE *repo_file; static char *old_args, *old_dir, *old_main; extern int flag_use_repository; -extern struct obstack temporary_obstack; +static struct obstack temporary_obstack; extern struct obstack permanent_obstack; #define IDENTIFIER_REPO_USED(NODE) (TREE_LANG_FLAG_3 (NODE)) @@ -335,6 +335,7 @@ init_repo (filename) ggc_add_tree_root (&pending_repo, 1); ggc_add_tree_root (&original_repo, 1); + gcc_obstack_init (&temporary_obstack); open_repo_file (filename); diff --git a/gcc/cp/search.c b/gcc/cp/search.c index befcb99eef3..67f16fb1918 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -36,8 +36,6 @@ Boston, MA 02111-1307, USA. */ #define obstack_chunk_alloc xmalloc #define obstack_chunk_free free -extern struct obstack *current_obstack; - #include "stack.h" /* Obstack used for remembering decision points of breadth-first. */ diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index fecd227f174..a17ae249cdd 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -1266,7 +1266,7 @@ add_exception_specifier (list, spec, complain) break; if (!probe) { - spec = build_decl_list (NULL_TREE, spec); + spec = build_tree_list (NULL_TREE, spec); TREE_CHAIN (spec) = list; list = spec; } diff --git a/gcc/cse.c b/gcc/cse.c index 79622a49407..ac9ae6be46c 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -1591,7 +1591,7 @@ insert (x, classp, hash, mode) else { n_elements_made++; - elt = (struct table_elt *) oballoc (sizeof (struct table_elt)); + elt = (struct table_elt *) xmalloc (sizeof (struct table_elt)); } elt->exp = x; @@ -7017,10 +7017,8 @@ cse_main (f, nregs, after_loop, file) memory_extend_rtx = gen_rtx_ZERO_EXTEND (VOIDmode, NULL_RTX); #endif - /* Discard all the free elements of the previous function - since they are allocated in the temporarily obstack. */ - bzero ((char *) table, sizeof table); - free_element_chain = 0; + /* Reset the counter indicating how many elements have been made + thus far. */ n_elements_made = 0; /* Find the largest uid. */ @@ -7075,8 +7073,7 @@ cse_main (f, nregs, after_loop, file) || global_regs[i]) SET_HARD_REG_BIT (regs_invalidated_by_call, i); - if (ggc_p) - ggc_push_context (); + ggc_push_context (); /* Loop over basic blocks. Compute the maximum number of qty's needed for each basic block @@ -7135,7 +7132,7 @@ cse_main (f, nregs, after_loop, file) cse_jumps_altered |= old_cse_jumps_altered; } - if (ggc_p && cse_altered) + if (cse_altered) ggc_collect (); #ifdef USE_C_ALLOCA @@ -7143,8 +7140,7 @@ cse_main (f, nregs, after_loop, file) #endif } - if (ggc_p) - ggc_pop_context (); + ggc_pop_context (); if (max_elements_made < n_elements_made) max_elements_made = n_elements_made; diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index a73b2cc11ec..017cc625406 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -3606,15 +3606,7 @@ static rtx save_rtx (orig) register rtx orig; { - if (ggc_p) - VARRAY_PUSH_RTX (used_rtx_varray, orig); - else - { - push_obstacks_nochange (); - end_temporary_allocation (); - orig = copy_rtx (orig); - pop_obstacks (); - } + VARRAY_PUSH_RTX (used_rtx_varray, orig); return orig; } @@ -10854,11 +10846,8 @@ dwarf2out_init (asm_out_file, main_input_filename) invoked when the given (base) source file was compiled. */ comp_unit_die = gen_compile_unit_die (main_input_filename); - if (ggc_p) - { - VARRAY_RTX_INIT (used_rtx_varray, 32, "used_rtx_varray"); - ggc_add_rtx_varray_root (&used_rtx_varray, 1); - } + VARRAY_RTX_INIT (used_rtx_varray, 32, "used_rtx_varray"); + ggc_add_rtx_varray_root (&used_rtx_varray, 1); ASM_GENERATE_INTERNAL_LABEL (text_end_label, TEXT_END_LABEL, 0); ASM_GENERATE_INTERNAL_LABEL (abbrev_section_label, ABBREV_SECTION_LABEL, 0); diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index c5ddeb081ed..66b1f7e93a9 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -171,9 +171,6 @@ static rtx free_insn; #define last_filename (cfun->emit->x_last_filename) #define first_label_num (cfun->emit->x_first_label_num) -/* This is where the pointer to the obstack being used for RTL is stored. */ -extern struct obstack *rtl_obstack; - static rtx make_jump_insn_raw PARAMS ((rtx)); static rtx make_call_insn_raw PARAMS ((rtx)); static rtx find_line_note PARAMS ((rtx)); @@ -254,17 +251,7 @@ gen_rtx_CONST_INT (mode, arg) slot = htab_find_slot_with_hash (const_int_htab, &arg, (hashval_t) arg, INSERT); if (*slot == 0) - { - if (!ggc_p) - { - push_obstacks_nochange (); - end_temporary_allocation (); - *slot = gen_rtx_raw_CONST_INT (VOIDmode, arg); - pop_obstacks (); - } - else - *slot = gen_rtx_raw_CONST_INT (VOIDmode, arg); - } + *slot = gen_rtx_raw_CONST_INT (VOIDmode, arg); return (rtx) *slot; } @@ -2492,15 +2479,7 @@ make_insn_raw (pattern) { register rtx insn; - /* If in RTL generation phase, see if FREE_INSN can be used. */ - if (!ggc_p && free_insn != 0 && rtx_equal_function_value_matters) - { - insn = free_insn; - free_insn = NEXT_INSN (free_insn); - PUT_CODE (insn, INSN); - } - else - insn = rtx_alloc (INSN); + insn = rtx_alloc (INSN); INSN_UID (insn) = cur_insn_uid++; PATTERN (insn) = pattern; @@ -2927,8 +2906,6 @@ emit_insn_before (pattern, before) insn = XVECEXP (pattern, 0, i); add_insn_before (insn, before); } - if (!ggc_p && XVECLEN (pattern, 0) < SEQUENCE_RESULT_SIZE) - sequence_result[XVECLEN (pattern, 0)] = pattern; } else { @@ -3061,8 +3038,6 @@ emit_insn_after (pattern, after) add_insn_after (insn, after); after = insn; } - if (!ggc_p && XVECLEN (pattern, 0) < SEQUENCE_RESULT_SIZE) - sequence_result[XVECLEN (pattern, 0)] = pattern; } else { @@ -3222,8 +3197,6 @@ emit_insn (pattern) insn = XVECEXP (pattern, 0, i); add_insn (insn); } - if (!ggc_p && XVECLEN (pattern, 0) < SEQUENCE_RESULT_SIZE) - sequence_result[XVECLEN (pattern, 0)] = pattern; } else { @@ -3711,29 +3684,9 @@ gen_sequence () && GET_CODE (first_insn) == INSN /* Don't throw away any reg notes. */ && REG_NOTES (first_insn) == 0) - { - if (!ggc_p) - { - NEXT_INSN (first_insn) = free_insn; - free_insn = first_insn; - } - return PATTERN (first_insn); - } + return PATTERN (first_insn); - /* Put them in a vector. See if we already have a SEQUENCE of the - appropriate length around. */ - if (!ggc_p && len < SEQUENCE_RESULT_SIZE - && (result = sequence_result[len]) != 0) - sequence_result[len] = 0; - else - { - /* Ensure that this rtl goes in saveable_obstack, since we may - cache it. */ - push_obstacks_nochange (); - rtl_in_saveable_obstack (); - result = gen_rtx_SEQUENCE (VOIDmode, rtvec_alloc (len)); - pop_obstacks (); - } + result = gen_rtx_SEQUENCE (VOIDmode, rtvec_alloc (len)); for (i = 0, tem = first_insn; tem; tem = NEXT_INSN (tem), i++) XVECEXP (result, 0, i) = tem; @@ -3887,14 +3840,6 @@ copy_insn_1 (orig) } break; - case 'b': - { - bitmap new_bits = BITMAP_OBSTACK_ALLOC (rtl_obstack); - bitmap_copy (new_bits, XBITMAP (orig, i)); - XBITMAP (copy, i) = new_bits; - break; - } - case 't': case 'w': case 'i': @@ -4117,8 +4062,7 @@ init_emit_once (line_numbers) virtual_cfa_rtx = gen_rtx_raw_REG (Pmode, VIRTUAL_CFA_REGNUM); /* These rtx must be roots if GC is enabled. */ - if (ggc_p) - ggc_add_rtx_root (global_rtl, GR_MAX); + ggc_add_rtx_root (global_rtl, GR_MAX); #ifdef INIT_EXPANDERS /* This is to initialize save_machine_status and restore_machine_status before @@ -4135,8 +4079,7 @@ init_emit_once (line_numbers) for (i = - MAX_SAVED_CONST_INT; i <= MAX_SAVED_CONST_INT; i++) const_int_rtx[i + MAX_SAVED_CONST_INT] = gen_rtx_raw_CONST_INT (VOIDmode, i); - if (ggc_p) - ggc_add_rtx_root (const_int_rtx, 2 * MAX_SAVED_CONST_INT + 1); + ggc_add_rtx_root (const_int_rtx, 2 * MAX_SAVED_CONST_INT + 1); if (STORE_FLAG_VALUE >= - MAX_SAVED_CONST_INT && STORE_FLAG_VALUE <= MAX_SAVED_CONST_INT) diff --git a/gcc/except.c b/gcc/except.c index efa61e5bbef..d3a0a3ca509 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -503,15 +503,11 @@ create_rethrow_ref (region_num) char *ptr; char buf[60]; - push_obstacks_nochange (); - end_temporary_allocation (); - ASM_GENERATE_INTERNAL_LABEL (buf, "LRTH", region_num); ptr = ggc_alloc_string (buf, -1); def = gen_rtx_SYMBOL_REF (Pmode, ptr); SYMBOL_REF_NEED_ADJUST (def) = 1; - pop_obstacks (); return def; } @@ -1104,10 +1100,6 @@ add_partial_entry (handler) { expand_eh_region_start (); - /* Make sure the entry is on the correct obstack. */ - push_obstacks_nochange (); - resume_temporary_allocation (); - /* Because this is a cleanup action, we may have to protect the handler with __terminate. */ handler = protect_with_terminate (handler); @@ -1121,7 +1113,6 @@ add_partial_entry (handler) /* Add this entry to the front of the list. */ TREE_VALUE (protect_list) = tree_cons (NULL_TREE, handler, TREE_VALUE (protect_list)); - pop_obstacks (); } /* Emit code to get EH context to current function. */ @@ -1136,8 +1127,6 @@ call_get_eh_context () { tree fntype; fn = get_identifier ("__get_eh_context"); - push_obstacks_nochange (); - end_temporary_allocation (); fntype = build_pointer_type (build_pointer_type (build_pointer_type (void_type_node))); fntype = build_function_type (fntype, NULL_TREE); @@ -1148,7 +1137,6 @@ call_get_eh_context () TREE_READONLY (fn) = 1; make_decl_rtl (fn, NULL_PTR, 1); assemble_external (fn); - pop_obstacks (); ggc_add_tree_root (&fn, 1); } @@ -2043,15 +2031,8 @@ expand_rethrow (label) void begin_protect_partials () { - /* Put the entry on the function obstack. */ - push_obstacks_nochange (); - resume_temporary_allocation (); - /* Push room for a new list. */ protect_list = tree_cons (NULL_TREE, NULL_TREE, protect_list); - - /* We're done with the function obstack now. */ - pop_obstacks (); } /* End all the pending exception regions on protect_list. The handlers @@ -2091,10 +2072,6 @@ protect_with_terminate (e) { tree handler, result; - /* All cleanups must be on the function_obstack. */ - push_obstacks_nochange (); - resume_temporary_allocation (); - handler = make_node (RTL_EXPR); TREE_TYPE (handler) = void_type_node; RTL_EXPR_RTL (handler) = const0_rtx; @@ -2112,8 +2089,6 @@ protect_with_terminate (e) TREE_THIS_VOLATILE (result) = TREE_THIS_VOLATILE (e); TREE_READONLY (result) = TREE_READONLY (e); - pop_obstacks (); - e = result; } diff --git a/gcc/explow.c b/gcc/explow.c index b2763e3abf0..92de3418cfb 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -129,15 +129,10 @@ plus_constant_wide (x, c) if (GET_CODE (XEXP (x, 0)) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (XEXP (x, 0))) { - /* Any rtl we create here must go in a saveable obstack, since - we might have been called from within combine. */ - push_obstacks_nochange (); - rtl_in_saveable_obstack (); tem = force_const_mem (GET_MODE (x), plus_constant (get_pool_constant (XEXP (x, 0)), c)); - pop_obstacks (); if (memory_address_p (GET_MODE (tem), XEXP (tem, 0))) return tem; } diff --git a/gcc/expr.c b/gcc/expr.c index c36d61fcb96..2115a471ae9 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -238,15 +238,9 @@ init_expr_once () enum machine_mode mode; int num_clobbers; rtx mem, mem1; - char *free_point; start_sequence (); - /* Since we are on the permanent obstack, we must be sure we save this - spot AFTER we call start_sequence, since it will reuse the rtl it - makes. */ - free_point = (char *) oballoc (0); - /* Try indexing by frame ptr and try by stack ptr. It is known that on the Convex the stack ptr isn't a valid index. With luck, one or the other is valid on any machine. */ @@ -302,7 +296,6 @@ init_expr_once () } end_sequence (); - obfree (free_point); } /* This is run at the start of compiling a function. */ @@ -1757,8 +1750,6 @@ emit_block_move (x, y, size, align) /* This was copied from except.c, I don't know if all this is necessary in this context or not. */ fn = get_identifier ("memcpy"); - push_obstacks_nochange (); - end_temporary_allocation (); fntype = build_pointer_type (void_type_node); fntype = build_function_type (fntype, NULL_TREE); fn = build_decl (FUNCTION_DECL, fn, fntype); @@ -1768,7 +1759,6 @@ emit_block_move (x, y, size, align) DECL_ARTIFICIAL (fn) = 1; make_decl_rtl (fn, NULL_PTR, 1); assemble_external (fn); - pop_obstacks (); } /* We need to make an argument list for the function call. @@ -2525,8 +2515,6 @@ clear_storage (object, size, align) /* This was copied from except.c, I don't know if all this is necessary in this context or not. */ fn = get_identifier ("memset"); - push_obstacks_nochange (); - end_temporary_allocation (); fntype = build_pointer_type (void_type_node); fntype = build_function_type (fntype, NULL_TREE); fn = build_decl (FUNCTION_DECL, fn, fntype); @@ -2536,7 +2524,6 @@ clear_storage (object, size, align) DECL_ARTIFICIAL (fn) = 1; make_decl_rtl (fn, NULL_PTR, 1); assemble_external (fn); - pop_obstacks (); } /* We need to make an argument list for the function call. @@ -5966,15 +5953,9 @@ expand_expr (exp, target, tmode, modifier) && function != inline_function_decl && function != 0) { struct function *p = find_function_data (function); - /* Allocate in the memory associated with the function - that the label is in. */ - push_obstacks (p->function_obstack, - p->function_maybepermanent_obstack); - p->expr->x_forced_labels = gen_rtx_EXPR_LIST (VOIDmode, label_rtx (exp), p->expr->x_forced_labels); - pop_obstacks (); } else { @@ -6007,11 +5988,8 @@ expand_expr (exp, target, tmode, modifier) if (DECL_SIZE (exp) == 0 && COMPLETE_TYPE_P (TREE_TYPE (exp)) && (TREE_STATIC (exp) || DECL_EXTERNAL (exp))) { - push_obstacks_nochange (); - end_temporary_allocation (); layout_decl (exp, 0); PUT_MODE (DECL_RTL (exp), DECL_MODE (exp)); - pop_obstacks (); } /* Although static-storage variables start off initialized, according to diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index 63d89b59bb6..0ffe42ea258 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,3 +1,43 @@ +Thu Oct 12 22:28:51 2000 Mark Mitchell <mark@codesourcery.com> + + * com.c (ffecom_do_entry_): Don't mess with obstacks. + (ffecom_finish_global_): Likewise. + (ffecom_finish_symbol_transform_): Likewise. + (ffecom_gen_sfuncdef_): Likewise. + (ffecom_init_zero_): Likewise. + (ffecom_start_progunit_): Likewise. + (ffecom_sym_transform_): Likewise. + (ffecom_sym_transform_assign_): Likewise. + (ffecom_transform_equiv_): Likewise. + (ffecom_transform_namelist_): Likewise. + (ffecom_vardesc_): Likewise. + (ffecom_vardesc_array_): Likewise. + (ffecom_vardesc_dims_): Likewise. + (ffecom_end_transition): Likewise. + (ffecom_make_tempvar): Likewise. + (bison_rule_pushlevel_): Likewise. + (bison_rule_compstmt_): Likewise. + (finish_decl): Likewise. + (finish_function): Likewise. + (push_parm_decl): Likewise. + (start_decl): Likewise. + (start_function): Likewise. + (ggc_p): Don't define. + * std.c (ffestd_stmt_pass_): Likewise. + * ste.c (ffeste_end_block_): Likewise. + (ffeste_end_stmt_): Likewise. + (ffeste_begin_iterdo_): Likewise. + (ffeste_io_ialist_): Likewise. + (ffeste_io_cilist_): Likewise. + (ffeste_io_inlist_): Likewise. + (ffeste_io_olist_): Likewise. + (ffeste_R810): Likewise. + (ffeste_R838): Likewise. + (ffeste_R839): Likewise. + (ffeste_R842): Likewise. + (ffeste_R843): Likewise. + (ffeste_R1001): Likewise. + 2000-10-05 Richard Henderson <rth@cygnus.com> * com.c (finish_function): Don't init can_reach_end. diff --git a/gcc/f/com.c b/gcc/f/com.c index 7648910e3ea..495f168e056 100644 --- a/gcc/f/com.c +++ b/gcc/f/com.c @@ -54,8 +54,6 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA when it comes to building decls: Internal Function (one we define, not just declare as extern): - int yes; - yes = suspend_momentary (); if (is_nested) push_f_function_context (); start_function (get_identifier ("function_name"), function_type, is_nested, is_public); @@ -66,13 +64,10 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA ffecom_end_compstmt (); finish_function (is_nested); if (is_nested) pop_f_function_context (); - if (is_nested) resume_momentary (yes); Everything Else: - int yes; tree d; tree init; - yes = suspend_momentary (); // fill in external, public, static, &c for decl, and // set DECL_INITIAL to error_mark_node if going to initialize // set is_top_level TRUE only if not at top level and decl @@ -80,7 +75,6 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA d = start_decl (decl, is_top_level); init = ...; // if have initializer finish_decl (d, init, is_top_level); - resume_momentary (yes); */ @@ -2698,23 +2692,12 @@ ffecom_do_entry_ (ffesymbol fn, int entrynum) bool cmplxfunc; /* Use f2c way of returning COMPLEX. */ bool multi; /* Master fn has multiple return types. */ bool altreturning = FALSE; /* This entry point has alternate returns. */ - int yes; int old_lineno = lineno; const char *old_input_filename = input_filename; input_filename = ffesymbol_where_filename (fn); lineno = ffesymbol_where_filelinenum (fn); - /* c-parse.y indeed does call suspend_momentary and not only ignores the - return value, but also never calls resume_momentary, when starting an - outer function (see "fndef:", "setspecs:", and so on). So g77 does the - same thing. It shouldn't be a problem since start_function calls - temporary_allocation, but it might be necessary. If it causes a problem - here, then maybe there's a bug lurking in gcc. NOTE: This identical - comment appears twice in thist file. */ - - suspend_momentary (); - ffecom_doing_entry_ = TRUE; /* Don't bother with array dimensions. */ switch (ffecom_primary_entry_kind_) @@ -2835,8 +2818,6 @@ ffecom_do_entry_ (ffesymbol fn, int entrynum) /* Build dummy arg list for this entry point. */ - yes = suspend_momentary (); - if (charfunc || cmplxfunc) { /* Prepend arg for where result goes. */ tree type; @@ -2873,8 +2854,6 @@ ffecom_do_entry_ (ffesymbol fn, int entrynum) ffecom_push_dummy_decls_ (ffesymbol_dummyargs (fn), FALSE); - resume_momentary (yes); - store_parm_decls (0); ffecom_start_compstmt (); @@ -2885,16 +2864,12 @@ ffecom_do_entry_ (ffesymbol fn, int entrynum) if (multi) { - yes = suspend_momentary (); - multi_retval = ffecom_get_invented_identifier ("__g77_%s", "multi_retval"); multi_retval = build_decl (VAR_DECL, multi_retval, ffecom_multi_type_node_); multi_retval = start_decl (multi_retval, FALSE); finish_decl (multi_retval, NULL_TREE, FALSE); - - resume_momentary (yes); } else multi_retval = NULL_TREE; /* Not actually ref'd if !multi. */ @@ -3045,8 +3020,6 @@ ffecom_do_entry_ (ffesymbol fn, int entrynum) call)); expand_return (result); } - - clear_momentary (); } ffecom_end_compstmt (); @@ -6112,8 +6085,6 @@ ffecom_finish_global_ (ffeglobal global) || !ffeglobal_common_have_size (global)) return global; /* No need to make common, never ref'd. */ - suspend_momentary (); - DECL_EXTERNAL (cbt) = 0; /* Give the array a size now. */ @@ -6172,8 +6143,6 @@ ffecom_finish_symbol_transform_ (ffesymbol s) if ((ffesymbol_where (s) == FFEINFO_whereCOMMON) && (ffesymbol_hook (s).decl_tree != error_mark_node)) { - int yes = suspend_momentary (); - /* This isn't working, at least for dbxout. The .s file looks okay to me (burley), but in gdb 4.9 at least, the variables appear to reside somewhere outside of the common area, so @@ -6182,8 +6151,6 @@ ffecom_finish_symbol_transform_ (ffesymbol s) with EQUIVALENCE, sadly...see similar #if later. */ ffecom_member_phase2_ (ffesymbol_storage (ffesymbol_common (s)), ffesymbol_storage (s)); - - resume_momentary (yes); } return s; @@ -6297,7 +6264,6 @@ ffecom_gen_sfuncdef_ (ffesymbol s, ffeinfoBasictype bt, ffeinfoKindtype kt) tree result; bool charfunc = (bt == FFEINFO_basictypeCHARACTER); static bool recurse = FALSE; - int yes; int old_lineno = lineno; const char *old_input_filename = input_filename; @@ -6326,8 +6292,6 @@ ffecom_gen_sfuncdef_ (ffesymbol s, ffeinfoBasictype bt, ffeinfoKindtype kt) assert (!recurse); recurse = TRUE; - yes = suspend_momentary (); - push_f_function_context (); if (charfunc) @@ -6349,8 +6313,6 @@ ffecom_gen_sfuncdef_ (ffesymbol s, ffeinfoBasictype bt, ffeinfoKindtype kt) entirely internal to our code, and gcc has the ability to return COMPLEX directly as a value. */ - yes = suspend_momentary (); - if (charfunc) { /* Prepend arg for where result goes. */ tree type; @@ -6371,8 +6333,6 @@ ffecom_gen_sfuncdef_ (ffesymbol s, ffeinfoBasictype bt, ffeinfoKindtype kt) ffecom_push_dummy_decls_ (ffesymbol_dummyargs (s), TRUE); - resume_momentary (yes); - store_parm_decls (0); ffecom_start_compstmt (); @@ -6404,8 +6364,6 @@ ffecom_gen_sfuncdef_ (ffesymbol s, ffeinfoBasictype bt, ffeinfoKindtype kt) DECL_RESULT (current_function_decl), ffecom_expr (expr))); } - - clear_momentary (); } ffecom_end_compstmt (); @@ -6415,8 +6373,6 @@ ffecom_gen_sfuncdef_ (ffesymbol s, ffeinfoBasictype bt, ffeinfoKindtype kt) pop_f_function_context (); - resume_momentary (yes); - recurse = FALSE; lineno = old_lineno; @@ -6515,8 +6471,6 @@ ffecom_init_zero_ (tree decl) assemble_variable (decl, TREE_PUBLIC (decl) ? 1 : 0, 0, 1); } - push_momentary (); - if ((TREE_CODE (type) != ARRAY_TYPE) && (TREE_CODE (type) != RECORD_TYPE) && (TREE_CODE (type) != UNION_TYPE) @@ -6524,26 +6478,16 @@ ffecom_init_zero_ (tree decl) init = convert (type, integer_zero_node); else if (!incremental) { - int momentary = suspend_momentary (); - init = build (CONSTRUCTOR, type, NULL_TREE, NULL_TREE); TREE_CONSTANT (init) = 1; TREE_STATIC (init) = 1; - - resume_momentary (momentary); } else { - int momentary = suspend_momentary (); - assemble_zeros (int_size_in_bytes (type)); init = error_mark_node; - - resume_momentary (momentary); } - pop_momentary_nofree (); - return init; } @@ -7339,7 +7283,6 @@ ffecom_start_progunit_ () bool main_program = FALSE; int old_lineno = lineno; const char *old_input_filename = input_filename; - int yes; assert (fn != NULL); assert (ffesymbol_hook (fn).decl_tree == NULL_TREE); @@ -7347,16 +7290,6 @@ ffecom_start_progunit_ () input_filename = ffesymbol_where_filename (fn); lineno = ffesymbol_where_filelinenum (fn); - /* c-parse.y indeed does call suspend_momentary and not only ignores the - return value, but also never calls resume_momentary, when starting an - outer function (see "fndef:", "setspecs:", and so on). So g77 does the - same thing. It shouldn't be a problem since start_function calls - temporary_allocation, but it might be necessary. If it causes a problem - here, then maybe there's a bug lurking in gcc. NOTE: This identical - comment appears twice in thist file. */ - - suspend_momentary (); - switch (ffecom_primary_entry_kind_) { case FFEINFO_kindPROGRAM: @@ -7468,8 +7401,6 @@ ffecom_start_progunit_ () ffeglobal_set_hook (g, current_function_decl); } - yes = suspend_momentary (); - /* Arg handling needs exec-transitioned ffesymbols to work with. But exec-transitioning needs current_function_decl to be filled in. So we do these things in two phases. */ @@ -7532,8 +7463,6 @@ ffecom_start_progunit_ () ffecom_push_dummy_decls_ (arglist, FALSE); } - resume_momentary (yes); - if (TREE_CODE (current_function_decl) != ERROR_MARK) store_parm_decls (main_program ? 1 : 0); @@ -7572,7 +7501,6 @@ ffecom_sym_transform_ (ffesymbol s) ffeinfoBasictype bt; ffeinfoKindtype kt; ffeglobal g; - int yes; int old_lineno = lineno; const char *old_input_filename = input_filename; @@ -7698,9 +7626,7 @@ ffecom_sym_transform_ (ffesymbol s) break; } - yes = suspend_momentary (); type = ffecom_type_localvar_ (s, bt, kt); - resume_momentary (yes); if (type == error_mark_node) { @@ -7713,7 +7639,6 @@ ffecom_sym_transform_ (ffesymbol s) { /* Child of EQUIVALENCE parent. */ ffestorag est; tree et; - int yes; ffetargetOffset offset; est = ffestorag_parent (st); @@ -7725,8 +7650,6 @@ ffecom_sym_transform_ (ffesymbol s) if (! TREE_STATIC (et)) put_var_into_stack (et); - yes = suspend_momentary (); - offset = ffestorag_modulo (est) + ffestorag_offset (ffesymbol_storage (s)) - ffestorag_offset (est); @@ -7747,16 +7670,12 @@ ffecom_sym_transform_ (ffesymbol s) TREE_CONSTANT (t) = staticp (et); addr = TRUE; - - resume_momentary (yes); } else { tree initexpr; bool init = ffesymbol_is_init (s); - yes = suspend_momentary (); - t = build_decl (VAR_DECL, ffecom_get_identifier_ (ffesymbol_text (s)), type); @@ -7805,8 +7724,6 @@ ffecom_sym_transform_ (ffesymbol s) assert (0 == compare_tree_int (DECL_SIZE_UNIT (t), ffestorag_size (st))); } - - resume_momentary (yes); } } break; @@ -7839,20 +7756,15 @@ ffecom_sym_transform_ (ffesymbol s) if ((ffecom_num_entrypoints_ != 0) && (ffecom_master_bt_ == FFEINFO_basictypeNONE)) { - yes = suspend_momentary (); - assert (ffecom_multi_retval_ != NULL_TREE); t = ffecom_1 (INDIRECT_REF, ffecom_multi_type_node_, ffecom_multi_retval_); t = ffecom_2 (COMPONENT_REF, ffecom_tree_type[bt][kt], t, ffecom_multi_fields_[bt][kt]); - resume_momentary (yes); break; } - yes = suspend_momentary (); - t = build_decl (VAR_DECL, ffecom_get_identifier_ (ffesymbol_text (s)), ffecom_tree_type[bt][kt]); @@ -7862,7 +7774,6 @@ ffecom_sym_transform_ (ffesymbol s) ffecom_func_result_ = t; - resume_momentary (yes); break; case FFEINFO_whereDUMMY: @@ -8208,7 +8119,6 @@ ffecom_sym_transform_ (ffesymbol s) tree ct; ffestorag st = ffesymbol_storage (s); tree type; - int yes; cs = ffesymbol_common (s); /* The COMMON area itself. */ if (st != NULL) /* Else not laid out. */ @@ -8217,8 +8127,6 @@ ffecom_sym_transform_ (ffesymbol s) st = ffesymbol_storage (s); } - yes = suspend_momentary (); - type = ffecom_type_localvar_ (s, bt, kt); cg = ffesymbol_global (cs); /* The global COMMON info. */ @@ -8261,8 +8169,6 @@ ffecom_sym_transform_ (ffesymbol s) addr = TRUE; } - - resume_momentary (yes); } break; @@ -8619,7 +8525,6 @@ static ffesymbol ffecom_sym_transform_assign_ (ffesymbol s) { tree t; /* Transformed thingy. */ - int yes; int old_lineno = lineno; const char *old_input_filename = input_filename; @@ -8638,8 +8543,6 @@ ffecom_sym_transform_assign_ (ffesymbol s) assert (!ffecom_transform_only_dummies_); - yes = suspend_momentary (); - t = build_decl (VAR_DECL, ffecom_get_invented_identifier ("__g77_ASSIGN_%s", ffesymbol_text (s)), @@ -8683,8 +8586,6 @@ ffecom_sym_transform_assign_ (ffesymbol s) t = start_decl (t, FALSE); finish_decl (t, NULL_TREE, FALSE); - resume_momentary (yes); - ffesymbol_hook (s).assign_tree = t; lineno = old_lineno; @@ -8886,7 +8787,6 @@ ffecom_transform_equiv_ (ffestorag eqst) tree init; tree high; bool is_init = ffestorag_is_init (eqst); - int yes; assert (eqst != NULL); @@ -8941,8 +8841,6 @@ ffecom_transform_equiv_ (ffestorag eqst) &ffecom_member_phase1_, eqst); - yes = suspend_momentary (); - high = build_int_2 ((ffestorag_size (eqst) + ffestorag_modulo (eqst)) - 1, 0); TREE_TYPE (high) = ffecom_integer_type_node; @@ -9008,8 +8906,6 @@ ffecom_transform_equiv_ (ffestorag eqst) ffestorag_drive (ffestorag_list_equivs (eqst), &ffecom_member_phase2_, eqst); - - resume_momentary (yes); } #endif @@ -9027,12 +8923,9 @@ ffecom_transform_namelist_ (ffesymbol s) tree nvarsinit; tree field; tree high; - int yes; int i; static int mynumber = 0; - yes = suspend_momentary (); - nmlt = build_decl (VAR_DECL, ffecom_get_invented_identifier ("__g77_namelist_%d", mynumber++), @@ -9095,8 +8988,6 @@ ffecom_transform_namelist_ (ffesymbol s) nmlt = ffecom_1 (ADDR_EXPR, build_pointer_type (nmltype), nmlt); - resume_momentary (yes); - return nmlt; } @@ -9590,11 +9481,8 @@ ffecom_vardesc_ (ffebld expr) tree typeinit; tree field; tree varinits; - int yes; static int mynumber = 0; - yes = suspend_momentary (); - var = build_decl (VAR_DECL, ffecom_get_invented_identifier ("__g77_vardesc_%d", mynumber++), @@ -9656,8 +9544,6 @@ ffecom_vardesc_ (ffebld expr) var = ffecom_1 (ADDR_EXPR, build_pointer_type (vardesctype), var); - resume_momentary (yes); - ffesymbol_hook (s).vardesc_tree = var; } @@ -9674,7 +9560,6 @@ ffecom_vardesc_array_ (ffesymbol s) tree item = NULL_TREE; tree var; int i; - int yes; static int mynumber = 0; for (i = 0, list = NULL_TREE, b = ffesymbol_namelist (s); @@ -9694,8 +9579,6 @@ ffecom_vardesc_array_ (ffesymbol s) } } - yes = suspend_momentary (); - item = build_array_type (build_pointer_type (ffecom_type_vardesc_ ()), build_range_type (integer_type_node, integer_one_node, @@ -9711,8 +9594,6 @@ ffecom_vardesc_array_ (ffesymbol s) var = start_decl (var, FALSE); finish_decl (var, list, FALSE); - resume_momentary (yes); - return var; } @@ -9732,7 +9613,6 @@ ffecom_vardesc_dims_ (ffesymbol s) tree backlist; tree item = NULL_TREE; tree var; - int yes; tree numdim; tree numelem; tree baseoff = NULL_TREE; @@ -9805,8 +9685,6 @@ ffecom_vardesc_dims_ (ffesymbol s) numdim = build_tree_list (NULL_TREE, numdim); TREE_CHAIN (numdim) = numelem; - yes = suspend_momentary (); - item = build_array_type (ffecom_f2c_ftnlen_type_node, build_range_type (integer_type_node, integer_zero_node, @@ -9826,8 +9704,6 @@ ffecom_vardesc_dims_ (ffesymbol s) var = ffecom_1 (ADDR_EXPR, build_pointer_type (item), var); - resume_momentary (yes); - return var; } } @@ -11126,7 +11002,6 @@ ffecom_end_transition () tree dt; tree t; tree var; - int yes; static int number = 0; callee = ffebld_head (item); @@ -11138,8 +11013,6 @@ ffecom_end_transition () t = ffesymbol_hook (s).decl_tree; } - yes = suspend_momentary (); - dt = build_pointer_type (TREE_TYPE (t)); var = build_decl (VAR_DECL, @@ -11157,8 +11030,6 @@ ffecom_end_transition () t = ffecom_1 (ADDR_EXPR, dt, t); finish_decl (var, t, FALSE); - - resume_momentary (yes); } /* This handles any COMMON areas that weren't referenced but have, for @@ -12817,7 +12688,6 @@ tree ffecom_make_tempvar (const char *commentary, tree type, ffetargetCharacterSize size, int elements) { - int yes; tree t; static int mynumber; @@ -12826,8 +12696,6 @@ ffecom_make_tempvar (const char *commentary, tree type, if (type == error_mark_node) return error_mark_node; - yes = suspend_momentary (); - if (size != FFETARGET_charactersizeNONE) type = build_array_type (type, build_range_type (ffecom_f2c_ftnlen_type_node, @@ -12848,8 +12716,6 @@ ffecom_make_tempvar (const char *commentary, tree type, t = start_decl (t, FALSE); finish_decl (t, NULL_TREE, FALSE); - resume_momentary (yes); - return t; } #endif @@ -13670,7 +13536,6 @@ bison_rule_pushlevel_ () emit_line_note (input_filename, lineno); pushlevel (0); clear_last_expr (); - push_momentary (); expand_start_bindings (0); } @@ -13687,7 +13552,6 @@ bison_rule_compstmt_ () emit_line_note (input_filename, lineno); expand_end_bindings (getdecls (), keep, 0); t = poplevel (keep, 1, 0); - pop_momentary (); return t; } @@ -13988,7 +13852,6 @@ finish_decl (tree decl, tree init, bool is_top_level) { register tree type = TREE_TYPE (decl); int was_incomplete = (DECL_SIZE (decl) == 0); - int temporary = allocation_temporary_p (); bool at_top_level = (current_binding_level == global_binding_level); bool top_level = is_top_level || at_top_level; @@ -14017,11 +13880,6 @@ finish_decl (tree decl, tree init, bool is_top_level) } } - /* Pop back to the obstack that is current for this binding level. This is - because MAXINDEX, rtl, etc. to be made below must go in the permanent - obstack. But don't discard the temporary data yet. */ - pop_obstacks (); - /* Deduce size of array from initialization, if not already known */ if (TREE_CODE (type) == ARRAY_TYPE @@ -14101,46 +13959,6 @@ finish_decl (tree decl, tree init, bool is_top_level) 0); } - if (!(TREE_CODE (decl) == FUNCTION_DECL && DECL_INLINE (decl)) - && temporary - /* DECL_INITIAL is not defined in PARM_DECLs, since it shares space with - DECL_ARG_TYPE. */ - && TREE_CODE (decl) != PARM_DECL) - { - /* We need to remember that this array HAD an initialization, but - discard the actual temporary nodes, since we can't have a permanent - node keep pointing to them. */ - /* We make an exception for inline functions, since it's normal for a - local extern redeclaration of an inline function to have a copy of - the top-level decl's DECL_INLINE. */ - if ((DECL_INITIAL (decl) != 0) - && (DECL_INITIAL (decl) != error_mark_node)) - { - /* If this is a const variable, then preserve the - initializer instead of discarding it so that we can optimize - references to it. */ - /* This test used to include TREE_STATIC, but this won't be set - for function level initializers. */ - if (TREE_READONLY (decl)) - { - preserve_initializer (); - - /* The initializer and DECL must have the same (or equivalent - types), but if the initializer is a STRING_CST, its type - might not be on the right obstack, so copy the type - of DECL. */ - TREE_TYPE (DECL_INITIAL (decl)) = type; - } - else - DECL_INITIAL (decl) = error_mark_node; - } - } - - /* If we have gone back from temporary to permanent allocation, actually - free the temporary space that we no longer need. */ - if (temporary && !allocation_temporary_p ()) - permanent_allocation (0); - /* At the end of a declaration, throw away any variable type sizes of types defined inside that declaration. There is no use computing them in the following function definition. */ @@ -14190,23 +14008,17 @@ finish_function (int nested) /* If this is a nested function, protect the local variables in the stack above us from being collected while we're compiling this function. */ - if (ggc_p && nested) + if (nested) ggc_push_context (); /* Run the optimizers and output the assembler code for this function. */ rest_of_compilation (fndecl); /* Undo the GC context switch. */ - if (ggc_p && nested) + if (nested) ggc_pop_context (); } - /* Free all the tree nodes making up this function. */ - /* Switch back to allocating nodes permanently until we start another - function. */ - if (!nested) - permanent_allocation (1); - if (TREE_CODE (fndecl) != ERROR_MARK && !nested && DECL_SAVED_INSNS (fndecl) == 0) @@ -14435,8 +14247,6 @@ push_parm_decl (tree parm) immediate_size_expand = 0; - push_obstacks_nochange (); - /* Fill in arg stuff. */ DECL_ARG_TYPE (parm) = TREE_TYPE (parm); @@ -14517,9 +14327,6 @@ start_decl (tree decl, bool is_top_level) level anyway. */ assert (!is_top_level || !at_top_level); - /* The corresponding pop_obstacks is in finish_decl. */ - push_obstacks_nochange (); - if (DECL_INITIAL (decl) != NULL_TREE) { assert (DECL_INITIAL (decl) == error_mark_node); @@ -14551,14 +14358,6 @@ start_decl (tree decl, bool is_top_level) expand_decl (tem); } - if (DECL_INITIAL (tem) != NULL_TREE) - { - /* When parsing and digesting the initializer, use temporary storage. - Do this even if we will ignore the value. */ - if (at_top_level) - temporary_allocation (); - } - return tem; } @@ -14640,11 +14439,6 @@ start_function (tree name, tree type, int nested, int public) = build_decl (RESULT_DECL, NULL_TREE, restype); } - if (!nested) - /* Allocate further tree nodes temporarily during compilation of this - function only. */ - temporary_allocation (); - if (!nested && (TREE_CODE (current_function_decl) != ERROR_MARK)) TREE_ADDRESSABLE (current_function_decl) = 1; @@ -15802,10 +15596,6 @@ unsigned_type (type) return type; } -/* Callback routines for garbage collection. */ - -int ggc_p = 1; - void lang_mark_tree (t) union tree_node *t ATTRIBUTE_UNUSED; diff --git a/gcc/f/std.c b/gcc/f/std.c index 8610b9c01da..425744cb0d6 100644 --- a/gcc/f/std.c +++ b/gcc/f/std.c @@ -1,5 +1,5 @@ /* std.c -- Implementation File (module.c template V1.0) - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 2000 Free Software Foundation, Inc. Contributed by James Craig Burley. This file is part of GNU Fortran. @@ -687,7 +687,6 @@ ffestd_stmt_pass_ () tree duplicate; expand_start_case (0, which, TREE_TYPE (which), "entrypoint dispatch"); - push_momentary (); stmt = ffestd_stmt_list_.first; do @@ -709,7 +708,6 @@ ffestd_stmt_pass_ () label = ffecom_temp_label (); TREE_USED (label) = 1; expand_goto (label); - clear_momentary (); ffesymbol_hook (stmt->u.R1226.entry).length_tree = label; } @@ -717,9 +715,7 @@ ffestd_stmt_pass_ () } while (--ents != 0); - pop_momentary (); expand_end_case (which); - clear_momentary (); } #endif diff --git a/gcc/f/ste.c b/gcc/f/ste.c index ea927cca7a5..5b4c68eb2d1 100644 --- a/gcc/f/ste.c +++ b/gcc/f/ste.c @@ -440,8 +440,6 @@ ffeste_end_block_ (ffestw block) free (b); - clear_momentary (); - ffecom_end_compstmt (); } @@ -482,8 +480,6 @@ ffeste_end_stmt_(void) free (b); - clear_momentary (); - ffecom_end_compstmt (); } @@ -493,7 +489,6 @@ ffeste_end_stmt_(void) #define ffeste_end_block_(b) \ do \ { \ - clear_momentary (); \ ffecom_end_compstmt (); \ } while(0) #define ffeste_start_stmt_() ffeste_start_block_(NULL) @@ -501,10 +496,8 @@ ffeste_end_stmt_(void) #endif /* ! defined (ENABLE_CHECKING) */ -/* Begin an iterative DO loop. Pass the block to start if applicable. - - NOTE: Does _two_ push_momentary () calls, which the caller must - undo (by calling ffeste_end_iterdo_). */ +/* Begin an iterative DO loop. Pass the block to start if + applicable. */ #if FFECOM_targetCURRENT == FFECOM_targetGCC static void @@ -573,8 +566,6 @@ ffeste_begin_iterdo_ (ffestw block, tree *xtvar, tree *xtincr, tincr_saved = ffecom_save_tree (tincr); - preserve_momentary (); - /* Want to have tstart, tend for just this statement. */ ffeste_start_stmt_ (); @@ -1210,7 +1201,6 @@ ffeste_io_ialist_ (bool have_err, static tree f2c_alist_struct = NULL_TREE; tree t; tree ttype; - int yes; tree field; tree inits, initn; bool constantp = TRUE; @@ -1277,8 +1267,6 @@ ffeste_io_ialist_ (bool have_err, TREE_CONSTANT (inits) = constantp ? 1 : 0; TREE_STATIC (inits) = 1; - yes = suspend_momentary (); - t = build_decl (VAR_DECL, ffecom_get_invented_identifier ("__g77_alist_%d", mynumber++), @@ -1287,8 +1275,6 @@ ffeste_io_ialist_ (bool have_err, t = ffecom_start_decl (t, 1); ffecom_finish_decl (t, inits, 0); - resume_momentary (yes); - /* Prepare run-time expressions. */ if (! unitexp) @@ -1343,7 +1329,6 @@ ffeste_io_cilist_ (bool have_err, static tree f2c_cilist_struct = NULL_TREE; tree t; tree ttype; - int yes; tree field; tree inits, initn; bool constantp = TRUE; @@ -1489,8 +1474,6 @@ ffeste_io_cilist_ (bool have_err, TREE_CONSTANT (inits) = constantp ? 1 : 0; TREE_STATIC (inits) = 1; - yes = suspend_momentary (); - t = build_decl (VAR_DECL, ffecom_get_invented_identifier ("__g77_cilist_%d", mynumber++), @@ -1499,8 +1482,6 @@ ffeste_io_cilist_ (bool have_err, t = ffecom_start_decl (t, 1); ffecom_finish_decl (t, inits, 0); - resume_momentary (yes); - /* Prepare run-time expressions. */ if (! unitexp) @@ -1569,7 +1550,6 @@ ffeste_io_cllist_ (bool have_err, static tree f2c_close_struct = NULL_TREE; tree t; tree ttype; - int yes; tree field; tree inits, initn; tree ignore; /* Ignore length info for certain fields. */ @@ -1625,8 +1605,6 @@ ffeste_io_cllist_ (bool have_err, TREE_CONSTANT (inits) = constantp ? 1 : 0; TREE_STATIC (inits) = 1; - yes = suspend_momentary (); - t = build_decl (VAR_DECL, ffecom_get_invented_identifier ("__g77_cllist_%d", mynumber++), @@ -1635,8 +1613,6 @@ ffeste_io_cllist_ (bool have_err, t = ffecom_start_decl (t, 1); ffecom_finish_decl (t, inits, 0); - resume_momentary (yes); - /* Prepare run-time expressions. */ if (! unitexp) @@ -1692,7 +1668,6 @@ ffeste_io_icilist_ (bool have_err, static tree f2c_icilist_struct = NULL_TREE; tree t; tree ttype; - int yes; tree field; tree inits, initn; bool constantp = TRUE; @@ -1839,8 +1814,6 @@ ffeste_io_icilist_ (bool have_err, TREE_CONSTANT (inits) = constantp ? 1 : 0; TREE_STATIC (inits) = 1; - yes = suspend_momentary (); - t = build_decl (VAR_DECL, ffecom_get_invented_identifier ("__g77_icilist_%d", mynumber++), @@ -1849,8 +1822,6 @@ ffeste_io_icilist_ (bool have_err, t = ffecom_start_decl (t, 1); ffecom_finish_decl (t, inits, 0); - resume_momentary (yes); - /* Prepare run-time expressions. */ if (! unitexp) @@ -1940,7 +1911,6 @@ ffeste_io_inlist_ (bool have_err, static tree f2c_inquire_struct = NULL_TREE; tree t; tree ttype; - int yes; tree field; tree inits, initn; bool constantp = TRUE; @@ -2095,8 +2065,6 @@ ffeste_io_inlist_ (bool have_err, TREE_CONSTANT (inits) = constantp ? 1 : 0; TREE_STATIC (inits) = 1; - yes = suspend_momentary (); - t = build_decl (VAR_DECL, ffecom_get_invented_identifier ("__g77_inlist_%d", mynumber++), @@ -2105,8 +2073,6 @@ ffeste_io_inlist_ (bool have_err, t = ffecom_start_decl (t, 1); ffecom_finish_decl (t, inits, 0); - resume_momentary (yes); - /* Prepare run-time expressions. */ ffeste_f2c_prepare_int_ (unit_spec, unitexp); @@ -2196,7 +2162,6 @@ ffeste_io_olist_ (bool have_err, static tree f2c_open_struct = NULL_TREE; tree t; tree ttype; - int yes; tree field; tree inits, initn; tree ignore; /* Ignore length info for certain fields. */ @@ -2280,8 +2245,6 @@ ffeste_io_olist_ (bool have_err, TREE_CONSTANT (inits) = constantp ? 1 : 0; TREE_STATIC (inits) = 1; - yes = suspend_momentary (); - t = build_decl (VAR_DECL, ffecom_get_invented_identifier ("__g77_olist_%d", mynumber++), @@ -2290,8 +2253,6 @@ ffeste_io_olist_ (bool have_err, t = ffecom_start_decl (t, 1); ffecom_finish_decl (t, inits, 0); - resume_momentary (yes); - /* Prepare run-time expressions. */ if (! unitexp) @@ -2974,8 +2935,6 @@ ffeste_R810 (ffestw block, unsigned long casenum) c->previous_stmt = c->previous_stmt->previous_stmt; } while ((c != (ffestwCase) &s->first_rel) && (casenum == c->casenum)); - - clear_momentary (); } #else #error @@ -3305,8 +3264,6 @@ ffeste_R838 (ffelab label, ffebld target) target_tree, label_tree); expand_expr_stmt (expr_tree); - - clear_momentary (); } } #else @@ -3340,8 +3297,6 @@ ffeste_R839 (ffebld target) error ("ASSIGNed GOTO target variable is too small"); expand_computed_goto (convert (TREE_TYPE (null_pointer_node), t)); - - clear_momentary (); } #else #error @@ -3556,8 +3511,6 @@ ffeste_R842 (ffebld expr) TREE_SIDE_EFFECTS (callit) = 1; expand_expr_stmt (callit); - - clear_momentary (); } #else #error @@ -3641,8 +3594,6 @@ ffeste_R843 (ffebld expr) TREE_SIDE_EFFECTS (callit) = 1; expand_expr_stmt (callit); - - clear_momentary (); } #if 0 /* Old approach for phantom g77 run-time library. */ @@ -3668,8 +3619,6 @@ ffeste_R843 (ffebld expr) TREE_SIDE_EFFECTS (callit) = 1; expand_expr_stmt (callit); - - clear_momentary (); } #endif #else @@ -4998,9 +4947,6 @@ ffeste_R1001 (ffests s) TREE_CONSTANT (t) = 1; TREE_STATIC (t) = 1; - push_obstacks_nochange (); - end_temporary_allocation (); - var = ffecom_lookup_label (ffeste_label_formatdef_); if ((var != NULL_TREE) && (TREE_CODE (var) == VAR_DECL)) @@ -5019,9 +4965,6 @@ ffeste_R1001 (ffests s) expand_decl_init (var); } - resume_temporary_allocation (); - pop_obstacks (); - ffeste_label_formatdef_ = NULL; } #else diff --git a/gcc/flow.c b/gcc/flow.c index 0cb8428215b..2f56e91dde8 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -168,12 +168,10 @@ Boston, MA 02111-1307, USA. */ #define EPILOGUE_USES(REGNO) 0 #endif -/* The contents of the current function definition are allocated - in this obstack, and all are freed at the end of the function. - For top-level functions, this is temporary_obstack. - Separate obstacks are made for nested functions. */ +/* The obstack on which the flow graph components are allocated. */ -extern struct obstack *function_obstack; +struct obstack flow_obstack; +static char *flow_firstobj; /* Number of basic blocks in the current function. */ @@ -439,6 +437,7 @@ static void flow_loop_tree_node_add PARAMS ((struct loop *, struct loop *)); static void flow_loops_tree_build PARAMS ((struct loops *)); static int flow_loop_level_compute PARAMS ((struct loop *, int)); static int flow_loops_level_compute PARAMS ((struct loops *)); +static void allocate_bb_life_data PARAMS ((void)); /* Find basic blocks of the current function. F is the first insn of the function and NREGS the number of register @@ -942,7 +941,7 @@ create_basic_block (index, head, end, bb_note) the same lifetime by allocating it off the function obstack rather than using malloc. */ - bb = (basic_block) obstack_alloc (function_obstack, sizeof (*bb)); + bb = (basic_block) obstack_alloc (&flow_obstack, sizeof (*bb)); memset (bb, 0, sizeof (*bb)); if (GET_CODE (head) == CODE_LABEL) @@ -1479,7 +1478,7 @@ split_block (bb, insn) return 0; /* Create the new structures. */ - new_bb = (basic_block) obstack_alloc (function_obstack, sizeof (*new_bb)); + new_bb = (basic_block) obstack_alloc (&flow_obstack, sizeof (*new_bb)); new_edge = (edge) xcalloc (1, sizeof (*new_edge)); n_edges++; @@ -1532,8 +1531,8 @@ split_block (bb, insn) if (bb->global_live_at_start) { - new_bb->global_live_at_start = OBSTACK_ALLOC_REG_SET (function_obstack); - new_bb->global_live_at_end = OBSTACK_ALLOC_REG_SET (function_obstack); + new_bb->global_live_at_start = OBSTACK_ALLOC_REG_SET (&flow_obstack); + new_bb->global_live_at_end = OBSTACK_ALLOC_REG_SET (&flow_obstack); COPY_REG_SET (new_bb->global_live_at_end, bb->global_live_at_end); /* We now have to calculate which registers are live at the end @@ -1584,7 +1583,7 @@ split_edge (edge_in) } /* Create the new structures. */ - bb = (basic_block) obstack_alloc (function_obstack, sizeof (*bb)); + bb = (basic_block) obstack_alloc (&flow_obstack, sizeof (*bb)); edge_out = (edge) xcalloc (1, sizeof (*edge_out)); n_edges++; @@ -1593,8 +1592,8 @@ split_edge (edge_in) /* ??? This info is likely going to be out of date very soon. */ if (old_succ->global_live_at_start) { - bb->global_live_at_start = OBSTACK_ALLOC_REG_SET (function_obstack); - bb->global_live_at_end = OBSTACK_ALLOC_REG_SET (function_obstack); + bb->global_live_at_start = OBSTACK_ALLOC_REG_SET (&flow_obstack); + bb->global_live_at_end = OBSTACK_ALLOC_REG_SET (&flow_obstack); COPY_REG_SET (bb->global_live_at_start, old_succ->global_live_at_start); COPY_REG_SET (bb->global_live_at_end, old_succ->global_live_at_start); } @@ -3356,7 +3355,7 @@ calculate_global_regs_live (blocks_in, blocks_out, flags) if (bb->local_set == NULL) { - bb->local_set = OBSTACK_ALLOC_REG_SET (function_obstack); + bb->local_set = OBSTACK_ALLOC_REG_SET (&flow_obstack); rescan = 1; } else @@ -3465,7 +3464,7 @@ calculate_global_regs_live (blocks_in, blocks_out, flags) /* Allocate the permanent data structures that represent the results of life analysis. Not static since used also for stupid life analysis. */ -void +static void allocate_bb_life_data () { register int i; @@ -3474,16 +3473,16 @@ allocate_bb_life_data () { basic_block bb = BASIC_BLOCK (i); - bb->global_live_at_start = OBSTACK_ALLOC_REG_SET (function_obstack); - bb->global_live_at_end = OBSTACK_ALLOC_REG_SET (function_obstack); + bb->global_live_at_start = OBSTACK_ALLOC_REG_SET (&flow_obstack); + bb->global_live_at_end = OBSTACK_ALLOC_REG_SET (&flow_obstack); } ENTRY_BLOCK_PTR->global_live_at_end - = OBSTACK_ALLOC_REG_SET (function_obstack); + = OBSTACK_ALLOC_REG_SET (&flow_obstack); EXIT_BLOCK_PTR->global_live_at_start - = OBSTACK_ALLOC_REG_SET (function_obstack); + = OBSTACK_ALLOC_REG_SET (&flow_obstack); - regs_live_at_setjmp = OBSTACK_ALLOC_REG_SET (function_obstack); + regs_live_at_setjmp = OBSTACK_ALLOC_REG_SET (&flow_obstack); } void @@ -8363,3 +8362,23 @@ reg_set_to_hard_reg_set (to, from) SET_HARD_REG_BIT (*to, i); }); } + +/* Called once at intialization time. */ + +void +init_flow () +{ + static int initialized; + + if (!initialized) + { + gcc_obstack_init (&flow_obstack); + flow_firstobj = (char *) obstack_alloc (&flow_obstack, 0); + initialized = 1; + } + else + { + obstack_free (&flow_obstack, flow_firstobj); + flow_firstobj = (char *) obstack_alloc (&flow_obstack, 0); + } +} diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 6908d7101b8..c8b0fd2486d 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -1860,7 +1860,7 @@ size_int_type_wide (number, type) static int init_p = 0; tree t; - if (ggc_p && ! init_p) + if (! init_p) { ggc_add_tree_root ((tree *) size_table, sizeof size_table / sizeof (tree)); @@ -1877,21 +1877,11 @@ size_int_type_wide (number, type) if (TREE_TYPE (t) == type) return t; - if (! ggc_p) - { - /* Make this a permanent node. */ - push_obstacks_nochange (); - end_temporary_allocation (); - } - t = build_int_2 (number, 0); TREE_TYPE (t) = type; TREE_CHAIN (t) = size_table[number]; size_table[number] = t; - if (! ggc_p) - pop_obstacks (); - return t; } diff --git a/gcc/function.c b/gcc/function.c index 11ceea7c971..4cf71195a1f 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -360,7 +360,6 @@ push_function_context_to (context) outer_function_chain = p; p->fixup_var_refs_queue = 0; - save_tree_status (p); if (save_lang_status) (*save_lang_status) (p); if (save_machine_status) @@ -392,7 +391,6 @@ pop_function_context_from (context) current_function_decl = p->decl; reg_renumber = 0; - restore_tree_status (p); restore_emit_status (p); if (restore_machine_status) @@ -547,12 +545,6 @@ assign_stack_local_1 (mode, size, align, function) int bigend_correction = 0; int alignment; - /* Allocate in the memory associated with the function in whose frame - we are assigning. */ - if (function != cfun) - push_obstacks (function->function_obstack, - function->function_maybepermanent_obstack); - if (align == 0) { tree type; @@ -624,9 +616,6 @@ assign_stack_local_1 (mode, size, align, function) function->x_stack_slot_list = gen_rtx_EXPR_LIST (VOIDmode, x, function->x_stack_slot_list); - if (function != cfun) - pop_obstacks (); - return x; } @@ -1637,7 +1626,7 @@ find_fixup_replacement (replacements, x) if (p == 0) { - p = (struct fixup_replacement *) oballoc (sizeof (struct fixup_replacement)); + p = (struct fixup_replacement *) xmalloc (sizeof (struct fixup_replacement)); p->old = x; p->new = 0; p->next = *replacements; @@ -1800,6 +1789,8 @@ fixup_var_refs_insns (var, promoted_mode, unsignedp, insn, toplevel, ht) while (replacements) { + struct fixup_replacement *next; + if (GET_CODE (replacements->new) == REG) { rtx insert_before; @@ -1835,7 +1826,9 @@ fixup_var_refs_insns (var, promoted_mode, unsignedp, insn, toplevel, ht) emit_insn_before (seq, insert_before); } - replacements = replacements->next; + next = replacements->next; + free (replacements); + replacements = next; } } @@ -3306,15 +3299,8 @@ insns_for_mem_walk (r, data) we process the INSNs in order, we know that if we have recorded it it must be at the front of the list. */ if (ifme && (!ifme->insns || XEXP (ifme->insns, 0) != ifmwi->insn)) - { - /* We do the allocation on the same obstack as is used for - the hash table since this memory will not be used once - the hash table is deallocated. */ - push_obstacks (&ifmwi->ht->memory, &ifmwi->ht->memory); - ifme->insns = gen_rtx_EXPR_LIST (VOIDmode, ifmwi->insn, - ifme->insns); - pop_obstacks (); - } + ifme->insns = gen_rtx_EXPR_LIST (VOIDmode, ifmwi->insn, + ifme->insns); } return 0; @@ -3556,13 +3542,6 @@ instantiate_decls (fndecl, valid_only) { tree decl; - if (DECL_SAVED_INSNS (fndecl)) - /* When compiling an inline function, the obstack used for - rtl allocation is the maybepermanent_obstack. Calling - `resume_temporary_allocation' switches us back to that - obstack while we process this function's parameters. */ - resume_temporary_allocation (); - /* Process all parameters of the function. */ for (decl = DECL_ARGUMENTS (fndecl); decl; decl = TREE_CHAIN (decl)) { @@ -3579,15 +3558,6 @@ instantiate_decls (fndecl, valid_only) /* Now process all variables defined in the function or its subblocks. */ instantiate_decls_1 (DECL_INITIAL (fndecl), valid_only); - - if (DECL_INLINE (fndecl) || DECL_DEFER_OUTPUT (fndecl)) - { - /* Save all rtl allocated for this function by raising the - high-water mark on the maybepermanent_obstack. */ - preserve_data (); - /* All further rtl allocation is now done in the current_obstack. */ - rtl_in_current_obstack (); - } } /* Subroutine of instantiate_decls: Process all decls in the given @@ -5587,21 +5557,16 @@ trampoline_address (function) by expand_function_end. */ if (fp != 0) { - push_obstacks (fp->function_maybepermanent_obstack, - fp->function_maybepermanent_obstack); rtlexp = make_node (RTL_EXPR); RTL_EXPR_RTL (rtlexp) = tramp; fp->x_trampoline_list = tree_cons (function, rtlexp, fp->x_trampoline_list); - pop_obstacks (); } else { /* Make the RTL_EXPR node temporary, not momentary, so that the trampoline_list doesn't become garbage. */ - int momentary = suspend_momentary (); rtlexp = make_node (RTL_EXPR); - resume_momentary (momentary); RTL_EXPR_RTL (rtlexp) = tramp; trampoline_list = tree_cons (function, rtlexp, trampoline_list); @@ -6554,10 +6519,8 @@ expand_function_end (filename, line, end_bindings) initializing trampolines. */ if (initial_trampoline == 0) { - end_temporary_allocation (); initial_trampoline = gen_rtx_MEM (BLKmode, assemble_trampoline_template ()); - resume_temporary_allocation (); ggc_add_rtx_root (&initial_trampoline, 1); } diff --git a/gcc/function.h b/gcc/function.h index f3124a7b71a..3ea4c838d43 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -433,20 +433,6 @@ struct function during the nested function. */ struct var_refs_queue *fixup_var_refs_queue; - /* For tree.c. */ - int all_types_permanent; - struct momentary_level *momentary_stack; - char *maybepermanent_firstobj; - char *temporary_firstobj; - char *momentary_firstobj; - char *momentary_function_firstobj; - struct obstack *current_obstack; - struct obstack *function_obstack; - struct obstack *function_maybepermanent_obstack; - struct obstack *expression_obstack; - struct obstack *saveable_obstack; - struct obstack *rtl_obstack; - /* For integrate.c. */ int inlinable; int no_debugging_symbols; @@ -590,8 +576,6 @@ extern void (*restore_lang_status) PARAMS ((struct function *)); extern void (*free_lang_status) PARAMS ((struct function *)); /* Save and restore status information for a nested function. */ -extern void save_tree_status PARAMS ((struct function *)); -extern void restore_tree_status PARAMS ((struct function *)); extern void restore_emit_status PARAMS ((struct function *)); extern void free_after_parsing PARAMS ((struct function *)); extern void free_after_compilation PARAMS ((struct function *)); diff --git a/gcc/gcse.c b/gcc/gcse.c index ba07aa75444..36ca4033f93 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -817,8 +817,6 @@ compute_can_copy () #ifndef AVOID_CCMODE_COPIES rtx reg,insn; #endif - char *free_point = (char *) oballoc (1); - bzero (can_copy_p, NUM_MACHINE_MODES); start_sequence (); @@ -838,9 +836,6 @@ compute_can_copy () can_copy_p[i] = 1; end_sequence (); - - /* Free the objects we just allocated. */ - obfree (free_point); } /* Cover function to xmalloc to record bytes allocated. */ diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c index 46b9bdda67b..0796a1b39dd 100644 --- a/gcc/genattrtab.c +++ b/gcc/genattrtab.c @@ -1784,20 +1784,7 @@ operate_exp (op, left, right) /* If the resulting cond is trivial (all alternatives give the same value), optimize it away. */ if (allsame) - { - if (!ggc_p) - obstack_free (rtl_obstack, newexp); - return operate_exp (op, left, XEXP (right, 1)); - } - - /* If the result is the same as the RIGHT operand, - just use that. */ - if (rtx_equal_p (newexp, right)) - { - if (!ggc_p) - obstack_free (rtl_obstack, newexp); - return right; - } + return operate_exp (op, left, XEXP (right, 1)); return newexp; } @@ -1843,20 +1830,12 @@ operate_exp (op, left, right) /* If the cond is trivial (all alternatives give the same value), optimize it away. */ if (allsame) - { - if (!ggc_p) - obstack_free (rtl_obstack, newexp); - return operate_exp (op, XEXP (left, 1), right); - } + return operate_exp (op, XEXP (left, 1), right); /* If the result is the same as the LEFT operand, just use that. */ if (rtx_equal_p (newexp, left)) - { - if (!ggc_p) - obstack_free (rtl_obstack, newexp); - return left; - } + return left; return newexp; } @@ -2675,18 +2654,12 @@ simplify_cond (exp, insn_code, insn_index) if (len == 0) { - if (!ggc_p) - obstack_free (rtl_obstack, first_spacer); if (GET_CODE (defval) == COND) return simplify_cond (defval, insn_code, insn_index); return defval; } else if (allsame) - { - if (!ggc_p) - obstack_free (rtl_obstack, first_spacer); - return exp; - } + return exp; else { rtx newexp = rtx_alloc (COND); @@ -3200,7 +3173,6 @@ simplify_test_exp (exp, insn_code, insn_index) struct insn_ent *ie; int i; rtx newexp = exp; - char *spacer = (char *) obstack_finish (rtl_obstack); /* Don't re-simplify something we already simplified. */ if (RTX_UNCHANGING_P (exp) || MEM_IN_STRUCT_P (exp)) @@ -3212,19 +3184,11 @@ simplify_test_exp (exp, insn_code, insn_index) left = SIMPLIFY_TEST_EXP (XEXP (exp, 0), insn_code, insn_index); SIMPLIFY_ALTERNATIVE (left); if (left == false_rtx) - { - if (!ggc_p) - obstack_free (rtl_obstack, spacer); - return false_rtx; - } + return false_rtx; right = SIMPLIFY_TEST_EXP (XEXP (exp, 1), insn_code, insn_index); SIMPLIFY_ALTERNATIVE (right); if (left == false_rtx) - { - if (!ggc_p) - obstack_free (rtl_obstack, spacer); - return false_rtx; - } + return false_rtx; /* If either side is an IOR and we have (eq_attr "alternative" ..") present on both sides, apply the distributive law since this will @@ -3253,11 +3217,7 @@ simplify_test_exp (exp, insn_code, insn_index) left = simplify_and_tree (left, &right, insn_code, insn_index); if (left == false_rtx || right == false_rtx) - { - if (!ggc_p) - obstack_free (rtl_obstack, spacer); - return false_rtx; - } + return false_rtx; else if (left == true_rtx) { return right; @@ -3313,30 +3273,18 @@ simplify_test_exp (exp, insn_code, insn_index) left = SIMPLIFY_TEST_EXP (XEXP (exp, 0), insn_code, insn_index); SIMPLIFY_ALTERNATIVE (left); if (left == true_rtx) - { - if (!ggc_p) - obstack_free (rtl_obstack, spacer); - return true_rtx; - } + return true_rtx; right = SIMPLIFY_TEST_EXP (XEXP (exp, 1), insn_code, insn_index); SIMPLIFY_ALTERNATIVE (right); if (right == true_rtx) - { - if (!ggc_p) - obstack_free (rtl_obstack, spacer); - return true_rtx; - } + return true_rtx; right = simplify_or_tree (right, &left, insn_code, insn_index); if (left == XEXP (exp, 0) && right == XEXP (exp, 1)) left = simplify_or_tree (left, &right, insn_code, insn_index); if (right == true_rtx || left == true_rtx) - { - if (!ggc_p) - obstack_free (rtl_obstack, spacer); - return true_rtx; - } + return true_rtx; else if (left == false_rtx) { return right; @@ -3420,17 +3368,9 @@ simplify_test_exp (exp, insn_code, insn_index) return XEXP (left, 0); if (left == false_rtx) - { - if (!ggc_p) - obstack_free (rtl_obstack, spacer); - return true_rtx; - } + return true_rtx; else if (left == true_rtx) - { - if (!ggc_p) - obstack_free (rtl_obstack, spacer); - return false_rtx; - } + return false_rtx; /* Try to apply De`Morgan's laws. */ else if (GET_CODE (left) == IOR) @@ -3564,7 +3504,6 @@ optimize_attrs () for (iv = insn_code_values[i]; iv; iv = iv->next) { struct obstack *old = rtl_obstack; - char *spacer = (char *) obstack_finish (temp_obstack); attr = iv->attr; av = iv->av; @@ -3593,8 +3532,6 @@ optimize_attrs () insert_insn_ent (av, ie); something_changed = 1; } - if (!ggc_p) - obstack_free (temp_obstack, spacer); } } } diff --git a/gcc/gengenrtl.c b/gcc/gengenrtl.c index 535c839345f..707173f904b 100644 --- a/gcc/gengenrtl.c +++ b/gcc/gengenrtl.c @@ -321,10 +321,7 @@ gendef (format) the memory and initializes it. */ puts ("{"); puts (" rtx rt;"); - puts (" if (ggc_p)"); - printf (" rt = ggc_alloc_rtx (%d);\n", (int) strlen (format)); - puts (" else"); - printf (" rt = obstack_alloc_rtx (%d);\n", (int) strlen (format)); + printf (" rt = ggc_alloc_rtx (%d);\n", (int) strlen (format)); puts (" memset (rt, 0, sizeof (struct rtx_def) - sizeof (rtunion));\n"); puts (" PUT_CODE (rt, code);"); diff --git a/gcc/ggc-callbacks.c b/gcc/ggc-callbacks.c index b53af557978..f637581ca94 100644 --- a/gcc/ggc-callbacks.c +++ b/gcc/ggc-callbacks.c @@ -25,8 +25,6 @@ #include "tm_p.h" #include "ggc.h" -int ggc_p = 0; - void ATTRIBUTE_NORETURN lang_mark_tree (t) union tree_node *t ATTRIBUTE_UNUSED; diff --git a/gcc/ggc-none.c b/gcc/ggc-none.c index f006ae89a0f..e75ff4a687d 100644 --- a/gcc/ggc-none.c +++ b/gcc/ggc-none.c @@ -1,5 +1,5 @@ /* Null garbage collection for the GNU compiler. - Copyright (C) 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of GNU CC. @@ -32,9 +32,6 @@ #include "tm_p.h" #include "ggc.h" -/* For now, keep using the old obstack scheme in the gen* programs. */ -int ggc_p = 0; - void * ggc_alloc (size) size_t size; diff --git a/gcc/ggc.h b/gcc/ggc.h index 1a5b4d886af..373026ce464 100644 --- a/gcc/ggc.h +++ b/gcc/ggc.h @@ -24,10 +24,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA /* Symbols are marked with `ggc' for `gcc gc' so as not to interfere with an external gc library that might be linked in. */ -/* Language-specific code defines this variable to be either one (if - it wants garbage collection), or zero (if it does not). */ -extern int ggc_p; - /* These structures are defined in various headers throughout the compiler. However, rather than force everyone who includes this header to include all the headers in which they are declared, we diff --git a/gcc/integrate.c b/gcc/integrate.c index cc3a5581985..34387907929 100644 --- a/gcc/integrate.c +++ b/gcc/integrate.c @@ -444,12 +444,6 @@ save_for_inline (fndecl) in_nonparm_insns = 0; save_parm_insns (insn, first_nonparm_insn); - /* We have now allocated all that needs to be allocated permanently - on the rtx obstack. Set our high-water mark, so that we - can free the rest of this when the time comes. */ - - preserve_data (); - cfun->inl_max_label_num = max_label_num (); cfun->inl_last_parm_insn = cfun->x_last_parm_insn; cfun->original_arg_vector = argvec; @@ -1666,10 +1660,7 @@ integrate_decl_tree (let, map) { tree d; - push_obstacks_nochange (); - saveable_allocation (); d = copy_decl_for_inlining (t, map->fndecl, current_function_decl); - pop_obstacks (); if (DECL_RTL (t) != 0) { @@ -2779,10 +2770,6 @@ output_inline_function (fndecl) current_function_decl = fndecl; clear_emit_caches (); - /* Things we allocate from here on are part of this function, not - permanent. */ - temporary_allocation (); - set_new_last_label_num (f->inl_max_label_num); /* We're not deferring this any longer. */ diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 1f0229a9a3a..aa9bb2bb546 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,75 @@ +2000-10-12 Mark Mitchell <mark@codesourcery.com> + + * class.c (temporary_obstack): Remove. + (make_class): Don't mess with obstascks. + (push_class): Likewise. + (set_super_info): Likewise. + (add_method_1): Likewise. + (add_method): Likewise. + (add_field): Likewise. + (build_utf8_ref): Likewise. + (build_class_ref): Likewise. + (build_static_field_ref): Likewise. + (finish_class): Likewise. + (push_super_field): Likewise. + (layout_class): Likewise. + (layout_class_methods): Likewise. + (init_class_processing): Likewise. + * constants.c (get_tag_node): Likewise. + (build_constant_data_ref): Likewise. + * decl.c (ggc_p): Remove. + (copy_lang_decl): Use ggc_alloc. + (complete_start_java_method): Don't mess with obstacks. + (start_java_method): Likewise. + (end_java_method): Likewise. + * except.c (link_handler): Use xmalloc. + (free_eh_ranges): New function. + (method_init_exceptions): Use it. + (add_handler): Use xmalloc. + (expand_start_java_handler): Don't mess with obstacks. + (prepare_eh_table_type): Likewise. + (expand_end_java_handler): Likewise. + * expr.c (push_value): Likewise. + (create_label_decl): Likewise. + (build_jni_stub): Likewise. + (java_lang_expand_expr): Likewise. + (note_instructions): Use xrealloc. + (java_push_constant_from_pool): Don't mess with obstacks. + (process_jvm_instruction): Likewise. + * java-tree.h (cyclic_inheritance_report): Remove duplicate + declaration. + * jcf-parse.c (get_constant): Don't mess with obstacks. + (read_class): Likewise. + (jcf_parse): Likewise. + * lex.c (expresion_obstack): Remove. + (java_lex): Don't use obstack_free. + * parse.h (exit_java_complete_class): Don't mess with obstacks. + (MANGLE_OUTER_LOCAL_VARIABLE_NAME): Adjust. + (MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_ID): Likewise. + (MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STRING): Likewise. + * parse.y (gaol): Add more GC roots. + (add_inner_class_fields): Adjust calls to MANGLE_* macros. + (lookup_field_wrapper): Likewise. + (obtain_incomplete_type): Don't mess with obstacks. + (build_alias_initializer_paramter_list): Adjust calls to MANGLE_* + macros. + (craft_constructor): Don't mess with obstacks. + (safe_layout_class): Likewise. + (java_complete_class): Likewise. + (source_end_java_method): Likewise. + (build_outer_field_access_methods): Likewise. + (build_outer_method_access_method): Likewise. + (maybe_build_thisn_access_method): Likewise. + (build_dot_class_method_invocation): Likewise. + (java_complete_tree): Likewise. + (java_complete_lhs): Likewise. + (do_merge_string_cste): Likewise. + (patch_string_cst): Likewise. + (array_constructor_check_entry): Likewise. + * typeck.c (build_java_array_type): Likewise. + (parse_signature_string): Likewise. + (build_java_signature): Likewise. + 2000-10-12 Tom Tromey <tromey@cygnus.com> Fix for PR gcj/356: diff --git a/gcc/java/class.c b/gcc/java/class.c index b029da55538..1b184975dfa 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -59,7 +59,7 @@ static tree mangle_field PARAMS ((tree, tree)); static rtx registerClass_libfunc; extern struct obstack permanent_obstack; -extern struct obstack temporary_obstack; +struct obstack temporary_obstack; /* The compiler generates different code depending on whether or not it can assume certain classes have been compiled down to native @@ -272,7 +272,6 @@ tree make_class () { tree type; - push_obstacks (&permanent_obstack, &permanent_obstack); type = make_node (RECORD_TYPE); #ifdef JAVA_USE_HANDLES tree field1 = build_decl (FIELD_DECL, get_identifier ("obj"), @@ -290,7 +289,6 @@ make_class () TYPE_BINFO (type) = make_tree_vec (6); #endif MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC (type); - pop_obstacks (); return type; } @@ -327,7 +325,6 @@ push_class (class_type, class_name) const char *save_input_filename = input_filename; int save_lineno = lineno; tree source_name = identifier_subst (class_name, "", '.', '/', ".java"); - push_obstacks (&permanent_obstack, &permanent_obstack); CLASS_P (class_type) = 1; input_filename = IDENTIFIER_POINTER (source_name); lineno = 0; @@ -353,7 +350,6 @@ push_class (class_type, class_name) } #endif - pop_obstacks (); return decl; } @@ -384,7 +380,6 @@ set_super_info (access_flags, this_class, super_class, interfaces_count) if (super_class) total_supers++; - push_obstacks (&permanent_obstack, &permanent_obstack); TYPE_BINFO_BASETYPES (this_class) = make_tree_vec (total_supers); if (super_class) { @@ -396,7 +391,6 @@ set_super_info (access_flags, this_class, super_class, interfaces_count) = super_binfo; CLASS_HAS_SUPER (this_class) = 1; } - pop_obstacks (); if (access_flags & ACC_PUBLIC) CLASS_PUBLIC (class_decl) = 1; if (access_flags & ACC_FINAL) CLASS_FINAL (class_decl) = 1; @@ -649,7 +643,6 @@ add_method_1 (handle_class, access_flags, name, function_type) tree function_type; { tree method_type, fndecl; - push_obstacks (&permanent_obstack, &permanent_obstack); method_type = build_java_method_type (function_type, handle_class, access_flags); @@ -667,7 +660,6 @@ add_method_1 (handle_class, access_flags, name, function_type) TREE_CHAIN (fndecl) = TYPE_METHODS (handle_class); TYPE_METHODS (handle_class) = fndecl; - pop_obstacks (); if (access_flags & ACC_PUBLIC) METHOD_PUBLIC (fndecl) = 1; if (access_flags & ACC_PROTECTED) METHOD_PROTECTED (fndecl) = 1; @@ -702,13 +694,11 @@ add_method (this_class, access_flags, name, method_sig) tree handle_class = CLASS_TO_HANDLE_TYPE (this_class); tree function_type, fndecl; const unsigned char *sig = (const unsigned char*)IDENTIFIER_POINTER (method_sig); - push_obstacks (&permanent_obstack, &permanent_obstack); if (sig[0] != '(') fatal ("bad method signature"); function_type = get_type_from_signature (method_sig); fndecl = add_method_1 (handle_class, access_flags, name, function_type); set_java_signature (TREE_TYPE (fndecl), method_sig); - pop_obstacks (); return fndecl; } @@ -721,10 +711,7 @@ add_field (class, name, field_type, flags) { int is_static = (flags & ACC_STATIC) != 0; tree field; - /* Push the obstack of field_type ? FIXME */ - push_obstacks (&permanent_obstack, &permanent_obstack); field = build_decl (is_static ? VAR_DECL : FIELD_DECL, name, field_type); - pop_obstacks (); TREE_CHAIN (field) = TYPE_FIELDS (class); TYPE_FIELDS (class) = field; DECL_CONTEXT (field) = class; @@ -820,7 +807,6 @@ build_utf8_ref (name) if (ref != NULL_TREE) return ref; - push_obstacks (&permanent_obstack, &permanent_obstack); ctype = make_node (RECORD_TYPE); str_type = build_prim_array_type (unsigned_byte_type_node, name_len + 1); /* Allow for final '\0'. */ @@ -872,7 +858,6 @@ build_utf8_ref (name) make_decl_rtl (decl, (char*) 0, 1); ref = build1 (ADDR_EXPR, utf8const_ptr_type, decl); IDENTIFIER_UTF8_REF (name) = ref; - pop_obstacks (); return ref; } @@ -898,7 +883,6 @@ build_class_ref (type) decl = IDENTIFIER_GLOBAL_VALUE (decl_name); if (decl == NULL_TREE) { - push_obstacks (&permanent_obstack, &permanent_obstack); decl = build_decl (VAR_DECL, decl_name, class_type_node); DECL_SIZE (decl) = TYPE_SIZE (class_type_node); DECL_SIZE_UNIT (decl) = TYPE_SIZE_UNIT (class_type_node); @@ -911,7 +895,6 @@ build_class_ref (type) pushdecl_top_level (decl); if (is_compiled == 1) DECL_EXTERNAL (decl) = 1; - pop_obstacks (); } } else @@ -957,7 +940,6 @@ build_class_ref (type) decl = IDENTIFIER_GLOBAL_VALUE (decl_name); if (decl == NULL_TREE) { - push_obstacks (&permanent_obstack, &permanent_obstack); decl = build_decl (VAR_DECL, decl_name, class_type_node); TREE_STATIC (decl) = 1; TREE_PUBLIC (decl) = 1; @@ -965,7 +947,6 @@ build_class_ref (type) pushdecl_top_level (decl); if (is_compiled == 1) DECL_EXTERNAL (decl) = 1; - pop_obstacks (); } } @@ -976,11 +957,9 @@ build_class_ref (type) { int index; tree cl; - push_obstacks (&permanent_obstack, &permanent_obstack); index = alloc_class_constant (type); cl = build_ref_from_constant_pool (index); TREE_TYPE (cl) = promote_type (class_ptr_type); - pop_obstacks (); return cl; } } @@ -995,9 +974,7 @@ build_static_field_ref (fdecl) { if (DECL_RTL (fdecl) == 0) { - push_obstacks (&permanent_obstack, &permanent_obstack); make_decl_rtl (fdecl, NULL, 1); - pop_obstacks (); if (is_compiled == 1) DECL_EXTERNAL (fdecl) = 1; } @@ -1502,9 +1479,7 @@ finish_class () || ! METHOD_PRIVATE (method) || saw_native_method) { - temporary_allocation (); output_inline_function (method); - permanent_allocation (1); /* Scan the list again to see if there are any earlier methods to emit. */ method = type_methods; @@ -1749,9 +1724,7 @@ push_super_field (this_class, super_class) /* Don't insert the field if we're just re-laying the class out. */ if (TYPE_FIELDS (this_class) && !DECL_NAME (TYPE_FIELDS (this_class))) return; - push_obstacks (&permanent_obstack, &permanent_obstack); base_decl = build_decl (FIELD_DECL, NULL_TREE, super_class); - pop_obstacks (); DECL_IGNORED_P (base_decl) = 1; TREE_CHAIN (base_decl) = TYPE_FIELDS (this_class); TYPE_FIELDS (this_class) = base_decl; @@ -1814,6 +1787,7 @@ layout_class (this_class) if (CLASS_BEING_LAIDOUT (this_class)) { char buffer [1024]; + char *report; tree current; sprintf (buffer, " with `%s'", @@ -1831,7 +1805,9 @@ layout_class (this_class) obstack_grow (&temporary_obstack, buffer, strlen (buffer)); } obstack_1grow (&temporary_obstack, '\0'); - cyclic_inheritance_report = obstack_finish (&temporary_obstack); + report = obstack_finish (&temporary_obstack); + cyclic_inheritance_report = ggc_strdup (report); + obstack_free (&temporary_obstack, report); TYPE_SIZE (this_class) = error_mark_node; return; } @@ -1883,7 +1859,6 @@ layout_class_methods (this_class) if (TYPE_NVIRTUALS (this_class)) return; - push_obstacks (&permanent_obstack, &permanent_obstack); super_class = CLASSTYPE_SUPER (this_class); handle_type = CLASS_TO_HANDLE_TYPE (this_class); @@ -1909,7 +1884,6 @@ layout_class_methods (this_class) #ifdef JAVA_USE_HANDLES layout_type (handle_type); #endif - pop_obstacks (); } /* A sorted list of all C++ keywords. */ @@ -2230,4 +2204,5 @@ init_class_processing () registerClass_libfunc = gen_rtx (SYMBOL_REF, Pmode, "_Jv_RegisterClass"); ggc_add_tree_root (®istered_class, 1); ggc_add_rtx_root (®isterClass_libfunc, 1); + gcc_obstack_init (&temporary_obstack); } diff --git a/gcc/java/constants.c b/gcc/java/constants.c index c1dd6719caa..ad2ed21f213 100644 --- a/gcc/java/constants.c +++ b/gcc/java/constants.c @@ -335,11 +335,7 @@ get_tag_node (tag) } if (tag_nodes[tag] == NULL_TREE) - { - push_obstacks (&permanent_obstack, &permanent_obstack); - tag_nodes[tag] = build_int_2 (tag, 0); - pop_obstacks (); - } + tag_nodes[tag] = build_int_2 (tag, 0); return tag_nodes[tag]; } @@ -402,13 +398,11 @@ build_constant_data_ref () { tree decl; tree decl_name = mangled_classname ("_CD_", current_class); - push_obstacks (&permanent_obstack, &permanent_obstack); decl = build_decl (VAR_DECL, decl_name, build_array_type (ptr_type_node, one_elt_array_domain_type)); TREE_STATIC (decl) = 1; make_decl_rtl (decl, NULL, 1); - pop_obstacks (); TYPE_CPOOL_DATA_REF (current_class) = current_constant_pool_data_ref = build1 (ADDR_EXPR, ptr_type_node, decl); } diff --git a/gcc/java/decl.c b/gcc/java/decl.c index dd36ff02674..7d5c165f5e2 100644 --- a/gcc/java/decl.c +++ b/gcc/java/decl.c @@ -57,10 +57,6 @@ static tree check_local_unnamed_variable PARAMS ((tree, tree, tree)); before static field references. */ extern int always_initialize_class_p; -/* Use garbage collection. */ - -int ggc_p = 1; - /* The DECL_MAP is a mapping from (index, type) to a decl node. If index < max_locals, it is the index of a local variable. if index >= max_locals, then index-max_locals is a stack slot. @@ -1558,7 +1554,7 @@ copy_lang_decl (node) int lang_decl_size = TREE_CODE (node) == VAR_DECL ? sizeof (struct lang_decl_var) : sizeof (struct lang_decl); - struct lang_decl *x = (struct lang_decl *) oballoc (lang_decl_size); + struct lang_decl *x = (struct lang_decl *) ggc_alloc (lang_decl_size); bcopy ((PTR) DECL_LANG_SPECIFIC (node), (PTR) x, lang_decl_size); DECL_LANG_SPECIFIC (node) = x; } @@ -1733,10 +1729,6 @@ complete_start_java_method (fndecl) emit_init_test_initialization, 0); } - /* Allocate further tree nodes temporarily during compilation - of this function only. */ - temporary_allocation (); - #if 0 /* If this fcn was already referenced via a block-scope `extern' decl (or an implicit decl), propagate certain information about the usage. */ @@ -1812,7 +1804,7 @@ start_java_method (fndecl) i = DECL_MAX_LOCALS(fndecl) + DECL_MAX_STACK(fndecl); decl_map = make_tree_vec (i); - type_map = (tree *) oballoc (i * sizeof (tree)); + type_map = (tree *) xrealloc (type_map, i * sizeof (tree)); #if defined(DEBUG_JAVA_BINDING_LEVELS) fprintf (stderr, "%s:\n", (*decl_printable_name) (fndecl, 2)); @@ -1891,7 +1883,6 @@ end_java_method () rest_of_compilation (fndecl); current_function_decl = NULL_TREE; - permanent_allocation (1); asynchronous_exceptions = flag_asynchronous_exceptions; } diff --git a/gcc/java/except.c b/gcc/java/except.c index 9075e6168f8..258bbc0b2a1 100644 --- a/gcc/java/except.c +++ b/gcc/java/except.c @@ -43,6 +43,7 @@ static struct eh_range *find_handler_in_range PARAMS ((int, struct eh_range *, struct eh_range *)); static void link_handler PARAMS ((struct eh_range *, struct eh_range *)); static void check_start_handlers PARAMS ((struct eh_range *, int)); +static void free_eh_ranges PARAMS ((struct eh_range *range)); extern struct obstack permanent_obstack; @@ -156,7 +157,7 @@ link_handler (range, outer) if (range->start_pc < outer->start_pc || range->end_pc > outer->end_pc) { struct eh_range *h - = (struct eh_range *) oballoc (sizeof (struct eh_range)); + = (struct eh_range *) xmalloc (sizeof (struct eh_range)); if (range->start_pc < outer->start_pc) { h->start_pc = range->start_pc; @@ -221,12 +222,27 @@ handle_nested_ranges () } } +/* Free RANGE as well as its children and siblings. */ + +static void +free_eh_ranges (range) + struct eh_range *range; +{ + while (range) + { + struct eh_range *next = range->next_sibling; + free_eh_ranges (range->first_child); + free (range); + range = next; + } +} /* Called to re-initialize the exception machinery for a new method. */ void method_init_exceptions () { + free_eh_ranges (&whole_range); whole_range.start_pc = 0; whole_range.end_pc = DECL_CODE_LENGTH (current_function_decl) + 1; whole_range.outer = NULL; @@ -279,7 +295,7 @@ add_handler (start_pc, end_pc, handler, type) prev = ptr; } - h = (struct eh_range *) oballoc (sizeof (struct eh_range)); + h = (struct eh_range *) xmalloc (sizeof (struct eh_range)); h->start_pc = start_pc; h->end_pc = end_pc; h->first_child = NULL; @@ -306,9 +322,7 @@ expand_start_java_handler (range) current_pc, range->end_pc); #endif /* defined(DEBUG_JAVA_BINDING_LEVELS) */ range->expanded = 1; - push_obstacks (&permanent_obstack, &permanent_obstack); expand_eh_region_start (); - pop_obstacks (); } tree @@ -323,7 +337,6 @@ prepare_eh_table_type (type) * c) a pointer to the Utf8Const name of the class, plus one * (which yields a value with low-order bit 1). */ - push_obstacks (&permanent_obstack, &permanent_obstack); if (type == NULL_TREE) exp = CATCH_ALL_TYPE; else if (is_compiled_class (type)) @@ -333,7 +346,6 @@ prepare_eh_table_type (type) (PLUS_EXPR, ptr_type_node, build_utf8_ref (build_internal_class_name (type)), size_one_node)); - pop_obstacks (); return exp; } @@ -345,9 +357,7 @@ expand_end_java_handler (range) { tree handler = range->handlers; force_poplevels (range->start_pc); - push_obstacks (&permanent_obstack, &permanent_obstack); expand_start_all_catch (); - pop_obstacks (); for ( ; handler != NULL_TREE; handler = TREE_CHAIN (handler)) { start_catch_handler (prepare_eh_table_type (TREE_PURPOSE (handler))); diff --git a/gcc/java/expr.c b/gcc/java/expr.c index 1dd26c38c4d..6dc5184ad5a 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -281,7 +281,7 @@ push_value (value) } push_type (type); if (tree_list_free_list == NULL_TREE) - quick_stack = perm_tree_cons (NULL_TREE, value, quick_stack); + quick_stack = tree_cons (NULL_TREE, value, quick_stack); else { tree node = tree_list_free_list; @@ -1463,10 +1463,8 @@ create_label_decl (name) tree name; { tree decl; - push_obstacks (&permanent_obstack, &permanent_obstack); decl = build_decl (LABEL_DECL, name, TREE_TYPE (return_address_type_node)); - pop_obstacks (); DECL_CONTEXT (decl) = current_function_decl; DECL_IGNORED_P (decl) = 1; return decl; @@ -1985,14 +1983,12 @@ build_jni_stub (method) TREE_CHAIN (env_var) = res_var; } - push_obstacks (&permanent_obstack, &permanent_obstack); meth_var = build_decl (VAR_DECL, get_identifier ("meth"), ptr_type_node); TREE_STATIC (meth_var) = 1; TREE_PUBLIC (meth_var) = 0; DECL_EXTERNAL (meth_var) = 0; make_decl_rtl (meth_var, NULL, 0); meth_var = pushdecl_top_level (meth_var); - pop_obstacks (); /* One strange way that the front ends are different is that they store arguments differently. */ @@ -2334,7 +2330,6 @@ java_lang_expand_expr (exp, target, tmode, modifier) { tree temp, value, init_decl; struct rtx_def *r; - push_obstacks (&permanent_obstack, &permanent_obstack); START_RECORD_CONSTRUCTOR (temp, object_type_node); PUSH_FIELD_VALUE (temp, "vtable", get_primitive_array_vtable (element_type)); @@ -2358,7 +2353,6 @@ java_lang_expand_expr (exp, target, tmode, modifier) make_decl_rtl (init_decl, NULL, 1); init = build1 (ADDR_EXPR, TREE_TYPE (exp), init_decl); r = expand_expr (init, target, tmode, modifier); - pop_obstacks (); return r; } @@ -2371,7 +2365,6 @@ java_lang_expand_expr (exp, target, tmode, modifier) && ilength >= 10 && JPRIMITIVE_TYPE_P (element_type)) { tree init_decl; - push_obstacks (&permanent_obstack, &permanent_obstack); init_decl = build_decl (VAR_DECL, generate_name (), TREE_TYPE (init)); pushdecl_top_level (init_decl); @@ -2381,7 +2374,6 @@ java_lang_expand_expr (exp, target, tmode, modifier) TREE_READONLY (init_decl) = 1; TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (init_decl)) = 1; make_decl_rtl (init_decl, NULL, 1); - pop_obstacks (); init = init_decl; } expand_assignment (build (COMPONENT_REF, TREE_TYPE (data_fld), @@ -2449,13 +2441,9 @@ java_lang_expand_expr (exp, target, tmode, modifier) /* We expand a try[-catch] block */ /* Expand the try block */ - push_obstacks (&permanent_obstack, &permanent_obstack); expand_eh_region_start (); - pop_obstacks (); expand_expr_stmt (TREE_OPERAND (exp, 0)); - push_obstacks (&permanent_obstack, &permanent_obstack); expand_start_all_catch (); - pop_obstacks (); /* Expand all catch clauses (EH handlers) */ for (current = TREE_OPERAND (exp, 1); current; @@ -2517,7 +2505,7 @@ note_instructions (jcf, method) JCF_SEEK (jcf, DECL_CODE_OFFSET (method)); byte_ops = jcf->read_ptr; - instruction_bits = oballoc (length + 1); + instruction_bits = xrealloc (instruction_bits, length + 1); bzero (instruction_bits, length + 1); /* This pass figures out which PC can be the targets of jumps. */ @@ -2748,12 +2736,10 @@ java_push_constant_from_pool (jcf, index) if (JPOOL_TAG (jcf, index) == CONSTANT_String) { tree name; - push_obstacks (&permanent_obstack, &permanent_obstack); name = get_name_constant (jcf, JPOOL_USHORT1 (jcf, index)); index = alloc_name_constant (CONSTANT_String, name); c = build_ref_from_constant_pool (index); TREE_TYPE (c) = promote_type (string_type_node); - pop_obstacks (); } else c = get_constant (jcf, index); @@ -2881,7 +2867,6 @@ process_jvm_instruction (PC, byte_ops, length) tree type = TREE_TYPE (selector); \ flush_quick_stack (); \ expand_start_case (0, selector, type, "switch statement");\ - push_momentary (); \ while (--npairs >= 0) \ { \ jint match = IMMEDIATE_s4; jint offset = IMMEDIATE_s4; \ @@ -2894,7 +2879,6 @@ process_jvm_instruction (PC, byte_ops, length) label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); \ pushcase (NULL_TREE, 0, label, &duplicate); \ expand_java_goto (oldpc + default_offset); \ - pop_momentary (); \ expand_end_case (selector); \ } @@ -2906,7 +2890,6 @@ process_jvm_instruction (PC, byte_ops, length) tree type = TREE_TYPE (selector); \ flush_quick_stack (); \ expand_start_case (0, selector, type, "switch statement");\ - push_momentary (); \ for (; low <= high; low++) \ { \ jint offset = IMMEDIATE_s4; \ @@ -2919,7 +2902,6 @@ process_jvm_instruction (PC, byte_ops, length) label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); \ pushcase (NULL_TREE, 0, label, &duplicate); \ expand_java_goto (oldpc + default_offset); \ - pop_momentary (); \ expand_end_case (selector); \ } diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h index 17b76925c28..f1f205427fc 100644 --- a/gcc/java/java-tree.h +++ b/gcc/java/java-tree.h @@ -602,8 +602,6 @@ extern struct CPool *outgoing_cpool; extern char *cyclic_inheritance_report; -extern char *cyclic_inheritance_report; - struct lang_identifier { struct tree_identifier ignore; diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c index 71503e3cdf5..b11d949a9e3 100644 --- a/gcc/java/jcf-parse.c +++ b/gcc/java/jcf-parse.c @@ -255,7 +255,6 @@ get_constant (jcf, index) tag = JPOOL_TAG (jcf, index); if ((tag & CONSTANT_ResolvedFlag) || tag == CONSTANT_Utf8) return (tree) jcf->cpool.data[index]; - push_obstacks (&permanent_obstack, &permanent_obstack); switch (tag) { case CONSTANT_Integer: @@ -327,7 +326,6 @@ get_constant (jcf, index) #endif /* TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT */ case CONSTANT_String: { - extern struct obstack *expression_obstack; tree name = get_name_constant (jcf, JPOOL_USHORT1 (jcf, index)); const char *utf8_ptr = IDENTIFIER_POINTER (name); unsigned char *str_ptr; @@ -350,8 +348,7 @@ get_constant (jcf, index) value = make_node (STRING_CST); TREE_TYPE (value) = build_pointer_type (string_type_node); TREE_STRING_LENGTH (value) = 2 * str_len; - TREE_STRING_POINTER (value) - = obstack_alloc (expression_obstack, 2 * str_len); + TREE_STRING_POINTER (value) = ggc_alloc (2 * str_len); str_ptr = (unsigned char *) TREE_STRING_POINTER (value); str = (const unsigned char *)utf8_ptr; for (i = 0; i < str_len; i++) @@ -391,7 +388,6 @@ get_constant (jcf, index) default: goto bad; } - pop_obstacks (); JPOOL_TAG(jcf, index) = tag | CONSTANT_ResolvedFlag; jcf->cpool.data [index] = (jword) value; return value; @@ -486,17 +482,12 @@ read_class (name) if (current_jcf->read_state) saved_pos = ftell (current_jcf->read_state); - push_obstacks (&permanent_obstack, &permanent_obstack); - /* Search in current zip first. */ if (find_in_current_zip (IDENTIFIER_POINTER (name), &jcf) == 0) { if (find_class (IDENTIFIER_POINTER (name), IDENTIFIER_LENGTH (name), &this_jcf, 1) == 0) - { - pop_obstacks (); /* FIXME: one pop_obstack() per function */ - return 0; - } + return 0; else { this_jcf.seen_in_zip = 0; @@ -519,7 +510,6 @@ read_class (name) if (!current_jcf->seen_in_zip) JCF_FINISH (current_jcf); - pop_obstacks (); current_class = save_current_class; input_filename = save_input_filename; @@ -639,7 +629,6 @@ jcf_parse (jcf) if (current_class != class_type_node && current_class != object_type_node) TYPE_FIELDS (current_class) = nreverse (TYPE_FIELDS (current_class)); - push_obstacks (&permanent_obstack, &permanent_obstack); layout_class (current_class); if (current_class == object_type_node) layout_class_methods (object_type_node); @@ -651,8 +640,6 @@ jcf_parse (jcf) for (current = DECL_INNER_CLASS_LIST (TYPE_NAME (current_class)); current; current = TREE_CHAIN (current)) load_class (DECL_NAME (TREE_PURPOSE (current)), 1); - - pop_obstacks (); } void diff --git a/gcc/java/lex.c b/gcc/java/lex.c index 8fb6a15a6fd..1775441d329 100644 --- a/gcc/java/lex.c +++ b/gcc/java/lex.c @@ -36,10 +36,6 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ #include "keyword.h" -#ifndef JC1_LITE -extern struct obstack *expression_obstack; -#endif - /* Function declaration */ static int java_lineterminator PARAMS ((unicode_t)); static char *java_sprint_unicode PARAMS ((struct java_line *, int)); @@ -1104,6 +1100,7 @@ java_lex (java_lval) else java_lval->node = build_string (strlen (string), string); #endif + obstack_free (&temporary_obstack, string); return STRING_LIT_TK; } diff --git a/gcc/java/parse.h b/gcc/java/parse.h index 0f0aa9b9ca9..40fad4aef2d 100644 --- a/gcc/java/parse.h +++ b/gcc/java/parse.h @@ -111,7 +111,6 @@ extern tree stabilize_reference PARAMS ((tree)); /* Misc. */ #define exit_java_complete_class() \ { \ - pop_obstacks (); \ return; \ } @@ -229,11 +228,14 @@ extern tree stabilize_reference PARAMS ((tree)); scope local variables. */ #define MANGLE_OUTER_LOCAL_VARIABLE_NAME(N, O) \ { \ + char *mangled_name; \ obstack_grow (&temporary_obstack, "val$", 4); \ - obstack_grow (&temporary_obstack, \ + obstack_grow (&temporary_obstack, \ IDENTIFIER_POINTER ((O)), IDENTIFIER_LENGTH ((O))); \ obstack_1grow (&temporary_obstack, '\0'); \ - (N) = obstack_finish (&temporary_obstack); \ + mangled_name = obstack_finish (&temporary_obstack); \ + (N) = get_identifier (mangled_name); \ + obstack_free (&temporary_obstack, mangled_name); \ } /* Build the string parm$<O> and store in into the identifier N. This @@ -241,19 +243,25 @@ extern tree stabilize_reference PARAMS ((tree)); initialize outer scope aliases. */ #define MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_ID(N, O) \ { \ + char *mangled_name; \ obstack_grow (&temporary_obstack, "parm$", 5); \ obstack_grow (&temporary_obstack, \ IDENTIFIER_POINTER ((O)), IDENTIFIER_LENGTH ((O))); \ obstack_1grow (&temporary_obstack, '\0'); \ - (N) = obstack_finish (&temporary_obstack); \ + mangled_name = obstack_finish (&temporary_obstack); \ + (N) = get_identifier (mangled_name); \ + obstack_free (&temporary_obstack, mangled_name); \ } #define MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR(N, S) \ { \ + char *mangled_name; \ obstack_grow (&temporary_obstack, "parm$", 5); \ obstack_grow (&temporary_obstack, (S), strlen ((S))); \ obstack_1grow (&temporary_obstack, '\0'); \ - (N) = obstack_finish (&temporary_obstack); \ + mangled_name = obstack_finish (&temporary_obstack); \ + (N) = get_identifier (mangled_name); \ + obstack_free (&temporary_obstack, mangled_name); \ } /* Skip THIS and artificial parameters found in function decl M and diff --git a/gcc/java/parse.y b/gcc/java/parse.y index e66d2f55634..e9fe4b3bb57 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -598,6 +598,7 @@ goal: ggc_add_tree_root (&package_list, 1); ggc_add_tree_root (¤t_this, 1); ggc_add_tree_root (¤tly_caught_type_list, 1); + ggc_add_string_root (&cyclic_inheritance_report, 1); ggc_add_root (&ctxp, 1, sizeof (struct parser_ctxt *), mark_parser_ctxt); @@ -3938,7 +3939,7 @@ add_inner_class_fields (class_decl, fct_decl) tree decl; for (decl = BLOCK_EXPR_DECLS (block); decl; decl = TREE_CHAIN (decl)) { - char *name, *pname; + tree name, pname; tree wfl, init, list; /* Avoid non final arguments. */ @@ -3947,8 +3948,8 @@ add_inner_class_fields (class_decl, fct_decl) MANGLE_OUTER_LOCAL_VARIABLE_NAME (name, DECL_NAME (decl)); MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_ID (pname, DECL_NAME (decl)); - wfl = build_wfl_node (get_identifier (name)); - init = build_wfl_node (get_identifier (pname)); + wfl = build_wfl_node (name); + init = build_wfl_node (pname); /* Build an initialization for the field: it will be initialized by a parameter added to finit$, bearing a mangled name of the field itself (param$<n>.) The @@ -4036,10 +4037,8 @@ lookup_field_wrapper (class, name) context. We try to look for it now. */ if (INNER_CLASS_TYPE_P (class)) { - char *alias_buffer; tree new_name; - MANGLE_OUTER_LOCAL_VARIABLE_NAME (alias_buffer, name); - new_name = get_identifier (alias_buffer); + MANGLE_OUTER_LOCAL_VARIABLE_NAME (new_name, name); decl = lookup_field (&type, new_name); if (decl && decl != error_mark_node) FIELD_LOCAL_ALIAS_USED (decl) = 1; @@ -4959,10 +4958,8 @@ obtain_incomplete_type (type_name) if (!ptr) { - push_obstacks (&permanent_obstack, &permanent_obstack); BUILD_PTR_FROM_NAME (ptr, name); layout_type (ptr); - pop_obstacks (); TREE_CHAIN (ptr) = ctxp->incomplete_class; ctxp->incomplete_class = ptr; } @@ -5060,12 +5057,14 @@ build_alias_initializer_parameter_list (mode, class_type, parm, artificial) { const char *buffer = IDENTIFIER_POINTER (DECL_NAME (field)); tree purpose = NULL_TREE, value = NULL_TREE, name = NULL_TREE; + tree mangled_id; switch (mode) { case AIPL_FUNCTION_DECLARATION: - MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR (buffer, &buffer [4]); - purpose = build_wfl_node (get_identifier (buffer)); + MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR (mangled_id, + &buffer [4]); + purpose = build_wfl_node (mangled_id); if (TREE_CODE (TREE_TYPE (field)) == POINTER_TYPE) value = build_wfl_node (TYPE_NAME (TREE_TYPE (field))); else @@ -5073,13 +5072,14 @@ build_alias_initializer_parameter_list (mode, class_type, parm, artificial) break; case AIPL_FUNCTION_CREATION: - MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR (buffer, &buffer [4]); - purpose = get_identifier (buffer); + MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR (purpose, + &buffer [4]); value = TREE_TYPE (field); break; case AIPL_FUNCTION_FINIT_INVOCATION: - MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR (buffer, &buffer [4]); + MANGLE_ALIAS_INITIALIZER_PARAMETER_NAME_STR (mangled_id, + &buffer [4]); /* Now, this is wrong. purpose should always be the NAME of something and value its matching value (decl, type, etc...) FIXME -- but there is a lot to fix. */ @@ -5087,7 +5087,7 @@ build_alias_initializer_parameter_list (mode, class_type, parm, artificial) /* When invoked for this kind of operation, we already know whether a field is used or not. */ purpose = TREE_TYPE (field); - value = build_wfl_node (get_identifier (buffer)); + value = build_wfl_node (mangled_id); break; case AIPL_FUNCTION_CTOR_INVOCATION: @@ -5136,8 +5136,6 @@ craft_constructor (class_decl, args) tree decl, ctor_name; char buffer [80]; - push_obstacks (&permanent_obstack, &permanent_obstack); - /* The constructor name is <init> unless we're dealing with an anonymous class, in which case the name will be fixed after having be expanded. */ @@ -5174,8 +5172,6 @@ craft_constructor (class_decl, args) fix_method_argument_names (parm, decl); /* Now, mark the artificial parameters. */ DECL_FUNCTION_NAP (decl) = artificial; - - pop_obstacks (); DECL_CONSTRUCTOR_P (decl) = 1; } @@ -5227,10 +5223,7 @@ safe_layout_class (class) const char *save_input_filename = input_filename; int save_lineno = lineno; - push_obstacks (&permanent_obstack, &permanent_obstack); - layout_class (class); - pop_obstacks (); current_class = save_current_class; input_filename = save_input_filename; @@ -5270,8 +5263,6 @@ java_complete_class () int error_found; tree type; - push_obstacks (&permanent_obstack, &permanent_obstack); - /* Process imports */ process_imports (); @@ -5306,10 +5297,8 @@ java_complete_class () /* We do part of the job done in add_field */ tree field_decl = JDEP_DECL (dep); tree field_type = TREE_TYPE (decl); - push_obstacks (&permanent_obstack, &permanent_obstack); if (TREE_CODE (field_type) == RECORD_TYPE) field_type = promote_type (field_type); - pop_obstacks (); TREE_TYPE (field_decl) = field_type; DECL_ALIGN (field_decl) = 0; DECL_USER_ALIGN (field_decl) = 0; @@ -5350,7 +5339,6 @@ java_complete_class () if (!error_found) { tree mdecl = JDEP_DECL (dep), signature; - push_obstacks (&permanent_obstack, &permanent_obstack); /* Recompute and reset the signature, check first that all types are now defined. If they're not, dont build the signature. */ @@ -5359,7 +5347,6 @@ java_complete_class () signature = build_java_signature (TREE_TYPE (mdecl)); set_java_signature (TREE_TYPE (mdecl), signature); } - pop_obstacks (); } else continue; @@ -5404,7 +5391,6 @@ java_complete_class () } } } - pop_obstacks (); return; } @@ -7245,7 +7231,6 @@ source_end_java_method () } current_function_decl = NULL_TREE; - permanent_allocation (1); java_parser_context_restore_global (); asynchronous_exceptions = flag_asynchronous_exceptions; } @@ -8005,8 +7990,6 @@ build_outer_field_access_methods (decl) if (FIELD_INNER_ACCESS (decl)) return FIELD_INNER_ACCESS (decl); - push_obstacks (&permanent_obstack, &permanent_obstack); - /* Create the identifier and a function named after it. */ id = build_new_access_id (); @@ -8036,7 +8019,6 @@ build_outer_field_access_methods (decl) mdecl = build_outer_field_access_method (DECL_CONTEXT (decl), TREE_TYPE (decl), id, args, stmt); DECL_FUNCTION_ACCESS_DECL (mdecl) = decl; - pop_obstacks (); /* Return the access name */ return FIELD_INNER_ACCESS (decl) = id; @@ -8093,8 +8075,6 @@ build_outer_method_access_method (decl) id = build_new_access_id (); OUTER_FIELD_ACCESS_IDENTIFIER_P (id) = 1; - push_obstacks (&permanent_obstack, &permanent_obstack); - carg = TYPE_ARG_TYPES (TREE_TYPE (decl)); /* Create the arguments, as much as the original */ for (; carg && carg != end_params_node; @@ -8141,7 +8121,6 @@ build_outer_method_access_method (decl) java_method_add_stmt (mdecl,body); end_artificial_method_body (mdecl); current_function_decl = saved_current_function_decl; - pop_obstacks (); /* Back tag the access function so it know what it accesses */ DECL_FUNCTION_ACCESS_DECL (decl) = mdecl; @@ -8212,7 +8191,6 @@ maybe_build_thisn_access_method (type) /* We generate the method. The method looks like: static <outer_of_type> access$0 (<type> inst$) { return inst$.this$<n>; } */ - push_obstacks (&permanent_obstack, &permanent_obstack); args = build_tree_list (inst_id, build_pointer_type (type)); TREE_CHAIN (args) = end_params_node; rtype = build_pointer_type (TREE_TYPE (DECL_CONTEXT (TYPE_NAME (type)))); @@ -8230,7 +8208,6 @@ maybe_build_thisn_access_method (type) java_method_add_stmt (mdecl, stmt); end_artificial_method_body (mdecl); current_function_decl = saved_current_function_decl; - pop_obstacks (); CLASS_ACCESS0_GENERATED_P (type) = 1; @@ -8432,11 +8409,8 @@ build_dot_class_method_invocation (type) else sig_id = DECL_NAME (TYPE_NAME (type)); - s = make_node (STRING_CST); - TREE_STRING_LENGTH (s) = IDENTIFIER_LENGTH (sig_id); - TREE_STRING_POINTER (s) = obstack_alloc (expression_obstack, - TREE_STRING_LENGTH (s)+1); - strcpy (TREE_STRING_POINTER (s), IDENTIFIER_POINTER (sig_id)); + s = build_string (IDENTIFIER_LENGTH (sig_id), + IDENTIFIER_POINTER (sig_id)); return build_method_invocation (build_wfl_node (get_identifier ("class$")), build_tree_list (NULL_TREE, s)); } @@ -10899,9 +10873,7 @@ java_complete_tree (node) { tree value = DECL_INITIAL (node); DECL_INITIAL (node) = NULL_TREE; - push_obstacks (&permanent_obstack, &permanent_obstack); value = fold_constant_for_init (value, node); - pop_obstacks (); DECL_INITIAL (node) = value; if (value != NULL_TREE) { @@ -11114,10 +11086,8 @@ java_complete_lhs (node) && FIELD_FINAL (TREE_OPERAND (cn, 1)) && DECL_INITIAL (TREE_OPERAND (cn, 1))) { - push_obstacks (&permanent_obstack, &permanent_obstack); cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)), TREE_OPERAND (cn, 1)); - pop_obstacks (); } if (!TREE_CONSTANT (cn) && !flag_emit_xref) @@ -11395,9 +11365,7 @@ java_complete_lhs (node) { tree value; - push_obstacks (&permanent_obstack, &permanent_obstack); value = fold_constant_for_init (nn, nn); - pop_obstacks (); if (value != NULL_TREE) { @@ -13029,7 +12997,7 @@ do_merge_string_cste (cste, string, string_len, after) cste = make_node (STRING_CST); TREE_STRING_LENGTH (cste) = len; - new = TREE_STRING_POINTER (cste) = obstack_alloc (expression_obstack, len+1); + new = TREE_STRING_POINTER (cste) = ggc_alloc (len+1); if (after) { @@ -13234,11 +13202,9 @@ patch_string_cst (node) int location; if (! flag_emit_class_files) { - push_obstacks (&permanent_obstack, &permanent_obstack); node = get_identifier (TREE_STRING_POINTER (node)); location = alloc_name_constant (CONSTANT_String, node); node = build_ref_from_constant_pool (location); - pop_obstacks (); } TREE_TYPE (node) = string_ptr_type_node; TREE_CONSTANT (node) = 1; @@ -13972,7 +13938,6 @@ array_constructor_check_entry (type, entry) new_value = NULL_TREE; wfl_value = TREE_VALUE (entry); - push_obstacks (&permanent_obstack, &permanent_obstack); value = java_complete_tree (TREE_VALUE (entry)); /* patch_string return error_mark_node if arg is error_mark_node */ if ((patched = patch_string (value))) @@ -13989,7 +13954,6 @@ array_constructor_check_entry (type, entry) if (!new_value && (new_value = try_reference_assignconv (type, value))) type_value = promote_type (type); - pop_obstacks (); /* Check and report errors */ if (!new_value) { diff --git a/gcc/java/typeck.c b/gcc/java/typeck.c index 0b406a7a545..ad78ffbf621 100644 --- a/gcc/java/typeck.c +++ b/gcc/java/typeck.c @@ -407,7 +407,6 @@ build_java_array_type (element_type, length) TYPE_ARRAY_ELEMENT (t) = element_type; /* Add length pseudo-field. */ - push_obstacks (&permanent_obstack, &permanent_obstack); fld = build_decl (FIELD_DECL, get_identifier ("length"), int_type_node); TYPE_FIELDS (t) = fld; DECL_CONTEXT (fld) = t; @@ -447,7 +446,6 @@ build_java_array_type (element_type, length) #endif TYPE_ALIGN (t) = desired_align; } - pop_obstacks (); /* We could layout_class, but that loads java.lang.Object prematurely. * This is called by the parser, and it is a bad idea to do load_class @@ -552,7 +550,6 @@ parse_signature_string (sig_string, sig_length) const unsigned char *str = sig_string; const unsigned char *limit = str + sig_length; - push_obstacks (&permanent_obstack, &permanent_obstack); if (str < limit && str[0] == '(') { tree argtype_list = NULL_TREE; @@ -572,7 +569,6 @@ parse_signature_string (sig_string, sig_length) result_type = parse_signature_type (&str, limit); if (str != limit) error ("junk at end of signature string"); - pop_obstacks (); return result_type; } @@ -633,7 +629,6 @@ build_java_signature (type) tree type; { tree sig, t; - push_obstacks (&permanent_obstack, &permanent_obstack); while (TREE_CODE (type) == POINTER_TYPE) type = TREE_TYPE (type); MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC (type); @@ -705,7 +700,6 @@ build_java_signature (type) } TYPE_SIGNATURE (type) = sig; } - pop_obstacks (); return sig; } diff --git a/gcc/lists.c b/gcc/lists.c index eb665b87ee1..b13d171414a 100644 --- a/gcc/lists.c +++ b/gcc/lists.c @@ -121,21 +121,11 @@ zap_lists (dummy) void init_EXPR_INSN_LIST_cache () { - if (ggc_p) + static int initialized; + if (!initialized) { - static int initialized; - if (!initialized) - { - initialized = 1; - ggc_add_root (&unused_expr_list, 1, 1, zap_lists); - } - - /* No need to squish the lists across functions with GC enabled. */ - } - else - { - unused_expr_list = NULL; - unused_insn_list = NULL; + initialized = 1; + ggc_add_root (&unused_expr_list, 1, 1, zap_lists); } } diff --git a/gcc/loop.c b/gcc/loop.c index f685b3962e8..977bbd26279 100644 --- a/gcc/loop.c +++ b/gcc/loop.c @@ -85,17 +85,6 @@ unsigned int max_reg_before_loop; /* The value to pass to the next call of reg_scan_update. */ static int loop_max_reg; -/* This obstack is used in product_cheap_p to allocate its rtl. It - may call gen_reg_rtx which, in turn, may reallocate regno_reg_rtx. - If we used the same obstack that it did, we would be deallocating - that array. */ - -static struct obstack temp_obstack; - -/* This is where the pointer to the obstack being used for RTL is stored. */ - -extern struct obstack *rtl_obstack; - #define obstack_chunk_alloc xmalloc #define obstack_chunk_free free @@ -288,18 +277,11 @@ static int reg_address_cost; void init_loop () { - char *free_point = (char *) oballoc (1); rtx reg = gen_rtx_REG (word_mode, LAST_VIRTUAL_REGISTER + 1); reg_address_cost = address_cost (reg, SImode); copy_cost = COSTS_N_INSNS (1); - - /* Free the objects we just allocated. */ - obfree (free_point); - - /* Initialize the obstack used for rtl in product_cheap_p. */ - gcc_obstack_init (&temp_obstack); } /* Compute the mapping from uids to luids. @@ -4420,6 +4402,29 @@ egress: VARRAY_FREE (ivs->reg_iv_type); VARRAY_FREE (ivs->reg_iv_info); free (ivs->reg_biv_class); + { + struct iv_class *iv = ivs->loop_iv_list; + + while (iv) { + struct iv_class *next = iv->next; + struct induction *induction; + struct induction *next_induction; + + for (induction = iv->biv; induction; induction = next_induction) + { + next_induction = induction->next_iv; + free (induction); + } + for (induction = iv->giv; induction; induction = next_induction) + { + next_induction = induction->next_iv; + free (induction); + } + + free (iv); + iv = next; + } + } if (reg_map) free (reg_map); } @@ -4457,7 +4462,7 @@ check_insn_for_bivs (loop, p, not_every_iteration, maybe_multiple) Create and initialize an induction structure for it. */ struct induction *v - = (struct induction *) oballoc (sizeof (struct induction)); + = (struct induction *) xmalloc (sizeof (struct induction)); record_biv (loop, v, p, dest_reg, inc_val, mult_val, location, not_every_iteration, maybe_multiple); @@ -4524,7 +4529,7 @@ check_insn_for_givs (loop, p, not_every_iteration, maybe_multiple) &last_consec_insn)))) { struct induction *v - = (struct induction *) oballoc (sizeof (struct induction)); + = (struct induction *) xmalloc (sizeof (struct induction)); /* If this is a library call, increase benefit. */ if (find_reg_note (p, REG_RETVAL, NULL_RTX)) @@ -4653,7 +4658,7 @@ find_mem_givs (loop, x, insn, not_every_iteration, maybe_multiple) { /* Found one; record it. */ struct induction *v - = (struct induction *) oballoc (sizeof (struct induction)); + = (struct induction *) xmalloc (sizeof (struct induction)); record_giv (loop, v, insn, src_reg, addr_placeholder, mult_val, add_val, ext_val, benefit, DEST_ADDR, @@ -4733,7 +4738,7 @@ record_biv (loop, v, insn, dest_reg, inc_val, mult_val, location, { /* Create and initialize new iv_class. */ - bl = (struct iv_class *) oballoc (sizeof (struct iv_class)); + bl = (struct iv_class *) xmalloc (sizeof (struct iv_class)); bl->regno = REGNO (dest_reg); bl->biv = 0; @@ -5538,23 +5543,16 @@ general_induction_var (loop, x, src_reg, add_val, mult_val, ext_val, { struct loop_ivs *ivs = LOOP_IVS (loop); rtx orig_x = x; - char *storage; /* If this is an invariant, forget it, it isn't a giv. */ if (loop_invariant_p (loop, x) == 1) return 0; - /* See if the expression could be a giv and get its form. - Mark our place on the obstack in case we don't find a giv. */ - storage = (char *) oballoc (0); *pbenefit = 0; *ext_val = NULL_RTX; x = simplify_giv_expr (loop, x, ext_val, pbenefit); if (x == 0) - { - obfree (storage); - return 0; - } + return 0; switch (GET_CODE (x)) { @@ -6944,8 +6942,6 @@ product_cheap_p (a, b) { int i; rtx tmp; - struct obstack *old_rtl_obstack = rtl_obstack; - char *storage = (char *) obstack_alloc (&temp_obstack, 0); int win = 1; /* If only one is constant, make it B. */ @@ -6964,7 +6960,6 @@ product_cheap_p (a, b) code for the multiply and see if a call or multiply, or long sequence of insns is generated. */ - rtl_obstack = &temp_obstack; start_sequence (); expand_mult (GET_MODE (a), a, b, NULL_RTX, 0); tmp = gen_sequence (); @@ -7001,11 +6996,6 @@ product_cheap_p (a, b) && GET_CODE (SET_SRC (XVECEXP (tmp, 0, 0))) == MULT) win = 0; - /* Free any storage we obtained in generating this multiply and restore rtl - allocation to its normal obstack. */ - obstack_free (&temp_obstack, storage); - rtl_obstack = old_rtl_obstack; - return win; } diff --git a/gcc/optabs.c b/gcc/optabs.c index 6f087a8ca74..5dbbcaa9ee9 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -4471,8 +4471,7 @@ rtx init_one_libfunc (name) register const char *name; { - if (ggc_p) - name = ggc_alloc_string (name, -1); + name = ggc_strdup (name); return gen_rtx_SYMBOL_REF (Pmode, name); } diff --git a/gcc/print-tree.c b/gcc/print-tree.c index c951766bfa3..ddc18695be4 100644 --- a/gcc/print-tree.c +++ b/gcc/print-tree.c @@ -46,13 +46,10 @@ void debug_tree (node) tree node; { - char *object = (char *) oballoc (0); - - table = (struct bucket **) oballoc (HASH_SIZE * sizeof (struct bucket *)); + table = (struct bucket **) permalloc (HASH_SIZE * sizeof (struct bucket *)); bzero ((char *) table, HASH_SIZE * sizeof (struct bucket *)); print_node (stderr, "", node, 0); table = 0; - obfree (object); fprintf (stderr, "\n"); } @@ -224,7 +221,7 @@ print_node (file, prefix, node, indent) } /* Add this node to the table. */ - b = (struct bucket *) oballoc (sizeof (struct bucket)); + b = (struct bucket *) permalloc (sizeof (struct bucket)); b->node = node; b->next = table[hash]; table[hash] = b; @@ -267,22 +264,6 @@ print_node (file, prefix, node, indent) print_node (file, "type", TREE_TYPE (node), indent + 4); if (TREE_TYPE (node)) indent_to (file, indent + 3); - - if (!ggc_p) - { - print_obstack_name ((char *) node, file, ""); - indent_to (file, indent + 3); - } - } - - /* If a permanent object is in the wrong obstack, or the reverse, warn. */ - if (!ggc_p && object_permanent_p (node) != TREE_PERMANENT (node)) - { - if (TREE_PERMANENT (node)) - fputs (" !!permanent object in non-permanent obstack!!", file); - else - fputs (" !!non-permanent object in permanent obstack!!", file); - indent_to (file, indent + 3); } if (TREE_SIDE_EFFECTS (node)) @@ -303,8 +284,6 @@ print_node (file, prefix, node, indent) fputs (" used", file); if (TREE_NOTHROW (node)) fputs (" nothrow", file); - if (!ggc_p && TREE_PERMANENT (node)) - fputs (" permanent", file); if (TREE_PUBLIC (node)) fputs (" public", file); if (TREE_PRIVATE (node)) diff --git a/gcc/profile.c b/gcc/profile.c index 809e43f3e05..b52b35257be 100644 --- a/gcc/profile.c +++ b/gcc/profile.c @@ -1115,7 +1115,6 @@ output_func_start_profiler () announce_function (fndecl); current_function_decl = fndecl; DECL_INITIAL (fndecl) = error_mark_node; - temporary_allocation (); make_function_rtl (fndecl); init_function_start (fndecl, input_filename, lineno); pushlevel (0); diff --git a/gcc/reload1.c b/gcc/reload1.c index 803fd010faf..5a919c4ee15 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -2845,9 +2845,6 @@ eliminate_regs_in_insn (insn, replace) abort (); } - if (! replace) - push_obstacks (&reload_obstack, &reload_obstack); - if (old_set != 0 && GET_CODE (SET_DEST (old_set)) == REG && REGNO (SET_DEST (old_set)) < FIRST_PSEUDO_REGISTER) { @@ -3148,9 +3145,6 @@ eliminate_regs_in_insn (insn, replace) if (val && REG_NOTES (insn) != 0) REG_NOTES (insn) = eliminate_regs (REG_NOTES (insn), 0, REG_NOTES (insn)); - if (! replace) - pop_obstacks (); - return val; } diff --git a/gcc/resource.c b/gcc/resource.c index de33cb12975..4faaedf9a81 100644 --- a/gcc/resource.c +++ b/gcc/resource.c @@ -923,7 +923,7 @@ mark_target_live_regs (insns, target, res) { /* Allocate a place to put our results and chain it into the hash table. */ - tinfo = (struct target_info *) oballoc (sizeof (struct target_info)); + tinfo = (struct target_info *) xmalloc (sizeof (struct target_info)); tinfo->uid = INSN_UID (target); tinfo->block = b; tinfo->next = target_hash_table[INSN_UID (target) % TARGET_HASH_PRIME]; @@ -1223,6 +1223,20 @@ free_resource_info () { if (target_hash_table != NULL) { + int i; + + for (i = 0; i < TARGET_HASH_PRIME; ++i) + { + struct target_info *ti = target_hash_table[i]; + + while (ti) + { + struct target_info *next = ti->next; + free (ti); + ti = next; + } + } + free (target_hash_table); target_hash_table = NULL; } diff --git a/gcc/rtl.c b/gcc/rtl.c index aba68823f82..e4b2c48ad33 100644 --- a/gcc/rtl.c +++ b/gcc/rtl.c @@ -32,13 +32,6 @@ Boston, MA 02111-1307, USA. */ #define obstack_chunk_alloc xmalloc #define obstack_chunk_free free -/* Obstack used for allocating RTL objects. - Between functions, this is the permanent_obstack. - While parsing and expanding a function, this is maybepermanent_obstack - so we can save it if it is an inline function. - During optimization and output, this is function_obstack. */ - -extern struct obstack *rtl_obstack; /* Calculate the format for CONST_DOUBLE. This depends on the relative widths of HOST_WIDE_INT and REAL_VALUE_TYPE. @@ -312,12 +305,7 @@ rtvec_alloc (n) { rtvec rt; - if (ggc_p) - rt = ggc_alloc_rtvec (n); - else - rt = (rtvec) obstack_alloc (rtl_obstack, - sizeof (struct rtvec_def) - + ((n - 1) * sizeof (rtx))); + rt = ggc_alloc_rtvec (n); /* clear out the vector */ memset (&rt->elem[0], 0, n * sizeof (rtx)); @@ -335,12 +323,7 @@ rtx_alloc (code) rtx rt; int n = GET_RTX_LENGTH (code); - if (ggc_p) - rt = ggc_alloc_rtx (n); - else - rt = (rtx) obstack_alloc (rtl_obstack, - sizeof (struct rtx_def) - + ((n - 1) * sizeof (rtunion))); + rt = ggc_alloc_rtx (n); /* We want to clear everything up to the FLD array. Normally, this is one int, but we don't want to assume that and it isn't very @@ -351,15 +334,6 @@ rtx_alloc (code) return rt; } -/* Free the rtx X and all RTL allocated since X. */ - -void -rtx_free (x) - rtx x; -{ - if (!ggc_p) - obstack_free (rtl_obstack, x); -} /* Create a new copy of an rtx. Recursively copies the operands of the rtx, @@ -449,14 +423,6 @@ copy_rtx (orig) } break; - case 'b': - { - bitmap new_bits = BITMAP_OBSTACK_ALLOC (rtl_obstack); - bitmap_copy (new_bits, XBITMAP (orig, i)); - XBITMAP (copy, i) = new_bits; - break; - } - case 't': case 'w': case 'i': @@ -923,6 +889,10 @@ read_rtx (infile) int tmp_int; HOST_WIDE_INT tmp_wide; + /* Obstack used for allocating RTL objects. */ + static struct obstack rtl_obstack; + static int initialized; + /* Linked list structure for making RTXs: */ struct rtx_list { @@ -930,6 +900,13 @@ read_rtx (infile) rtx value; /* Value of this node. */ }; + if (!initialized) { + _obstack_begin (&rtl_obstack,0, 0, + (void *(*) PARAMS ((long))) xmalloc, + (void (*) PARAMS ((void *))) free); + initialized = 1; + } + c = read_skip_spaces (infile); /* Should be open paren. */ if (c != '(') fatal_expected_char (infile, '(', c); @@ -1083,7 +1060,7 @@ read_rtx (infile) newline and tab. */ if (c == ';') { - obstack_grow (rtl_obstack, "\\n\\t", 4); + obstack_grow (&rtl_obstack, "\\n\\t", 4); continue; } if (c == '\n') @@ -1092,11 +1069,11 @@ read_rtx (infile) else if (c == '"') break; - obstack_1grow (rtl_obstack, c); + obstack_1grow (&rtl_obstack, c); } - obstack_1grow (rtl_obstack, 0); - stringbuf = (char *) obstack_finish (rtl_obstack); + obstack_1grow (&rtl_obstack, 0); + stringbuf = (char *) obstack_finish (&rtl_obstack); if (saw_paren) { diff --git a/gcc/rtl.h b/gcc/rtl.h index 825f09705d4..674a5a1722a 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -1145,7 +1145,6 @@ extern rtx gen_rtx PARAMS ((enum rtx_code, extern rtvec gen_rtvec PARAMS ((int, ...)); /* In other files */ -extern char *oballoc PARAMS ((int)); extern char *permalloc PARAMS ((int)); extern rtx rtx_alloc PARAMS ((RTX_CODE)); extern rtvec rtvec_alloc PARAMS ((int)); @@ -1631,12 +1630,9 @@ extern int no_new_pseudos; extern int rtx_to_tree_code PARAMS ((enum rtx_code)); /* In tree.c */ -extern void obfree PARAMS ((char *)); struct obstack; extern void gcc_obstack_init PARAMS ((struct obstack *)); -extern void pop_obstacks PARAMS ((void)); -extern void push_obstacks PARAMS ((struct obstack *, - struct obstack *)); + /* In cse.c */ struct cse_basic_block_data; @@ -1801,8 +1797,6 @@ extern void move_by_pieces PARAMS ((rtx, rtx, unsigned int)); /* In flow.c */ -extern void allocate_bb_life_data PARAMS ((void)); -extern void allocate_reg_life_data PARAMS ((void)); extern void recompute_reg_usage PARAMS ((rtx, int)); #ifdef BUFSIZ extern void print_rtl_with_bb PARAMS ((FILE *, rtx)); @@ -1947,7 +1941,6 @@ extern void init_varasm_once PARAMS ((void)); /* In rtl.c */ extern void init_rtl PARAMS ((void)); -extern void rtx_free PARAMS ((rtx)); #ifdef BUFSIZ extern int read_skip_spaces PARAMS ((FILE *)); diff --git a/gcc/sdbout.c b/gcc/sdbout.c index c75aa848a39..863a2a07931 100644 --- a/gcc/sdbout.c +++ b/gcc/sdbout.c @@ -994,7 +994,7 @@ static void sdbout_queue_anonymous_type (type) tree type; { - anonymous_types = saveable_tree_cons (NULL_TREE, type, anonymous_types); + anonymous_types = tree_cons (NULL_TREE, type, anonymous_types); } static void diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index eb1ac584dbb..85ce605abbf 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -3274,14 +3274,10 @@ cselib_init () /* These are only created once. */ if (! callmem) { - extern struct obstack permanent_obstack; - gcc_obstack_init (&cselib_obstack); cselib_startobj = obstack_alloc (&cselib_obstack, 0); - push_obstacks (&permanent_obstack, &permanent_obstack); callmem = gen_rtx_MEM (BLKmode, const0_rtx); - pop_obstacks (); ggc_add_rtx_root (&callmem, 1); } diff --git a/gcc/stmt.c b/gcc/stmt.c index f6468254043..92774817824 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -426,7 +426,7 @@ static void mark_block_nesting PARAMS ((struct nesting *)); static void mark_case_nesting PARAMS ((struct nesting *)); static void mark_case_node PARAMS ((struct case_node *)); static void mark_goto_fixup PARAMS ((struct goto_fixup *)); - +static void free_case_nodes PARAMS ((case_node_ptr)); void using_eh_for_cleanups () @@ -485,8 +485,11 @@ mark_block_nesting (n) ggc_mark_tree (n->data.block.cleanups); ggc_mark_tree (n->data.block.outer_cleanups); - for (l = n->data.block.label_chain; l != NULL; l = l->next) - ggc_mark_tree (l->label); + for (l = n->data.block.label_chain; l != NULL; l = l->next) + { + ggc_mark (l); + ggc_mark_tree (l->label); + } ggc_mark_rtx (n->data.block.last_unconditional_cleanup); @@ -748,7 +751,7 @@ expand_label (label) if (stack_block_stack != 0) { - p = (struct label_chain *) oballoc (sizeof (struct label_chain)); + p = (struct label_chain *) ggc_alloc (sizeof (struct label_chain)); p->next = stack_block_stack->data.block.label_chain; stack_block_stack->data.block.label_chain = p; p->label = label; @@ -2093,14 +2096,11 @@ clear_last_expr () tree expand_start_stmt_expr () { - int momentary; tree t; /* Make the RTL_EXPR node temporary, not momentary, so that rtl_expr_chain doesn't become garbage. */ - momentary = suspend_momentary (); t = make_node (RTL_EXPR); - resume_momentary (momentary); do_pending_stack_adjust (); start_sequence_for_rtl_expr (t); NO_DEFER_POP; @@ -3998,10 +3998,6 @@ expand_decl_cleanup (decl, cleanup) emit_move_insn (flag, const1_rtx); - /* All cleanups must be on the function_obstack. */ - push_obstacks_nochange (); - resume_temporary_allocation (); - cond = build_decl (VAR_DECL, NULL_TREE, type_for_mode (word_mode, 1)); DECL_RTL (cond) = flag; @@ -4011,18 +4007,12 @@ expand_decl_cleanup (decl, cleanup) cleanup, integer_zero_node); cleanup = fold (cleanup); - pop_obstacks (); - cleanups = thisblock->data.block.cleanup_ptr; } - /* All cleanups must be on the function_obstack. */ - push_obstacks_nochange (); - resume_temporary_allocation (); cleanup = unsave_expr (cleanup); - pop_obstacks (); - t = *cleanups = temp_tree_cons (decl, cleanup, *cleanups); + t = *cleanups = tree_cons (decl, cleanup, *cleanups); if (! cond_context) /* If this block has a cleanup, it belongs in stack_block_stack. */ @@ -4114,15 +4104,11 @@ expand_dcc_cleanup (decl) /* Record the cleanup for the dynamic handler chain. */ - /* All cleanups must be on the function_obstack. */ - push_obstacks_nochange (); - resume_temporary_allocation (); cleanup = make_node (POPDCC_EXPR); - pop_obstacks (); /* Add the cleanup in a manner similar to expand_decl_cleanup. */ thisblock->data.block.cleanups - = temp_tree_cons (decl, cleanup, thisblock->data.block.cleanups); + = tree_cons (decl, cleanup, thisblock->data.block.cleanups); /* If this block has a cleanup, it belongs in stack_block_stack. */ stack_block_stack = thisblock; @@ -4156,15 +4142,11 @@ expand_dhc_cleanup (decl) /* Record the cleanup for the dynamic handler chain. */ - /* All cleanups must be on the function_obstack. */ - push_obstacks_nochange (); - resume_temporary_allocation (); cleanup = make_node (POPDHC_EXPR); - pop_obstacks (); /* Add the cleanup in a manner similar to expand_decl_cleanup. */ thisblock->data.block.cleanups - = temp_tree_cons (decl, cleanup, thisblock->data.block.cleanups); + = tree_cons (decl, cleanup, thisblock->data.block.cleanups); /* If this block has a cleanup, it belongs in stack_block_stack. */ stack_block_stack = thisblock; @@ -4239,8 +4221,8 @@ expand_anon_union_decl (decl, cleanup, decl_elts) if (cleanup != 0) thisblock->data.block.cleanups - = temp_tree_cons (decl_elt, cleanup_elt, - thisblock->data.block.cleanups); + = tree_cons (decl_elt, cleanup_elt, + thisblock->data.block.cleanups); } } @@ -4713,7 +4695,7 @@ add_case_node (low, high, label, duplicate) Copy LOW, HIGH so they are on temporary rather than momentary obstack and will thus survive till the end of the case statement. */ - r = (struct case_node *) oballoc (sizeof (struct case_node)); + r = (struct case_node *) xmalloc (sizeof (struct case_node)); r->low = copy_node (low); /* If the bounds are equal, turn this into the one-value case. */ @@ -5247,6 +5229,20 @@ check_for_full_enumeration_handling (type) #endif /* 0 */ } +/* Free CN, and its children. */ + +static void +free_case_nodes (cn) + case_node_ptr cn; +{ + if (cn) + { + free_case_nodes (cn->left); + free_case_nodes (cn->right); + free (cn); + } +} + /* Terminate a case (Pascal) or switch (C) statement in which ORIG_INDEX is the expression to be tested. @@ -5634,6 +5630,7 @@ expand_end_case (orig_index) if (thiscase->exit_label) emit_label (thiscase->exit_label); + free_case_nodes (case_stack->data.case_stmt.case_list); POPSTACK (case_stack); free_temp_slots (); diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 1de070d521a..095780a6d45 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -1230,8 +1230,6 @@ void layout_type (type) tree type; { - int old; - if (type == 0) abort (); @@ -1239,16 +1237,6 @@ layout_type (type) if (TYPE_SIZE (type)) return; - /* Make sure all nodes we allocate are not momentary; they must last - past the current statement. */ - old = suspend_momentary (); - - /* Put all our nodes into the same obstack as the type. Also, - make expressions saveable (this is a no-op for permanent types). */ - - push_obstacks (TYPE_OBSTACK (type), TYPE_OBSTACK (type)); - saveable_allocation (); - switch (TREE_CODE (type)) { case LANG_TYPE: @@ -1536,9 +1524,6 @@ layout_type (type) && TREE_CODE (type) != QUAL_UNION_TYPE) finalize_type_size (type); - pop_obstacks (); - resume_momentary (old); - /* If this type is created before sizetype has been permanently set, record it so set_sizetype can fix it up. */ if (! sizetype_set) diff --git a/gcc/toplev.c b/gcc/toplev.c index fb7c71bcb3a..15e1f65dc62 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1956,9 +1956,7 @@ wrapup_global_declarations (vec, len) || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))) { reconsider = 1; - temporary_allocation (); output_inline_function (decl); - permanent_allocation (1); } } @@ -2218,7 +2216,7 @@ compile_file (name) _IOFBF, IO_BUFFER_SIZE); #endif - if (ggc_p && name != 0) + if (name != 0) name = ggc_alloc_string (name, strlen (name)); input_filename = name; @@ -2715,6 +2713,8 @@ rest_of_compilation (decl) if (cfun->x_whole_function_mode_p) reorder_blocks (); + init_flow (); + /* If we are reconsidering an inline function at the end of compilation, skip the stuff for making it inline. */ @@ -2838,8 +2838,7 @@ rest_of_compilation (decl) init_EXPR_INSN_LIST_cache (); - if (ggc_p) - ggc_collect (); + ggc_collect (); /* Initialize some variables used by the optimizers. */ init_function_for_compilation (); @@ -2884,14 +2883,6 @@ rest_of_compilation (decl) FINALIZE_PIC; #endif - /* From now on, allocate rtl in current_obstack, not in saveable_obstack. - The call to resume_temporary_allocation near the end of this function - goes back to the usual state of affairs. This must be done after - we've built up any unwinders for exception handling, and done - the FINALIZE_PIC work, if necessary. */ - - rtl_in_current_obstack (); - insns = get_insns (); /* Copy any shared structure that should not be shared. */ @@ -2963,8 +2954,7 @@ rest_of_compilation (decl) close_dump_file (DFI_jump, print_rtl, insns); - if (ggc_p) - ggc_collect (); + ggc_collect (); /* Perform common subexpression elimination. Nonzero value from `cse_main' means that jumps were simplified @@ -3030,8 +3020,7 @@ rest_of_compilation (decl) close_dump_file (DFI_addressof, print_rtl, insns); - if (ggc_p) - ggc_collect (); + ggc_collect (); if (optimize > 0 && flag_ssa) { @@ -3082,8 +3071,7 @@ rest_of_compilation (decl) close_dump_file (DFI_ussa, print_rtl_with_bb, insns); timevar_pop (TV_FROM_SSA); - if (ggc_p) - ggc_collect (); + ggc_collect (); } /* Perform global cse. */ @@ -3110,8 +3098,7 @@ rest_of_compilation (decl) close_dump_file (DFI_gcse, print_rtl, insns); timevar_pop (TV_GCSE); - if (ggc_p) - ggc_collect (); + ggc_collect (); } /* Move constant computations out of loops. */ @@ -3143,8 +3130,7 @@ rest_of_compilation (decl) close_dump_file (DFI_loop, print_rtl, insns); timevar_pop (TV_LOOP); - if (ggc_p) - ggc_collect (); + ggc_collect (); } if (optimize > 0) @@ -3200,8 +3186,7 @@ rest_of_compilation (decl) close_dump_file (DFI_cse2, print_rtl, insns); timevar_pop (TV_CSE2); - if (ggc_p) - ggc_collect (); + ggc_collect (); } cse_not_expected = 1; @@ -3264,8 +3249,7 @@ rest_of_compilation (decl) close_dump_file (DFI_life, print_rtl_with_bb, insns); - if (ggc_p) - ggc_collect (); + ggc_collect (); /* If -opt, try combining insns through substitution. */ @@ -3307,8 +3291,7 @@ rest_of_compilation (decl) close_dump_file (DFI_combine, print_rtl_with_bb, insns); timevar_pop (TV_COMBINE); - if (ggc_p) - ggc_collect (); + ggc_collect (); } /* Rerun if-conversion, as combine may have simplified things enough to @@ -3338,8 +3321,7 @@ rest_of_compilation (decl) close_dump_file (DFI_regmove, print_rtl_with_bb, insns); timevar_pop (TV_REGMOVE); - if (ggc_p) - ggc_collect (); + ggc_collect (); } /* Any of the several passes since flow1 will have munged register @@ -3381,8 +3363,7 @@ rest_of_compilation (decl) close_dump_file (DFI_sched, print_rtl_with_bb, insns); timevar_pop (TV_SCHED); - if (ggc_p) - ggc_collect (); + ggc_collect (); /* Register lifetime information was updated as part of verifying the schedule. */ @@ -3421,8 +3402,7 @@ rest_of_compilation (decl) timevar_pop (TV_DUMP); } - if (ggc_p) - ggc_collect (); + ggc_collect (); timevar_push (TV_GLOBAL_ALLOC); open_dump_file (DFI_greg, decl); @@ -3443,8 +3423,7 @@ rest_of_compilation (decl) if (failure) goto exit_rest_of_compilation; - if (ggc_p) - ggc_collect (); + ggc_collect (); /* Do a very simple CSE pass over just the hard registers. */ if (optimize > 0) @@ -3514,8 +3493,7 @@ rest_of_compilation (decl) #endif combine_stack_adjustments (); - if (ggc_p) - ggc_collect (); + ggc_collect (); } flow2_completed = 1; @@ -3572,8 +3550,7 @@ rest_of_compilation (decl) close_dump_file (DFI_sched2, print_rtl_with_bb, insns); timevar_pop (TV_SCHED2); - if (ggc_p) - ggc_collect (); + ggc_collect (); } #endif @@ -3618,8 +3595,7 @@ rest_of_compilation (decl) close_dump_file (DFI_mach, print_rtl_with_bb, insns); - if (ggc_p) - ggc_collect (); + ggc_collect (); #endif /* If a scheduling pass for delayed branches is to be done, @@ -3636,8 +3612,7 @@ rest_of_compilation (decl) close_dump_file (DFI_dbr, print_rtl_with_bb, insns); timevar_pop (TV_DBR_SCHED); - if (ggc_p) - ggc_collect (); + ggc_collect (); } #endif @@ -3658,8 +3633,7 @@ rest_of_compilation (decl) close_dump_file (DFI_stack, print_rtl_with_bb, insns); timevar_pop (TV_REG_STACK); - if (ggc_p) - ggc_collect (); + ggc_collect (); #endif current_function_nothrow = nothrow_function_p (); @@ -3702,8 +3676,7 @@ rest_of_compilation (decl) } timevar_pop (TV_FINAL); - if (ggc_p) - ggc_collect (); + ggc_collect (); /* Write DBX symbols if requested. */ @@ -3756,9 +3729,6 @@ rest_of_compilation (decl) it runs through become garbage. */ clear_const_double_mem (); - /* Cancel the effect of rtl_in_current_obstack. */ - resume_temporary_allocation (); - /* Show no temporary slots allocated. */ init_temp_slots (); @@ -3783,8 +3753,7 @@ rest_of_compilation (decl) free_after_compilation (cfun); cfun = 0; - if (ggc_p) - ggc_collect (); + ggc_collect (); timevar_pop (TV_REST_OF_COMPILATION); } @@ -4094,10 +4063,7 @@ decode_f_option (arg) = skip_leading_substring (arg, "stack-limit-symbol="))) { char *nm; - if (ggc_p) - nm = ggc_alloc_string (option_value, strlen (option_value)); - else - nm = xstrdup (option_value); + nm = ggc_strdup (option_value); stack_limit_rtx = gen_rtx_SYMBOL_REF (Pmode, nm); } else if ((option_value diff --git a/gcc/tree.c b/gcc/tree.c index fab3d1de0c9..7bd7a41309f 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -53,112 +53,10 @@ extern int _obstack_allocated_p PARAMS ((struct obstack *h, PTR obj)); static void unsave_expr_now_r PARAMS ((tree)); -/* Tree nodes of permanent duration are allocated in this obstack. - They are the identifier nodes, and everything outside of - the bodies and parameters of function definitions. */ +/* Objects allocated on this obstack last forever. */ struct obstack permanent_obstack; -/* The initial RTL, and all ..._TYPE nodes, in a function - are allocated in this obstack. Usually they are freed at the - end of the function, but if the function is inline they are saved. - For top-level functions, this is maybepermanent_obstack. - Separate obstacks are made for nested functions. */ - -struct obstack *function_maybepermanent_obstack; - -/* This is the function_maybepermanent_obstack for top-level functions. */ - -struct obstack maybepermanent_obstack; - -/* The contents of the current function definition are allocated - in this obstack, and all are freed at the end of the function. - For top-level functions, this is temporary_obstack. - Separate obstacks are made for nested functions. */ - -struct obstack *function_obstack; - -/* This is used for reading initializers of global variables. */ - -struct obstack temporary_obstack; - -/* The tree nodes of an expression are allocated - in this obstack, and all are freed at the end of the expression. */ - -struct obstack momentary_obstack; - -/* The tree nodes of a declarator are allocated - in this obstack, and all are freed when the declarator - has been parsed. */ - -static struct obstack temp_decl_obstack; - -/* This points at either permanent_obstack - or the current function_maybepermanent_obstack. */ - -struct obstack *saveable_obstack; - -/* This is same as saveable_obstack during parse and expansion phase; - it points to the current function's obstack during optimization. - This is the obstack to be used for creating rtl objects. */ - -struct obstack *rtl_obstack; - -/* This points at either permanent_obstack or the current function_obstack. */ - -struct obstack *current_obstack; - -/* This points at either permanent_obstack or the current function_obstack - or momentary_obstack. */ - -struct obstack *expression_obstack; - -/* Stack of obstack selections for push_obstacks and pop_obstacks. */ - -struct obstack_stack -{ - struct obstack_stack *next; - struct obstack *current; - struct obstack *saveable; - struct obstack *expression; - struct obstack *rtl; -}; - -struct obstack_stack *obstack_stack; - -/* Obstack for allocating struct obstack_stack entries. */ - -static struct obstack obstack_stack_obstack; - -/* Addresses of first objects in some obstacks. - This is for freeing their entire contents. */ -char *maybepermanent_firstobj; -char *temporary_firstobj; -char *momentary_firstobj; -char *temp_decl_firstobj; - -/* This is used to preserve objects (mainly array initializers) that need to - live until the end of the current function, but no further. */ -char *momentary_function_firstobj; - -/* Nonzero means all ..._TYPE nodes should be allocated permanently. */ - -int all_types_permanent; - -/* Stack of places to restore the momentary obstack back to. */ - -struct momentary_level -{ - /* Pointer back to previous such level. */ - struct momentary_level *prev; - /* First object allocated within this level. */ - char *base; - /* Value of expression_obstack saved at entry to this level. */ - struct obstack *obstack; -}; - -struct momentary_level *momentary_stack; - /* Table indexed by tree code giving a string containing a character classifying the tree code. Possibilities are t, d, s, c, r, <, 1, 2 and e. See tree.def for details. */ @@ -304,26 +202,8 @@ tree integer_types[itk_none]; void init_obstacks () { - gcc_obstack_init (&obstack_stack_obstack); gcc_obstack_init (&permanent_obstack); - gcc_obstack_init (&temporary_obstack); - temporary_firstobj = (char *) obstack_alloc (&temporary_obstack, 0); - gcc_obstack_init (&momentary_obstack); - momentary_firstobj = (char *) obstack_alloc (&momentary_obstack, 0); - momentary_function_firstobj = momentary_firstobj; - gcc_obstack_init (&maybepermanent_obstack); - maybepermanent_firstobj - = (char *) obstack_alloc (&maybepermanent_obstack, 0); - gcc_obstack_init (&temp_decl_obstack); - temp_decl_firstobj = (char *) obstack_alloc (&temp_decl_obstack, 0); - - function_obstack = &temporary_obstack; - function_maybepermanent_obstack = &maybepermanent_obstack; - current_obstack = &permanent_obstack; - expression_obstack = &permanent_obstack; - rtl_obstack = saveable_obstack = &permanent_obstack; - /* Init the hash table of identifiers. */ bzero ((char *) hash_table, sizeof hash_table); ggc_add_tree_root (hash_table, sizeof hash_table / sizeof (tree)); @@ -356,309 +236,7 @@ gcc_obstack_init (obstack) (void (*) PARAMS ((void *))) OBSTACK_CHUNK_FREE); } -/* Save all variables describing the current status into the structure - *P. This function is called whenever we start compiling one - function in the midst of compiling another. For example, when - compiling a nested function, or, in C++, a template instantiation - that is required by the function we are currently compiling. - - CONTEXT is the decl_function_context for the function we're about to - compile; if it isn't current_function_decl, we have to play some games. */ - -void -save_tree_status (p) - struct function *p; -{ - p->all_types_permanent = all_types_permanent; - p->momentary_stack = momentary_stack; - p->maybepermanent_firstobj = maybepermanent_firstobj; - p->temporary_firstobj = temporary_firstobj; - p->momentary_firstobj = momentary_firstobj; - p->momentary_function_firstobj = momentary_function_firstobj; - p->function_obstack = function_obstack; - p->function_maybepermanent_obstack = function_maybepermanent_obstack; - p->current_obstack = current_obstack; - p->expression_obstack = expression_obstack; - p->saveable_obstack = saveable_obstack; - p->rtl_obstack = rtl_obstack; - - function_maybepermanent_obstack - = (struct obstack *) xmalloc (sizeof (struct obstack)); - gcc_obstack_init (function_maybepermanent_obstack); - maybepermanent_firstobj - = (char *) obstack_finish (function_maybepermanent_obstack); - - function_obstack = (struct obstack *) xmalloc (sizeof (struct obstack)); - gcc_obstack_init (function_obstack); - - current_obstack = &permanent_obstack; - expression_obstack = &permanent_obstack; - rtl_obstack = saveable_obstack = &permanent_obstack; - - temporary_firstobj = (char *) obstack_alloc (&temporary_obstack, 0); - momentary_firstobj = (char *) obstack_finish (&momentary_obstack); - momentary_function_firstobj = momentary_firstobj; -} - -/* Restore all variables describing the current status from the structure *P. - This is used after a nested function. */ - -void -restore_tree_status (p) - struct function *p; -{ - all_types_permanent = p->all_types_permanent; - momentary_stack = p->momentary_stack; - - obstack_free (&momentary_obstack, momentary_function_firstobj); - - /* Free saveable storage used by the function just compiled and not - saved. */ - obstack_free (function_maybepermanent_obstack, maybepermanent_firstobj); - if (obstack_empty_p (function_maybepermanent_obstack)) - { - obstack_free (function_maybepermanent_obstack, NULL); - free (function_maybepermanent_obstack); - } - - obstack_free (&temporary_obstack, temporary_firstobj); - obstack_free (&momentary_obstack, momentary_function_firstobj); - - obstack_free (function_obstack, NULL); - free (function_obstack); - - temporary_firstobj = p->temporary_firstobj; - momentary_firstobj = p->momentary_firstobj; - momentary_function_firstobj = p->momentary_function_firstobj; - maybepermanent_firstobj = p->maybepermanent_firstobj; - function_obstack = p->function_obstack; - function_maybepermanent_obstack = p->function_maybepermanent_obstack; - current_obstack = p->current_obstack; - expression_obstack = p->expression_obstack; - saveable_obstack = p->saveable_obstack; - rtl_obstack = p->rtl_obstack; -} -/* Start allocating on the temporary (per function) obstack. - This is done in start_function before parsing the function body, - and before each initialization at top level, and to go back - to temporary allocation after doing permanent_allocation. */ - -void -temporary_allocation () -{ - /* Note that function_obstack at top level points to temporary_obstack. - But within a nested function context, it is a separate obstack. */ - current_obstack = function_obstack; - expression_obstack = function_obstack; - rtl_obstack = saveable_obstack = function_maybepermanent_obstack; - momentary_stack = 0; -} - -/* Start allocating on the permanent obstack but don't - free the temporary data. After calling this, call - `permanent_allocation' to fully resume permanent allocation status. */ - -void -end_temporary_allocation () -{ - current_obstack = &permanent_obstack; - expression_obstack = &permanent_obstack; - rtl_obstack = saveable_obstack = &permanent_obstack; -} - -/* Resume allocating on the temporary obstack, undoing - effects of `end_temporary_allocation'. */ - -void -resume_temporary_allocation () -{ - current_obstack = function_obstack; - expression_obstack = function_obstack; - rtl_obstack = saveable_obstack = function_maybepermanent_obstack; -} - -/* While doing temporary allocation, switch to allocating in such a - way as to save all nodes if the function is inlined. Call - resume_temporary_allocation to go back to ordinary temporary - allocation. */ - -void -saveable_allocation () -{ - /* Note that function_obstack at top level points to temporary_obstack. - But within a nested function context, it is a separate obstack. */ - expression_obstack = current_obstack = saveable_obstack; -} - -/* Switch to current obstack CURRENT and maybepermanent obstack SAVEABLE, - recording the previously current obstacks on a stack. - This does not free any storage in any obstack. */ - -void -push_obstacks (current, saveable) - struct obstack *current, *saveable; -{ - struct obstack_stack *p; - - p = (struct obstack_stack *) obstack_alloc (&obstack_stack_obstack, - (sizeof (struct obstack_stack))); - - p->current = current_obstack; - p->saveable = saveable_obstack; - p->expression = expression_obstack; - p->rtl = rtl_obstack; - p->next = obstack_stack; - obstack_stack = p; - - current_obstack = current; - expression_obstack = current; - rtl_obstack = saveable_obstack = saveable; -} - -/* Save the current set of obstacks, but don't change them. */ - -void -push_obstacks_nochange () -{ - struct obstack_stack *p; - - p = (struct obstack_stack *) obstack_alloc (&obstack_stack_obstack, - (sizeof (struct obstack_stack))); - - p->current = current_obstack; - p->saveable = saveable_obstack; - p->expression = expression_obstack; - p->rtl = rtl_obstack; - p->next = obstack_stack; - obstack_stack = p; -} - -/* Pop the obstack selection stack. */ - -void -pop_obstacks () -{ - struct obstack_stack *p; - - p = obstack_stack; - obstack_stack = p->next; - - current_obstack = p->current; - saveable_obstack = p->saveable; - expression_obstack = p->expression; - rtl_obstack = p->rtl; - - obstack_free (&obstack_stack_obstack, p); -} - -/* Nonzero if temporary allocation is currently in effect. - Zero if currently doing permanent allocation. */ - -int -allocation_temporary_p () -{ - return current_obstack != &permanent_obstack; -} - -/* Go back to allocating on the permanent obstack - and free everything in the temporary obstack. - - FUNCTION_END is true only if we have just finished compiling a function. - In that case, we also free preserved initial values on the momentary - obstack. */ - -void -permanent_allocation (function_end) - int function_end; -{ - /* Free up previous temporary obstack data */ - obstack_free (&temporary_obstack, temporary_firstobj); - if (function_end) - { - obstack_free (&momentary_obstack, momentary_function_firstobj); - momentary_firstobj = momentary_function_firstobj; - } - else - obstack_free (&momentary_obstack, momentary_firstobj); - - obstack_free (function_maybepermanent_obstack, maybepermanent_firstobj); - obstack_free (&temp_decl_obstack, temp_decl_firstobj); - - current_obstack = &permanent_obstack; - expression_obstack = &permanent_obstack; - rtl_obstack = saveable_obstack = &permanent_obstack; -} - -/* Save permanently everything on the maybepermanent_obstack. */ - -void -preserve_data () -{ - maybepermanent_firstobj - = (char *) obstack_alloc (function_maybepermanent_obstack, 0); -} - -void -preserve_initializer () -{ - struct momentary_level *tem; - char *old_momentary; - - temporary_firstobj - = (char *) obstack_alloc (&temporary_obstack, 0); - maybepermanent_firstobj - = (char *) obstack_alloc (function_maybepermanent_obstack, 0); - - old_momentary = momentary_firstobj; - momentary_firstobj - = (char *) obstack_alloc (&momentary_obstack, 0); - if (momentary_firstobj != old_momentary) - for (tem = momentary_stack; tem; tem = tem->prev) - tem->base = momentary_firstobj; -} - -/* Start allocating new rtl in current_obstack. - Use resume_temporary_allocation - to go back to allocating rtl in saveable_obstack. */ - -void -rtl_in_current_obstack () -{ - rtl_obstack = current_obstack; -} - -/* Start allocating rtl from saveable_obstack. Intended to be used after - a call to push_obstacks_nochange. */ - -void -rtl_in_saveable_obstack () -{ - rtl_obstack = saveable_obstack; -} - -/* Allocate SIZE bytes in the current obstack - and return a pointer to them. - In practice the current obstack is always the temporary one. */ - -char * -oballoc (size) - int size; -{ - return (char *) obstack_alloc (current_obstack, size); -} - -/* Free the object PTR in the current obstack - as well as everything allocated since PTR. - In practice the current obstack is always the temporary one. */ - -void -obfree (ptr) - char *ptr; -{ - obstack_free (current_obstack, ptr); -} - /* Allocate SIZE bytes in the permanent obstack and return a pointer to them. */ @@ -683,204 +261,6 @@ perm_calloc (nelem, size) return rval; } -/* Allocate SIZE bytes in the saveable obstack - and return a pointer to them. */ - -char * -savealloc (size) - int size; -{ - return (char *) obstack_alloc (saveable_obstack, size); -} - -/* Allocate SIZE bytes in the expression obstack - and return a pointer to them. */ - -char * -expralloc (size) - int size; -{ - return (char *) obstack_alloc (expression_obstack, size); -} - -/* Print out which obstack an object is in. */ - -void -print_obstack_name (object, file, prefix) - char *object; - FILE *file; - const char *prefix; -{ - struct obstack *obstack = NULL; - const char *obstack_name = NULL; - struct function *p; - - for (p = outer_function_chain; p; p = p->next) - { - if (_obstack_allocated_p (p->function_obstack, object)) - { - obstack = p->function_obstack; - obstack_name = "containing function obstack"; - } - if (_obstack_allocated_p (p->function_maybepermanent_obstack, object)) - { - obstack = p->function_maybepermanent_obstack; - obstack_name = "containing function maybepermanent obstack"; - } - } - - if (_obstack_allocated_p (&obstack_stack_obstack, object)) - { - obstack = &obstack_stack_obstack; - obstack_name = "obstack_stack_obstack"; - } - else if (_obstack_allocated_p (function_obstack, object)) - { - obstack = function_obstack; - obstack_name = "function obstack"; - } - else if (_obstack_allocated_p (&permanent_obstack, object)) - { - obstack = &permanent_obstack; - obstack_name = "permanent_obstack"; - } - else if (_obstack_allocated_p (&momentary_obstack, object)) - { - obstack = &momentary_obstack; - obstack_name = "momentary_obstack"; - } - else if (_obstack_allocated_p (function_maybepermanent_obstack, object)) - { - obstack = function_maybepermanent_obstack; - obstack_name = "function maybepermanent obstack"; - } - else if (_obstack_allocated_p (&temp_decl_obstack, object)) - { - obstack = &temp_decl_obstack; - obstack_name = "temp_decl_obstack"; - } - - /* Check to see if the object is in the free area of the obstack. */ - if (obstack != NULL) - { - if (object >= obstack->next_free - && object < obstack->chunk_limit) - fprintf (file, "%s in free portion of obstack %s", - prefix, obstack_name); - else - fprintf (file, "%s allocated from %s", prefix, obstack_name); - } - else - fprintf (file, "%s not allocated from any obstack", prefix); -} - -void -debug_obstack (object) - char *object; -{ - print_obstack_name (object, stderr, "object"); - fprintf (stderr, ".\n"); -} - -/* Return 1 if OBJ is in the permanent obstack. - This is slow, and should be used only for debugging. - Use TREE_PERMANENT for other purposes. */ - -int -object_permanent_p (obj) - tree obj; -{ - return _obstack_allocated_p (&permanent_obstack, obj); -} - -/* Start a level of momentary allocation. - In C, each compound statement has its own level - and that level is freed at the end of each statement. - All expression nodes are allocated in the momentary allocation level. */ - -void -push_momentary () -{ - struct momentary_level *tem - = (struct momentary_level *) obstack_alloc (&momentary_obstack, - sizeof (struct momentary_level)); - tem->prev = momentary_stack; - tem->base = (char *) obstack_base (&momentary_obstack); - tem->obstack = expression_obstack; - momentary_stack = tem; - expression_obstack = &momentary_obstack; -} - -/* Set things up so the next clear_momentary will only clear memory - past our present position in momentary_obstack. */ - -void -preserve_momentary () -{ - momentary_stack->base = (char *) obstack_base (&momentary_obstack); -} - -/* Free all the storage in the current momentary-allocation level. - In C, this happens at the end of each statement. */ - -void -clear_momentary () -{ - obstack_free (&momentary_obstack, momentary_stack->base); -} - -/* Discard a level of momentary allocation. - In C, this happens at the end of each compound statement. - Restore the status of expression node allocation - that was in effect before this level was created. */ - -void -pop_momentary () -{ - struct momentary_level *tem = momentary_stack; - momentary_stack = tem->prev; - expression_obstack = tem->obstack; - /* We can't free TEM from the momentary_obstack, because there might - be objects above it which have been saved. We can free back to the - stack of the level we are popping off though. */ - obstack_free (&momentary_obstack, tem->base); -} - -/* Pop back to the previous level of momentary allocation, - but don't free any momentary data just yet. */ - -void -pop_momentary_nofree () -{ - struct momentary_level *tem = momentary_stack; - momentary_stack = tem->prev; - expression_obstack = tem->obstack; -} - -/* Call when starting to parse a declaration: - make expressions in the declaration last the length of the function. - Returns an argument that should be passed to resume_momentary later. */ - -int -suspend_momentary () -{ - register int tem = expression_obstack == &momentary_obstack; - expression_obstack = saveable_obstack; - return tem; -} - -/* Call when finished parsing a declaration: - restore the treatment of node-allocation that was - in effect before the suspension. - YES should be the value previously returned by suspend_momentary. */ - -void -resume_momentary (yes) - int yes; -{ - if (yes) - expression_obstack = &momentary_obstack; -} /* Init the tables indexed by tree code. Note that languages can add to these tables to define their own codes. */ @@ -951,9 +331,6 @@ tree_size (node) } /* Return a newly allocated node of code CODE. - Initialize the node's unique id and its TREE_PERMANENT flag. - Note that if garbage collection is in use, TREE_PERMANENT will - always be zero - we want to eliminate use of TREE_PERMANENT. For decl and type nodes, some other fields are initialized. The rest of the node is initialized to zero. @@ -1037,7 +414,6 @@ make_node (code) memset ((PTR) t, 0, length); TREE_SET_CODE (t, code); - TREE_SET_PERMANENT (t); switch (type) { @@ -1133,10 +509,7 @@ copy_node (node) register size_t length; length = tree_size (node); - if (ggc_p) - t = ggc_alloc_tree (length); - else - t = (tree) obstack_alloc (current_obstack, length); + t = ggc_alloc_tree (length); memcpy (t, node, length); TREE_CHAIN (t) = 0; @@ -1147,8 +520,6 @@ copy_node (node) else if (TREE_CODE_CLASS (code) == 't') { TYPE_UID (t) = next_type_uid++; - TYPE_OBSTACK (t) = current_obstack; - /* The following is so that the debug code for the copy is different from the original type. The two statements usually duplicate each other @@ -1158,8 +529,6 @@ copy_node (node) TYPE_SYMTAB_ADDRESS (t) = 0; } - TREE_SET_PERMANENT (t); - return t; } @@ -1246,10 +615,7 @@ get_identifier (text) id_string_size += len; #endif - if (ggc_p) - IDENTIFIER_POINTER (idp) = ggc_alloc_string (text, len); - else - IDENTIFIER_POINTER (idp) = obstack_copy0 (&permanent_obstack, text, len); + IDENTIFIER_POINTER (idp) = ggc_alloc_string (text, len); TREE_CHAIN (idp) = hash_table[hi]; hash_table[hi] = idp; @@ -1492,17 +858,10 @@ build_string (len, str) int len; const char *str; { - /* Put the string in saveable_obstack since it will be placed in the RTL - for an "asm" statement and will also be kept around a while if - deferring constant output in varasm.c. */ - register tree s = make_node (STRING_CST); TREE_STRING_LENGTH (s) = len; - if (ggc_p) - TREE_STRING_POINTER (s) = ggc_alloc_string (str, len); - else - TREE_STRING_POINTER (s) = obstack_copy0 (saveable_obstack, str, len); + TREE_STRING_POINTER (s) = ggc_alloc_string (str, len); return s; } @@ -1536,22 +895,17 @@ make_tree_vec (len) { register tree t; register int length = (len-1) * sizeof (tree) + sizeof (struct tree_vec); - register struct obstack *obstack = current_obstack; #ifdef GATHER_STATISTICS tree_node_counts[(int)vec_kind]++; tree_node_sizes[(int)vec_kind] += length; #endif - if (ggc_p) - t = ggc_alloc_tree (length); - else - t = (tree) obstack_alloc (obstack, length); + t = ggc_alloc_tree (length); memset ((PTR) t, 0, length); TREE_SET_CODE (t, TREE_VEC); TREE_VEC_LENGTH (t) = len; - TREE_SET_PERMANENT (t); return t; } @@ -2062,36 +1416,6 @@ build_tree_list (parm, value) return t; } -/* Similar, but build on the temp_decl_obstack. */ - -tree -build_decl_list (parm, value) - tree parm, value; -{ - register tree node; - register struct obstack *ambient_obstack = current_obstack; - - current_obstack = &temp_decl_obstack; - node = build_tree_list (parm, value); - current_obstack = ambient_obstack; - return node; -} - -/* Similar, but build on the expression_obstack. */ - -tree -build_expr_list (parm, value) - tree parm, value; -{ - register tree node; - register struct obstack *ambient_obstack = current_obstack; - - current_obstack = expression_obstack; - node = build_tree_list (parm, value); - current_obstack = ambient_obstack; - return node; -} - /* Return a newly created TREE_LIST node whose purpose and value fields are PARM and VALUE and whose TREE_CHAIN is CHAIN. */ @@ -2102,10 +1426,7 @@ tree_cons (purpose, value, chain) { register tree node; - if (ggc_p) - node = ggc_alloc_tree (sizeof (struct tree_list)); - else - node = (tree) obstack_alloc (current_obstack, sizeof (struct tree_list)); + node = ggc_alloc_tree (sizeof (struct tree_list)); memset (node, 0, sizeof (struct tree_common)); @@ -2115,88 +1436,12 @@ tree_cons (purpose, value, chain) #endif TREE_SET_CODE (node, TREE_LIST); - TREE_SET_PERMANENT (node); - TREE_CHAIN (node) = chain; TREE_PURPOSE (node) = purpose; TREE_VALUE (node) = value; return node; } -/* Similar, but build on the temp_decl_obstack. */ - -tree -decl_tree_cons (purpose, value, chain) - tree purpose, value, chain; -{ - register tree node; - register struct obstack *ambient_obstack = current_obstack; - - current_obstack = &temp_decl_obstack; - node = tree_cons (purpose, value, chain); - current_obstack = ambient_obstack; - return node; -} - -/* Similar, but build on the expression_obstack. */ - -tree -expr_tree_cons (purpose, value, chain) - tree purpose, value, chain; -{ - register tree node; - register struct obstack *ambient_obstack = current_obstack; - - current_obstack = expression_obstack; - node = tree_cons (purpose, value, chain); - current_obstack = ambient_obstack; - return node; -} - -/* Same as `tree_cons' but make a permanent object. */ - -tree -perm_tree_cons (purpose, value, chain) - tree purpose, value, chain; -{ - register tree node; - register struct obstack *ambient_obstack = current_obstack; - - current_obstack = &permanent_obstack; - node = tree_cons (purpose, value, chain); - current_obstack = ambient_obstack; - return node; -} - -/* Same as `tree_cons', but make this node temporary, regardless. */ - -tree -temp_tree_cons (purpose, value, chain) - tree purpose, value, chain; -{ - register tree node; - register struct obstack *ambient_obstack = current_obstack; - - current_obstack = &temporary_obstack; - node = tree_cons (purpose, value, chain); - current_obstack = ambient_obstack; - return node; -} - -/* Same as `tree_cons', but save this node if the function's RTL is saved. */ - -tree -saveable_tree_cons (purpose, value, chain) - tree purpose, value, chain; -{ - register tree node; - register struct obstack *ambient_obstack = current_obstack; - - current_obstack = saveable_obstack; - node = tree_cons (purpose, value, chain); - current_obstack = ambient_obstack; - return node; -} /* Return the size nominally occupied by an object of type TYPE when it resides in memory. The value is measured in units of bytes, @@ -3308,7 +2553,6 @@ build1 (code, type, node) tree type; tree node; { - register struct obstack *obstack = expression_obstack; register int length; #ifdef GATHER_STATISTICS register tree_node_kind kind; @@ -3324,10 +2568,7 @@ build1 (code, type, node) length = sizeof (struct tree_exp); - if (ggc_p) - t = ggc_alloc_tree (length); - else - t = (tree) obstack_alloc (obstack, length); + t = ggc_alloc_tree (length); memset ((PTR) t, 0, sizeof (struct tree_common)); @@ -3337,8 +2578,6 @@ build1 (code, type, node) #endif TREE_SET_CODE (t, code); - TREE_SET_PERMANENT (t); - TREE_TYPE (t) = type; TREE_COMPLEXITY (t) = 0; TREE_OPERAND (t, 0) = node; @@ -3408,7 +2647,6 @@ build_parse_node VPARAMS ((enum tree_code code, ...)) #ifndef ANSI_PROTOTYPES enum tree_code code; #endif - register struct obstack *ambient_obstack = expression_obstack; va_list p; register tree t; register int length; @@ -3420,8 +2658,6 @@ build_parse_node VPARAMS ((enum tree_code code, ...)) code = va_arg (p, enum tree_code); #endif - expression_obstack = &temp_decl_obstack; - t = make_node (code); length = TREE_CODE_LENGTH (code); @@ -3429,7 +2665,6 @@ build_parse_node VPARAMS ((enum tree_code code, ...)) TREE_OPERAND (t, i) = va_arg (p, tree); va_end (p); - expression_obstack = ambient_obstack; return t; } @@ -3554,7 +2789,6 @@ build_type_attribute_variant (ttype, attribute) unsigned int hashcode; tree ntype; - push_obstacks (TYPE_OBSTACK (ttype), TYPE_OBSTACK (ttype)); ntype = copy_node (ttype); TYPE_POINTER_TO (ntype) = 0; @@ -3590,7 +2824,6 @@ build_type_attribute_variant (ttype, attribute) ntype = type_hash_canon (hashcode, ntype); ttype = build_qualified_type (ntype, TYPE_QUALS (ttype)); - pop_obstacks (); } return ttype; @@ -3906,11 +3139,8 @@ build_type_copy (type) tree type; { register tree t, m = TYPE_MAIN_VARIANT (type); - register struct obstack *ambient_obstack = current_obstack; - current_obstack = TYPE_OBSTACK (type); t = copy_node (type); - current_obstack = ambient_obstack; TYPE_POINTER_TO (t) = 0; TYPE_REFERENCE_TO (t) = 0; @@ -4053,9 +3283,6 @@ type_hash_canon (hashcode, type) t1 = type_hash_lookup (hashcode, type); if (t1 != 0) { - if (!ggc_p) - obstack_free (TYPE_OBSTACK (type), type); - #ifdef GATHER_STATISTICS tree_node_counts[(int) t_kind]--; tree_node_sizes[(int) t_kind] -= sizeof (struct tree_type); @@ -4064,8 +3291,7 @@ type_hash_canon (hashcode, type) } /* If this is a permanent type, record it for later reuse. */ - if (ggc_p || TREE_PERMANENT (type)) - type_hash_add (hashcode, type); + type_hash_add (hashcode, type); return type; } @@ -4520,10 +3746,8 @@ build_pointer_type (to_type) if (t != 0) return t; - /* We need a new one. Put this in the same obstack as TO_TYPE. */ - push_obstacks (TYPE_OBSTACK (to_type), TYPE_OBSTACK (to_type)); + /* We need a new one. */ t = make_node (POINTER_TYPE); - pop_obstacks (); TREE_TYPE (t) = to_type; @@ -4551,10 +3775,8 @@ build_reference_type (to_type) if (t) return t; - /* We need a new one. Put this in the same obstack as TO_TYPE. */ - push_obstacks (TYPE_OBSTACK (to_type), TYPE_OBSTACK (to_type)); + /* We need a new one. */ t = make_node (REFERENCE_TYPE); - pop_obstacks (); TREE_TYPE (t) = to_type; @@ -4585,9 +3807,7 @@ build_index_type (maxval) TYPE_PRECISION (itype) = TYPE_PRECISION (sizetype); TYPE_MIN_VALUE (itype) = size_zero_node; - push_obstacks (TYPE_OBSTACK (itype), TYPE_OBSTACK (itype)); TYPE_MAX_VALUE (itype) = convert (sizetype, maxval); - pop_obstacks (); TYPE_MODE (itype) = TYPE_MODE (sizetype); TYPE_SIZE (itype) = TYPE_SIZE (sizetype); @@ -4616,10 +3836,8 @@ build_range_type (type, lowval, highval) if (type == NULL_TREE) type = sizetype; - push_obstacks (TYPE_OBSTACK (itype), TYPE_OBSTACK (itype)); TYPE_MIN_VALUE (itype) = convert (type, lowval); TYPE_MAX_VALUE (itype) = highval ? convert (type, highval) : NULL; - pop_obstacks (); TYPE_PRECISION (itype) = TYPE_PRECISION (type); TYPE_MODE (itype) = TYPE_MODE (type); @@ -5281,10 +4499,6 @@ dump_tree_statistics () fprintf (stderr, "(No per-node statistics)\n"); #endif print_obstack_statistics ("permanent_obstack", &permanent_obstack); - print_obstack_statistics ("maybepermanent_obstack", &maybepermanent_obstack); - print_obstack_statistics ("temporary_obstack", &temporary_obstack); - print_obstack_statistics ("momentary_obstack", &momentary_obstack); - print_obstack_statistics ("temp_decl_obstack", &temp_decl_obstack); print_type_hash_statistics (); print_lang_statistics (); } diff --git a/gcc/tree.h b/gcc/tree.h index c00fafd840f..80a3282a237 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -133,7 +133,6 @@ struct tree_common ENUM_BITFIELD(tree_code) code : 8; unsigned side_effects_flag : 1; unsigned constant_flag : 1; - unsigned permanent_flag : 1; unsigned addressable_flag : 1; unsigned volatile_flag : 1; unsigned readonly_flag : 1; @@ -155,6 +154,10 @@ struct tree_common unsigned lang_flag_4 : 1; unsigned lang_flag_5 : 1; unsigned lang_flag_6 : 1; + /* This flag is presently unused. However, language front-ends + should not make use of this flag; it is reserved for future + expansion. */ + unsigned dummy : 1; }; /* The following table lists the uses of each of the above flags and @@ -230,8 +233,6 @@ struct tree_common TREE_CONSTANT in all expressions - permanent_flag: TREE_PERMANENT in all nodes - unsigned_flag: TREE_UNSIGNED in @@ -568,17 +569,6 @@ extern void tree_class_check_failed PARAMS ((const tree, int, if the value is constant. */ #define TREE_CONSTANT(NODE) ((NODE)->common.constant_flag) -/* Nonzero means permanent node; - node will continue to exist for the entire compiler run. - Otherwise it will be recycled at the end of the function. - This flag is always zero if garbage collection is in use. - Try not to use this. Only set it with TREE_SET_PERMANENT. */ -#define TREE_PERMANENT(NODE) ((NODE)->common.permanent_flag) -#define TREE_SET_PERMANENT(NODE) do { \ - if (!ggc_p && current_obstack == &permanent_obstack) \ - TREE_PERMANENT(NODE) = 1; \ -} while (0) - /* In INTEGER_TYPE or ENUMERAL_TYPE nodes, means an unsigned type. In FIELD_DECL nodes, means an unsigned bit field. The same bit is used in functions as DECL_BUILT_IN_NONANSI. */ @@ -890,7 +880,6 @@ struct tree_block #define TYPE_MAIN_VARIANT(NODE) (TYPE_CHECK (NODE)->type.main_variant) #define TYPE_NONCOPIED_PARTS(NODE) (TYPE_CHECK (NODE)->type.noncopied_parts) #define TYPE_CONTEXT(NODE) (TYPE_CHECK (NODE)->type.context) -#define TYPE_OBSTACK(NODE) (TYPE_CHECK (NODE)->type.obstack) #define TYPE_LANG_SPECIFIC(NODE) (TYPE_CHECK (NODE)->type.lang_specific) /* For a VECTOR_TYPE node, this describes a different type which is emitted @@ -1152,7 +1141,6 @@ struct tree_type union tree_node *binfo; union tree_node *noncopied_parts; union tree_node *context; - struct obstack *obstack; HOST_WIDE_INT alias_set; /* Points to a structure whose details depend on the language in use. */ struct lang_type *lang_specific; @@ -1858,9 +1846,7 @@ extern tree integer_types[itk_none]; extern int exact_log2_wide PARAMS ((unsigned HOST_WIDE_INT)); extern int floor_log2_wide PARAMS ((unsigned HOST_WIDE_INT)); -extern char *oballoc PARAMS ((int)); extern char *permalloc PARAMS ((int)); -extern char *savealloc PARAMS ((int)); extern char *expralloc PARAMS ((int)); /* Compute the number of bytes occupied by 'node'. This routine only @@ -1917,8 +1903,6 @@ extern tree build_complex PARAMS ((tree, tree, tree)); extern tree build_string PARAMS ((int, const char *)); extern tree build1 PARAMS ((enum tree_code, tree, tree)); extern tree build_tree_list PARAMS ((tree, tree)); -extern tree build_decl_list PARAMS ((tree, tree)); -extern tree build_expr_list PARAMS ((tree, tree)); extern tree build_decl PARAMS ((enum tree_code, tree, tree)); extern tree build_block PARAMS ((tree, tree, tree, tree, tree)); extern tree build_expr_wfl PARAMS ((tree, const char *, int, int)); @@ -2177,11 +2161,6 @@ extern tree chainon PARAMS ((tree, tree)); /* Make a new TREE_LIST node from specified PURPOSE, VALUE and CHAIN. */ extern tree tree_cons PARAMS ((tree, tree, tree)); -extern tree perm_tree_cons PARAMS ((tree, tree, tree)); -extern tree temp_tree_cons PARAMS ((tree, tree, tree)); -extern tree saveable_tree_cons PARAMS ((tree, tree, tree)); -extern tree decl_tree_cons PARAMS ((tree, tree, tree)); -extern tree expr_tree_cons PARAMS ((tree, tree, tree)); /* Return the last tree node in a chain. */ @@ -2620,34 +2599,9 @@ extern tree gettags PARAMS ((void)); extern tree build_range_type PARAMS ((tree, tree, tree)); -/* Call when starting to parse a declaration: - make expressions in the declaration last the length of the function. - Returns an argument that should be passed to resume_momentary later. */ -extern int suspend_momentary PARAMS ((void)); - -extern int allocation_temporary_p PARAMS ((void)); - -/* Call when finished parsing a declaration: - restore the treatment of node-allocation that was - in effect before the suspension. - YES should be the value previously returned by suspend_momentary. */ -extern void resume_momentary PARAMS ((int)); - /* Called after finishing a record, union or enumeral type. */ extern void rest_of_type_compilation PARAMS ((tree, int)); -/* Save the current set of obstacks, but don't change them. */ -extern void push_obstacks_nochange PARAMS ((void)); - -extern void permanent_allocation PARAMS ((int)); -extern void push_momentary PARAMS ((void)); -extern void clear_momentary PARAMS ((void)); -extern void pop_momentary PARAMS ((void)); -extern void end_temporary_allocation PARAMS ((void)); - -/* Pop the obstack selection stack. */ -extern void pop_obstacks PARAMS ((void)); - /* In alias.c */ extern void record_component_aliases PARAMS ((tree)); extern HOST_WIDE_INT get_alias_set PARAMS ((tree)); @@ -2657,18 +2611,10 @@ extern HOST_WIDE_INT lang_get_alias_set PARAMS ((tree)); /* In tree.c */ extern int really_constant_p PARAMS ((tree)); -extern void push_obstacks PARAMS ((struct obstack *, - struct obstack *)); -extern void pop_momentary_nofree PARAMS ((void)); -extern void preserve_momentary PARAMS ((void)); -extern void saveable_allocation PARAMS ((void)); -extern void temporary_allocation PARAMS ((void)); -extern void resume_temporary_allocation PARAMS ((void)); extern void set_identifier_size PARAMS ((int)); extern int int_fits_type_p PARAMS ((tree, tree)); extern int tree_log2 PARAMS ((tree)); extern int tree_floor_log2 PARAMS ((tree)); -extern void preserve_initializer PARAMS ((void)); extern void preserve_data PARAMS ((void)); extern int object_permanent_p PARAMS ((tree)); extern int type_precision PARAMS ((tree)); @@ -2683,9 +2629,6 @@ extern tree type_hash_lookup PARAMS ((unsigned int, tree)); extern void type_hash_add PARAMS ((unsigned int, tree)); extern unsigned int type_hash_list PARAMS ((tree)); extern int simple_cst_list_equal PARAMS ((tree, tree)); -extern void debug_obstack PARAMS ((char *)); -extern void rtl_in_current_obstack PARAMS ((void)); -extern void rtl_in_saveable_obstack PARAMS ((void)); extern void init_tree_codes PARAMS ((void)); extern void dump_tree_statistics PARAMS ((void)); extern void print_obstack_statistics PARAMS ((const char *, @@ -2702,7 +2645,6 @@ extern int real_twop PARAMS ((tree)); extern void start_identifier_warnings PARAMS ((void)); extern void gcc_obstack_init PARAMS ((struct obstack *)); extern void init_obstacks PARAMS ((void)); -extern void obfree PARAMS ((char *)); extern void build_common_tree_nodes PARAMS ((int)); extern void build_common_tree_nodes_2 PARAMS ((int)); diff --git a/gcc/varasm.c b/gcc/varasm.c index 1fdce5f9df6..497931f128f 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -80,9 +80,6 @@ extern FILE *asm_out_file; const char *first_global_object_name; const char *weak_global_object_name; -extern struct obstack *current_obstack; -extern struct obstack *saveable_obstack; -extern struct obstack *rtl_obstack; extern struct obstack permanent_obstack; #define obstack_chunk_alloc xmalloc @@ -2110,18 +2107,8 @@ immed_double_const (i0, i1, mode) && GET_MODE (r) == mode) return r; - /* No; make a new one and add it to the chain. - - We may be called by an optimizer which may be discarding any memory - allocated during its processing (such as combine and loop). However, - we will be leaving this constant on the chain, so we cannot tolerate - freed memory. So switch to saveable_obstack for this allocation - and then switch back if we were in current_obstack. */ - - push_obstacks_nochange (); - rtl_in_saveable_obstack (); + /* No; make a new one and add it to the chain. */ r = gen_rtx_CONST_DOUBLE (mode, const0_rtx, i0, i1); - pop_obstacks (); /* Don't touch const_double_chain if not inside any function. */ if (current_function_decl != 0) @@ -2186,12 +2173,8 @@ immed_real_const_1 (d, mode) We may be called by an optimizer which may be discarding any memory allocated during its processing (such as combine and loop). However, we will be leaving this constant on the chain, so we cannot tolerate - freed memory. So switch to saveable_obstack for this allocation - and then switch back if we were in current_obstack. */ - push_obstacks_nochange (); - rtl_in_saveable_obstack (); + freed memory. */ r = rtx_alloc (CONST_DOUBLE); - pop_obstacks (); PUT_MODE (r, mode); bcopy ((char *) &u, (char *) &CONST_DOUBLE_LOW (r), sizeof u); @@ -2314,6 +2297,22 @@ decode_addr_const (exp, value) value->offset = offset; } +struct rtx_const +{ +#ifdef ONLY_INT_FIELDS + unsigned int kind : 16; + unsigned int mode : 16; +#else + enum kind kind : 16; + enum machine_mode mode : 16; +#endif + union { + union real_extract du; + struct addr_const addr; + struct {HOST_WIDE_INT high, low;} di; + } un; +}; + /* Uniquize all constants that appear in memory. Each constant in memory thus far output is recorded in `const_hash_table' with a `struct constant_descriptor' @@ -3095,21 +3094,12 @@ output_constant_def (exp) desc->label = ggc_alloc_string (label, -1); const_hash_table[hash] = desc; - /* We have a symbol name; construct the SYMBOL_REF and the MEM - in the permanent obstack. We could also construct this in the - obstack of EXP and put it into TREE_CST_RTL, but we have no way - of knowing what obstack it is (e.g., it might be in a function - obstack of a function we are nested inside). */ - - push_obstacks_nochange (); - end_temporary_allocation (); - + /* We have a symbol name; construct the SYMBOL_REF and the MEM. */ desc->rtl = gen_rtx_MEM (TYPE_MODE (TREE_TYPE (exp)), gen_rtx_SYMBOL_REF (Pmode, desc->label)); set_mem_attributes (desc->rtl, exp, 1); - pop_obstacks (); found = 0; } @@ -3140,10 +3130,7 @@ output_constant_def (exp) struct deferred_constant *p; p = (struct deferred_constant *) xmalloc (sizeof (struct deferred_constant)); - push_obstacks_nochange (); - suspend_momentary (); p->exp = copy_constant (exp); - pop_obstacks (); p->reloc = reloc; p->labelno = const_labelno++; if (after_function) @@ -3260,14 +3247,10 @@ init_varasm_status (f) f->varasm = p; p->x_const_rtx_hash_table = ((struct constant_descriptor **) - xmalloc (MAX_RTX_HASH_TABLE * sizeof (struct constant_descriptor *))); + xcalloc (MAX_RTX_HASH_TABLE, sizeof (struct constant_descriptor *))); p->x_const_rtx_sym_hash_table = ((struct pool_sym **) - xmalloc (MAX_RTX_HASH_TABLE * sizeof (struct pool_sym *))); - bzero ((char *) p->x_const_rtx_hash_table, - MAX_RTX_HASH_TABLE * sizeof (struct constant_descriptor *)); - bzero ((char *) p->x_const_rtx_sym_hash_table, - MAX_RTX_HASH_TABLE * sizeof (struct pool_sym *)); + xcalloc (MAX_RTX_HASH_TABLE, sizeof (struct pool_sym *))); p->x_first_pool = p->x_last_pool = 0; p->x_pool_offset = 0; @@ -3282,6 +3265,7 @@ mark_pool_constant (pc) { while (pc) { + ggc_mark (pc); ggc_mark_rtx (pc->constant); pc = pc->next; } @@ -3324,8 +3308,31 @@ free_varasm_status (f) struct function *f; { struct varasm_status *p; + int i; p = f->varasm; + + /* Clear out the hash tables. */ + for (i = 0; i < MAX_RTX_HASH_TABLE; ++i) + { + struct constant_descriptor* cd; + struct pool_sym *ps; + + cd = p->x_const_rtx_hash_table[i]; + while (cd) { + struct constant_descriptor* next = cd->next; + free (cd); + cd = next; + } + + ps = p->x_const_rtx_sym_hash_table[i]; + while (ps) { + struct pool_sym *next = ps->next; + free (ps); + ps = next; + } + } + free (p->x_const_rtx_hash_table); free (p->x_const_rtx_sym_hash_table); free (p); @@ -3334,22 +3341,6 @@ free_varasm_status (f) enum kind { RTX_DOUBLE, RTX_INT }; -struct rtx_const -{ -#ifdef ONLY_INT_FIELDS - unsigned int kind : 16; - unsigned int mode : 16; -#else - enum kind kind : 16; - enum machine_mode mode : 16; -#endif - union { - union real_extract du; - struct addr_const addr; - struct {HOST_WIDE_INT high, low;} di; - } un; -}; - /* Express an rtx for a constant integer (perhaps symbolic) as the sum of a symbol or label plus an explicit integer. They are stored into VALUE. */ @@ -3361,13 +3352,7 @@ decode_rtx_const (mode, x, value) struct rtx_const *value; { /* Clear the whole structure, including any gaps. */ - - { - int *p = (int *) value; - int *end = (int *) (value + 1); - while (p < end) - *p++ = 0; - } + bzero (value, sizeof (struct rtx_const)); value->kind = RTX_INT; /* Most usual kind. */ value->mode = mode; @@ -3516,23 +3501,14 @@ record_constant_rtx (mode, x) rtx x; { struct constant_descriptor *ptr; - char *label; - rtx rtl; - struct rtx_const value; - - decode_rtx_const (mode, x, &value); - - /* Put these things in the saveable obstack so we can ensure it won't - be freed if we are called from combine or some other phase that discards - memory allocated from function_obstack (current_obstack). */ - obstack_grow (saveable_obstack, &ptr, sizeof ptr); - obstack_grow (saveable_obstack, &label, sizeof label); - obstack_grow (saveable_obstack, &rtl, sizeof rtl); - /* Record constant contents. */ - obstack_grow (saveable_obstack, &value, sizeof value); + ptr = ((struct constant_descriptor *) + xcalloc (1, + (sizeof (struct constant_descriptor) + + sizeof (struct rtx_const) - 1))); + decode_rtx_const (mode, x, (struct rtx_const *) ptr->contents); - return (struct constant_descriptor *) obstack_finish (saveable_obstack); + return ptr; } /* Given a constant rtx X, make (or find) a memory constant for its value @@ -3602,32 +3578,9 @@ force_const_mem (mode, x) pool_offset += align - 1; pool_offset &= ~ (align - 1); - /* If RTL is not being placed into the saveable obstack, make a - copy of X that is in the saveable obstack in case we are - being called from combine or some other phase that discards - memory it allocates. We used to only do this if it is a - CONST; however, reload can allocate a CONST_INT when - eliminating registers. */ - if (rtl_obstack != saveable_obstack - && (GET_CODE (x) == CONST || GET_CODE (x) == CONST_INT)) - { - push_obstacks_nochange (); - rtl_in_saveable_obstack (); - - if (GET_CODE (x) == CONST) - x = gen_rtx_CONST (GET_MODE (x), - gen_rtx_PLUS (GET_MODE (x), - XEXP (XEXP (x, 0), 0), - XEXP (XEXP (x, 0), 1))); - else - x = GEN_INT (INTVAL (x)); - - pop_obstacks (); - } - /* Allocate a pool constant descriptor, fill it in, and chain it in. */ - pool = (struct pool_constant *) savealloc (sizeof (struct pool_constant)); + pool = (struct pool_constant *) ggc_alloc (sizeof (struct pool_constant)); pool->desc = desc; pool->constant = x; pool->mode = mode; @@ -3654,7 +3607,7 @@ force_const_mem (mode, x) /* Add label to symbol hash table. */ hash = SYMHASH (found); - sym = (struct pool_sym *) savealloc (sizeof (struct pool_sym)); + sym = (struct pool_sym *) xmalloc (sizeof (struct pool_sym)); sym->label = found; sym->pool = pool; sym->next = const_rtx_sym_hash_table[hash]; |