diff options
| author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-07-01 05:50:51 +0000 |
|---|---|---|
| committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-07-01 05:50:51 +0000 |
| commit | e49e8bd540832217538f9720f502da8c20f1f9b0 (patch) | |
| tree | 8f6bc6f898cfafd809ea3bf6f2a7660a896f9a40 /gcc | |
| parent | b528597c9f3f2e3a64a664c7be6c82a7c2688287 (diff) | |
| download | gcc-e49e8bd540832217538f9720f502da8c20f1f9b0.tar.gz | |
2008-07-01 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r137307
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@137309 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
234 files changed, 5914 insertions, 2842 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2516b26bdef..a48eef21663 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,817 @@ +2008-06-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * config/darwin-driver.c (darwin_default_min_version): Fix + -Wc++-compat warnings. + +2008-06-30 Uros Bizjak <ubizjak@gmail.com> + + * config/i386/i386.md (*movti_rex64): Add "!" to "r" constraint + of operand 0. + +2008-06-30 Kenneth Zadeck <zadeck@naturalbridge.com> + + * ifcvt.c (cond_move_process_if_block): Free vectors on false + return. + +2008-06-30 Kenneth Zadeck <zadeck@naturalbridge.com> + + * df-scan.c (df_scan_free_ref_vec, df_scan_free_mws_vec): New + macros. + (df_scan_free_internal): Free data structures not + allocated in storage pools. + (df_mw_hardreg_chain_delete_eq_uses): Use df_scan_free_mws_vec. + (df_refs_add_to_chains): Use df_scan_free_ref_vec and + df_scan_free_mws_vec. + * dse.c (dse_step6): Free offset_map_p and offset_map_n + unconditionally. + +2008-06-30 H.J. Lu <hongjiu.lu@intel.com> + + * config/i386/i386.c (contains_aligned_value_p): Return true + for __float128. + (ix86_function_arg_boundary): Return its natural boundary + for __float128. + (return_in_memory_32): Don't check TDmode. + (ix86_split_to_parts): Support splitting into 4 parts and + support TFmode for 32bit target. + (ix86_split_long_move): Support splitting into 4 parts. + (bdesc_args): Enable IX86_BUILTIN_FABSQ and IX86_BUILTIN_COPYSIGNQ + for SSE2. + (ix86_init_mmx_sse_builtins): Move __float80 and __float128 to ... + (ix86_init_builtins): Here. + (ix86_scalar_mode_supported_p): Always return true for TFmode. + (ix86_c_mode_for_suffix): Always return TFmode and XFmode for + 'q' and 'w', respectively. + + * config/i386/i386.md (movtf): Check TARGET_SSE2 instead of + TARGET_64BIT. + (movtf_internal): Likewise. + (<code>tf2): Likewise. + (*absnegtf2_sse): Likewise. + (copysign<mode>3): Likewise. + (copysign<mode>3_const): Likewise. + (copysign<mode>3_var): Likewise. + (define_split UNSPEC_COPYSIGN): Likewise. + * config/i386/sse.md (*nandtf3): Likewise. + (<code>tf3): Likewise. + (*<code>tf3): Likewise. + +2008-06-30 Joey Ye <joey.ye@intel.com> + H.J. Lu <hongjiu.lu@intel.com> + + * global.c (compute_regsets): Set frame_pointer_needed here. + * reload1.c (init_elim_table): Don't set frame_pointer_needed here. + +2008-06-30 Aaron W. LaFramboise <aaronavay62@aaronwl.com> + + * doc/install.texi (specific): Expand Windows build notes. + +2008-06-30 Ira Rosen <irar@il.ibm.com> + + PR tree-optimization/36648 + * tree-vect-transform.c (vect_do_peeling_for_loop_bound): Divide + number of prolog iterations by step. Fix the comment. + +2008-06-30 Richard Guenther <rguenther@suse.de> + + PR middle-end/36671 + * tree-ssa-structalias.c (handle_lhs_call): Add flags argument, + handle calls from ECF_MALLOC functions. + (handle_pure_call): ECF_MALLOC functions do not return + call-used memory. + (find_func_aliases): Handle all calls, adjust calls to handle_lhs_call. + +2008-06-29 Andreas Schwab <schwab@suse.de> + + * config/m68k/m68k.c (print_operand): Always print a float + constant in hex. + * config/m68k/m68k.h (ASM_OUTPUT_FLOAT_OPERAND) + (ASM_OUTPUT_DOUBLE_OPERAND, ASM_OUTPUT_LONG_DOUBLE_OPERAND): + Remove macros. + + * config/rs6000/x-linux64: Remove never used file. + +2008-06-29 Richard Guenther <rguenther@suse.de> + + * tree-ssa-structalias.h (compute_points_to_sets): Adjust + prototype. + (struct alias_info): Move ... + * tree-ssa-alias.c: ... here. + (update_alias_info): Declare. + (compute_may_aliases): Call it. + (update_alias_info): New function. + * tree-ssa-structalias.c (update_alias_info): Move ... + * tree-ssa-alias.c (update_alias_info_1): ... here. + * tree-ssa-structalias.c (process_constraint_1): Remove + unused from_call argument. Rename to ... + (process_constraint): ... this. Delete old wrapper. + (make_constraint_to): Adjust callers. + (handle_const_call): Likewise. + (handle_pure_call): Likewise. + (init_base_vars): Likewise. + (handle_lhs_call): Likewise. Remove unnecessary constraint. + (find_func_aliases): We don't need structure copies for + complex types. + (make_constraint_from_anything): Remove. + (create_variable_info_for): For globals make constraints + from escaped, not from anything. + (compute_points_to_sets): Do not call update_alias_info. + (ipa_pta_execute): Use make_constraint_from. + +2008-06-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * Makefile.in (CXX_COMPAT_WARN, cxx_compat_warn): Delete. + (bitmap.o-warn, dominance.o-warn): New. + * configure.ac (cxx_compat_warn): Delete. + (loose_warn): Add -Wcast-qual and -Wc++-compat. + * system.h: Remove #pragma diagnostic for -Wcast-qual and + -Wc++-compat. + * configure: Regenerate. + + * optabs.c (libfunc_decl_hash, libfunc_decl_eq): Fix -Wcast-qual + warnings. + +2008-06-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * alloc-pool.c (create_alloc_pool): Fix -Wc++-compat warnings. + * df-scan.c (df_notes_rescan): Likewise. + * ggc-page.c (set_page_table_entry): Likewise. + * intl.c (gcc_gettext_width): Likewise. + * varasm.c (get_unnamed_section, get_noswitch_section, + get_section): Likewise. + +2008-06-28 Andrew Jenner <andrew@codesourcery.com> + + * regrename.c (build_def_use): Don't copy RTX. + +2008-06-28 Sandra Loosemore <sandra@codesourcery.com> + + * doc/extend.texi (Variable Attributes): Use @ref instead of @xref. + (Type Attributes): Fix nesting of @table and @subsection. Adjust + punctuation. Use @ref instead of @xref. + (Function Names): Remove stray @display/@end display. + (C++ Attributes): Use @ref instead of @xref. + (Deprecated Features): Fix punctuation around @xref. + (Backwards Compatibility): Likewise. + * doc/rtl.texi (Incdec): Remove stray @table/@end table. + +2008-06-28 Joseph Myers <joseph@codesourcery.com> + + * config/rs6000/predicates.md (easy_fp_constant): Reject TFmode + constants for E500 double. + +2008-06-28 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + + * doc/rtl.texi (const_vector): Document const_fixed as legitimate + element type of const_vector. + +2008-06-28 Uros Bizjak <ubizjak@gmail.com> + + * config/i386/i386.md (addti3, adddi3, addsi3, addhi3, addqi3): + Remove FLAGS_REG clobber from expander pattern. + (subti3, subdi3, subsi3, subhi3, subqi3): Ditto. + (anddi3, andsi3, andhi3, andqi3): Ditto. + (iordi3, iorsi3, iorhi3, iorqi3): Ditto. + (xordi3, xorsi3, xorhi3, xorqi3): Ditto. + (negti2, negdi2, negsi2, neghi2, negqi2): Ditto. + (ashlsi3, ashlhi3, ashlqi3): Ditto. + (ashrsi3, ashrhi3, ashrqi3): Ditto. + (lshrsi3, lshrhi3, lshrqi3): Ditto. + (rotldi3, rotlsi3, rotlhi3, rotlqi3): Ditto. + (rotrdi3, rotrsi3, rotrhi3, rotrqi3): Ditto. + +2008-06-28 Richard Guenther <rguenther@suse.de> + + * tree-ssa-structalias.c (callused_id, var_callused, + callused_tree): Add. + (handle_pure_call): New function. + (find_func_aliases): Call it. + (find_what_p_points_to): Handle the call-used set. + (clobber_what_escaped): Likewise. + (compute_call_used_vars): New function. + (init_base_vars): Init the call-used variable. + (do_sd_constraint): Do not propagate the solution from CALLUSED + but use CALLUSED as a placeholder. + (solve_graph): Likewise. + * tree-flow-inline.h (gimple_call_used_vars): New function. + * tree-flow.h (struct gimple_df): Add call_used_vars bitmap. + (compute_call_used_vars): Declare. + * tree-ssa-alias.c (set_initial_properties): Call + compute_call_used_vars. + (reset_alias_info): Clear call-used variables. + (add_call_clobber_ops): Assert we are not called for const/pure + functions. Remove handling of them. + (add_call_read_ops): Handle pure functions by adding the + call-used set of variables as VUSEs. + * tree-ssa.c (init_tree_ssa): Allocate call-used bitmap. + (delete_tree_ssa): Free it. + * tree-dfa.c (remove_referenced_var): Clear the var from the + call-used bitmap. + +2008-06-28 Kai Tietz <kai.tietz@onevision.com> + + * tree.c (build_varargs_function_type_list): New. + (build_function_type_list_1): New. + (build_function_type_list): Use build_function_type_list_1. + * tree.h (build_varargs_function_type_list): New. + +2008-06-28 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + + PR target/34856 + * config/spu/spu.c (spu_builtin_splats): Do not generate + invalid CONST_VECTOR expressions. + (spu_expand_vector_init): Likewise. + +2008-06-28 Richard Sandiford <rdsandiford@googlemail.com> + + * optabs.c (libfunc_decls): New variable. + (libfunc_decl_hash, libfunc_decl_eq): New functions. + (init_one_libfunc): Reuse decls and SYMBOL_REFs when asked + for the same function twice. + +2008-06-27 Uros Bizjak <ubizjak@gmail.com> + + * config/i386/i386.md (ashlti3, ashrti3, lshrti3): Expand using + ix86_expand_binary_operator directly. + (*ashlti3_1): Rename from ashlti3_1. Use nonmemory_operand predicate + for operand 2. + (*ashrti3_1): Ditto. + (*lshrti3_1): Ditto. + (*ashlti3_2, *ashrti3_2, *lshrti3_2): Remove insn patterns. + (ashlti, ashrti and lshrti splitters): Handle nonmemory operand 2 + using only one splitter. Conditionaly execute splitter before or + after peephole2 pass. + (ashlti, ashrti and lshrti peephole2): Define peephole2 patterns. + (x86_shld): Rename from x86_shld_1. Compress operand 2 constraints. + Use only one alternative in asm template. + (x86_64_shld): Compress operand 2 constraints. Use only one alternative + in asm template. + (*ashldi3_cmp_rex64): Use const_1_to_63_operand operand predicate and + "J" operand constraint for operand 2. + (*ashldi3_cconly_rex64): Ditto. + (*ashrdi3_cmp_rex64): Ditto. + (*ashrdi3_cconly_rex64): Ditto. + (*lshrdi3_cmp_rex64): Ditto. + (*lshrdi3_cconly_rex64): Ditto. + * config/i386/predicates.md (const_1_to_63_operand): New predicate. + * config/i386/i386.md (print_operand) ['s']: Print ", " using fputs. + (split_ashr, split_ashl, split_lshr): Use gen_x86_shrd instead of + gen_x86_shrd_1. + +2008-06-27 Jakub Jelinek <jakub@redhat.com> + + * gimplify.c (omp_is_private): Don't return true if decl is not + already private on #pragma omp for or #pragma omp parallel for. + + PR debug/36617 + * tree-cfg.c (struct move_stmt_d): Replace block field with + orig_block and new_block fields. + (move_stmt_r): Only set TREE_BLOCK to p->new_block if + if it used to be NULL, p->orig_block or if p->orig_block is NULL. + (move_block_to_fn): Replace vars_map and new_label_map arguments + with struct move_stmt_d pointer. + (replace_block_vars_by_duplicates): New function. + (move_sese_region_to_fn): Add ORIG_BLOCK argument. Adjust + move_block_to_fn caller. If ORIG_BLOCK is non-NULL, move over + all subblocks of ORIG_BLOCK to the new function. Call + replace_block_vars_by_duplicates. + * tree-flow.h (move_sese_region_to_fn): Adjust prototype. + * omp-low.c (expand_omp_taskreg): Set TREE_USED on DECL_INITIAL + BLOCK of the new function. Adjust move_sese_region_to_fn caller. + Prune vars with original DECL_CONTEXT from child_cfun->local_decls. + (expand_omp): Temporarily set input_location to the location of + region's controlling stmt. + (lower_omp_sections, lower_omp_for): Add a BLOCK into outermost + BIND_EXPR, push ctx->block_vars and gimplification vars into + the BIND_EXPR and its block's BLOCK_VARS instead of directly + into dest function. + (lower_omp_single): Set TREE_USED on the BIND_EXPR's BLOCK if + there are any BLOCK_VARS. + (lower_omp_taskreg): Set BLOCK on a BIND_EXPR containing the + OMP_PARALLEL or OMP_TASK stmt. + (lower_omp): Save and restore input_location around the lower_omp_1 + call. + +2008-06-27 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/36400 + PR tree-optimization/36373 + PR tree-optimization/36344 + * tree-ssa-structalias.c (var_escaped, escaped_tree, escaped_id, + var_nonlocal, nonlocal_tree, nonlocal_id): New globals + (update_alias_info): Remove call clobbering code. + (make_constraint_to): New helper function. + (make_escape_constraint): Likewise. + (handle_rhs_call): Use it on all pointer containing arguments. + Also mark the static chain escaped. + (handle_lhs_call): Make constraints from NONLOCAL and ESCAPED + instead of ANYTHING. + (make_constraint_from): New helper split out from ... + (make_constraint_from_anything): ... here. + (find_func_aliases): Add constraints for escape sites. + (intra_create_variable_infos): Make constraints from NONLOCAL + for parameters. + (find_what_p_points_to): Interpret NONLOCAL and ESCAPED the same + as ANYTHING. + (clobber_what_p_points_to): Remove. + (clobber_what_escaped): New function. + (init_base_vars): Init NONLOCAL and ESCAPED. + (do_sd_constraint): Do not propagate the solution from ESCAPED + but use ESCAPED as a placeholder. + (solve_graph): Likewise. + * tree-flow.h (clobber_what_p_points_to): Remove. + (clobber_what_escaped): Declare. + * tree-ssa-alias.c (set_initial_properties): Call it. + Remove code clobbering escaped pointers. + +2008-06-27 Richard Sandiford <rdsandiford@googlemail.com> + + * function.c (allocate_struct_function): Only allocate a unique + funcdef_no if the decl is nonzero. + +2008-06-27 Richard Sandiford <rdsandiford@googlemail.com> + + * config/mips/mips-protos.h (mips_split_const_insns): Declare. + * config/mips/mips.c (mips_split_const_insns): New function. + * config/mips/mips.md (move_type): New attribute. + (mode): Move attribute definition earlier in file. Add "TI" and "TF". + (dword_mode): New attribute. + (type): Avoid long line. Map "move_type"s to "type"s, + choosing "multi" for doubleword moves if appropriate. + Swap MTC/MFC comments to match their declaration order. + (extended_mips16): Default to "yes" if "move_type" is "sll0", + "type" is "branch" or "jal" is "direct". + (length): Handle "extended_mips16" first. Make the default + "0" for "ghost" instructions. Set the length from "move_type". + (truncdisi2, truncdihi2, truncdiqi2): Use "move_type" instead + of "type", with "sll0" for the register alternative. Remove the + "extended_mips16" attribute. + (zero_extendsidi2, *clear_upper32): Use "move_type" instead + of "type", with "shift_shift" for the register alternative. + Remove the "length" attribute. + (*extend<SHORT:mode><GPR:mode>2, *extendqihi2): Likewise. + (*zero_extend<SHORT:mode><GPR:mode>2): Use "move_type" instead + of "type", with "andi" for the register alternative. + (*zero_extendqihi2): Likewise. + (*zero_extend<SHORT:mode><GPR:mode>2_mips16e): Use a "move_type" + of "andi" instead of a "type" of "arith". + (*zero_extend<SHORT:mode><GPR:mode>2_mips16): Use "move_type" + instead of "type". + (*zero_extendqihi2_mips16, mov_<load>l, mov_<load>r, mov_<store>l) + (mov_<store>r, *mov<mode>_ra): Likewise. + (extendsidi2): Use "move_type" instead of "type", with "move" + for the register alternative. + (*extend<SHORT:mode><GPR:mode>2_mips16e): Use "move_type" instead + of "type", with "signext" for the register alternative. + (*extend<SHORT:mode><GPR:mode>2_se<SHORT:size>): Likewise. + (*extendqihi2_mips16e, *extendqihi2_seb): Likewise. + (fix_truncdfsi2_insn, fix_truncsfsi2_insn, fix_truncdfdi2) + (fix_truncsfdi2, floatsidf2, floatdidf2, floatsisf2, floatdisf2) + (floatdisf2, *branch_equality<mode>_mips16): Likewise. + (unnamed branch insn): Likewise. + (*movdi_gp32_fp64): Fold into... + (*movdi_32bit): ...here. + (*movdf_hardfloat_64bit, *movdf_hardfloat_32bit): Combine into... + (*movdf_hardfloat): ...this new pattern. + (*movdf_softfloat): Remove redundant FPR alternatives. + (*movti, *movti_mips16, *movtf, *movtf_mips16): Add "mode" attributes. + (*movv2sf_hardfloat_64bit, *movv2sf_hardfloat_32bit): Combine into... + (*movv2sf): ...this new pattern. Use "DF" rather than "SF" for + the "move" attribute. + (*movdi_32bit): Use "move_type" instead of "type" and remove the + "length" attribute. Use "fpload" and "fpstore" instead of "load" + and "store" for COP loads and stores. + (*movdi_32bit_mips16, *movdi_64bit, *movsi_internal, movcc) + (*movhi_internal, *movhi_mips16, *movqi_internal, *movqi_mips16) + (*movsf_hardfloat, *movsf_softfloat, *movsi_mips16, *movdf_hardfloat) + (*movdf_softfloat, *movdf_mips16, *movti, *movti_mips16, *movtf) + (*movtf_mips16, *movv2sf): Likewise. + (mfhi<GPR:mode>_<HILO:mode>, mflo<GPR:mode>_<HILO:mode>) + (load_low<mode>, load_high<mode>, store_word<mode>, mthc1<mode>) + (mfhc1<mode>): Use "move_type" instead of "move". + (*low<mode>_mips16): Use "extended_mips16" instead of "length". + (loadgp_blockage): Remove the "length" attribute. + (blockage, set_got_version, update_got_version): Likewise. + (call_internal): Remove the "extended_mips16" attribute. + (call_value_internal, call_value_multiple_internal): Likewise. + * config/mips/loongson.md (mov<mode>_internal): Use "move_type" + instead of "move". + * config/mips/mips-dsp.md (mips_lbux, mips_lhx, mips_lwx): Remove + the "length" attribute. + +2008-06-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * c-format.c (handle_format_attribute): Fix -Wc++-compat and/or + -Wcast-qual warnings. + * c-pragma.c (dpm_eq, handle_pragma_push_macro, + handle_pragma_pop_macro): Likewise. + * collect2.c (resolve_lib_name): Likewise. + * config/arc/arc.c (arc_init): Likewise. + * config/arm/arm.c (neon_builtin_compare, + locate_neon_builtin_icode): Likewise. + * config/arm/pe.c (arm_mark_dllexport, arm_pe_unique_section): Likewise. + * config/bfin/bfin.c (bfin_init_machine_status, + bfin_optimize_loop): Likewise. + * config/bfin/bfin.h (TARGET_CPU_CPP_BUILTINS): Likewise. + * config/cris/cris.c (cris_init_expanders): Likewise. + * config/darwin-c.c (frameworks_in_use, add_framework): Likewise. + * config/darwin.c (machopic_indirection_eq, + machopic_indirection_name, machopic_output_indirection): Likewise. + * config/frv/frv.c (frv_init_machine_status, frv_compare_insns, + frv_io_check_address, frv_io_handle_set, frv_io_handle_use_1, + frv_optimize_membar): Likewise. + * config/i386/cygwin.h (mingw_scan, + GCC_DRIVER_HOST_INITIALIZATION): Likewise. + * config/i386/cygwin1.c (mingw_scan): Likewise. + * config/i386/i386.c (machopic_output_stub): Likewise. + * config/i386/winnt.c (gen_stdcall_or_fastcall_suffix, + i386_pe_unique_section): Likewise. + * config/ia64/ia64.c (ia64_init_machine_status, + ia64_h_i_d_extended, get_free_bundle_state, bundling, ia64_reorg): + Likewise. + * config/iq2000/iq2000.c, iq2000_init_machine_status): Likewise. + * config/m68hc11/m68hc11.c (m68hc11_encode_label): Likewise. + * config/m68k/m68k.c (m68k_handle_option, + m68k_sched_md_init_global): Likewise. + * config/mcore/mcore.c (mcore_mark_dllexport, mcore_mark_dllimport, + mcore_unique_section): Likewise. + * config/mips/mips.c (mips_block_move_straight, + mips16_rewrite_pool_refs, mips_sim_wait_regs_2, mips_sim_record_set): + Likewise. + * config/mmix/mmix.c (mmix_init_machine_status, + mmix_encode_section_info): Likewise. + * config/pa/pa.c (pa_init_machine_status, hppa_encode_label): Likewise. + * config/rs6000/rs6000.c (rs6000_init_machine_status, + print_operand_address, output_toc, redefine_groups, + rs6000_elf_encode_section_info, machopic_output_stub): Likewise. + * config/s390/s390.c (s390_init_machine_status): Likewise. + * config/score/score.c (score_block_move_straight, + score_block_move_loop_body): Likewise. + * config/sparc/sparc.c (sparc_init_machine_status): Likewise. + * config/xtensa/xtensa.c (xtensa_init_machine_status): Likewise. + * emit-rtl.c (find_auto_inc): Likewise. + * gcc.c (translate_options, process_command): Likewise. + * reorg.c (dbr_schedule): Likewise. + * sdbout.c (sdbout_start_source_file, sdbout_init): Likewise. + * xcoffout.c (xcoffout_declare_function): Likewise. + +2008-06-27 Daniel Berlin <dberlin@dberlin.org> + + * tree-ssa-structalias.c (find_func_aliases): Trivial fix to get + ipa-pta working again. + +2008-06-27 David Edelsohn <edelsohn@gnu.org> + + * config/rs6000/t-aix52: Append large data option to LDFLAGS for + genautomata. + +2008-06-27 Edmar Wienskoski <edmar@freescale.com> + + * config.gcc (powerpc*-*-*): Add new core e500mc. + * config/rs6000/e500mc.md: New file. + * config/rs6000/rs6000.c (processor_costs): Add new costs for + e500mc. + (rs6000_override_options): Add e500mc case to + processor_target_table. Altivec and Spe options not allowed + with e500mc. Add isel instruction to e500mc by + default. Initialize rs6000_cost for e500mc. + (rs6000_issue_rate): Set issue rate for e500mc. + * config/rs6000/rs6000.h (processor_type): Add + PROCESSOR_PPCE500MC. + (ASM_CPU_SPEC): Add e500mc. + Set TARGET_ISEL to rs6000_isel. + * config/rs6000/e500.h: Remove redefinition of TARGET_ISEL. + (CHECK_E500_OPTIONS): Remove TARGET_ISEL. + * config/rs6000/rs6000.md (define_attr "cpu"): Add ppce500mc. + Include e500mc.md. + * doc/invoke.texi: Add e500mc to list of cpus. + +2008-06-27 Laurynas Biveinis <laurynas.biveinis@gmail.com> + + PR c/34867 + * c-lex.c (lex_charconst): Initialize unsignedp. + +2008-06-27 Olivier Hainque <hainque@adacore.com> + + * gimplify.c (gimplify_modify_expr_to_memset): Assert our + documented assumptions. + +2008-06-26 H.J. Lu <hongjiu.lu@intel.com> + + * dwarf2out.c: Remove trailing white spaces. Break long line + in comments. + +2008-06-26 Richard Sandiford <rdsandiford@googlemail.com> + + * libfuncs.h (LTI_synchronize): New libfunc_index. + (synchronize_libfunc): Declare. + * builtins.c (expand_builtin_synchronize): Consider using + synchronize_libfunc before falling back on an asm blockage. + * config/mips/mips.c: Include libfuncs.h + (mips_init_libfuncs): Initialize synchronize_libfunc for TARGET_MIPS16. + +2008-06-26 Nathan Froyd <froydnj@codesourcery.com> + + * config/rs6000/rs6000.c (emit_allocate_stack): Add copy_r11 + parameter. Copy stack_reg to r11 where appropriate. + (no_global_regs_above): Add gpr parameter. + (rs6000_stack_info): Only add padding for SPE save area if we + are saving SPE GPRs and CR. + (saveres_routine_syms): New variable. + (FIRST_SAVRES_REGISTER, LAST_SAVRES_REGISTER, N_SAVRES_REGISTERS): + Define. + (rs6000_savres_routine_sym): New function. + (rs6000_emit_stack_reset, rs6000_restore_saved_cr): New functions, + split out of... + (rs6000_emit_epilogue): ...here. Use rs6000_use_multiple_p and + rs6000_savres_strategy. Restore GPRs out-of-line if appropriate. + Tweak FPR out-of-line saving. + (rs6000_make_savres_rtx): New function. + (rs6000_use_multiple_p): New function. + (rs6000_savres_strategy): New function. + (rs6000_emit_prologue): Use rs6000_savres_strategy. Save GPRs + out-of-line if appropriate. + * config/rs6000/sysv4.h (FP_SAVE_INLINE): Save FPRs out-of-line + if we are optimizing for size. + (GP_SAVE_INLINE): Define. + (SAVE_FP_SUFFIX, RESTORE_FP_SUFFIX): Only use _l on 64-bit targets. + * config/rs6000/darwin.h (GP_SAVE_INLINE): Define. + * config/rs6000/aix.h (GP_SAVE_INLINE): Define. + * config/rs6000/rs6000.md (*save_gpregs_<mode>): New insn. + (*save_fpregs_<mode>): Add use of r11. + (*restore_gpregs_<mode>): New insn. + (*return_and_restore_gpregs_<mode>): New insn. + (*return_and_restore_fpregs_<mode>): Adjust to clobber LR and + use r11. + * config/rs6000/spe.md (*save_gpregs_spe): New insn. + (*restore_gpregs_spe): New insn. + (*return_and_restore_gpregs_spe): New insn. + * config/rs6000/predicates.md (save_world_operation): Fix check. + +2008-06-26 Steven Bosscher <steven@gcc.gnu.org> + + * tree-into-ssa (insert_phi_nodes_for): 'var' must be a DECL at + this point, so assert that. + +2008-06-26 Steven Bosscher <steven@gcc.gnu.org> + + * cfganal.c: Include vec.h and vecprim.h. + (compute_idf): Import from... + * tree-into-ssa (compute_idf): ...here. + * basic-block.h (compute_idf): Export. + +2008-06-26 Joseph Myers <joseph@codesourcery.com> + + * c-decl.c (merge_decls): Use !current_function_decl to check for + extern declaration of C99 inline function being at file scope. + +2008-06-25 John David Anglin <dave.anglin@gcc-cnrc.gc.ca> + + * config.gcc (hppa[12]*-*-hpux10*): Don't use fixproto. + +2008-06-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * alias.c (record_alias_subset, init_alias_analysis): Fix + -Wc++-compat and/or -Wcast-qual warnings. + * attribs.c (lookup_attribute_spec): Likewise. + * bb-reorder.c (find_traces, rotate_loop, find_traces_1_round, + copy_bb, connect_traces, + find_rarely_executed_basic_blocks_and_cr): Likewise. + * bt-load.c (find_btr_def_group, add_btr_def, new_btr_user, + note_btr_set, migrate_btr_defs): Likewise. + * builtins.c (result_vector, expand_builtin_memcpy, + expand_builtin_mempcpy_args, expand_builtin_strncpy, + builtin_memset_read_str, expand_builtin_printf, + fold_builtin_memchr, rewrite_call_expr, fold_builtin_printf): + Likewise. + * caller-save.c (mark_set_regs): Likewise. + * calls.c (expand_call, emit_library_call_value_1): Likewise. + * cgraph.c (cgraph_edge): Likewise. + * combine.c (likely_spilled_retval_1): Likewise. + * coverage.c (htab_counts_entry_hash, htab_counts_entry_eq, + htab_counts_entry_del, get_coverage_counts): Likewise. + * cselib.c (new_elt_list, new_elt_loc_list, entry_and_rtx_equal_p, + new_cselib_val): Likewise. + * dbgcnt.c (dbg_cnt_process_opt): Likewise. + * dbxout.c (dbxout_init, dbxout_type, output_used_types_helper): + Likewise. + * df-core.c (df_compact_blocks): Likewise. + * df-problems.c (df_grow_bb_info, df_chain_create): Likewise. + * df-scan.c (df_grow_reg_info, df_ref_create, + df_insn_create_insn_record, df_insn_rescan, df_notes_rescan, + df_ref_compare, df_ref_create_structure, df_bb_refs_record, + df_record_entry_block_defs, df_record_exit_block_uses, + df_bb_verify): Likewise. + * df.h (DF_REF_EXTRACT_WIDTH_CONST, DF_REF_EXTRACT_OFFSET_CONST, + DF_REF_EXTRACT_MODE_CONST): New. + * dominance.c (get_immediate_dominator, get_dominated_by, + nearest_common_dominator, root_of_dom_tree, + iterate_fix_dominators, first_dom_son, next_dom_son): Fix + -Wc++-compat and/or -Wcast-qual warnings. + * dse.c (clear_alias_set_lookup, get_group_info, gen_rtx_MEM, + record_store, replace_read, check_mem_read_rtx, scan_insn, + dse_step1, dse_record_singleton_alias_set): Likewise. + * dwarf2asm.c (dw2_force_const_mem): Likewise. + +2008-06-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * dwarf2out.c (new_cfi, queue_reg_save, dwarf2out_begin_prologue, + dwarf2out_frame_init, new_loc_descr, new_die, lookup_decl_die, + lookup_decl_loc, add_var_loc_to_decl, compute_section_prefix, + assign_symbol_names, htab_cu_hash, htab_cu_eq, htab_cu_del, + build_abbrev_table, new_loc_list, output_comp_unit, add_arange, + add_ranges_num, add_ranges_by_labels, file_info_cmp, + file_name_acquire, output_file_names, add_const_value_attribute, + premark_used_types_helper, file_table_eq, file_table_hash, + lookup_filename, dwarf2out_var_location, dwarf2out_source_line, + dwarf2out_init, file_table_relative_p): Fix -Wc++-compat and/or + -Wcast-qual warnings. + * ebitmap.c (ebitmap_array_grow, ebitmap_array_init, + ebitmap_alloc, ebitmap_ior, ebitmap_and_compl): Likewise. + * emit-rtl.c (get_mem_attrs, get_reg_attrs, gen_rtvec, + gen_reg_rtx, start_sequence, init_emit): Likewise. + * et-forest.c (et_new_occ, et_new_tree): Likewise. + * except.c (init_eh_for_function, gen_eh_region, + remove_unreachable_regions, add_ehl_entry, duplicate_eh_regions_1, + arh_to_landing_pad, arh_to_label, add_action_record, + add_call_site, switch_to_exception_section): Likewise. + * expmed.c (synth_mult): Likewise. + * expr.c (gen_group_rtx, emit_group_load, emit_group_store, + store_expr): Likewise. + * final.c (shorten_branches, final_scan_insn, debug_queue_symbol): + Likewise. + * function.c (assign_stack_temp_for_type, + allocate_struct_function, match_asm_constraints_1): Likewise. + * gcov-io.c (gcov_allocate): Likewise. + * gcse.c (GNEW, GCNEW, GNEWVEC, GCNEWVEC, GRESIZEVEC, GNEWVAR, + GCNEWVAR, GRESIZEVAR, GOBNEW, GOBNEWVAR): New. + (gcse_main, alloc_gcse_mem, alloc_gcse_mem, alloc_reg_set_mem, + record_one_set, insert_expr_in_table, insert_set_in_table, + dump_hash_table, compute_hash_table_work, alloc_hash_table, + pre_ldst_expr_hash, pre_ldst_expr_eq, find_rtx_in_ldst, + reg_set_info, reg_clear_last_set): Fix -Wc++-compat and/or + -Wcast-qual warnings. + +2008-06-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * cse.c (approx_reg_cost_1, cse_insn): Fix -Wc++-compat and/or + -Wcast-qual warnings. + * gcc.c (process_command): Likewise. + * genattrtab.c (oballoc): Use XOBNEW. + (oballocvec): Define. + (attr_hash_add_rtx, attr_hash_add_string, attr_string, + get_attr_value, fill_attr, make_length_attrs, gen_attr, gen_insn, + gen_delay, find_attr, gen_insn_reserv, gen_bypass_1): Fix + -Wc++-compat and/or -Wcast-qual warnings. + * genautomata.c (XCREATENODE, XCREATENODEVEC, XCREATENODEVAR, + XCOPYNODE, XCOPYNODEVEC, XCOPYNODEVAR): New. + (gen_cpu_unit, gen_query_cpu_unit, gen_bypass, gen_excl_set, + gen_presence_absence_set, gen_automaton, gen_regexp_el, + gen_regexp_repeat, gen_regexp_allof, gen_regexp_oneof, + gen_regexp_sequence, gen_reserv, gen_insn_reserv, process_excls, + add_excls, process_presence_absence_names, + process_presence_absence_patterns, add_presence_absence, + process_regexp, add_advance_cycle_insn_decl, get_free_alt_state, + get_free_state, add_arc, get_free_automata_list_el, + form_reserv_sets_list, copy_insn_regexp, transform_1, transform_2, + transform_3, cache_presence, create_ainsns, create_automata, + create_state_ainsn_table, dfa_insn_code_enlarge, + output_trans_func, output_min_issue_delay_func, + output_dead_lock_func, output_reset_func, + output_get_cpu_unit_code_func, output_dfa_start_func, + expand_automata): Likewise. + * genextract.c (gen_insn): Likewise. + * gengtype-lex.l: Likewise. + * gengtype.c (read_input_list, adjust_field_type, + process_gc_options): Likewise. + * genoutput.c (note_constraint): Likewise. + * genpreds.c (mangle, add_constraint): Likewise. + * genrecog.c (process_define_predicate, new_decision, + add_to_sequence): Likewise. + * gensupport.c (record_insn_name): Likewise. + +2008-06-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * config/i386/driver-i386.c (detect_caches_amd, + detect_caches_intel, host_detect_local_cpu): Fix -Wc++-compat + and/or -Wcast-qual warnings. + *ggc-common.c (ggc_mark_roots, gt_pch_note_object, + gt_pch_note_reorder, relocate_ptrs, write_pch_globals, + gt_pch_save): Likewise. + * ggc-page.c (push_depth, push_by_depth, alloc_anon, alloc_page, + gt_ggc_m_S, clear_marks, ggc_pch_read): Likewise. + * global.c (compute_regsets): Likewise. + * graph.c (print_rtl_graph_with_bb, clean_graph_dump_file, + finish_graph_dump_file): Likewise. + * haifa-sched.c (schedule_block, extend_h_i_d, extend_ready, + unlink_bb_notes): Likewise. + * integrate.c (get_hard_reg_initial_val): Likewise. + * ipa-prop.c (ipa_push_func_to_list): Likewise. + * ipa-struct-reorg.c (gen_var_name, gen_cluster_name): Likewise. + * local-alloc.c (update_equiv_regs): Likewise. + * loop-invariant.c (check_invariant_table_size, + hash_invariant_expr, eq_invariant_expr, find_or_insert_inv): + Likewise. + * loop-iv.c (check_iv_ref_table_size, analyzed_for_bivness_p, + altered_reg_used, mark_altered): Likewise. + * loop-unroll.c (si_info_eq, ve_info_eq, allocate_basic_variable, + insert_var_expansion_initialization, + combine_var_copies_in_loop_exit, apply_opt_in_copies, + release_var_copies): Likewise. + * matrix-reorg.c (mat_acc_phi_hash, mat_acc_phi_eq, mtt_info_eq, + analyze_matrix_decl, add_allocation_site, analyze_transpose, + analyze_accesses_for_phi_node, check_var_notmodified_p, + check_allocation_function, find_sites_in_func, + record_all_accesses_in_func, transform_access_sites, + transform_allocation_sites): Likewise. + * omp-low.c (new_omp_region, create_omp_child_function_name, + check_omp_nesting_restrictions, check_combined_parallel, + lower_omp_2, diagnose_sb_1, diagnose_sb_2): Likewise. + * optabs.c (no_conflict_move_test, gen_libfunc, gen_fp_libfunc, + gen_intv_fp_libfunc, gen_interclass_conv_libfunc, + gen_intraclass_conv_libfunc, set_optab_libfunc, set_conv_libfunc): + Likewise. + * opts-common.c (prune_options): Likewise. + * opts.c (add_input_filename, print_filtered_help, + get_option_state): Likewise. + * params.c (add_params): Likewise. + * passes.c (set_pass_for_id, next_pass_1, + do_per_function_toporder, pass_fini_dump_file): Likewise. + * postreload.c (reload_cse_simplify_operands): Likewise. + * predict.c (tree_predicted_by_p, tree_predict_edge, + clear_bb_predictions, combine_predictions_for_bb): Likewise. + +2008-06-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * ra.h (add_neighbor): Fix -Wc++-compat and/or -Wcast-qual + warnings. + * recog.c (check_asm_operands, validate_change_1): Likewise. + * reg-stack.c (check_asm_stack_operands, subst_asm_stack_regs, + subst_asm_stack_regs): Likewise. + * regclass.c (regclass, som_hash, som_eq, record_subregs_of_mode, + cannot_change_mode_set_regs, invalid_mode_change_p): Likewise. + * regmove.c (reg_is_remote_constant_p): Likewise. + * regrename.c (regrename_optimize, scan_rtx_reg, + kill_clobbered_value, kill_set_value, kill_autoinc_value): + Likewise. + * regstat.c (regstat_init_n_sets_and_refs, regstat_compute_ri, + regstat_compute_calls_crossed): Likewise. + * reload1.c (init_reload, new_insn_chain, + has_nonexceptional_receiver, reload, copy_reloads, + calculate_needs_all_insns, init_elim_table): Likewise. + * rtl-factoring.c (compute_rtx_cost, fill_hash_bucket): Likewise. + * rtl.c (shallow_copy_rtx_stat): Likewise. + * rtlanal.c (parms_set): Likewise. + * sbitmap.c (sbitmap_alloc, sbitmap_alloc_with_popcount, + sbitmap_resize, sbitmap_vector_alloc): Likewise. + * sched-ebb.c (earliest_block_with_similiar_load, + add_deps_for_risky_insns): Likewise. + * sched-rgn.c (find_rgns, gather_region_statistics, extend_rgns, + schedule_region): Likewise. + * see.c (eq_descriptor_pre_extension, + hash_descriptor_pre_extension, hash_del_pre_extension, + eq_descriptor_properties, hash_descriptor_properties, + hash_del_properties, see_seek_pre_extension_expr, + see_initialize_data_structures, see_print_register_properties, + see_print_pre_extension_expr, see_delete_merged_def_extension, + see_delete_unmerged_def_extension, see_emit_use_extension, + see_pre_delete_extension, see_map_extension, see_commit_changes, + see_analyze_merged_def_local_prop, + see_analyze_merged_def_local_prop, + see_analyze_unmerged_def_local_prop, see_analyze_use_local_prop, + see_set_prop_merged_def, see_set_prop_unmerged_def, + see_set_prop_unmerged_use, see_print_one_extension, + see_merge_one_use_extension, see_merge_one_def_extension, + see_store_reference_and_extension, see_update_uses_relevancy, + see_update_defs_relevancy): Likewise. + * statistics.c (hash_statistics_hash, hash_statistics_eq, + hash_statistics_free, curr_statistics_hash): Likewise. + * stmt.c (parse_output_constraint, decl_overlaps_hard_reg_set_p, + expand_asm_operands, expand_return, case_bit_test_cmp, + expand_case): Likewise. + * stor-layout.c (start_record_layout): Likewise. + * stringpool.c (ggc_alloc_string, gt_pch_n_S, + gt_pch_save_stringpool): Likewise. + * tree-data-ref.c (hash_stmt_vertex_info, + have_similar_memory_accesses_1, ref_base_address_1): Likewise. + * tree-ssa-phiopt.c (name_to_bb_hash): Likewise. + +2008-06-25 Uros Bizjak <ubizjak@gmail.com> + + PR target/36627 + * config/i386/i386.md : Change constraints of HImode and QImode + immediate operands from "i" to "n". Change SImode "ni" constraint to + "i" and SImode "rmi" constraint to "g". Remove all constraints + from const0_operand and const1_operand predicated operands. + (i): Change QImode and HImode attribute from "i" to "n". + (*subqi_2): Change HImode operands to QImode. + (*subqi_3): Ditto. + +2008-06-25 Olivier Hainque <hainque@adacore.com> + + * Makefile.in (GTFILES_H): Use | instead of ; as separator in + sed substitutions. + 2008-06-25 Richard Guenther <rguenther@suse.de> * tree-ssa-structalias.c (fieldoff_compare): Make sure to @@ -46,7 +860,7 @@ the memory instead of the memory itself for the save area. 2008-06-24 Olivier Hainque <hainque@adacore.com> - Nicolas Roche <roche@adacore.com> + Nicolas Roche <roche@adacore.com> * gengtype.c (srcdir_len): size_t instead of int. (get_file_realbasename): New function. For F a filename, the real @@ -74,7 +888,7 @@ 2008-06-23 Uros Bizjak <ubizjak@gmail.com> - PR middle-end/PR36584 + PR middle-end/36584 * calls.c (expand_call): Increase alignment for recursive functions. 2008-06-23 Anatoly Sokolov <aesok@post.ru> diff --git a/gcc/ChangeLog.melt b/gcc/ChangeLog.melt index b23eb146cbb..c5a0e3c704d 100644 --- a/gcc/ChangeLog.melt +++ b/gcc/ChangeLog.melt @@ -1,3 +1,6 @@ +2008-07-01 Basile Starynkevitch <basile@starynkevitch.net> + MELT branch merged with trunk r137307 + 2008-06-30 Basile Starynkevitch <basile@starynkevitch.net> [apparently warmelt-*-3.c generated ok!] diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 476e175ea0f..96615672409 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20080625 +20080701 diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 1d163bf861a..383dc36bcdc 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -160,10 +160,8 @@ coverageexts = .{gcda,gcno} # STRICT_WARN are the additional warning flags to # apply to the back end and the C front end, which may be compiled # with other compilers. -# CXX_COMPAT_WARN are C++ source compatibility warnings. LOOSE_WARN = @loose_warn@ STRICT_WARN = @strict_warn@ -CXX_COMPAT_WARN = @cxx_compat_warn@ # This is set by --enable-checking. The idea is to catch forgotten # "extern" tags in header files. @@ -189,6 +187,10 @@ build/gengtype-lex.o-warn = -Wno-error SYSCALLS.c.X-warn = -Wno-strict-prototypes -Wno-error # dfp.c contains alias violations dfp.o-warn = -Wno-error +# bitmap.c contains -Wc++compat warnings. +bitmap.o-warn = -Wno-error +# dominance.c contains a -Wc++compat warning. +dominance.o-warn = -Wno-error ## basilys.c contain tricky stuff basilys.o-warn = -Wno-error @@ -2754,7 +2756,7 @@ cfgrtl.o : cfgrtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ tree-pass.h $(DF_H) cfganal.o : cfganal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(BASIC_BLOCK_H) hard-reg-set.h insn-config.h $(RECOG_H) $(TM_P_H) \ - $(TIMEVAR_H) $(OBSTACK_H) toplev.h + $(TIMEVAR_H) $(OBSTACK_H) toplev.h vecprim.h cfgbuild.o : cfgbuild.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(FLAGS_H) $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h \ $(FUNCTION_H) except.h $(TIMEVAR_H) $(TREE_H) @@ -3243,7 +3245,7 @@ GTFILES_H = $(subst /,-, \ $(shell echo $(patsubst $(srcdir)/%,gt-%, \ $(patsubst %.c,%.h, \ $(filter %.c, $(GTFILES)))) \ - | sed -e "s;/[^ ]*/;/;g" -e "s;gt-config/;gt-;g")) + | sed -e "s|/[^ ]*/|/|g" -e "s|gt-config/|gt-|g")) GTFILES_LANG_H = $(patsubst [%], gtype-%.h, $(filter [%], $(GTFILES))) ALL_GTFILES_H := $(sort $(GTFILES_H) $(GTFILES_LANG_H)) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index be34816b3f4..15ad6dcd4a2 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,27 @@ +2008-06-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * ada-tree.h (SET_TYPE_LANG_SPECIFIC, SET_DECL_LANG_SPECIFIC): Fix + -Wc++-compat warnings. + * adaint.c (__gnat_locate_regular_file, __gnat_locate_exec, + __gnat_locate_exec_on_path): Likewise. + * decl.c (annotate_value): Likewise. + * misc.c (gnat_handle_option): Likewise. + * trans.c (gnat_to_gnu, extract_encoding, decode_name, + post_error_ne_tree): Likewise. + +2008-06-27 Eric Botcazou <ebotcazou@adacore.com> + + * utils.c (convert) <CONSTRUCTOR>: When converting it to a packable + version of its type, attempt to first convert its elements. + +2008-06-26 Chris Proctor <chrisp_42@bigpond.com> + + * Makefile.in: Fix *86 kfreebsd target specific pairs. + +2008-06-25 Samuel Tardieu <sam@rfc1149.net> + + * Makefile.in: Use mlib-tgt-specific-linux.adb for sh4 as well. + 2008-06-24 Eric Botcazou <ebotcazou@adacore.com> * utils2.c (known_alignment): Derive the alignment from pointed-to diff --git a/gcc/ada/Makefile.in b/gcc/ada/Makefile.in index 9ffc02e2110..b3b4d080ef0 100644 --- a/gcc/ada/Makefile.in +++ b/gcc/ada/Makefile.in @@ -903,7 +903,7 @@ ifeq ($(strip $(filter-out %86 kfreebsd%,$(arch) $(osys))),) system.ads<system-freebsd-x86.ads TOOLS_TARGET_PAIRS = \ - mlib-tgt-specific.adb<mlib-tgt-linux.adb \ + mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \ indepsw.adb<indepsw-gnu.adb EH_MECHANISM=-gcc @@ -1538,7 +1538,7 @@ ifeq ($(strip $(filter-out sh4% linux%,$(arch) $(osys))),) system.ads<system-linux-sh4.ads TOOLS_TARGET_PAIRS = \ - mlib-tgt-specific.adb<mlib-tgt-linux.adb \ + mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \ indepsw.adb<indepsw-linux.adb EXTRA_GNATRTL_TASKING_OBJS=s-linux.o diff --git a/gcc/ada/ada-tree.h b/gcc/ada/ada-tree.h index 008a5a496e5..044cea811b3 100644 --- a/gcc/ada/ada-tree.h +++ b/gcc/ada/ada-tree.h @@ -39,7 +39,7 @@ struct lang_type GTY(()) {tree t; }; #define SET_TYPE_LANG_SPECIFIC(NODE, X) \ (TYPE_LANG_SPECIFIC (NODE) \ = (TYPE_LANG_SPECIFIC (NODE) \ - ? TYPE_LANG_SPECIFIC (NODE) : ggc_alloc (sizeof (struct lang_type)))) \ + ? TYPE_LANG_SPECIFIC (NODE) : GGC_NEW (struct lang_type))) \ ->t = X; #define GET_DECL_LANG_SPECIFIC(NODE) \ @@ -47,7 +47,7 @@ struct lang_type GTY(()) {tree t; }; #define SET_DECL_LANG_SPECIFIC(NODE, VALUE) \ (DECL_LANG_SPECIFIC (NODE) \ = (DECL_LANG_SPECIFIC (NODE) \ - ? DECL_LANG_SPECIFIC (NODE) : ggc_alloc (sizeof (struct lang_decl)))) \ + ? DECL_LANG_SPECIFIC (NODE) : GGC_NEW (struct lang_decl))) \ ->t = VALUE; /* Flags added to GCC type nodes. */ diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index 391a424a094..8ace0a1c827 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -2147,7 +2147,7 @@ char * __gnat_locate_regular_file (char *file_name, char *path_val) { char *ptr; - char *file_path = alloca (strlen (file_name) + 1); + char *file_path = (char *) alloca (strlen (file_name) + 1); int absolute; /* Return immediately if file_name is empty */ @@ -2196,7 +2196,7 @@ __gnat_locate_regular_file (char *file_name, char *path_val) { /* The result has to be smaller than path_val + file_name. */ - char *file_path = alloca (strlen (path_val) + strlen (file_name) + 2); + char *file_path = (char *) alloca (strlen (path_val) + strlen (file_name) + 2); for (;;) { @@ -2245,7 +2245,7 @@ __gnat_locate_exec (char *exec_name, char *path_val) if (!strstr (exec_name, HOST_EXECUTABLE_SUFFIX)) { char *full_exec_name - = alloca (strlen (exec_name) + strlen (HOST_EXECUTABLE_SUFFIX) + 1); + = (char *) alloca (strlen (exec_name) + strlen (HOST_EXECUTABLE_SUFFIX) + 1); strcpy (full_exec_name, exec_name); strcat (full_exec_name, HOST_EXECUTABLE_SUFFIX); @@ -2298,7 +2298,7 @@ __gnat_locate_exec_on_path (char *exec_name) char *path_val = getenv ("PATH"); #endif if (path_val == NULL) return NULL; - apath_val = alloca (strlen (path_val) + 1); + apath_val = (char *) alloca (strlen (path_val) + 1); strcpy (apath_val, path_val); return __gnat_locate_exec (exec_name, apath_val); #endif diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c index ff2927fe642..e6865d292bc 100644 --- a/gcc/ada/decl.c +++ b/gcc/ada/decl.c @@ -6774,7 +6774,7 @@ annotate_value (tree gnu_size) /* Save the result in the cache. */ if (h) { - *h = ggc_alloc (sizeof (struct tree_int_map)); + *h = GGC_NEW (struct tree_int_map); (*h)->base.from = gnu_size; (*h)->to = ret; } diff --git a/gcc/ada/misc.c b/gcc/ada/misc.c index f8137242175..85dd22e8bb3 100644 --- a/gcc/ada/misc.c +++ b/gcc/ada/misc.c @@ -232,7 +232,7 @@ gnat_handle_option (size_t scode, const char *arg, int value) switch (code) { case OPT_I: - q = xmalloc (sizeof("-I") + strlen (arg)); + q = XNEWVEC (char, sizeof("-I") + strlen (arg)); strcpy (q, "-I"); strcat (q, arg); gnat_argv[gnat_argc] = q; @@ -289,7 +289,7 @@ gnat_handle_option (size_t scode, const char *arg, int value) case OPT_gnat: /* Recopy the switches without the 'gnat' prefix. */ - gnat_argv[gnat_argc] = xmalloc (strlen (arg) + 2); + gnat_argv[gnat_argc] = XNEWVEC (char, strlen (arg) + 2); gnat_argv[gnat_argc][0] = '-'; strcpy (gnat_argv[gnat_argc] + 1, arg); gnat_argc++; diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c index fd69b3eb7aa..89b10c695da 100644 --- a/gcc/ada/trans.c +++ b/gcc/ada/trans.c @@ -3273,7 +3273,7 @@ gnat_to_gnu (Node_Id gnat_node) int i; char *string; if (length >= ALLOCA_THRESHOLD) - string = xmalloc (length + 1); /* in case of large strings */ + string = XNEWVEC (char, length + 1); /* in case of large strings */ else string = (char *) alloca (length + 1); @@ -6922,7 +6922,7 @@ set_expr_location_from_node (tree node, Node_Id gnat_node) static const char * extract_encoding (const char *name) { - char *encoding = ggc_alloc (strlen (name)); + char *encoding = GGC_NEWVEC (char, strlen (name)); get_encoding (name, encoding); @@ -6934,7 +6934,7 @@ extract_encoding (const char *name) static const char * decode_name (const char *name) { - char *decoded = ggc_alloc (strlen (name) * 2 + 60); + char *decoded = GGC_NEWVEC (char, strlen (name) * 2 + 60); __gnat_decode (name, decoded, 0); @@ -6998,7 +6998,7 @@ post_error_ne_num (const char *msg, Node_Id node, Entity_Id ent, int n) void post_error_ne_tree (const char *msg, Node_Id node, Entity_Id ent, tree t) { - char *newmsg = alloca (strlen (msg) + 1); + char *newmsg = XALLOCAVEC (char, strlen (msg) + 1); String_Template temp = {1, 0}; Fat_Pointer fp; char start_yes, end_yes, start_no, end_no; diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c index f255d37d6ef..92e83487b80 100644 --- a/gcc/ada/utils.c +++ b/gcc/ada/utils.c @@ -3579,17 +3579,47 @@ convert (tree type, tree expr) case CONSTRUCTOR: /* If we are converting a CONSTRUCTOR to a mere variant type, just make - a new one in the proper type. Likewise for a conversion between - original and packable version. */ - if (code == ecode - && (gnat_types_compatible_p (type, etype) - || (code == RECORD_TYPE - && TYPE_NAME (type) == TYPE_NAME (etype)))) + a new one in the proper type. */ + if (code == ecode && gnat_types_compatible_p (type, etype)) { expr = copy_node (expr); TREE_TYPE (expr) = type; return expr; } + + /* Likewise for a conversion between original and packable version, but + we have to work harder in order to preserve type consistency. */ + if (code == ecode + && code == RECORD_TYPE + && TYPE_NAME (type) == TYPE_NAME (etype)) + { + VEC(constructor_elt,gc) *e = CONSTRUCTOR_ELTS (expr); + unsigned HOST_WIDE_INT len = VEC_length (constructor_elt, e); + VEC(constructor_elt,gc) *v = VEC_alloc (constructor_elt, gc, len); + tree efield = TYPE_FIELDS (etype), field = TYPE_FIELDS (type); + unsigned HOST_WIDE_INT idx; + tree index, value; + + FOR_EACH_CONSTRUCTOR_ELT(e, idx, index, value) + { + constructor_elt *elt = VEC_quick_push (constructor_elt, v, NULL); + /* We expect only simple constructors. Otherwise, punt. */ + if (!(index == efield || index == DECL_ORIGINAL_FIELD (efield))) + break; + elt->index = field; + elt->value = convert (TREE_TYPE (field), value); + efield = TREE_CHAIN (efield); + field = TREE_CHAIN (field); + } + + if (idx == len) + { + expr = copy_node (expr); + TREE_TYPE (expr) = type; + CONSTRUCTOR_ELTS (expr) = v; + return expr; + } + } break; case UNCONSTRAINED_ARRAY_REF: diff --git a/gcc/alias.c b/gcc/alias.c index ec2d053362c..684205cd89e 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -713,7 +713,7 @@ record_alias_subset (alias_set_type superset, alias_set_type subset) { /* Create an entry for the SUPERSET, so that we have a place to attach the SUBSET. */ - superset_entry = ggc_alloc (sizeof (struct alias_set_entry)); + superset_entry = GGC_NEW (struct alias_set_entry); superset_entry->alias_set = superset; superset_entry->children = splay_tree_new_ggc (splay_tree_compare_ints); @@ -2412,8 +2412,8 @@ init_alias_analysis (void) timevar_push (TV_ALIAS_ANALYSIS); reg_known_value_size = maxreg - FIRST_PSEUDO_REGISTER; - reg_known_value = ggc_calloc (reg_known_value_size, sizeof (rtx)); - reg_known_equiv_p = xcalloc (reg_known_value_size, sizeof (bool)); + reg_known_value = GGC_CNEWVEC (rtx, reg_known_value_size); + reg_known_equiv_p = XCNEWVEC (bool, reg_known_value_size); /* If we have memory allocated from the previous run, use it. */ if (old_reg_base_value) diff --git a/gcc/alloc-pool.c b/gcc/alloc-pool.c index d5d1fab79af..b22869fe787 100644 --- a/gcc/alloc-pool.c +++ b/gcc/alloc-pool.c @@ -119,7 +119,7 @@ alloc_pool create_alloc_pool (const char *name, size_t size, size_t num) { alloc_pool pool; - size_t pool_size, header_size; + size_t header_size; #ifdef GATHER_STATISTICS struct alloc_pool_descriptor *desc; #endif @@ -141,11 +141,8 @@ create_alloc_pool (const char *name, size_t size, size_t num) /* Um, we can't really allocate 0 elements per block. */ gcc_assert (num); - /* Find the size of the pool structure, and the name. */ - pool_size = sizeof (struct alloc_pool_def); - - /* and allocate that much memory. */ - pool = xmalloc (pool_size); + /* Allocate memory for the pool structure. */ + pool = XNEW (struct alloc_pool_def); /* Now init the various pieces of our pool structure. */ pool->name = /*xstrdup (name)*/name; diff --git a/gcc/attribs.c b/gcc/attribs.c index 65233de9e55..3c60e8bd967 100644 --- a/gcc/attribs.c +++ b/gcc/attribs.c @@ -206,8 +206,9 @@ lookup_attribute_spec (tree name) attr.str = IDENTIFIER_POINTER (name); attr.length = IDENTIFIER_LENGTH (name); extract_attribute_substring (&attr); - return htab_find_with_hash (attribute_hash, &attr, - substring_hash (attr.str, attr.length)); + return (const struct attribute_spec *) + htab_find_with_hash (attribute_hash, &attr, + substring_hash (attr.str, attr.length)); } /* Process the attributes listed in ATTRIBUTES and install them in *NODE, diff --git a/gcc/basic-block.h b/gcc/basic-block.h index 116e9521626..0b0082cfb24 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -543,6 +543,7 @@ extern int dfs_enumerate_from (basic_block, int, bool (*)(const_basic_block, const void *), basic_block *, int, const void *); extern void compute_dominance_frontiers (bitmap *); +extern bitmap compute_idf (bitmap, bitmap *); extern void dump_bb_info (basic_block, bool, bool, int, const char *, FILE *); extern void dump_edge_info (FILE *, edge, int); extern void brief_dump_cfg (FILE *); diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c index a3fd3feb6c7..b36c6c24bb3 100644 --- a/gcc/bb-reorder.c +++ b/gcc/bb-reorder.c @@ -278,7 +278,7 @@ find_traces (int *n_traces, struct trace *traces) basic_block bb; fprintf (dump_file, "Trace %d (round %d): ", i + 1, traces[i].round + 1); - for (bb = traces[i].first; bb != traces[i].last; bb = bb->aux) + for (bb = traces[i].first; bb != traces[i].last; bb = (basic_block) bb->aux) fprintf (dump_file, "%d [%d] ", bb->index, bb->frequency); fprintf (dump_file, "%d [%d]\n", bb->index, bb->frequency); } @@ -358,7 +358,7 @@ rotate_loop (edge back_edge, struct trace *trace, int trace_n) } } } - bb = bb->aux; + bb = (basic_block) bb->aux; } while (bb != back_edge->dest); @@ -368,7 +368,7 @@ rotate_loop (edge back_edge, struct trace *trace, int trace_n) the trace. */ if (back_edge->dest == trace->first) { - trace->first = best_bb->aux; + trace->first = (basic_block) best_bb->aux; } else { @@ -376,7 +376,7 @@ rotate_loop (edge back_edge, struct trace *trace, int trace_n) for (prev_bb = trace->first; prev_bb->aux != back_edge->dest; - prev_bb = prev_bb->aux) + prev_bb = (basic_block) prev_bb->aux) ; prev_bb->aux = best_bb->aux; @@ -442,7 +442,7 @@ find_traces_1_round (int branch_th, int exec_th, gcov_type count_th, fibheapkey_t key; edge_iterator ei; - bb = fibheap_extract_min (*heap); + bb = (basic_block) fibheap_extract_min (*heap); bbd[bb->index].heap = NULL; bbd[bb->index].node = NULL; @@ -780,7 +780,7 @@ copy_bb (basic_block old_bb, edge e, basic_block bb, int trace) new_size = MAX (last_basic_block, new_bb->index + 1); new_size = GET_ARRAY_SIZE (new_size); - bbd = xrealloc (bbd, new_size * sizeof (bbro_basic_block_data)); + bbd = XRESIZEVEC (bbro_basic_block_data, bbd, new_size); for (i = array_size; i < new_size; i++) { bbd[i].start_of_trace = -1; @@ -1143,7 +1143,7 @@ connect_traces (int n_traces, struct trace *traces) basic_block bb; fprintf (dump_file, "Final order:\n"); - for (bb = traces[0].first; bb; bb = bb->aux) + for (bb = traces[0].first; bb; bb = (basic_block) bb->aux) fprintf (dump_file, "%d ", bb->index); fprintf (dump_file, "\n"); fflush (dump_file); @@ -1251,8 +1251,7 @@ find_rarely_executed_basic_blocks_and_crossing_edges (edge **crossing_edges, if (i == *max_idx) { *max_idx *= 2; - *crossing_edges = xrealloc (*crossing_edges, - (*max_idx) * sizeof (edge)); + *crossing_edges = XRESIZEVEC (edge, *crossing_edges, *max_idx); } (*crossing_edges)[i++] = e; } diff --git a/gcc/bt-load.c b/gcc/bt-load.c index 6feefbbf7af..b0a7fdb4a21 100644 --- a/gcc/bt-load.c +++ b/gcc/bt-load.c @@ -279,8 +279,7 @@ find_btr_def_group (btr_def_group *all_btr_def_groups, btr_def def) if (!this_group) { - this_group = obstack_alloc (&migrate_btrl_obstack, - sizeof (struct btr_def_group_s)); + this_group = XOBNEW (&migrate_btrl_obstack, struct btr_def_group_s); this_group->src = def_src; this_group->members = NULL; this_group->next = *all_btr_def_groups; @@ -303,7 +302,7 @@ add_btr_def (fibheap_t all_btr_defs, basic_block bb, int insn_luid, rtx insn, btr_def_group *all_btr_def_groups) { btr_def this - = obstack_alloc (&migrate_btrl_obstack, sizeof (struct btr_def_s)); + = XOBNEW (&migrate_btrl_obstack, struct btr_def_s); this->bb = bb; this->luid = insn_luid; this->insn = insn; @@ -354,7 +353,7 @@ new_btr_user (basic_block bb, int insn_luid, rtx insn) usep = NULL; } use = usep ? *usep : NULL_RTX; - user = obstack_alloc (&migrate_btrl_obstack, sizeof (struct btr_user_s)); + user = XOBNEW (&migrate_btrl_obstack, struct btr_user_s); user->bb = bb; user->luid = insn_luid; user->insn = insn; @@ -425,7 +424,7 @@ typedef struct { static void note_btr_set (rtx dest, const_rtx set ATTRIBUTE_UNUSED, void *data) { - defs_uses_info *info = data; + defs_uses_info *info = (defs_uses_info *) data; int regno, end_regno; if (!REG_P (dest)) @@ -1428,14 +1427,14 @@ migrate_btr_defs (enum reg_class btr_class, int allow_callee_save) first_btr = reg; } - btrs_live = xcalloc (n_basic_blocks, sizeof (HARD_REG_SET)); - btrs_live_at_end = xcalloc (n_basic_blocks, sizeof (HARD_REG_SET)); + btrs_live = XCNEWVEC (HARD_REG_SET, n_basic_blocks); + btrs_live_at_end = XCNEWVEC (HARD_REG_SET, n_basic_blocks); build_btr_def_use_webs (all_btr_defs); while (!fibheap_empty (all_btr_defs)) { - btr_def def = fibheap_extract_min (all_btr_defs); + btr_def def = (btr_def) fibheap_extract_min (all_btr_defs); int min_cost = -fibheap_min_key (all_btr_defs); if (migrate_btr_def (def, min_cost)) { diff --git a/gcc/builtins.c b/gcc/builtins.c index 06ae07adaa9..10af34254aa 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -1292,7 +1292,7 @@ result_vector (int savep, rtx result) int regno, size, align, nelts; enum machine_mode mode; rtx reg, mem; - rtx *savevec = alloca (FIRST_PSEUDO_REGISTER * sizeof (rtx)); + rtx *savevec = XALLOCAVEC (rtx, FIRST_PSEUDO_REGISTER); size = nelts = 0; for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) @@ -3327,11 +3327,13 @@ expand_builtin_memcpy (tree exp, rtx target, enum machine_mode mode) && GET_CODE (len_rtx) == CONST_INT && (unsigned HOST_WIDE_INT) INTVAL (len_rtx) <= strlen (src_str) + 1 && can_store_by_pieces (INTVAL (len_rtx), builtin_memcpy_read_str, - (void *) src_str, dest_align, false)) + CONST_CAST (char *, src_str), + dest_align, false)) { dest_mem = store_by_pieces (dest_mem, INTVAL (len_rtx), builtin_memcpy_read_str, - (void *) src_str, dest_align, false, 0); + CONST_CAST (char *, src_str), + dest_align, false, 0); dest_mem = force_operand (XEXP (dest_mem, 0), NULL_RTX); dest_mem = convert_memory_address (ptr_mode, dest_mem); return dest_mem; @@ -3440,14 +3442,15 @@ expand_builtin_mempcpy_args (tree dest, tree src, tree len, tree type, && GET_CODE (len_rtx) == CONST_INT && (unsigned HOST_WIDE_INT) INTVAL (len_rtx) <= strlen (src_str) + 1 && can_store_by_pieces (INTVAL (len_rtx), builtin_memcpy_read_str, - (void *) src_str, dest_align, false)) + CONST_CAST (char *, src_str), + dest_align, false)) { dest_mem = get_memory_rtx (dest, len); set_mem_align (dest_mem, dest_align); dest_mem = store_by_pieces (dest_mem, INTVAL (len_rtx), builtin_memcpy_read_str, - (void *) src_str, dest_align, - false, endp); + CONST_CAST (char *, src_str), + dest_align, false, endp); dest_mem = force_operand (XEXP (dest_mem, 0), NULL_RTX); dest_mem = convert_memory_address (ptr_mode, dest_mem); return dest_mem; @@ -3789,13 +3792,14 @@ expand_builtin_strncpy (tree exp, rtx target, enum machine_mode mode) if (!p || dest_align == 0 || !host_integerp (len, 1) || !can_store_by_pieces (tree_low_cst (len, 1), builtin_strncpy_read_str, - (void *) p, dest_align, false)) + CONST_CAST (char *, p), + dest_align, false)) return NULL_RTX; dest_mem = get_memory_rtx (dest, len); store_by_pieces (dest_mem, tree_low_cst (len, 1), builtin_strncpy_read_str, - (void *) p, dest_align, false, 0); + CONST_CAST (char *, p), dest_align, false, 0); dest_mem = force_operand (XEXP (dest_mem, 0), NULL_RTX); dest_mem = convert_memory_address (ptr_mode, dest_mem); return dest_mem; @@ -3813,7 +3817,7 @@ builtin_memset_read_str (void *data, HOST_WIDE_INT offset ATTRIBUTE_UNUSED, enum machine_mode mode) { const char *c = (const char *) data; - char *p = alloca (GET_MODE_SIZE (mode)); + char *p = XALLOCAVEC (char, GET_MODE_SIZE (mode)); memset (p, *c, GET_MODE_SIZE (mode)); @@ -3837,7 +3841,7 @@ builtin_memset_gen_str (void *data, HOST_WIDE_INT offset ATTRIBUTE_UNUSED, if (size == 1) return (rtx) data; - p = alloca (size); + p = XALLOCAVEC (char, size); memset (p, 1, size); coeff = c_readstr (p, mode); @@ -5311,7 +5315,7 @@ expand_builtin_printf (tree exp, rtx target, enum machine_mode mode, { /* Create a NUL-terminated string that's one char shorter than the original, stripping off the trailing '\n'. */ - char *newstr = alloca (len); + char *newstr = XALLOCAVEC (char, len); memcpy (newstr, fmt_str, len - 1); newstr[len - 1] = 0; arg = build_string_literal (len, newstr); @@ -5995,6 +5999,12 @@ expand_builtin_synchronize (void) } #endif + if (synchronize_libfunc != NULL_RTX) + { + emit_library_call (synchronize_libfunc, LCT_NORMAL, VOIDmode, 0); + return; + } + /* If no explicit memory barrier instruction is available, create an empty asm stmt with a memory clobber. */ x = build4 (ASM_EXPR, void_type_node, build_string (0, ""), NULL, NULL, @@ -8902,7 +8912,7 @@ fold_builtin_memchr (tree arg1, tree arg2, tree len, tree type) if (target_char_cast (arg2, &c)) return NULL_TREE; - r = memchr (p1, c, tree_low_cst (len, 1)); + r = (char *) memchr (p1, c, tree_low_cst (len, 1)); if (r == NULL) return build_int_cst (TREE_TYPE (arg1), 0); @@ -10752,7 +10762,7 @@ rewrite_call_expr (tree exp, int skip, tree fndecl, int n, ...) int i, j; va_list ap; - buffer = alloca (nargs * sizeof (tree)); + buffer = XALLOCAVEC (tree, nargs); va_start (ap, n); for (i = 0; i < n; i++) buffer[i] = va_arg (ap, tree); @@ -12469,7 +12479,7 @@ fold_builtin_printf (tree fndecl, tree fmt, tree arg, bool ignore, { /* Create a NUL-terminated string that's one char shorter than the original, stripping off the trailing '\n'. */ - char *newstr = alloca (len); + char *newstr = XALLOCAVEC (char, len); memcpy (newstr, str, len - 1); newstr[len - 1] = 0; diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 38c1581b3ff..18ad11901f9 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -1764,8 +1764,7 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) || !DECL_EXTERNAL (olddecl)) && DECL_EXTERNAL (newdecl) && !lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (newdecl)) - && (DECL_CONTEXT (newdecl) == NULL_TREE - || TREE_CODE (DECL_CONTEXT (newdecl)) != FUNCTION_DECL)) + && !current_function_decl) DECL_EXTERNAL (newdecl) = 0; if (DECL_EXTERNAL (newdecl)) diff --git a/gcc/c-format.c b/gcc/c-format.c index 6fb96a38ddd..fa28763028f 100644 --- a/gcc/c-format.c +++ b/gcc/c-format.c @@ -2804,8 +2804,8 @@ handle_format_attribute (tree *node, tree ARG_UNUSED (name), tree args, add them to FORMAT_TYPES at first use. */ if (TARGET_FORMAT_TYPES != NULL && !dynamic_format_types) { - dynamic_format_types = xmalloc ((n_format_types + TARGET_N_FORMAT_TYPES) - * sizeof (dynamic_format_types[0])); + dynamic_format_types = XNEWVEC (format_kind_info, + n_format_types + TARGET_N_FORMAT_TYPES); memcpy (dynamic_format_types, format_types_orig, sizeof (format_types_orig)); memcpy (&dynamic_format_types[n_format_types], TARGET_FORMAT_TYPES, diff --git a/gcc/c-lex.c b/gcc/c-lex.c index 73834ef413a..3c2c225c59f 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -977,7 +977,7 @@ lex_charconst (const cpp_token *token) cppchar_t result; tree type, value; unsigned int chars_seen; - int unsignedp; + int unsignedp = 0; result = cpp_interpret_charconst (parse_in, token, &chars_seen, &unsignedp); diff --git a/gcc/c-pragma.c b/gcc/c-pragma.c index 81b9910b41a..e7bb928c8a9 100644 --- a/gcc/c-pragma.c +++ b/gcc/c-pragma.c @@ -270,7 +270,8 @@ dpm_hash (const void *p) static int dpm_eq (const void *pa, const void *pb) { - const struct def_pragma_macro *a = pa, *b = pb; + const struct def_pragma_macro *const a = (const struct def_pragma_macro *) pa, + *const b = (const struct def_pragma_macro *) pb; return a->hash == b->hash && strcmp (a->name, b->name) == 0; } @@ -315,10 +316,10 @@ handle_pragma_push_macro (cpp_reader *reader) dummy.name = macroname; slot = htab_find_slot_with_hash (pushed_macro_table, &dummy, dummy.hash, INSERT); - c = *slot; + c = (struct def_pragma_macro *) *slot; if (c == NULL) { - *slot = c = ggc_alloc (sizeof (struct def_pragma_macro)); + *slot = c = GGC_NEW (struct def_pragma_macro); c->hash = dummy.hash; c->name = ggc_alloc_string (macroname, TREE_STRING_LENGTH (id) - 1); c->value.prev = NULL; @@ -326,7 +327,7 @@ handle_pragma_push_macro (cpp_reader *reader) else { struct def_pragma_macro_value *v; - v = ggc_alloc (sizeof (struct def_pragma_macro_value)); + v = GGC_NEW (struct def_pragma_macro_value); *v = c->value; c->value.prev = v; } @@ -372,7 +373,7 @@ handle_pragma_pop_macro (cpp_reader *reader) dummy.hash, NO_INSERT); if (slot == NULL) return; - c = *slot; + c = (struct def_pragma_macro *) *slot; cpp_pop_definition (reader, c->name, c->value.value); diff --git a/gcc/caller-save.c b/gcc/caller-save.c index c6a685bde9c..f8a3c387775 100644 --- a/gcc/caller-save.c +++ b/gcc/caller-save.c @@ -516,7 +516,7 @@ static void mark_set_regs (rtx reg, const_rtx setter ATTRIBUTE_UNUSED, void *data) { int regno, endregno, i; - HARD_REG_SET *this_insn_sets = data; + HARD_REG_SET *this_insn_sets = (HARD_REG_SET *) data; if (GET_CODE (reg) == SUBREG) { diff --git a/gcc/calls.c b/gcc/calls.c index 92ff9050e3b..79dc47b98fa 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -2214,7 +2214,7 @@ expand_call (tree exp, rtx target, int ignore) n_named_args = num_actuals; /* Make a vector to hold all the information about each arg. */ - args = alloca (num_actuals * sizeof (struct arg_data)); + args = XALLOCAVEC (struct arg_data, num_actuals); memset (args, 0, num_actuals * sizeof (struct arg_data)); /* Build up entries in the ARGS array, compute the size of the @@ -3316,7 +3316,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value, of the full argument passing conventions to limit complexity here since library functions shouldn't have many args. */ - argvec = alloca ((nargs + 1) * sizeof (struct arg)); + argvec = XALLOCAVEC (struct arg, nargs + 1); memset (argvec, 0, (nargs + 1) * sizeof (struct arg)); #ifdef INIT_CUMULATIVE_LIBCALL_ARGS diff --git a/gcc/cfganal.c b/gcc/cfganal.c index 66214d7fec6..663fbdcb6e4 100644 --- a/gcc/cfganal.c +++ b/gcc/cfganal.c @@ -31,6 +31,8 @@ along with GCC; see the file COPYING3. If not see #include "recog.h" #include "toplev.h" #include "tm_p.h" +#include "vec.h" +#include "vecprim.h" #include "timevar.h" /* Store the data structures necessary for depth-first search. */ @@ -1292,3 +1294,64 @@ compute_dominance_frontiers (bitmap *frontiers) timevar_pop (TV_DOM_FRONTIERS); } + +/* Given a set of blocks with variable definitions (DEF_BLOCKS), + return a bitmap with all the blocks in the iterated dominance + frontier of the blocks in DEF_BLOCKS. DFS contains dominance + frontier information as returned by compute_dominance_frontiers. + + The resulting set of blocks are the potential sites where PHI nodes + are needed. The caller is responsible for freeing the memory + allocated for the return value. */ + +bitmap +compute_idf (bitmap def_blocks, bitmap *dfs) +{ + bitmap_iterator bi; + unsigned bb_index, i; + VEC(int,heap) *work_stack; + bitmap phi_insertion_points; + + work_stack = VEC_alloc (int, heap, n_basic_blocks); + phi_insertion_points = BITMAP_ALLOC (NULL); + + /* Seed the work list with all the blocks in DEF_BLOCKS. We use + VEC_quick_push here for speed. This is safe because we know that + the number of definition blocks is no greater than the number of + basic blocks, which is the initial capacity of WORK_STACK. */ + EXECUTE_IF_SET_IN_BITMAP (def_blocks, 0, bb_index, bi) + VEC_quick_push (int, work_stack, bb_index); + + /* Pop a block off the worklist, add every block that appears in + the original block's DF that we have not already processed to + the worklist. Iterate until the worklist is empty. Blocks + which are added to the worklist are potential sites for + PHI nodes. */ + while (VEC_length (int, work_stack) > 0) + { + bb_index = VEC_pop (int, work_stack); + + /* Since the registration of NEW -> OLD name mappings is done + separately from the call to update_ssa, when updating the SSA + form, the basic blocks where new and/or old names are defined + may have disappeared by CFG cleanup calls. In this case, + we may pull a non-existing block from the work stack. */ + gcc_assert (bb_index < (unsigned) last_basic_block); + + EXECUTE_IF_AND_COMPL_IN_BITMAP (dfs[bb_index], phi_insertion_points, + 0, i, bi) + { + /* Use a safe push because if there is a definition of VAR + in every basic block, then WORK_STACK may eventually have + more than N_BASIC_BLOCK entries. */ + VEC_safe_push (int, heap, work_stack, i); + bitmap_set_bit (phi_insertion_points, i); + } + } + + VEC_free (int, heap, work_stack); + + return phi_insertion_points; +} + + diff --git a/gcc/cgraph.c b/gcc/cgraph.c index df214d1dba5..17ee8f0a63a 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -262,8 +262,9 @@ cgraph_edge (struct cgraph_node *node, tree call_stmt) int n = 0; if (node->call_site_hash) - return htab_find_with_hash (node->call_site_hash, call_stmt, - htab_hash_pointer (call_stmt)); + return (struct cgraph_edge *) + htab_find_with_hash (node->call_site_hash, call_stmt, + htab_hash_pointer (call_stmt)); /* This loop may turn out to be performance problem. In such case adding hashtables into call nodes with very many edges is probably best diff --git a/gcc/collect2.c b/gcc/collect2.c index dbd580606d4..314d30d7717 100644 --- a/gcc/collect2.c +++ b/gcc/collect2.c @@ -2628,7 +2628,7 @@ resolve_lib_name (const char *name) if (libpaths[i]->max_len > l) l = libpaths[i]->max_len; - lib_buf = xmalloc (l + strlen(name) + 10); + lib_buf = XNEWVEC (char, l + strlen(name) + 10); for (i = 0; libpaths[i]; i++) { diff --git a/gcc/combine.c b/gcc/combine.c index 79d96ed3763..59586a8bf18 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -2021,7 +2021,8 @@ struct likely_spilled_retval_info static void likely_spilled_retval_1 (rtx x, const_rtx set, void *data) { - struct likely_spilled_retval_info *info = data; + struct likely_spilled_retval_info *const info = + (struct likely_spilled_retval_info *) data; unsigned regno, nregs; unsigned new_mask; diff --git a/gcc/config.gcc b/gcc/config.gcc index 5327abde7f8..f4f171e0c02 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -929,7 +929,6 @@ hppa[12]*-*-hpux10*) tmake_file="$tmake_file pa/t-slibgcc-dwarf-ver" fi use_collect2=yes - use_fixproto=yes gas=yes ;; hppa*64*-*-hpux11*) @@ -2820,8 +2819,9 @@ case "${target}" in | rios | rios1 | rios2 | rsc | rsc1 | rs64a \ | 401 | 403 | 405 | 405fp | 440 | 440fp | 464 | 464fp \ | 505 | 601 | 602 | 603 | 603e | ec603e | 604 \ - | 604e | 620 | 630 | 740 | 750 | 7400 | 7450 | e300c[23] \ - | 854[08] | 801 | 821 | 823 | 860 | 970 | G3 | G4 | G5 | cell) + | 604e | 620 | 630 | 740 | 750 | 7400 | 7450 \ + | e300c[23] | 854[08] | e500mc \ + | 801 | 821 | 823 | 860 | 970 | G3 | G4 | G5 | cell) # OK ;; *) diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index b5e2cb96547..067d9f7ec79 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -173,11 +173,11 @@ arc_init (void) char *tmp; /* Set the pseudo-ops for the various standard sections. */ - arc_text_section = tmp = xmalloc (strlen (arc_text_string) + sizeof (ARC_SECTION_FORMAT) + 1); + arc_text_section = tmp = XNEWVEC (char, strlen (arc_text_string) + sizeof (ARC_SECTION_FORMAT) + 1); sprintf (tmp, ARC_SECTION_FORMAT, arc_text_string); - arc_data_section = tmp = xmalloc (strlen (arc_data_string) + sizeof (ARC_SECTION_FORMAT) + 1); + arc_data_section = tmp = XNEWVEC (char, strlen (arc_data_string) + sizeof (ARC_SECTION_FORMAT) + 1); sprintf (tmp, ARC_SECTION_FORMAT, arc_data_string); - arc_rodata_section = tmp = xmalloc (strlen (arc_rodata_string) + sizeof (ARC_SECTION_FORMAT) + 1); + arc_rodata_section = tmp = XNEWVEC (char, strlen (arc_rodata_string) + sizeof (ARC_SECTION_FORMAT) + 1); sprintf (tmp, ARC_SECTION_FORMAT, arc_rodata_string); arc_init_reg_tables (); diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index c7f223a6b63..fa3d06dcd75 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -15609,8 +15609,8 @@ arm_expand_unop_builtin (enum insn_code icode, static int neon_builtin_compare (const void *a, const void *b) { - const neon_builtin_datum *key = a; - const neon_builtin_datum *memb = b; + const neon_builtin_datum *const key = (const neon_builtin_datum *) a; + const neon_builtin_datum *const memb = (const neon_builtin_datum *) b; unsigned int soughtcode = key->base_fcode; if (soughtcode >= memb->base_fcode @@ -15629,7 +15629,8 @@ locate_neon_builtin_icode (int fcode, neon_itype *itype) int idx; key.base_fcode = fcode; - found = bsearch (&key, &neon_builtin_data[0], ARRAY_SIZE (neon_builtin_data), + found = (neon_builtin_datum *) + bsearch (&key, &neon_builtin_data[0], ARRAY_SIZE (neon_builtin_data), sizeof (neon_builtin_data[0]), neon_builtin_compare); gcc_assert (found); idx = fcode - (int) found->base_fcode; diff --git a/gcc/config/arm/pe.c b/gcc/config/arm/pe.c index 90bc7299386..8b8adff0e14 100644 --- a/gcc/config/arm/pe.c +++ b/gcc/config/arm/pe.c @@ -112,7 +112,7 @@ arm_mark_dllexport (tree decl) else if (arm_dllexport_name_p (oldname)) return; /* already done */ - newname = alloca (strlen (oldname) + 4); + newname = XALLOCAVEC (char, strlen (oldname) + 4); sprintf (newname, "%ce.%s", ARM_PE_FLAG_CHAR, oldname); /* We pass newname through get_identifier to ensure it has a unique @@ -178,7 +178,7 @@ arm_mark_dllimport (tree decl) TREE_PUBLIC (decl) = 1; } - newname = alloca (strlen (oldname) + 11); + newname = XALLOCAVEC (char, strlen (oldname) + 11); sprintf (newname, "%ci.__imp_%s", ARM_PE_FLAG_CHAR, oldname); /* We pass newname through get_identifier to ensure it has a unique @@ -250,7 +250,7 @@ arm_pe_unique_section (tree decl, int reloc) else prefix = ".data$"; len = strlen (name) + strlen (prefix); - string = alloca (len + 1); + string = XALLOCAVEC (char, len + 1); sprintf (string, "%s%s", prefix, name); DECL_SECTION_NAME (decl) = build_string (len, string); diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c index a7600cf80e2..05a5e495cea 100644 --- a/gcc/config/bfin/bfin.c +++ b/gcc/config/bfin/bfin.c @@ -2436,7 +2436,7 @@ bfin_init_machine_status (void) { struct machine_function *f; - f = ggc_alloc_cleared (sizeof (struct machine_function)); + f = GGC_CNEW (struct machine_function); return f; } @@ -3838,7 +3838,7 @@ bfin_optimize_loop (loop_info loop) if (JUMP_P (last_insn)) { - loop_info inner = bb->aux; + loop_info inner = (loop_info) bb->aux; if (inner && inner->outer == loop && inner->loop_end == last_insn diff --git a/gcc/config/bfin/bfin.h b/gcc/config/bfin/bfin.h index 8efcb5ea189..6f2d16c98d6 100644 --- a/gcc/config/bfin/bfin.h +++ b/gcc/config/bfin/bfin.h @@ -121,7 +121,7 @@ extern int target_flags; if (bfin_si_revision != -1) \ { \ /* space of 0xnnnn and a NUL */ \ - char *buf = alloca (7); \ + char *buf = XALLOCAVEC (char, 7); \ \ sprintf (buf, "0x%04x", bfin_si_revision); \ builtin_define_with_value ("__SILICON_REVISION__", buf, 0); \ diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c index 810366f5681..3a0eb2de066 100644 --- a/gcc/config/cris/cris.c +++ b/gcc/config/cris/cris.c @@ -2533,7 +2533,7 @@ cris_init_expanders (void) static struct machine_function * cris_init_machine_status (void) { - return ggc_alloc_cleared (sizeof (struct machine_function)); + return GGC_CNEW (struct machine_function); } /* Split a 2 word move (DI or presumably DF) into component parts. diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c index ba0eca14ed0..9f3b444d6bc 100644 --- a/gcc/config/darwin-c.c +++ b/gcc/config/darwin-c.c @@ -179,7 +179,7 @@ darwin_pragma_ms_struct (cpp_reader *pfile ATTRIBUTE_UNUSED) BAD ("junk at end of '#pragma ms_struct'"); } -static struct { +static struct frameworks_in_use { size_t len; const char *name; cpp_dir* dir; @@ -211,8 +211,8 @@ add_framework (const char *name, size_t len, cpp_dir *dir) { max_frameworks = i*2; max_frameworks += i == 0; - frameworks_in_use = xrealloc (frameworks_in_use, - max_frameworks*sizeof(*frameworks_in_use)); + frameworks_in_use = XRESIZEVEC (struct frameworks_in_use, + frameworks_in_use, max_frameworks); } dir_name = XNEWVEC (char, len + 1); memcpy (dir_name, name, len); diff --git a/gcc/config/darwin-driver.c b/gcc/config/darwin-driver.c index 524f31ec04c..02226308639 100644 --- a/gcc/config/darwin-driver.c +++ b/gcc/config/darwin-driver.c @@ -93,7 +93,7 @@ darwin_default_min_version (int * argc_p, char *** argv_p) && macosx_deployment_target[0]) { ++*argc_p; - *argv_p = xmalloc (sizeof (char *) * *argc_p); + *argv_p = XNEWVEC (char *, *argc_p); (*argv_p)[0] = argv[0]; (*argv_p)[1] = concat ("-mmacosx-version-min=", macosx_deployment_target, NULL); @@ -144,7 +144,7 @@ darwin_default_min_version (int * argc_p, char *** argv_p) /* Add the new flag. */ ++*argc_p; - *argv_p = xmalloc (sizeof (char *) * *argc_p); + *argv_p = XNEWVEC (char *, *argc_p); (*argv_p)[0] = argv[0]; (*argv_p)[1] = new_flag; memcpy (*argv_p + 2, argv + 1, (argc - 1) * sizeof (char *)); diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 5461fe083e0..20cce264101 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -366,7 +366,8 @@ machopic_indirection_hash (const void *slot) static int machopic_indirection_eq (const void *slot, const void *key) { - return strcmp (((const machopic_indirection *) slot)->ptr_name, key) == 0; + return strcmp (((const machopic_indirection *) slot)->ptr_name, + (const char *) key) == 0; } /* Return the name of the non-lazy pointer (if STUB_P is false) or @@ -420,7 +421,7 @@ machopic_indirection_name (rtx sym_ref, bool stub_p) else suffix = NON_LAZY_POINTER_SUFFIX; - buffer = alloca (strlen ("&L") + buffer = XALLOCAVEC (char, strlen ("&L") + strlen (prefix) + namelen + strlen (suffix) @@ -969,7 +970,7 @@ machopic_output_indirection (void **slot, void *data) sym_name = IDENTIFIER_POINTER (id); } - sym = alloca (strlen (sym_name) + 2); + sym = XALLOCAVEC (char, strlen (sym_name) + 2); if (sym_name[0] == '*' || sym_name[0] == '&') strcpy (sym, sym_name + 1); else if (sym_name[0] == '-' || sym_name[0] == '+') @@ -977,7 +978,7 @@ machopic_output_indirection (void **slot, void *data) else sprintf (sym, "%s%s", user_label_prefix, sym_name); - stub = alloca (strlen (ptr_name) + 2); + stub = XALLOCAVEC (char, strlen (ptr_name) + 2); if (ptr_name[0] == '*' || ptr_name[0] == '&') strcpy (stub, ptr_name + 1); else diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c index 93648ccf39d..6ba924b1df7 100644 --- a/gcc/config/frv/frv.c +++ b/gcc/config/frv/frv.c @@ -6950,7 +6950,7 @@ frv_assemble_integer (rtx value, unsigned int size, int aligned_p) static struct machine_function * frv_init_machine_status (void) { - return ggc_alloc_cleared (sizeof (struct machine_function)); + return GGC_CNEW (struct machine_function); } /* Implement TARGET_SCHED_ISSUE_RATE. */ @@ -7525,7 +7525,8 @@ frv_sort_insn_group_1 (enum frv_insn_group group, static int frv_compare_insns (const void *first, const void *second) { - const rtx *insn1 = first, *insn2 = second; + const rtx *const insn1 = (rtx const *) first, + *const insn2 = (rtx const *) second; return frv_insn_unit (*insn1) - frv_insn_unit (*insn2); } @@ -7758,7 +7759,7 @@ frv_extract_membar (struct frv_io *io, rtx insn) static void frv_io_check_address (rtx x, const_rtx pat ATTRIBUTE_UNUSED, void *data) { - rtx *other = data; + rtx *other = (rtx *) data; if (REG_P (x) && *other != 0 && reg_overlap_mentioned_p (x, *other)) *other = 0; @@ -7770,7 +7771,7 @@ frv_io_check_address (rtx x, const_rtx pat ATTRIBUTE_UNUSED, void *data) static void frv_io_handle_set (rtx x, const_rtx pat ATTRIBUTE_UNUSED, void *data) { - HARD_REG_SET *set = data; + HARD_REG_SET *set = (HARD_REG_SET *) data; unsigned int regno; if (REG_P (x)) @@ -7784,7 +7785,7 @@ frv_io_handle_set (rtx x, const_rtx pat ATTRIBUTE_UNUSED, void *data) static int frv_io_handle_use_1 (rtx *x, void *data) { - HARD_REG_SET *set = data; + HARD_REG_SET *set = (HARD_REG_SET *) data; unsigned int regno; if (REG_P (*x)) @@ -8005,8 +8006,8 @@ frv_optimize_membar (void) rtx *last_membar; compute_bb_for_insn (); - first_io = xcalloc (last_basic_block, sizeof (struct frv_io)); - last_membar = xcalloc (last_basic_block, sizeof (rtx)); + first_io = XCNEWVEC (struct frv_io, last_basic_block); + last_membar = XCNEWVEC (rtx, last_basic_block); FOR_EACH_BB (bb) frv_optimize_membar_local (bb, &first_io[bb->index], diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h index 1af48805660..f61cacb3e1a 100644 --- a/gcc/config/i386/cygwin.h +++ b/gcc/config/i386/cygwin.h @@ -203,12 +203,12 @@ char *cvt_to_mingw[] = #undef GEN_CVT_ARRAY #endif /*GEN_CVT_ARRAY*/ -void mingw_scan (int, const char * const *, char **); +void mingw_scan (int, const char * const *, const char **); #if 1 #define GCC_DRIVER_HOST_INITIALIZATION \ do \ { \ - mingw_scan(argc, (const char * const *) argv, (char **) &spec_machine); \ + mingw_scan(argc, (const char * const *) argv, &spec_machine); \ } \ while (0) #else diff --git a/gcc/config/i386/cygwin1.c b/gcc/config/i386/cygwin1.c index fb8657acd3c..3ba812fe449 100644 --- a/gcc/config/i386/cygwin1.c +++ b/gcc/config/i386/cygwin1.c @@ -27,7 +27,7 @@ along with GCC; see the file COPYING3. If not see void mingw_scan (int argc ATTRIBUTE_UNUSED, const char *const *argv, - char **spec_machine) + const char **spec_machine) { putenv (xstrdup ("GCC_CYGWIN_MINGW=0")); @@ -42,7 +42,7 @@ mingw_scan (int argc ATTRIBUTE_UNUSED, if (p) { int len = p - *spec_machine; - char *s = xmalloc (strlen (*spec_machine) + 3); + char *s = XNEWVEC (char, strlen (*spec_machine) + 3); memcpy (s, *spec_machine, len); strcpy (s + len, "-mingw32"); *spec_machine = s; diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c index b823d435c6d..44845cd8c2e 100644 --- a/gcc/config/i386/driver-i386.c +++ b/gcc/config/i386/driver-i386.c @@ -70,7 +70,7 @@ decode_l2_cache (unsigned *l2_size, unsigned *l2_line, unsigned *l2_assoc) /* Returns the description of caches for an AMD processor. */ -static char * +static const char * detect_caches_amd (unsigned max_ext_level) { unsigned eax, ebx, ecx, edx; @@ -78,7 +78,7 @@ detect_caches_amd (unsigned max_ext_level) unsigned l2_sizekb, l2_line, l2_assoc; if (max_ext_level < 0x80000005) - return (char *) ""; + return ""; __cpuid (0x80000005, eax, ebx, ecx, edx); @@ -282,7 +282,7 @@ decode_caches_intel (unsigned reg, unsigned *l1_sizekb, unsigned *l1_line, /* Returns the description of caches for an intel processor. */ -static char * +static const char * detect_caches_intel (unsigned max_level, unsigned max_ext_level) { unsigned eax, ebx, ecx, edx; @@ -290,7 +290,7 @@ detect_caches_intel (unsigned max_level, unsigned max_ext_level) unsigned l2_sizekb = 0, l2_line = 0, l2_assoc = 0; if (max_level < 2) - return (char *) ""; + return ""; __cpuid (2, eax, ebx, ecx, edx); @@ -304,7 +304,7 @@ detect_caches_intel (unsigned max_level, unsigned max_ext_level) &l2_sizekb, &l2_line, &l2_assoc); if (!l1_sizekb) - return (char *) ""; + return ""; /* Newer Intel CPUs are equipped with AMD style L2 cache info */ if (max_ext_level >= 0x80000006) @@ -393,13 +393,13 @@ const char *host_detect_local_cpu (int argc, const char **argv) if (!arch) { - if (vendor == *(unsigned int*) "Auth") + if (vendor == *(const unsigned int*) "Auth") cache = detect_caches_amd (ext_level); - else if (vendor == *(unsigned int*) "Genu") + else if (vendor == *(const unsigned int*) "Genu") cache = detect_caches_intel (max_level, ext_level); } - if (vendor == *(unsigned int*) "Auth") + if (vendor == *(const unsigned int*) "Auth") { processor = PROCESSOR_PENTIUM; @@ -412,7 +412,7 @@ const char *host_detect_local_cpu (int argc, const char **argv) if (has_sse4a) processor = PROCESSOR_AMDFAM10; } - else if (vendor == *(unsigned int*) "Geod") + else if (vendor == *(const unsigned int*) "Geod") processor = PROCESSOR_GEODE; else { diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 5ebb31c22d0..2edeec01c58 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -4744,7 +4744,9 @@ static bool contains_aligned_value_p (tree type) { enum machine_mode mode = TYPE_MODE (type); - if (((TARGET_SSE && SSE_REG_MODE_P (mode)) || mode == TDmode) + if (((TARGET_SSE && SSE_REG_MODE_P (mode)) + || mode == TDmode + || mode == TFmode) && (!TYPE_USER_ALIGN (type) || TYPE_ALIGN (type) > 128)) return true; if (TYPE_ALIGN (type) < 128) @@ -4803,8 +4805,9 @@ ix86_function_arg_boundary (enum machine_mode mode, tree type) align = GET_MODE_ALIGNMENT (mode); if (align < PARM_BOUNDARY) align = PARM_BOUNDARY; - /* In 32bit, only _Decimal128 is aligned to its natural boundary. */ - if (!TARGET_64BIT && mode != TDmode) + /* In 32bit, only _Decimal128 and __float128 are aligned to their + natural boundaries. */ + if (!TARGET_64BIT && mode != TDmode && mode != TFmode) { /* i386 ABI defines all arguments to be 4 byte aligned. We have to make an exception for SSE modes since these require 128bit @@ -4815,7 +4818,7 @@ ix86_function_arg_boundary (enum machine_mode mode, tree type) to 8 byte boundaries. */ if (!type) { - if (!(TARGET_SSE && SSE_REG_MODE_P (mode)) && mode != TDmode) + if (!(TARGET_SSE && SSE_REG_MODE_P (mode))) align = PARM_BOUNDARY; } else @@ -5041,9 +5044,6 @@ return_in_memory_32 (const_tree type, enum machine_mode mode) if (mode == XFmode) return 0; - if (mode == TDmode) - return 1; - if (size > 12) return 1; return 0; @@ -9207,7 +9207,7 @@ print_operand (FILE *file, rtx x, int code) if (CONST_INT_P (x) || ! SHIFT_DOUBLE_OMITS_COUNT) { PRINT_OPERAND (file, x, 0); - putc (',', file); + fputs (", ", file); } return; @@ -14122,7 +14122,7 @@ ix86_split_to_parts (rtx operand, rtx *parts, enum machine_mode mode) size = (GET_MODE_SIZE (mode) + 4) / 8; gcc_assert (!REG_P (operand) || !MMX_REGNO_P (REGNO (operand))); - gcc_assert (size >= 2 && size <= 3); + gcc_assert (size >= 2 && size <= 4); /* Optimize constant pool reference to immediates. This is used by fp moves, that force all constants to memory to allow combining. */ @@ -14142,7 +14142,7 @@ ix86_split_to_parts (rtx operand, rtx *parts, enum machine_mode mode) operand = copy_rtx (operand); PUT_MODE (operand, Pmode); - parts[0] = parts[1] = parts[2] = operand; + parts[0] = parts[1] = parts[2] = parts[3] = operand; return size; } @@ -14163,21 +14163,20 @@ ix86_split_to_parts (rtx operand, rtx *parts, enum machine_mode mode) split_di (&operand, 1, &parts[0], &parts[1]); else { + int i; + if (REG_P (operand)) { gcc_assert (reload_completed); - parts[0] = gen_rtx_REG (SImode, REGNO (operand) + 0); - parts[1] = gen_rtx_REG (SImode, REGNO (operand) + 1); - if (size == 3) - parts[2] = gen_rtx_REG (SImode, REGNO (operand) + 2); + for (i = 0; i < size; i++) + parts[i] = gen_rtx_REG (SImode, REGNO (operand) + i); } else if (offsettable_memref_p (operand)) { operand = adjust_address (operand, SImode, 0); parts[0] = operand; - parts[1] = adjust_address (operand, SImode, 4); - if (size == 3) - parts[2] = adjust_address (operand, SImode, 8); + for (i = 1; i < size; i++) + parts[i] = adjust_address (operand, SImode, 4 * i); } else if (GET_CODE (operand) == CONST_DOUBLE) { @@ -14187,6 +14186,11 @@ ix86_split_to_parts (rtx operand, rtx *parts, enum machine_mode mode) REAL_VALUE_FROM_CONST_DOUBLE (r, operand); switch (mode) { + case TFmode: + real_to_target (l, &r, mode); + parts[3] = gen_int_mode (l[3], SImode); + parts[2] = gen_int_mode (l[2], SImode); + break; case XFmode: REAL_VALUE_TO_TARGET_LONG_DOUBLE (r, l); parts[2] = gen_int_mode (l[2], SImode); @@ -14260,7 +14264,7 @@ ix86_split_to_parts (rtx operand, rtx *parts, enum machine_mode mode) return size; } -/* Emit insns to perform a move or push of DI, DF, and XF values. +/* Emit insns to perform a move or push of DI, DF, XF, and TF values. Return false when normal moves are needed; true when all required insns have been emitted. Operands 2-4 contain the input values int the correct order; operands 5-7 contain the output values. */ @@ -14268,11 +14272,12 @@ ix86_split_to_parts (rtx operand, rtx *parts, enum machine_mode mode) void ix86_split_long_move (rtx operands[]) { - rtx part[2][3]; - int nparts; + rtx part[2][4]; + int nparts, i, j; int push = 0; int collisions = 0; enum machine_mode mode = GET_MODE (operands[0]); + bool collisionparts[4]; /* The DFmode expanders may ask us to move double. For 64bit target this is single move. By hiding the fact @@ -14311,34 +14316,46 @@ ix86_split_long_move (rtx operands[]) /* When emitting push, take care for source operands on the stack. */ if (push && MEM_P (operands[1]) && reg_overlap_mentioned_p (stack_pointer_rtx, operands[1])) - { - if (nparts == 3) - part[1][1] = change_address (part[1][1], GET_MODE (part[1][1]), - XEXP (part[1][2], 0)); - part[1][0] = change_address (part[1][0], GET_MODE (part[1][0]), - XEXP (part[1][1], 0)); - } + for (i = 0; i < nparts - 1; i++) + part[1][i] = change_address (part[1][i], + GET_MODE (part[1][i]), + XEXP (part[1][i + 1], 0)); /* We need to do copy in the right order in case an address register of the source overlaps the destination. */ if (REG_P (part[0][0]) && MEM_P (part[1][0])) { - if (reg_overlap_mentioned_p (part[0][0], XEXP (part[1][0], 0))) - collisions++; - if (reg_overlap_mentioned_p (part[0][1], XEXP (part[1][0], 0))) - collisions++; - if (nparts == 3 - && reg_overlap_mentioned_p (part[0][2], XEXP (part[1][0], 0))) - collisions++; + rtx tmp; + + for (i = 0; i < nparts; i++) + { + collisionparts[i] + = reg_overlap_mentioned_p (part[0][i], XEXP (part[1][0], 0)); + if (collisionparts[i]) + collisions++; + } /* Collision in the middle part can be handled by reordering. */ - if (collisions == 1 && nparts == 3 - && reg_overlap_mentioned_p (part[0][1], XEXP (part[1][0], 0))) + if (collisions == 1 && nparts == 3 && collisionparts [1]) { - rtx tmp; tmp = part[0][1]; part[0][1] = part[0][2]; part[0][2] = tmp; tmp = part[1][1]; part[1][1] = part[1][2]; part[1][2] = tmp; } + else if (collisions == 1 + && nparts == 4 + && (collisionparts [1] || collisionparts [2])) + { + if (collisionparts [1]) + { + tmp = part[0][1]; part[0][1] = part[0][2]; part[0][2] = tmp; + tmp = part[1][1]; part[1][1] = part[1][2]; part[1][2] = tmp; + } + else + { + tmp = part[0][2]; part[0][2] = part[0][3]; part[0][3] = tmp; + tmp = part[1][2]; part[1][2] = part[1][3]; part[1][3] = tmp; + } + } /* If there are more collisions, we can't handle it by reordering. Do an lea to the last part and use only one colliding move. */ @@ -14357,11 +14374,11 @@ ix86_split_long_move (rtx operands[]) emit_insn (gen_rtx_SET (VOIDmode, base, XEXP (part[1][0], 0))); part[1][0] = replace_equiv_address (part[1][0], base); - part[1][1] = replace_equiv_address (part[1][1], - plus_constant (base, UNITS_PER_WORD)); - if (nparts == 3) - part[1][2] = replace_equiv_address (part[1][2], - plus_constant (base, 8)); + for (i = 1; i < nparts; i++) + { + tmp = plus_constant (base, UNITS_PER_WORD * i); + part[1][i] = replace_equiv_address (part[1][i], tmp); + } } } @@ -14375,6 +14392,11 @@ ix86_split_long_move (rtx operands[]) emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, GEN_INT (-4))); emit_move_insn (part[0][2], part[1][2]); } + else if (nparts == 4) + { + emit_move_insn (part[0][3], part[1][3]); + emit_move_insn (part[0][2], part[1][2]); + } } else { @@ -14412,77 +14434,42 @@ ix86_split_long_move (rtx operands[]) && REG_P (part[1][1]) && (REGNO (part[0][0]) == REGNO (part[1][1]) || (nparts == 3 - && REGNO (part[0][0]) == REGNO (part[1][2])))) + && REGNO (part[0][0]) == REGNO (part[1][2])) + || (nparts == 4 + && REGNO (part[0][0]) == REGNO (part[1][3])))) || (collisions > 0 && reg_overlap_mentioned_p (part[0][0], XEXP (part[1][0], 0)))) { - if (nparts == 3) + for (i = 0, j = nparts - 1; i < nparts; i++, j--) { - operands[2] = part[0][2]; - operands[3] = part[0][1]; - operands[4] = part[0][0]; - operands[5] = part[1][2]; - operands[6] = part[1][1]; - operands[7] = part[1][0]; - } - else - { - operands[2] = part[0][1]; - operands[3] = part[0][0]; - operands[5] = part[1][1]; - operands[6] = part[1][0]; + operands[2 + i] = part[0][j]; + operands[6 + i] = part[1][j]; } } else { - if (nparts == 3) + for (i = 0; i < nparts; i++) { - operands[2] = part[0][0]; - operands[3] = part[0][1]; - operands[4] = part[0][2]; - operands[5] = part[1][0]; - operands[6] = part[1][1]; - operands[7] = part[1][2]; - } - else - { - operands[2] = part[0][0]; - operands[3] = part[0][1]; - operands[5] = part[1][0]; - operands[6] = part[1][1]; + operands[2 + i] = part[0][i]; + operands[6 + i] = part[1][i]; } } /* If optimizing for size, attempt to locally unCSE nonzero constants. */ if (optimize_size) { - if (CONST_INT_P (operands[5]) - && operands[5] != const0_rtx - && REG_P (operands[2])) - { - if (CONST_INT_P (operands[6]) - && INTVAL (operands[6]) == INTVAL (operands[5])) - operands[6] = operands[2]; - - if (nparts == 3 - && CONST_INT_P (operands[7]) - && INTVAL (operands[7]) == INTVAL (operands[5])) - operands[7] = operands[2]; - } - - if (nparts == 3 - && CONST_INT_P (operands[6]) - && operands[6] != const0_rtx - && REG_P (operands[3]) - && CONST_INT_P (operands[7]) - && INTVAL (operands[7]) == INTVAL (operands[6])) - operands[7] = operands[3]; + for (j = 0; j < nparts - 1; j++) + if (CONST_INT_P (operands[6 + j]) + && operands[6 + j] != const0_rtx + && REG_P (operands[2 + j])) + for (i = j; i < nparts - 1; i++) + if (CONST_INT_P (operands[7 + i]) + && INTVAL (operands[7 + i]) == INTVAL (operands[6 + j])) + operands[7 + i] = operands[2 + j]; } - emit_move_insn (operands[2], operands[5]); - emit_move_insn (operands[3], operands[6]); - if (nparts == 3) - emit_move_insn (operands[4], operands[7]); + for (i = 0; i < nparts; i++) + emit_move_insn (operands[2 + i], operands[6 + i]); return; } @@ -14542,7 +14529,7 @@ ix86_split_ashl (rtx *operands, rtx scratch, enum machine_mode mode) if (!rtx_equal_p (operands[0], operands[1])) emit_move_insn (operands[0], operands[1]); emit_insn ((mode == DImode - ? gen_x86_shld_1 + ? gen_x86_shld : gen_x86_64_shld) (high[0], low[0], GEN_INT (count))); ix86_expand_ashl_const (low[0], count, mode); } @@ -14627,7 +14614,7 @@ ix86_split_ashl (rtx *operands, rtx scratch, enum machine_mode mode) (mode == DImode ? split_di : split_ti) (operands, 1, low, high); emit_insn ((mode == DImode - ? gen_x86_shld_1 + ? gen_x86_shld : gen_x86_64_shld) (high[0], low[0], operands[2])); } @@ -14685,7 +14672,7 @@ ix86_split_ashr (rtx *operands, rtx scratch, enum machine_mode mode) if (!rtx_equal_p (operands[0], operands[1])) emit_move_insn (operands[0], operands[1]); emit_insn ((mode == DImode - ? gen_x86_shrd_1 + ? gen_x86_shrd : gen_x86_64_shrd) (low[0], high[0], GEN_INT (count))); emit_insn ((mode == DImode ? gen_ashrsi3 @@ -14700,7 +14687,7 @@ ix86_split_ashr (rtx *operands, rtx scratch, enum machine_mode mode) (mode == DImode ? split_di : split_ti) (operands, 1, low, high); emit_insn ((mode == DImode - ? gen_x86_shrd_1 + ? gen_x86_shrd : gen_x86_64_shrd) (low[0], high[0], operands[2])); emit_insn ((mode == DImode ? gen_ashrsi3 @@ -14751,7 +14738,7 @@ ix86_split_lshr (rtx *operands, rtx scratch, enum machine_mode mode) if (!rtx_equal_p (operands[0], operands[1])) emit_move_insn (operands[0], operands[1]); emit_insn ((mode == DImode - ? gen_x86_shrd_1 + ? gen_x86_shrd : gen_x86_64_shrd) (low[0], high[0], GEN_INT (count))); emit_insn ((mode == DImode ? gen_lshrsi3 @@ -14766,7 +14753,7 @@ ix86_split_lshr (rtx *operands, rtx scratch, enum machine_mode mode) (mode == DImode ? split_di : split_ti) (operands, 1, low, high); emit_insn ((mode == DImode - ? gen_x86_shrd_1 + ? gen_x86_shrd : gen_x86_64_shrd) (low[0], high[0], operands[2])); emit_insn ((mode == DImode ? gen_lshrsi3 @@ -18674,6 +18661,9 @@ static const struct builtin_description bdesc_args[] = { OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_vmsqrtv2df2, "__builtin_ia32_sqrtsd", IX86_BUILTIN_SQRTSD, UNKNOWN, (int) V2DF_FTYPE_V2DF_VEC_MERGE }, + { OPTION_MASK_ISA_SSE2, CODE_FOR_abstf2, 0, IX86_BUILTIN_FABSQ, UNKNOWN, (int) FLOAT128_FTYPE_FLOAT128 }, + { OPTION_MASK_ISA_SSE2, CODE_FOR_copysigntf3, 0, IX86_BUILTIN_COPYSIGNQ, UNKNOWN, (int) FLOAT128_FTYPE_FLOAT128_FLOAT128 }, + /* SSE2 MMX */ { OPTION_MASK_ISA_SSE2, CODE_FOR_mmx_addv1di3, "__builtin_ia32_paddq", IX86_BUILTIN_PADDQ, UNKNOWN, (int) V1DI_FTYPE_V1DI_V1DI }, { OPTION_MASK_ISA_SSE2, CODE_FOR_mmx_subv1di3, "__builtin_ia32_psubq", IX86_BUILTIN_PSUBQ, UNKNOWN, (int) V1DI_FTYPE_V1DI_V1DI }, @@ -18799,10 +18789,6 @@ static const struct builtin_description bdesc_args[] = /* PCLMUL */ { OPTION_MASK_ISA_SSE2, CODE_FOR_pclmulqdq, 0, IX86_BUILTIN_PCLMULQDQ128, UNKNOWN, (int) V2DI_FTYPE_V2DI_V2DI_INT }, - - /* 64bit */ - { OPTION_MASK_ISA_64BIT, CODE_FOR_abstf2, 0, IX86_BUILTIN_FABSQ, UNKNOWN, (int) FLOAT128_FTYPE_FLOAT128 }, - { OPTION_MASK_ISA_64BIT, CODE_FOR_copysigntf3, 0, IX86_BUILTIN_COPYSIGNQ, UNKNOWN, (int) FLOAT128_FTYPE_FLOAT128_FLOAT128 }, }; /* SSE5 */ @@ -19600,47 +19586,6 @@ ix86_init_mmx_sse_builtins (void) tree ftype; - /* The __float80 type. */ - if (TYPE_MODE (long_double_type_node) == XFmode) - (*lang_hooks.types.register_builtin_type) (long_double_type_node, - "__float80"); - else - { - /* The __float80 type. */ - tree float80_type_node = make_node (REAL_TYPE); - - TYPE_PRECISION (float80_type_node) = 80; - layout_type (float80_type_node); - (*lang_hooks.types.register_builtin_type) (float80_type_node, - "__float80"); - } - - if (TARGET_64BIT) - { - tree float128_type_node = make_node (REAL_TYPE); - - TYPE_PRECISION (float128_type_node) = 128; - layout_type (float128_type_node); - (*lang_hooks.types.register_builtin_type) (float128_type_node, - "__float128"); - - /* TFmode support builtins. */ - ftype = build_function_type (float128_type_node, - void_list_node); - def_builtin (OPTION_MASK_ISA_64BIT, "__builtin_infq", ftype, IX86_BUILTIN_INFQ); - - ftype = build_function_type_list (float128_type_node, - float128_type_node, - NULL_TREE); - def_builtin_const (OPTION_MASK_ISA_64BIT, "__builtin_fabsq", ftype, IX86_BUILTIN_FABSQ); - - ftype = build_function_type_list (float128_type_node, - float128_type_node, - float128_type_node, - NULL_TREE); - def_builtin_const (OPTION_MASK_ISA_64BIT, "__builtin_copysignq", ftype, IX86_BUILTIN_COPYSIGNQ); - } - /* Add all special builtins with variable number of operands. */ for (i = 0, d = bdesc_special_args; i < ARRAY_SIZE (bdesc_special_args); @@ -20246,6 +20191,52 @@ ix86_init_mmx_sse_builtins (void) static void ix86_init_builtins (void) { + tree float128_type_node = make_node (REAL_TYPE); + tree ftype, decl; + + /* The __float80 type. */ + if (TYPE_MODE (long_double_type_node) == XFmode) + (*lang_hooks.types.register_builtin_type) (long_double_type_node, + "__float80"); + else + { + /* The __float80 type. */ + tree float80_type_node = make_node (REAL_TYPE); + + TYPE_PRECISION (float80_type_node) = 80; + layout_type (float80_type_node); + (*lang_hooks.types.register_builtin_type) (float80_type_node, + "__float80"); + } + + /* The __float128 type. */ + TYPE_PRECISION (float128_type_node) = 128; + layout_type (float128_type_node); + (*lang_hooks.types.register_builtin_type) (float128_type_node, + "__float128"); + + /* TFmode support builtins. */ + ftype = build_function_type (float128_type_node, void_list_node); + decl = add_builtin_function ("__builtin_infq", ftype, + IX86_BUILTIN_INFQ, BUILT_IN_MD, + NULL, NULL_TREE); + ix86_builtins[(int) IX86_BUILTIN_INFQ] = decl; + + if (HOST_BITS_PER_WIDE_INT >= 64) + { + /* Those builtins need TImode to compile. */ + ftype = build_function_type_list (float128_type_node, + float128_type_node, + NULL_TREE); + def_builtin_const (OPTION_MASK_ISA_SSE2, "__builtin_fabsq", ftype, IX86_BUILTIN_FABSQ); + + ftype = build_function_type_list (float128_type_node, + float128_type_node, + float128_type_node, + NULL_TREE); + def_builtin_const (OPTION_MASK_ISA_SSE2, "__builtin_copysignq", ftype, IX86_BUILTIN_COPYSIGNQ); + } + if (TARGET_MMX) ix86_init_mmx_sse_builtins (); } @@ -22967,11 +22958,11 @@ machopic_output_stub (FILE *file, const char *symb, const char *stub) symb = (*targetm.strip_name_encoding) (symb); length = strlen (stub); - binder_name = alloca (length + 32); + binder_name = XALLOCAVEC (char, length + 32); GEN_BINDER_NAME_FOR_STUB (binder_name, stub, length); length = strlen (symb); - symbol_name = alloca (length + 32); + symbol_name = XALLOCAVEC (char, length + 32); GEN_SYMBOL_NAME_FOR_SYMBOL (symbol_name, symb, length); sprintf (lazy_ptr_name, "L%d$lz", label); @@ -24702,7 +24693,7 @@ ix86_scalar_mode_supported_p (enum machine_mode mode) if (DECIMAL_FLOAT_MODE_P (mode)) return true; else if (mode == TFmode) - return TARGET_64BIT; + return true; else return default_scalar_mode_supported_p (mode); } @@ -24726,9 +24717,9 @@ ix86_vector_mode_supported_p (enum machine_mode mode) static enum machine_mode ix86_c_mode_for_suffix (char suffix) { - if (TARGET_64BIT && suffix == 'q') + if (suffix == 'q') return TFmode; - if (TARGET_MMX && suffix == 'w') + if (suffix == 'w') return XFmode; return VOIDmode; diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index f6e0f4b12b2..c67cf467bc9 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -597,7 +597,7 @@ (define_mode_attr r [(QI "q") (HI "r") (SI "r") (DI "r")]) ;; Immediate operand constraint for integer modes. -(define_mode_attr i [(QI "i") (HI "i") (SI "i") (DI "e")]) +(define_mode_attr i [(QI "n") (HI "n") (SI "i") (DI "e")]) ;; General operand predicate for integer modes. (define_mode_attr general_operand @@ -725,7 +725,7 @@ (define_insn "cmpdi_ccno_1_rex64" [(set (reg FLAGS_REG) (compare (match_operand:DI 0 "nonimmediate_operand" "r,?mr") - (match_operand:DI 1 "const0_operand" "n,n")))] + (match_operand:DI 1 "const0_operand" "")))] "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)" "@ test{q}\t%0, %0 @@ -764,7 +764,7 @@ (define_insn "*cmpsi_ccno_1" [(set (reg FLAGS_REG) (compare (match_operand:SI 0 "nonimmediate_operand" "r,?mr") - (match_operand:SI 1 "const0_operand" "n,n")))] + (match_operand:SI 1 "const0_operand" "")))] "ix86_match_ccmode (insn, CCNOmode)" "@ test{l}\t%0, %0 @@ -803,7 +803,7 @@ (define_insn "*cmphi_ccno_1" [(set (reg FLAGS_REG) (compare (match_operand:HI 0 "nonimmediate_operand" "r,?mr") - (match_operand:HI 1 "const0_operand" "n,n")))] + (match_operand:HI 1 "const0_operand" "")))] "ix86_match_ccmode (insn, CCNOmode)" "@ test{w}\t%0, %0 @@ -815,7 +815,7 @@ (define_insn "*cmphi_minus_1" [(set (reg FLAGS_REG) (compare (minus:HI (match_operand:HI 0 "nonimmediate_operand" "rm,r") - (match_operand:HI 1 "general_operand" "ri,mr")) + (match_operand:HI 1 "general_operand" "rn,mr")) (const_int 0)))] "ix86_match_ccmode (insn, CCGOCmode)" "cmp{w}\t{%1, %0|%0, %1}" @@ -825,7 +825,7 @@ (define_insn "*cmphi_1" [(set (reg FLAGS_REG) (compare (match_operand:HI 0 "nonimmediate_operand" "rm,r") - (match_operand:HI 1 "general_operand" "ri,mr")))] + (match_operand:HI 1 "general_operand" "rn,mr")))] "!(MEM_P (operands[0]) && MEM_P (operands[1])) && ix86_match_ccmode (insn, CCmode)" "cmp{w}\t{%1, %0|%0, %1}" @@ -835,7 +835,7 @@ (define_insn "*cmpqi_ccno_1" [(set (reg FLAGS_REG) (compare (match_operand:QI 0 "nonimmediate_operand" "q,?mq") - (match_operand:QI 1 "const0_operand" "n,n")))] + (match_operand:QI 1 "const0_operand" "")))] "ix86_match_ccmode (insn, CCNOmode)" "@ test{b}\t%0, %0 @@ -847,7 +847,7 @@ (define_insn "*cmpqi_1" [(set (reg FLAGS_REG) (compare (match_operand:QI 0 "nonimmediate_operand" "qm,q") - (match_operand:QI 1 "general_operand" "qi,mq")))] + (match_operand:QI 1 "general_operand" "qn,mq")))] "!(MEM_P (operands[0]) && MEM_P (operands[1])) && ix86_match_ccmode (insn, CCmode)" "cmp{b}\t{%1, %0|%0, %1}" @@ -857,7 +857,7 @@ (define_insn "*cmpqi_minus_1" [(set (reg FLAGS_REG) (compare (minus:QI (match_operand:QI 0 "nonimmediate_operand" "qm,q") - (match_operand:QI 1 "general_operand" "qi,mq")) + (match_operand:QI 1 "general_operand" "qn,mq")) (const_int 0)))] "ix86_match_ccmode (insn, CCGOCmode)" "cmp{b}\t{%1, %0|%0, %1}" @@ -900,7 +900,7 @@ (match_operand 0 "ext_register_operand" "Q") (const_int 8) (const_int 8)) 0) - (match_operand:QI 1 "const0_operand" "n")))] + (match_operand:QI 1 "const0_operand" "")))] "ix86_match_ccmode (insn, CCNOmode)" "test{b}\t%h0, %h0" [(set_attr "type" "test") @@ -1006,7 +1006,7 @@ (unspec:HI [(compare:CCFP (match_operand 1 "register_operand" "f") - (match_operand 2 "const0_operand" "X"))] + (match_operand 2 "const0_operand" ""))] UNSPEC_FNSTSW))] "X87_FLOAT_MODE_P (GET_MODE (operands[1])) && GET_MODE (operands[1]) == GET_MODE (operands[2])" @@ -1025,7 +1025,7 @@ [(set (reg:CCFP FLAGS_REG) (compare:CCFP (match_operand 1 "register_operand" "f") - (match_operand 2 "const0_operand" "X"))) + (match_operand 2 "const0_operand" ""))) (clobber (match_operand:HI 0 "register_operand" "=a"))] "X87_FLOAT_MODE_P (GET_MODE (operands[1])) && TARGET_SAHF && !TARGET_CMOVE @@ -1415,7 +1415,7 @@ (define_insn "*movsi_xor" [(set (match_operand:SI 0 "register_operand" "=r") - (match_operand:SI 1 "const0_operand" "i")) + (match_operand:SI 1 "const0_operand" "")) (clobber (reg:CC FLAGS_REG))] "reload_completed && (!TARGET_USE_MOV0 || optimize_size)" "xor{l}\t%0, %0" @@ -1440,9 +1440,9 @@ (define_insn "*movsi_1" [(set (match_operand:SI 0 "nonimmediate_operand" - "=r ,m ,*y,*y,?rm,?*y,*x,*x,?r ,m ,?*Yi,*x") + "=r,m ,*y,*y,?rm,?*y,*x,*x,?r ,m ,?*Yi,*x") (match_operand:SI 1 "general_operand" - "rinm,rin,C ,*y,*y ,rm ,C ,*x,*Yi,*x,r ,m "))] + "g ,ri,C ,*y,*y ,rm ,C ,*x,*Yi,*x,r ,m "))] "!(MEM_P (operands[0]) && MEM_P (operands[1]))" { switch (get_attr_type (insn)) @@ -1571,7 +1571,7 @@ ;; For 64BIT abi we always round up to 8 bytes. (define_insn "*pushhi2_rex64" [(set (match_operand:HI 0 "push_operand" "=X") - (match_operand:HI 1 "nonmemory_no_elim_operand" "ri"))] + (match_operand:HI 1 "nonmemory_no_elim_operand" "rn"))] "TARGET_64BIT" "push{q}\t%q1" [(set_attr "type" "push") @@ -1706,7 +1706,7 @@ (define_insn "*movstricthi_xor" [(set (strict_low_part (match_operand:HI 0 "register_operand" "+r")) - (match_operand:HI 1 "const0_operand" "i")) + (match_operand:HI 1 "const0_operand" "")) (clobber (reg:CC FLAGS_REG))] "reload_completed && ((!TARGET_USE_MOV0 && !TARGET_PARTIAL_REG_STALL) || optimize_size)" @@ -1736,7 +1736,7 @@ ;; For 64BIT abi we always round up to 8 bytes. (define_insn "*pushqi2_rex64" [(set (match_operand:QI 0 "push_operand" "=X") - (match_operand:QI 1 "nonmemory_no_elim_operand" "qi"))] + (match_operand:QI 1 "nonmemory_no_elim_operand" "qn"))] "TARGET_64BIT" "push{q}\t%q1" [(set_attr "type" "push") @@ -1863,7 +1863,7 @@ (define_insn "*movstrictqi_xor" [(set (strict_low_part (match_operand:QI 0 "q_regs_operand" "+q")) - (match_operand:QI 1 "const0_operand" "i")) + (match_operand:QI 1 "const0_operand" "")) (clobber (reg:CC FLAGS_REG))] "reload_completed && (!TARGET_USE_MOV0 || optimize_size)" "xor{b}\t%0, %0" @@ -2189,7 +2189,7 @@ (define_insn "*movdi_xor_rex64" [(set (match_operand:DI 0 "register_operand" "=r") - (match_operand:DI 1 "const0_operand" "i")) + (match_operand:DI 1 "const0_operand" "")) (clobber (reg:CC FLAGS_REG))] "TARGET_64BIT && (!TARGET_USE_MOV0 || optimize_size) && reload_completed" @@ -2464,7 +2464,7 @@ (const_string "TI")))]) (define_insn "*movti_rex64" - [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o,x,x,xm") + [(set (match_operand:TI 0 "nonimmediate_operand" "=!r,o,x,x,xm") (match_operand:TI 1 "general_operand" "riFo,riF,C,xm,x"))] "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))" @@ -3261,7 +3261,7 @@ (define_expand "movtf" [(set (match_operand:TF 0 "nonimmediate_operand" "") (match_operand:TF 1 "nonimmediate_operand" ""))] - "TARGET_64BIT" + "TARGET_SSE2" { ix86_expand_move (TFmode, operands); DONE; @@ -3270,7 +3270,7 @@ (define_insn "*movtf_internal" [(set (match_operand:TF 0 "nonimmediate_operand" "=x,m,x,?r,?o") (match_operand:TF 1 "general_operand" "xm,x,C,roF,Fr"))] - "TARGET_64BIT + "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))" { switch (which_alternative) @@ -5462,8 +5462,7 @@ (define_expand "addti3" [(set (match_operand:TI 0 "nonimmediate_operand" "") (plus:TI (match_operand:TI 1 "nonimmediate_operand" "") - (match_operand:TI 2 "x86_64_general_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:TI 2 "x86_64_general_operand" "")))] "TARGET_64BIT" "ix86_expand_binary_operator (PLUS, TImode, operands); DONE;") @@ -5499,8 +5498,7 @@ (define_expand "adddi3" [(set (match_operand:DI 0 "nonimmediate_operand" "") (plus:DI (match_operand:DI 1 "nonimmediate_operand" "") - (match_operand:DI 2 "x86_64_general_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:DI 2 "x86_64_general_operand" "")))] "" "ix86_expand_binary_operator (PLUS, DImode, operands); DONE;") @@ -5606,7 +5604,7 @@ [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q") (plus:QI (plus:QI (match_operand:QI 3 "ix86_carry_flag_operator" "") (match_operand:QI 1 "nonimmediate_operand" "%0,0")) - (match_operand:QI 2 "general_operand" "qi,qm"))) + (match_operand:QI 2 "general_operand" "qn,qm"))) (clobber (reg:CC FLAGS_REG))] "ix86_binary_operator_ok (PLUS, QImode, operands)" "adc{b}\t{%2, %0|%0, %2}" @@ -5618,7 +5616,7 @@ [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r") (plus:HI (plus:HI (match_operand:HI 3 "ix86_carry_flag_operator" "") (match_operand:HI 1 "nonimmediate_operand" "%0,0")) - (match_operand:HI 2 "general_operand" "ri,rm"))) + (match_operand:HI 2 "general_operand" "rn,rm"))) (clobber (reg:CC FLAGS_REG))] "ix86_binary_operator_ok (PLUS, HImode, operands)" "adc{w}\t{%2, %0|%0, %2}" @@ -5666,7 +5664,7 @@ (define_insn "addqi3_cc" [(set (reg:CC FLAGS_REG) (unspec:CC [(match_operand:QI 1 "nonimmediate_operand" "%0,0") - (match_operand:QI 2 "general_operand" "qi,qm")] + (match_operand:QI 2 "general_operand" "qn,qm")] UNSPEC_ADD_CARRY)) (set (match_operand:QI 0 "nonimmediate_operand" "=qm,q") (plus:QI (match_dup 1) (match_dup 2)))] @@ -5676,10 +5674,9 @@ (set_attr "mode" "QI")]) (define_expand "addsi3" - [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "") - (plus:SI (match_operand:SI 1 "nonimmediate_operand" "") - (match_operand:SI 2 "general_operand" ""))) - (clobber (reg:CC FLAGS_REG))])] + [(set (match_operand:SI 0 "nonimmediate_operand" "") + (plus:SI (match_operand:SI 1 "nonimmediate_operand" "") + (match_operand:SI 2 "general_operand" "")))] "" "ix86_expand_binary_operator (PLUS, SImode, operands); DONE;") @@ -6144,7 +6141,7 @@ (define_insn "*addsi_1" [(set (match_operand:SI 0 "nonimmediate_operand" "=r,rm,r") (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,r") - (match_operand:SI 2 "general_operand" "rmni,rni,lni"))) + (match_operand:SI 2 "general_operand" "g,ri,li"))) (clobber (reg:CC FLAGS_REG))] "ix86_binary_operator_ok (PLUS, SImode, operands)" { @@ -6228,7 +6225,7 @@ [(set (match_operand:DI 0 "register_operand" "=r,r") (zero_extend:DI (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,r") - (match_operand:SI 2 "general_operand" "rmni,lni")))) + (match_operand:SI 2 "general_operand" "g,li")))) (clobber (reg:CC FLAGS_REG))] "TARGET_64BIT && ix86_binary_operator_ok (PLUS, SImode, operands)" { @@ -6294,7 +6291,7 @@ [(set (reg FLAGS_REG) (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0") - (match_operand:SI 2 "general_operand" "rmni,rni")) + (match_operand:SI 2 "general_operand" "g,ri")) (const_int 0))) (set (match_operand:SI 0 "nonimmediate_operand" "=r,rm") (plus:SI (match_dup 1) (match_dup 2)))] @@ -6342,7 +6339,7 @@ [(set (reg FLAGS_REG) (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0") - (match_operand:SI 2 "general_operand" "rmni")) + (match_operand:SI 2 "general_operand" "g")) (const_int 0))) (set (match_operand:DI 0 "register_operand" "=r") (zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))] @@ -6385,7 +6382,7 @@ (define_insn "*addsi_3" [(set (reg FLAGS_REG) - (compare (neg:SI (match_operand:SI 2 "general_operand" "rmni")) + (compare (neg:SI (match_operand:SI 2 "general_operand" "g")) (match_operand:SI 1 "nonimmediate_operand" "%0"))) (clobber (match_scratch:SI 0 "=r"))] "ix86_match_ccmode (insn, CCZmode) @@ -6430,7 +6427,7 @@ ;; See comment for addsi_1_zext why we do use nonimmediate_operand (define_insn "*addsi_3_zext" [(set (reg FLAGS_REG) - (compare (neg:SI (match_operand:SI 2 "general_operand" "rmni")) + (compare (neg:SI (match_operand:SI 2 "general_operand" "g")) (match_operand:SI 1 "nonimmediate_operand" "%0"))) (set (match_operand:DI 0 "register_operand" "=r") (zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))] @@ -6520,7 +6517,7 @@ [(set (reg FLAGS_REG) (compare (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0") - (match_operand:SI 2 "general_operand" "rmni")) + (match_operand:SI 2 "general_operand" "g")) (const_int 0))) (clobber (match_scratch:SI 0 "=r"))] "ix86_match_ccmode (insn, CCGOCmode) @@ -6563,10 +6560,9 @@ (set_attr "mode" "SI")]) (define_expand "addhi3" - [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "") - (plus:HI (match_operand:HI 1 "nonimmediate_operand" "") - (match_operand:HI 2 "general_operand" ""))) - (clobber (reg:CC FLAGS_REG))])] + [(set (match_operand:HI 0 "nonimmediate_operand" "") + (plus:HI (match_operand:HI 1 "nonimmediate_operand" "") + (match_operand:HI 2 "general_operand" "")))] "TARGET_HIMODE_MATH" "ix86_expand_binary_operator (PLUS, HImode, operands); DONE;") @@ -6577,7 +6573,7 @@ (define_insn "*addhi_1_lea" [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r,r") (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,r") - (match_operand:HI 2 "general_operand" "ri,rm,lni"))) + (match_operand:HI 2 "general_operand" "rn,rm,ln"))) (clobber (reg:CC FLAGS_REG))] "!TARGET_PARTIAL_REG_STALL && ix86_binary_operator_ok (PLUS, HImode, operands)" @@ -6620,7 +6616,7 @@ (define_insn "*addhi_1" [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r") (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0") - (match_operand:HI 2 "general_operand" "ri,rm"))) + (match_operand:HI 2 "general_operand" "rn,rm"))) (clobber (reg:CC FLAGS_REG))] "TARGET_PARTIAL_REG_STALL && ix86_binary_operator_ok (PLUS, HImode, operands)" @@ -6660,7 +6656,7 @@ [(set (reg FLAGS_REG) (compare (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0") - (match_operand:HI 2 "general_operand" "rmni,rni")) + (match_operand:HI 2 "general_operand" "rmn,rn")) (const_int 0))) (set (match_operand:HI 0 "nonimmediate_operand" "=r,rm") (plus:HI (match_dup 1) (match_dup 2)))] @@ -6700,7 +6696,7 @@ (define_insn "*addhi_3" [(set (reg FLAGS_REG) - (compare (neg:HI (match_operand:HI 2 "general_operand" "rmni")) + (compare (neg:HI (match_operand:HI 2 "general_operand" "rmn")) (match_operand:HI 1 "nonimmediate_operand" "%0"))) (clobber (match_scratch:HI 0 "=r"))] "ix86_match_ccmode (insn, CCZmode) @@ -6780,7 +6776,7 @@ [(set (reg FLAGS_REG) (compare (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0") - (match_operand:HI 2 "general_operand" "rmni")) + (match_operand:HI 2 "general_operand" "rmn")) (const_int 0))) (clobber (match_scratch:HI 0 "=r"))] "ix86_match_ccmode (insn, CCGOCmode) @@ -6818,10 +6814,9 @@ (set_attr "mode" "HI")]) (define_expand "addqi3" - [(parallel [(set (match_operand:QI 0 "nonimmediate_operand" "") - (plus:QI (match_operand:QI 1 "nonimmediate_operand" "") - (match_operand:QI 2 "general_operand" ""))) - (clobber (reg:CC FLAGS_REG))])] + [(set (match_operand:QI 0 "nonimmediate_operand" "") + (plus:QI (match_operand:QI 1 "nonimmediate_operand" "") + (match_operand:QI 2 "general_operand" "")))] "TARGET_QIMODE_MATH" "ix86_expand_binary_operator (PLUS, QImode, operands); DONE;") @@ -6966,7 +6961,7 @@ [(set (reg FLAGS_REG) (compare (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0") - (match_operand:QI 2 "general_operand" "qmni,qni")) + (match_operand:QI 2 "general_operand" "qmn,qn")) (const_int 0))) (set (match_operand:QI 0 "nonimmediate_operand" "=q,qm") (plus:QI (match_dup 1) (match_dup 2)))] @@ -7005,7 +7000,7 @@ (define_insn "*addqi_3" [(set (reg FLAGS_REG) - (compare (neg:QI (match_operand:QI 2 "general_operand" "qmni")) + (compare (neg:QI (match_operand:QI 2 "general_operand" "qmn")) (match_operand:QI 1 "nonimmediate_operand" "%0"))) (clobber (match_scratch:QI 0 "=q"))] "ix86_match_ccmode (insn, CCZmode) @@ -7084,7 +7079,7 @@ [(set (reg FLAGS_REG) (compare (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0") - (match_operand:QI 2 "general_operand" "qmni")) + (match_operand:QI 2 "general_operand" "qmn")) (const_int 0))) (clobber (match_scratch:QI 0 "=q"))] "ix86_match_ccmode (insn, CCGOCmode) @@ -7233,10 +7228,9 @@ ;; %%% splits for subditi3 (define_expand "subti3" - [(parallel [(set (match_operand:TI 0 "nonimmediate_operand" "") - (minus:TI (match_operand:TI 1 "nonimmediate_operand" "") - (match_operand:TI 2 "x86_64_general_operand" ""))) - (clobber (reg:CC FLAGS_REG))])] + [(set (match_operand:TI 0 "nonimmediate_operand" "") + (minus:TI (match_operand:TI 1 "nonimmediate_operand" "") + (match_operand:TI 2 "x86_64_general_operand" "")))] "TARGET_64BIT" "ix86_expand_binary_operator (MINUS, TImode, operands); DONE;") @@ -7266,10 +7260,9 @@ ;; %%% splits for subsidi3 (define_expand "subdi3" - [(parallel [(set (match_operand:DI 0 "nonimmediate_operand" "") - (minus:DI (match_operand:DI 1 "nonimmediate_operand" "") - (match_operand:DI 2 "x86_64_general_operand" ""))) - (clobber (reg:CC FLAGS_REG))])] + [(set (match_operand:DI 0 "nonimmediate_operand" "") + (minus:DI (match_operand:DI 1 "nonimmediate_operand" "") + (match_operand:DI 2 "x86_64_general_operand" "")))] "" "ix86_expand_binary_operator (MINUS, DImode, operands); DONE;") @@ -7348,7 +7341,7 @@ [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q") (minus:QI (match_operand:QI 1 "nonimmediate_operand" "0,0") (plus:QI (match_operand:QI 3 "ix86_carry_flag_operator" "") - (match_operand:QI 2 "general_operand" "qi,qm")))) + (match_operand:QI 2 "general_operand" "qn,qm")))) (clobber (reg:CC FLAGS_REG))] "ix86_binary_operator_ok (MINUS, QImode, operands)" "sbb{b}\t{%2, %0|%0, %2}" @@ -7360,7 +7353,7 @@ [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r") (minus:HI (match_operand:HI 1 "nonimmediate_operand" "0,0") (plus:HI (match_operand:HI 3 "ix86_carry_flag_operator" "") - (match_operand:HI 2 "general_operand" "ri,rm")))) + (match_operand:HI 2 "general_operand" "rn,rm")))) (clobber (reg:CC FLAGS_REG))] "ix86_binary_operator_ok (MINUS, HImode, operands)" "sbb{w}\t{%2, %0|%0, %2}" @@ -7394,10 +7387,9 @@ (set_attr "mode" "SI")]) (define_expand "subsi3" - [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "") - (minus:SI (match_operand:SI 1 "nonimmediate_operand" "") - (match_operand:SI 2 "general_operand" ""))) - (clobber (reg:CC FLAGS_REG))])] + [(set (match_operand:SI 0 "nonimmediate_operand" "") + (minus:SI (match_operand:SI 1 "nonimmediate_operand" "") + (match_operand:SI 2 "general_operand" "")))] "" "ix86_expand_binary_operator (MINUS, SImode, operands); DONE;") @@ -7479,17 +7471,16 @@ (set_attr "mode" "DI")]) (define_expand "subhi3" - [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "") - (minus:HI (match_operand:HI 1 "nonimmediate_operand" "") - (match_operand:HI 2 "general_operand" ""))) - (clobber (reg:CC FLAGS_REG))])] + [(set (match_operand:HI 0 "nonimmediate_operand" "") + (minus:HI (match_operand:HI 1 "nonimmediate_operand" "") + (match_operand:HI 2 "general_operand" "")))] "TARGET_HIMODE_MATH" "ix86_expand_binary_operator (MINUS, HImode, operands); DONE;") (define_insn "*subhi_1" [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r") (minus:HI (match_operand:HI 1 "nonimmediate_operand" "0,0") - (match_operand:HI 2 "general_operand" "ri,rm"))) + (match_operand:HI 2 "general_operand" "rn,rm"))) (clobber (reg:CC FLAGS_REG))] "ix86_binary_operator_ok (MINUS, HImode, operands)" "sub{w}\t{%2, %0|%0, %2}" @@ -7500,7 +7491,7 @@ [(set (reg FLAGS_REG) (compare (minus:HI (match_operand:HI 1 "nonimmediate_operand" "0,0") - (match_operand:HI 2 "general_operand" "ri,rm")) + (match_operand:HI 2 "general_operand" "rn,rm")) (const_int 0))) (set (match_operand:HI 0 "nonimmediate_operand" "=rm,r") (minus:HI (match_dup 1) (match_dup 2)))] @@ -7513,7 +7504,7 @@ (define_insn "*subhi_3" [(set (reg FLAGS_REG) (compare (match_operand:HI 1 "nonimmediate_operand" "0,0") - (match_operand:HI 2 "general_operand" "ri,rm"))) + (match_operand:HI 2 "general_operand" "rn,rm"))) (set (match_operand:HI 0 "nonimmediate_operand" "=rm,r") (minus:HI (match_dup 1) (match_dup 2)))] "ix86_match_ccmode (insn, CCmode) @@ -7523,17 +7514,16 @@ (set_attr "mode" "HI")]) (define_expand "subqi3" - [(parallel [(set (match_operand:QI 0 "nonimmediate_operand" "") - (minus:QI (match_operand:QI 1 "nonimmediate_operand" "") - (match_operand:QI 2 "general_operand" ""))) - (clobber (reg:CC FLAGS_REG))])] + [(set (match_operand:QI 0 "nonimmediate_operand" "") + (minus:QI (match_operand:QI 1 "nonimmediate_operand" "") + (match_operand:QI 2 "general_operand" "")))] "TARGET_QIMODE_MATH" "ix86_expand_binary_operator (MINUS, QImode, operands); DONE;") (define_insn "*subqi_1" [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q") (minus:QI (match_operand:QI 1 "nonimmediate_operand" "0,0") - (match_operand:QI 2 "general_operand" "qn,qmn"))) + (match_operand:QI 2 "general_operand" "qn,qm"))) (clobber (reg:CC FLAGS_REG))] "ix86_binary_operator_ok (MINUS, QImode, operands)" "sub{b}\t{%2, %0|%0, %2}" @@ -7543,7 +7533,7 @@ (define_insn "*subqi_1_slp" [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q")) (minus:QI (match_dup 0) - (match_operand:QI 1 "general_operand" "qn,qmn"))) + (match_operand:QI 1 "general_operand" "qn,qm"))) (clobber (reg:CC FLAGS_REG))] "(! TARGET_PARTIAL_REG_STALL || optimize_size) && !(MEM_P (operands[0]) && MEM_P (operands[1]))" @@ -7555,10 +7545,10 @@ [(set (reg FLAGS_REG) (compare (minus:QI (match_operand:QI 1 "nonimmediate_operand" "0,0") - (match_operand:QI 2 "general_operand" "qi,qm")) + (match_operand:QI 2 "general_operand" "qn,qm")) (const_int 0))) - (set (match_operand:HI 0 "nonimmediate_operand" "=qm,q") - (minus:HI (match_dup 1) (match_dup 2)))] + (set (match_operand:QI 0 "nonimmediate_operand" "=qm,q") + (minus:QI (match_dup 1) (match_dup 2)))] "ix86_match_ccmode (insn, CCGOCmode) && ix86_binary_operator_ok (MINUS, QImode, operands)" "sub{b}\t{%2, %0|%0, %2}" @@ -7568,9 +7558,9 @@ (define_insn "*subqi_3" [(set (reg FLAGS_REG) (compare (match_operand:QI 1 "nonimmediate_operand" "0,0") - (match_operand:QI 2 "general_operand" "qi,qm"))) - (set (match_operand:HI 0 "nonimmediate_operand" "=qm,q") - (minus:HI (match_dup 1) (match_dup 2)))] + (match_operand:QI 2 "general_operand" "qn,qm"))) + (set (match_operand:QI 0 "nonimmediate_operand" "=qm,q") + (minus:QI (match_dup 1) (match_dup 2)))] "ix86_match_ccmode (insn, CCmode) && ix86_binary_operator_ok (MINUS, QImode, operands)" "sub{b}\t{%2, %0|%0, %2}" @@ -7732,7 +7722,7 @@ (define_insn "*mulhi3_1" [(set (match_operand:HI 0 "register_operand" "=r,r,r") (mult:HI (match_operand:HI 1 "nonimmediate_operand" "%rm,rm,0") - (match_operand:HI 2 "general_operand" "K,i,mr"))) + (match_operand:HI 2 "general_operand" "K,n,mr"))) (clobber (reg:CC FLAGS_REG))] "!(MEM_P (operands[1]) && MEM_P (operands[2]))" "@ @@ -8543,7 +8533,7 @@ [(set (reg FLAGS_REG) (compare (and:SI (match_operand:SI 0 "nonimmediate_operand" "%!*a,r,rm") - (match_operand:SI 1 "general_operand" "in,in,rin")) + (match_operand:SI 1 "general_operand" "i,i,ri")) (const_int 0)))] "ix86_match_ccmode (insn, CCNOmode) && !(MEM_P (operands[0]) && MEM_P (operands[1]))" @@ -8849,8 +8839,7 @@ (define_expand "anddi3" [(set (match_operand:DI 0 "nonimmediate_operand" "") (and:DI (match_operand:DI 1 "nonimmediate_operand" "") - (match_operand:DI 2 "x86_64_szext_general_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:DI 2 "x86_64_szext_general_operand" "")))] "TARGET_64BIT" "ix86_expand_binary_operator (AND, DImode, operands); DONE;") @@ -8914,8 +8903,7 @@ (define_expand "andsi3" [(set (match_operand:SI 0 "nonimmediate_operand" "") (and:SI (match_operand:SI 1 "nonimmediate_operand" "") - (match_operand:SI 2 "general_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:SI 2 "general_operand" "")))] "" "ix86_expand_binary_operator (AND, SImode, operands); DONE;") @@ -9036,15 +9024,14 @@ (define_expand "andhi3" [(set (match_operand:HI 0 "nonimmediate_operand" "") (and:HI (match_operand:HI 1 "nonimmediate_operand" "") - (match_operand:HI 2 "general_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:HI 2 "general_operand" "")))] "TARGET_HIMODE_MATH" "ix86_expand_binary_operator (AND, HImode, operands); DONE;") (define_insn "*andhi_1" [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r,r") (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,qm") - (match_operand:HI 2 "general_operand" "ri,rm,L"))) + (match_operand:HI 2 "general_operand" "rn,rm,L"))) (clobber (reg:CC FLAGS_REG))] "ix86_binary_operator_ok (AND, HImode, operands)" { @@ -9068,7 +9055,7 @@ (define_insn "*andhi_2" [(set (reg FLAGS_REG) (compare (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0") - (match_operand:HI 2 "general_operand" "g,ri")) + (match_operand:HI 2 "general_operand" "rmn,rn")) (const_int 0))) (set (match_operand:HI 0 "nonimmediate_operand" "=r,rm") (and:HI (match_dup 1) (match_dup 2)))] @@ -9081,8 +9068,7 @@ (define_expand "andqi3" [(set (match_operand:QI 0 "nonimmediate_operand" "") (and:QI (match_operand:QI 1 "nonimmediate_operand" "") - (match_operand:QI 2 "general_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:QI 2 "general_operand" "")))] "TARGET_QIMODE_MATH" "ix86_expand_binary_operator (AND, QImode, operands); DONE;") @@ -9090,7 +9076,7 @@ (define_insn "*andqi_1" [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q,r") (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0") - (match_operand:QI 2 "general_operand" "qi,qmi,ri"))) + (match_operand:QI 2 "general_operand" "qn,qmn,rn"))) (clobber (reg:CC FLAGS_REG))] "ix86_binary_operator_ok (AND, QImode, operands)" "@ @@ -9103,7 +9089,7 @@ (define_insn "*andqi_1_slp" [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q")) (and:QI (match_dup 0) - (match_operand:QI 1 "general_operand" "qi,qmi"))) + (match_operand:QI 1 "general_operand" "qn,qmn"))) (clobber (reg:CC FLAGS_REG))] "(! TARGET_PARTIAL_REG_STALL || optimize_size) && !(MEM_P (operands[0]) && MEM_P (operands[1]))" @@ -9115,7 +9101,7 @@ [(set (reg FLAGS_REG) (compare (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0") - (match_operand:QI 2 "general_operand" "qim,qi,i")) + (match_operand:QI 2 "general_operand" "qmn,qn,n")) (const_int 0))) (set (match_operand:QI 0 "nonimmediate_operand" "=q,qm,*r") (and:QI (match_dup 1) (match_dup 2)))] @@ -9139,7 +9125,7 @@ [(set (reg FLAGS_REG) (compare (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0") - (match_operand:QI 2 "general_operand" "qim,qi")) + (match_operand:QI 2 "general_operand" "qmn,qn")) (const_int 0))) (set (match_operand:QI 0 "nonimmediate_operand" "=q,qm") (and:QI (match_dup 1) (match_dup 2)))] @@ -9153,7 +9139,7 @@ [(set (reg FLAGS_REG) (compare (and:QI (match_operand:QI 0 "nonimmediate_operand" "+q,qm") - (match_operand:QI 1 "nonimmediate_operand" "qmi,qi")) + (match_operand:QI 1 "nonimmediate_operand" "qmn,qn")) (const_int 0))) (set (strict_low_part (match_dup 0)) (and:QI (match_dup 0) (match_dup 1)))] @@ -9322,8 +9308,7 @@ (define_expand "iordi3" [(set (match_operand:DI 0 "nonimmediate_operand" "") (ior:DI (match_operand:DI 1 "nonimmediate_operand" "") - (match_operand:DI 2 "x86_64_general_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:DI 2 "x86_64_general_operand" "")))] "TARGET_64BIT" "ix86_expand_binary_operator (IOR, DImode, operands); DONE;") @@ -9369,8 +9354,7 @@ (define_expand "iorsi3" [(set (match_operand:SI 0 "nonimmediate_operand" "") (ior:SI (match_operand:SI 1 "nonimmediate_operand" "") - (match_operand:SI 2 "general_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:SI 2 "general_operand" "")))] "" "ix86_expand_binary_operator (IOR, SImode, operands); DONE;") @@ -9462,15 +9446,14 @@ (define_expand "iorhi3" [(set (match_operand:HI 0 "nonimmediate_operand" "") (ior:HI (match_operand:HI 1 "nonimmediate_operand" "") - (match_operand:HI 2 "general_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:HI 2 "general_operand" "")))] "TARGET_HIMODE_MATH" "ix86_expand_binary_operator (IOR, HImode, operands); DONE;") (define_insn "*iorhi_1" [(set (match_operand:HI 0 "nonimmediate_operand" "=r,m") (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0") - (match_operand:HI 2 "general_operand" "g,ri"))) + (match_operand:HI 2 "general_operand" "rmn,rn"))) (clobber (reg:CC FLAGS_REG))] "ix86_binary_operator_ok (IOR, HImode, operands)" "or{w}\t{%2, %0|%0, %2}" @@ -9480,7 +9463,7 @@ (define_insn "*iorhi_2" [(set (reg FLAGS_REG) (compare (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0") - (match_operand:HI 2 "general_operand" "g,ri")) + (match_operand:HI 2 "general_operand" "rmn,rn")) (const_int 0))) (set (match_operand:HI 0 "nonimmediate_operand" "=r,rm") (ior:HI (match_dup 1) (match_dup 2)))] @@ -9493,7 +9476,7 @@ (define_insn "*iorhi_3" [(set (reg FLAGS_REG) (compare (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0") - (match_operand:HI 2 "general_operand" "g")) + (match_operand:HI 2 "general_operand" "rmn")) (const_int 0))) (clobber (match_scratch:HI 0 "=r"))] "ix86_match_ccmode (insn, CCNOmode) @@ -9505,8 +9488,7 @@ (define_expand "iorqi3" [(set (match_operand:QI 0 "nonimmediate_operand" "") (ior:QI (match_operand:QI 1 "nonimmediate_operand" "") - (match_operand:QI 2 "general_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:QI 2 "general_operand" "")))] "TARGET_QIMODE_MATH" "ix86_expand_binary_operator (IOR, QImode, operands); DONE;") @@ -9514,7 +9496,7 @@ (define_insn "*iorqi_1" [(set (match_operand:QI 0 "nonimmediate_operand" "=q,m,r") (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0") - (match_operand:QI 2 "general_operand" "qmi,qi,ri"))) + (match_operand:QI 2 "general_operand" "qmn,qn,rn"))) (clobber (reg:CC FLAGS_REG))] "ix86_binary_operator_ok (IOR, QImode, operands)" "@ @@ -9527,7 +9509,7 @@ (define_insn "*iorqi_1_slp" [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+q,m")) (ior:QI (match_dup 0) - (match_operand:QI 1 "general_operand" "qmi,qi"))) + (match_operand:QI 1 "general_operand" "qmn,qn"))) (clobber (reg:CC FLAGS_REG))] "(! TARGET_PARTIAL_REG_STALL || optimize_size) && !(MEM_P (operands[0]) && MEM_P (operands[1]))" @@ -9538,7 +9520,7 @@ (define_insn "*iorqi_2" [(set (reg FLAGS_REG) (compare (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0") - (match_operand:QI 2 "general_operand" "qim,qi")) + (match_operand:QI 2 "general_operand" "qmn,qn")) (const_int 0))) (set (match_operand:QI 0 "nonimmediate_operand" "=q,qm") (ior:QI (match_dup 1) (match_dup 2)))] @@ -9551,7 +9533,7 @@ (define_insn "*iorqi_2_slp" [(set (reg FLAGS_REG) (compare (ior:QI (match_operand:QI 0 "nonimmediate_operand" "+q,qm") - (match_operand:QI 1 "general_operand" "qim,qi")) + (match_operand:QI 1 "general_operand" "qmn,qn")) (const_int 0))) (set (strict_low_part (match_dup 0)) (ior:QI (match_dup 0) (match_dup 1)))] @@ -9565,7 +9547,7 @@ (define_insn "*iorqi_3" [(set (reg FLAGS_REG) (compare (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0") - (match_operand:QI 2 "general_operand" "qim")) + (match_operand:QI 2 "general_operand" "qmn")) (const_int 0))) (clobber (match_scratch:QI 0 "=q"))] "ix86_match_ccmode (insn, CCNOmode) @@ -9695,8 +9677,7 @@ (define_expand "xordi3" [(set (match_operand:DI 0 "nonimmediate_operand" "") (xor:DI (match_operand:DI 1 "nonimmediate_operand" "") - (match_operand:DI 2 "x86_64_general_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:DI 2 "x86_64_general_operand" "")))] "TARGET_64BIT" "ix86_expand_binary_operator (XOR, DImode, operands); DONE;") @@ -9741,8 +9722,7 @@ (define_expand "xorsi3" [(set (match_operand:SI 0 "nonimmediate_operand" "") (xor:SI (match_operand:SI 1 "nonimmediate_operand" "") - (match_operand:SI 2 "general_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:SI 2 "general_operand" "")))] "" "ix86_expand_binary_operator (XOR, SImode, operands); DONE;") @@ -9835,15 +9815,14 @@ (define_expand "xorhi3" [(set (match_operand:HI 0 "nonimmediate_operand" "") (xor:HI (match_operand:HI 1 "nonimmediate_operand" "") - (match_operand:HI 2 "general_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:HI 2 "general_operand" "")))] "TARGET_HIMODE_MATH" "ix86_expand_binary_operator (XOR, HImode, operands); DONE;") (define_insn "*xorhi_1" [(set (match_operand:HI 0 "nonimmediate_operand" "=r,m") (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0") - (match_operand:HI 2 "general_operand" "g,ri"))) + (match_operand:HI 2 "general_operand" "rmn,rn"))) (clobber (reg:CC FLAGS_REG))] "ix86_binary_operator_ok (XOR, HImode, operands)" "xor{w}\t{%2, %0|%0, %2}" @@ -9853,7 +9832,7 @@ (define_insn "*xorhi_2" [(set (reg FLAGS_REG) (compare (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0") - (match_operand:HI 2 "general_operand" "g,ri")) + (match_operand:HI 2 "general_operand" "rmn,rn")) (const_int 0))) (set (match_operand:HI 0 "nonimmediate_operand" "=r,rm") (xor:HI (match_dup 1) (match_dup 2)))] @@ -9866,7 +9845,7 @@ (define_insn "*xorhi_3" [(set (reg FLAGS_REG) (compare (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0") - (match_operand:HI 2 "general_operand" "g")) + (match_operand:HI 2 "general_operand" "rmn")) (const_int 0))) (clobber (match_scratch:HI 0 "=r"))] "ix86_match_ccmode (insn, CCNOmode) @@ -9878,8 +9857,7 @@ (define_expand "xorqi3" [(set (match_operand:QI 0 "nonimmediate_operand" "") (xor:QI (match_operand:QI 1 "nonimmediate_operand" "") - (match_operand:QI 2 "general_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:QI 2 "general_operand" "")))] "TARGET_QIMODE_MATH" "ix86_expand_binary_operator (XOR, QImode, operands); DONE;") @@ -9887,7 +9865,7 @@ (define_insn "*xorqi_1" [(set (match_operand:QI 0 "nonimmediate_operand" "=q,m,r") (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0") - (match_operand:QI 2 "general_operand" "qmi,qi,ri"))) + (match_operand:QI 2 "general_operand" "qmn,qn,rn"))) (clobber (reg:CC FLAGS_REG))] "ix86_binary_operator_ok (XOR, QImode, operands)" "@ @@ -9900,7 +9878,7 @@ (define_insn "*xorqi_1_slp" [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q")) (xor:QI (match_dup 0) - (match_operand:QI 1 "general_operand" "qi,qmi"))) + (match_operand:QI 1 "general_operand" "qn,qmn"))) (clobber (reg:CC FLAGS_REG))] "(! TARGET_PARTIAL_REG_STALL || optimize_size) && !(MEM_P (operands[0]) && MEM_P (operands[1]))" @@ -9985,7 +9963,7 @@ [(set (reg FLAGS_REG) (compare (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0") - (match_operand:QI 2 "general_operand" "qim,qi")) + (match_operand:QI 2 "general_operand" "qmn,qn")) (const_int 0))) (set (match_operand:QI 0 "nonimmediate_operand" "=q,qm") (xor:QI (match_dup 1) (match_dup 2)))] @@ -9998,7 +9976,7 @@ (define_insn "*xorqi_2_slp" [(set (reg FLAGS_REG) (compare (xor:QI (match_operand:QI 0 "nonimmediate_operand" "+q,qm") - (match_operand:QI 1 "general_operand" "qim,qi")) + (match_operand:QI 1 "general_operand" "qmn,qn")) (const_int 0))) (set (strict_low_part (match_dup 0)) (xor:QI (match_dup 0) (match_dup 1)))] @@ -10013,7 +9991,7 @@ [(set (reg FLAGS_REG) (compare (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0") - (match_operand:QI 2 "general_operand" "qim")) + (match_operand:QI 2 "general_operand" "qmn")) (const_int 0))) (clobber (match_scratch:QI 0 "=q"))] "ix86_match_ccmode (insn, CCNOmode) @@ -10127,9 +10105,8 @@ ;; Negation instructions (define_expand "negti2" - [(parallel [(set (match_operand:TI 0 "nonimmediate_operand" "") - (neg:TI (match_operand:TI 1 "nonimmediate_operand" ""))) - (clobber (reg:CC FLAGS_REG))])] + [(set (match_operand:TI 0 "nonimmediate_operand" "") + (neg:TI (match_operand:TI 1 "nonimmediate_operand" "")))] "TARGET_64BIT" "ix86_expand_unary_operator (NEG, TImode, operands); DONE;") @@ -10163,9 +10140,8 @@ "split_ti (&operands[0], 2, &operands[0], &operands[2]);") (define_expand "negdi2" - [(parallel [(set (match_operand:DI 0 "nonimmediate_operand" "") - (neg:DI (match_operand:DI 1 "nonimmediate_operand" ""))) - (clobber (reg:CC FLAGS_REG))])] + [(set (match_operand:DI 0 "nonimmediate_operand" "") + (neg:DI (match_operand:DI 1 "nonimmediate_operand" "")))] "" "ix86_expand_unary_operator (NEG, DImode, operands); DONE;") @@ -10224,9 +10200,8 @@ (define_expand "negsi2" - [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "") - (neg:SI (match_operand:SI 1 "nonimmediate_operand" ""))) - (clobber (reg:CC FLAGS_REG))])] + [(set (match_operand:SI 0 "nonimmediate_operand" "") + (neg:SI (match_operand:SI 1 "nonimmediate_operand" "")))] "" "ix86_expand_unary_operator (NEG, SImode, operands); DONE;") @@ -10284,9 +10259,8 @@ (set_attr "mode" "SI")]) (define_expand "neghi2" - [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "") - (neg:HI (match_operand:HI 1 "nonimmediate_operand" ""))) - (clobber (reg:CC FLAGS_REG))])] + [(set (match_operand:HI 0 "nonimmediate_operand" "") + (neg:HI (match_operand:HI 1 "nonimmediate_operand" "")))] "TARGET_HIMODE_MATH" "ix86_expand_unary_operator (NEG, HImode, operands); DONE;") @@ -10311,9 +10285,8 @@ (set_attr "mode" "HI")]) (define_expand "negqi2" - [(parallel [(set (match_operand:QI 0 "nonimmediate_operand" "") - (neg:QI (match_operand:QI 1 "nonimmediate_operand" ""))) - (clobber (reg:CC FLAGS_REG))])] + [(set (match_operand:QI 0 "nonimmediate_operand" "") + (neg:QI (match_operand:QI 1 "nonimmediate_operand" "")))] "TARGET_QIMODE_MATH" "ix86_expand_unary_operator (NEG, QImode, operands); DONE;") @@ -10375,7 +10348,7 @@ (define_expand "<code>tf2" [(set (match_operand:TF 0 "register_operand" "") (absneg:TF (match_operand:TF 1 "register_operand" "")))] - "TARGET_64BIT" + "TARGET_SSE2" "ix86_expand_fp_absneg_operator (<CODE>, TFmode, operands); DONE;") (define_insn "*absnegtf2_sse" @@ -10384,7 +10357,7 @@ [(match_operand:TF 1 "register_operand" "0,x")])) (use (match_operand:TF 2 "nonimmediate_operand" "xm,0")) (clobber (reg:CC FLAGS_REG))] - "TARGET_64BIT" + "TARGET_SSE2" "#") ;; Splitters for fp abs and neg. @@ -10563,7 +10536,7 @@ (match_operand:CSGNMODE 1 "nonmemory_operand" "") (match_operand:CSGNMODE 2 "register_operand" "")] "(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) - || (TARGET_64BIT && (<MODE>mode == TFmode))" + || (TARGET_SSE2 && (<MODE>mode == TFmode))" { ix86_expand_copysign (operands); DONE; @@ -10577,7 +10550,7 @@ (match_operand:<CSGNVMODE> 3 "nonimmediate_operand" "xm")] UNSPEC_COPYSIGN))] "(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) - || (TARGET_64BIT && (<MODE>mode == TFmode))" + || (TARGET_SSE2 && (<MODE>mode == TFmode))" "#" "&& reload_completed" [(const_int 0)] @@ -10596,7 +10569,7 @@ UNSPEC_COPYSIGN)) (clobber (match_scratch:<CSGNVMODE> 1 "=x,x,x,x,x"))] "(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) - || (TARGET_64BIT && (<MODE>mode == TFmode))" + || (TARGET_SSE2 && (<MODE>mode == TFmode))" "#") (define_split @@ -10609,7 +10582,7 @@ UNSPEC_COPYSIGN)) (clobber (match_scratch:<CSGNVMODE> 1 ""))] "((SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) - || (TARGET_64BIT && (<MODE>mode == TFmode))) + || (TARGET_SSE2 && (<MODE>mode == TFmode))) && reload_completed" [(const_int 0)] { @@ -10849,33 +10822,14 @@ ;; than 31. (define_expand "ashlti3" - [(parallel [(set (match_operand:TI 0 "register_operand" "") - (ashift:TI (match_operand:TI 1 "register_operand" "") - (match_operand:QI 2 "nonmemory_operand" ""))) - (clobber (reg:CC FLAGS_REG))])] - "TARGET_64BIT" -{ - if (! immediate_operand (operands[2], QImode)) - { - emit_insn (gen_ashlti3_1 (operands[0], operands[1], operands[2])); - DONE; - } - ix86_expand_binary_operator (ASHIFT, TImode, operands); - DONE; -}) - -(define_insn "ashlti3_1" - [(set (match_operand:TI 0 "register_operand" "=r") - (ashift:TI (match_operand:TI 1 "register_operand" "0") - (match_operand:QI 2 "register_operand" "c"))) - (clobber (match_scratch:DI 3 "=&r")) - (clobber (reg:CC FLAGS_REG))] + [(set (match_operand:TI 0 "register_operand" "") + (ashift:TI (match_operand:TI 1 "reg_or_pm1_operand" "") + (match_operand:QI 2 "nonmemory_operand" "")))] "TARGET_64BIT" - "#" - [(set_attr "type" "multi")]) + "ix86_expand_binary_operator (ASHIFT, TImode, operands); DONE;") -;; This pattern must be defined before *ashlti3_2 to prevent -;; combine pass from converting sse2_ashlti3 to *ashlti3_2. +;; This pattern must be defined before *ashlti3_1 to prevent +;; combine pass from converting sse2_ashlti3 to *ashlti3_1. (define_insn "sse2_ashlti3" [(set (match_operand:TI 0 "register_operand" "=x") @@ -10890,45 +10844,45 @@ (set_attr "prefix_data16" "1") (set_attr "mode" "TI")]) -(define_insn "*ashlti3_2" - [(set (match_operand:TI 0 "register_operand" "=r") - (ashift:TI (match_operand:TI 1 "register_operand" "0") - (match_operand:QI 2 "immediate_operand" "O"))) +(define_insn "*ashlti3_1" + [(set (match_operand:TI 0 "register_operand" "=&r,r") + (ashift:TI (match_operand:TI 1 "reg_or_pm1_operand" "n,0") + (match_operand:QI 2 "nonmemory_operand" "Oc,Oc"))) (clobber (reg:CC FLAGS_REG))] "TARGET_64BIT" "#" [(set_attr "type" "multi")]) -(define_split - [(set (match_operand:TI 0 "register_operand" "") - (ashift:TI (match_operand:TI 1 "nonmemory_operand" "") - (match_operand:QI 2 "register_operand" ""))) - (clobber (match_scratch:DI 3 "")) - (clobber (reg:CC FLAGS_REG))] - "TARGET_64BIT && reload_completed" +(define_peephole2 + [(match_scratch:DI 3 "r") + (parallel [(set (match_operand:TI 0 "register_operand" "") + (ashift:TI (match_operand:TI 1 "nonmemory_operand" "") + (match_operand:QI 2 "nonmemory_operand" ""))) + (clobber (reg:CC FLAGS_REG))]) + (match_dup 3)] + "TARGET_64BIT" [(const_int 0)] "ix86_split_ashl (operands, operands[3], TImode); DONE;") (define_split [(set (match_operand:TI 0 "register_operand" "") - (ashift:TI (match_operand:TI 1 "register_operand" "") - (match_operand:QI 2 "immediate_operand" ""))) + (ashift:TI (match_operand:TI 1 "nonmemory_operand" "") + (match_operand:QI 2 "nonmemory_operand" ""))) (clobber (reg:CC FLAGS_REG))] - "TARGET_64BIT && reload_completed" + "TARGET_64BIT && ((optimize > 0 && flag_peephole2) + ? epilogue_completed : reload_completed)" [(const_int 0)] "ix86_split_ashl (operands, NULL_RTX, TImode); DONE;") (define_insn "x86_64_shld" - [(set (match_operand:DI 0 "nonimmediate_operand" "+r*m,r*m") + [(set (match_operand:DI 0 "nonimmediate_operand" "+r*m") (ior:DI (ashift:DI (match_dup 0) - (match_operand:QI 2 "nonmemory_operand" "J,c")) - (lshiftrt:DI (match_operand:DI 1 "register_operand" "r,r") + (match_operand:QI 2 "nonmemory_operand" "Jc")) + (lshiftrt:DI (match_operand:DI 1 "register_operand" "r") (minus:QI (const_int 64) (match_dup 2))))) (clobber (reg:CC FLAGS_REG))] "TARGET_64BIT" - "@ - shld{q}\t{%2, %1, %0|%0, %1, %2} - shld{q}\t{%s2%1, %0|%0, %1, %2}" + "shld{q}\t{%s2%1, %0|%0, %1, %2}" [(set_attr "type" "ishift") (set_attr "prefix_0f" "1") (set_attr "mode" "DI") @@ -11021,7 +10975,7 @@ [(set (reg FLAGS_REG) (compare (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "immediate_operand" "e")) + (match_operand:QI 2 "const_1_to_63_operand" "J")) (const_int 0))) (set (match_operand:DI 0 "nonimmediate_operand" "=rm") (ashift:DI (match_dup 1) (match_dup 2)))] @@ -11064,7 +11018,7 @@ [(set (reg FLAGS_REG) (compare (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "immediate_operand" "e")) + (match_operand:QI 2 "const_1_to_63_operand" "J")) (const_int 0))) (clobber (match_scratch:DI 0 "=r"))] "TARGET_64BIT @@ -11135,17 +11089,15 @@ [(const_int 0)] "ix86_split_ashl (operands, NULL_RTX, DImode); DONE;") -(define_insn "x86_shld_1" - [(set (match_operand:SI 0 "nonimmediate_operand" "+r*m,r*m") +(define_insn "x86_shld" + [(set (match_operand:SI 0 "nonimmediate_operand" "+r*m") (ior:SI (ashift:SI (match_dup 0) - (match_operand:QI 2 "nonmemory_operand" "I,c")) - (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,r") + (match_operand:QI 2 "nonmemory_operand" "Ic")) + (lshiftrt:SI (match_operand:SI 1 "register_operand" "r") (minus:QI (const_int 32) (match_dup 2))))) (clobber (reg:CC FLAGS_REG))] "" - "@ - shld{l}\t{%2, %1, %0|%0, %1, %2} - shld{l}\t{%s2%1, %0|%0, %1, %2}" + "shld{l}\t{%s2%1, %0|%0, %1, %2}" [(set_attr "type" "ishift") (set_attr "prefix_0f" "1") (set_attr "mode" "SI") @@ -11200,8 +11152,7 @@ (define_expand "ashlsi3" [(set (match_operand:SI 0 "nonimmediate_operand" "") (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "") - (match_operand:QI 2 "nonmemory_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:QI 2 "nonmemory_operand" "")))] "" "ix86_expand_binary_operator (ASHIFT, SImode, operands); DONE;") @@ -11475,8 +11426,7 @@ (define_expand "ashlhi3" [(set (match_operand:HI 0 "nonimmediate_operand" "") (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "") - (match_operand:QI 2 "nonmemory_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:QI 2 "nonmemory_operand" "")))] "TARGET_HIMODE_MATH" "ix86_expand_binary_operator (ASHIFT, HImode, operands); DONE;") @@ -11641,8 +11591,7 @@ (define_expand "ashlqi3" [(set (match_operand:QI 0 "nonimmediate_operand" "") (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "") - (match_operand:QI 2 "nonmemory_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:QI 2 "nonmemory_operand" "")))] "TARGET_QIMODE_MATH" "ix86_expand_binary_operator (ASHIFT, QImode, operands); DONE;") @@ -11845,70 +11794,51 @@ ;; See comment above `ashldi3' about how this works. (define_expand "ashrti3" - [(parallel [(set (match_operand:TI 0 "register_operand" "") - (ashiftrt:TI (match_operand:TI 1 "register_operand" "") - (match_operand:QI 2 "nonmemory_operand" ""))) - (clobber (reg:CC FLAGS_REG))])] + [(set (match_operand:TI 0 "register_operand" "") + (ashiftrt:TI (match_operand:TI 1 "register_operand" "") + (match_operand:QI 2 "nonmemory_operand" "")))] "TARGET_64BIT" -{ - if (! immediate_operand (operands[2], QImode)) - { - emit_insn (gen_ashrti3_1 (operands[0], operands[1], operands[2])); - DONE; - } - ix86_expand_binary_operator (ASHIFTRT, TImode, operands); - DONE; -}) + "ix86_expand_binary_operator (ASHIFTRT, TImode, operands); DONE;") -(define_insn "ashrti3_1" +(define_insn "*ashrti3_1" [(set (match_operand:TI 0 "register_operand" "=r") (ashiftrt:TI (match_operand:TI 1 "register_operand" "0") - (match_operand:QI 2 "register_operand" "c"))) - (clobber (match_scratch:DI 3 "=&r")) + (match_operand:QI 2 "nonmemory_operand" "Oc"))) (clobber (reg:CC FLAGS_REG))] "TARGET_64BIT" "#" [(set_attr "type" "multi")]) -(define_insn "*ashrti3_2" - [(set (match_operand:TI 0 "register_operand" "=r") - (ashiftrt:TI (match_operand:TI 1 "register_operand" "0") - (match_operand:QI 2 "immediate_operand" "O"))) - (clobber (reg:CC FLAGS_REG))] +(define_peephole2 + [(match_scratch:DI 3 "r") + (parallel [(set (match_operand:TI 0 "register_operand" "") + (ashiftrt:TI (match_operand:TI 1 "register_operand" "") + (match_operand:QI 2 "nonmemory_operand" ""))) + (clobber (reg:CC FLAGS_REG))]) + (match_dup 3)] "TARGET_64BIT" - "#" - [(set_attr "type" "multi")]) - -(define_split - [(set (match_operand:TI 0 "register_operand" "") - (ashiftrt:TI (match_operand:TI 1 "register_operand" "") - (match_operand:QI 2 "register_operand" ""))) - (clobber (match_scratch:DI 3 "")) - (clobber (reg:CC FLAGS_REG))] - "TARGET_64BIT && reload_completed" [(const_int 0)] "ix86_split_ashr (operands, operands[3], TImode); DONE;") (define_split [(set (match_operand:TI 0 "register_operand" "") (ashiftrt:TI (match_operand:TI 1 "register_operand" "") - (match_operand:QI 2 "immediate_operand" ""))) + (match_operand:QI 2 "nonmemory_operand" ""))) (clobber (reg:CC FLAGS_REG))] - "TARGET_64BIT && reload_completed" + "TARGET_64BIT && ((optimize > 0 && flag_peephole2) + ? epilogue_completed : reload_completed)" [(const_int 0)] "ix86_split_ashr (operands, NULL_RTX, TImode); DONE;") (define_insn "x86_64_shrd" - [(set (match_operand:DI 0 "nonimmediate_operand" "+r*m,r*m") + [(set (match_operand:DI 0 "nonimmediate_operand" "+r*m") (ior:DI (ashiftrt:DI (match_dup 0) - (match_operand:QI 2 "nonmemory_operand" "J,c")) - (ashift:DI (match_operand:DI 1 "register_operand" "r,r") + (match_operand:QI 2 "nonmemory_operand" "Jc")) + (ashift:DI (match_operand:DI 1 "register_operand" "r") (minus:QI (const_int 64) (match_dup 2))))) (clobber (reg:CC FLAGS_REG))] "TARGET_64BIT" - "@ - shrd{q}\t{%2, %1, %0|%0, %1, %2} - shrd{q}\t{%s2%1, %0|%0, %1, %2}" + "shrd{q}\t{%s2%1, %0|%0, %1, %2}" [(set_attr "type" "ishift") (set_attr "prefix_0f" "1") (set_attr "mode" "DI") @@ -12010,7 +11940,7 @@ [(set (reg FLAGS_REG) (compare (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_operand" "n")) + (match_operand:QI 2 "const_1_to_63_operand" "J")) (const_int 0))) (set (match_operand:DI 0 "nonimmediate_operand" "=rm") (ashiftrt:DI (match_dup 1) (match_dup 2)))] @@ -12026,7 +11956,7 @@ [(set (reg FLAGS_REG) (compare (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_operand" "n")) + (match_operand:QI 2 "const_1_to_63_operand" "J")) (const_int 0))) (clobber (match_scratch:DI 0 "=r"))] "TARGET_64BIT @@ -12070,17 +12000,15 @@ [(const_int 0)] "ix86_split_ashr (operands, NULL_RTX, DImode); DONE;") -(define_insn "x86_shrd_1" - [(set (match_operand:SI 0 "nonimmediate_operand" "+r*m,r*m") +(define_insn "x86_shrd" + [(set (match_operand:SI 0 "nonimmediate_operand" "+r*m") (ior:SI (ashiftrt:SI (match_dup 0) - (match_operand:QI 2 "nonmemory_operand" "I,c")) - (ashift:SI (match_operand:SI 1 "register_operand" "r,r") + (match_operand:QI 2 "nonmemory_operand" "Ic")) + (ashift:SI (match_operand:SI 1 "register_operand" "r") (minus:QI (const_int 32) (match_dup 2))))) (clobber (reg:CC FLAGS_REG))] "" - "@ - shrd{l}\t{%2, %1, %0|%0, %1, %2} - shrd{l}\t{%s2%1, %0|%0, %1, %2}" + "shrd{l}\t{%s2%1, %0|%0, %1, %2}" [(set_attr "type" "ishift") (set_attr "prefix_0f" "1") (set_attr "pent_pair" "np") @@ -12150,8 +12078,7 @@ (define_expand "ashrsi3" [(set (match_operand:SI 0 "nonimmediate_operand" "") (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "") - (match_operand:QI 2 "nonmemory_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:QI 2 "nonmemory_operand" "")))] "" "ix86_expand_binary_operator (ASHIFTRT, SImode, operands); DONE;") @@ -12307,8 +12234,7 @@ (define_expand "ashrhi3" [(set (match_operand:HI 0 "nonimmediate_operand" "") (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "") - (match_operand:QI 2 "nonmemory_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:QI 2 "nonmemory_operand" "")))] "TARGET_HIMODE_MATH" "ix86_expand_binary_operator (ASHIFTRT, HImode, operands); DONE;") @@ -12408,8 +12334,7 @@ (define_expand "ashrqi3" [(set (match_operand:QI 0 "nonimmediate_operand" "") (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "") - (match_operand:QI 2 "nonmemory_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:QI 2 "nonmemory_operand" "")))] "TARGET_QIMODE_MATH" "ix86_expand_binary_operator (ASHIFTRT, QImode, operands); DONE;") @@ -12492,7 +12417,7 @@ [(set (reg FLAGS_REG) (compare (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const1_operand" "I")) + (match_operand:QI 2 "const1_operand" "")) (const_int 0))) (clobber (match_scratch:QI 0 "=q"))] "(TARGET_SHIFT1 || optimize_size) @@ -12540,33 +12465,14 @@ ;; See comment above `ashldi3' about how this works. (define_expand "lshrti3" - [(parallel [(set (match_operand:TI 0 "register_operand" "") - (lshiftrt:TI (match_operand:TI 1 "register_operand" "") - (match_operand:QI 2 "nonmemory_operand" ""))) - (clobber (reg:CC FLAGS_REG))])] - "TARGET_64BIT" -{ - if (! immediate_operand (operands[2], QImode)) - { - emit_insn (gen_lshrti3_1 (operands[0], operands[1], operands[2])); - DONE; - } - ix86_expand_binary_operator (LSHIFTRT, TImode, operands); - DONE; -}) - -(define_insn "lshrti3_1" - [(set (match_operand:TI 0 "register_operand" "=r") - (lshiftrt:TI (match_operand:TI 1 "register_operand" "0") - (match_operand:QI 2 "register_operand" "c"))) - (clobber (match_scratch:DI 3 "=&r")) - (clobber (reg:CC FLAGS_REG))] + [(set (match_operand:TI 0 "register_operand" "") + (lshiftrt:TI (match_operand:TI 1 "register_operand" "") + (match_operand:QI 2 "nonmemory_operand" "")))] "TARGET_64BIT" - "#" - [(set_attr "type" "multi")]) + "ix86_expand_binary_operator (LSHIFTRT, TImode, operands); DONE;") -;; This pattern must be defined before *lshrti3_2 to prevent -;; combine pass from converting sse2_lshrti3 to *lshrti3_2. +;; This pattern must be defined before *lshrti3_1 to prevent +;; combine pass from converting sse2_lshrti3 to *lshrti3_1. (define_insn "sse2_lshrti3" [(set (match_operand:TI 0 "register_operand" "=x") @@ -12581,31 +12487,33 @@ (set_attr "prefix_data16" "1") (set_attr "mode" "TI")]) -(define_insn "*lshrti3_2" +(define_insn "*lshrti3_1" [(set (match_operand:TI 0 "register_operand" "=r") (lshiftrt:TI (match_operand:TI 1 "register_operand" "0") - (match_operand:QI 2 "immediate_operand" "O"))) + (match_operand:QI 2 "nonmemory_operand" "Oc"))) (clobber (reg:CC FLAGS_REG))] "TARGET_64BIT" "#" [(set_attr "type" "multi")]) -(define_split - [(set (match_operand:TI 0 "register_operand" "") - (lshiftrt:TI (match_operand:TI 1 "register_operand" "") - (match_operand:QI 2 "register_operand" ""))) - (clobber (match_scratch:DI 3 "")) - (clobber (reg:CC FLAGS_REG))] - "TARGET_64BIT && reload_completed" +(define_peephole2 + [(match_scratch:DI 3 "r") + (parallel [(set (match_operand:TI 0 "register_operand" "") + (lshiftrt:TI (match_operand:TI 1 "register_operand" "") + (match_operand:QI 2 "nonmemory_operand" ""))) + (clobber (reg:CC FLAGS_REG))]) + (match_dup 3)] + "TARGET_64BIT" [(const_int 0)] "ix86_split_lshr (operands, operands[3], TImode); DONE;") (define_split [(set (match_operand:TI 0 "register_operand" "") (lshiftrt:TI (match_operand:TI 1 "register_operand" "") - (match_operand:QI 2 "immediate_operand" ""))) + (match_operand:QI 2 "nonmemory_operand" ""))) (clobber (reg:CC FLAGS_REG))] - "TARGET_64BIT && reload_completed" + "TARGET_64BIT && ((optimize > 0 && flag_peephole2) + ? epilogue_completed : reload_completed)" [(const_int 0)] "ix86_split_lshr (operands, NULL_RTX, TImode); DONE;") @@ -12687,7 +12595,7 @@ [(set (reg FLAGS_REG) (compare (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_operand" "e")) + (match_operand:QI 2 "const_1_to_63_operand" "J")) (const_int 0))) (set (match_operand:DI 0 "nonimmediate_operand" "=rm") (lshiftrt:DI (match_dup 1) (match_dup 2)))] @@ -12703,7 +12611,7 @@ [(set (reg FLAGS_REG) (compare (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "const_int_operand" "e")) + (match_operand:QI 2 "const_1_to_63_operand" "J")) (const_int 0))) (clobber (match_scratch:DI 0 "=r"))] "TARGET_64BIT @@ -12750,8 +12658,7 @@ (define_expand "lshrsi3" [(set (match_operand:SI 0 "nonimmediate_operand" "") (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "") - (match_operand:QI 2 "nonmemory_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:QI 2 "nonmemory_operand" "")))] "" "ix86_expand_binary_operator (LSHIFTRT, SImode, operands); DONE;") @@ -12908,8 +12815,7 @@ (define_expand "lshrhi3" [(set (match_operand:HI 0 "nonimmediate_operand" "") (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "") - (match_operand:QI 2 "nonmemory_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:QI 2 "nonmemory_operand" "")))] "TARGET_HIMODE_MATH" "ix86_expand_binary_operator (LSHIFTRT, HImode, operands); DONE;") @@ -13009,8 +12915,7 @@ (define_expand "lshrqi3" [(set (match_operand:QI 0 "nonimmediate_operand" "") (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "") - (match_operand:QI 2 "nonmemory_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:QI 2 "nonmemory_operand" "")))] "TARGET_QIMODE_MATH" "ix86_expand_binary_operator (LSHIFTRT, QImode, operands); DONE;") @@ -13139,8 +13044,7 @@ (define_expand "rotldi3" [(set (match_operand:DI 0 "shiftdi_operand" "") (rotate:DI (match_operand:DI 1 "shiftdi_operand" "") - (match_operand:QI 2 "nonmemory_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:QI 2 "nonmemory_operand" "")))] "" { if (TARGET_64BIT) @@ -13210,8 +13114,7 @@ (define_expand "rotlsi3" [(set (match_operand:SI 0 "nonimmediate_operand" "") (rotate:SI (match_operand:SI 1 "nonimmediate_operand" "") - (match_operand:QI 2 "nonmemory_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:QI 2 "nonmemory_operand" "")))] "" "ix86_expand_binary_operator (ROTATE, SImode, operands); DONE;") @@ -13270,8 +13173,7 @@ (define_expand "rotlhi3" [(set (match_operand:HI 0 "nonimmediate_operand" "") (rotate:HI (match_operand:HI 1 "nonimmediate_operand" "") - (match_operand:QI 2 "nonmemory_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:QI 2 "nonmemory_operand" "")))] "TARGET_HIMODE_MATH" "ix86_expand_binary_operator (ROTATE, HImode, operands); DONE;") @@ -13314,8 +13216,7 @@ (define_expand "rotlqi3" [(set (match_operand:QI 0 "nonimmediate_operand" "") (rotate:QI (match_operand:QI 1 "nonimmediate_operand" "") - (match_operand:QI 2 "nonmemory_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:QI 2 "nonmemory_operand" "")))] "TARGET_QIMODE_MATH" "ix86_expand_binary_operator (ROTATE, QImode, operands); DONE;") @@ -13375,8 +13276,7 @@ (define_expand "rotrdi3" [(set (match_operand:DI 0 "shiftdi_operand" "") (rotate:DI (match_operand:DI 1 "shiftdi_operand" "") - (match_operand:QI 2 "nonmemory_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:QI 2 "nonmemory_operand" "")))] "" { if (TARGET_64BIT) @@ -13446,8 +13346,7 @@ (define_expand "rotrsi3" [(set (match_operand:SI 0 "nonimmediate_operand" "") (rotatert:SI (match_operand:SI 1 "nonimmediate_operand" "") - (match_operand:QI 2 "nonmemory_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:QI 2 "nonmemory_operand" "")))] "" "ix86_expand_binary_operator (ROTATERT, SImode, operands); DONE;") @@ -13509,8 +13408,7 @@ (define_expand "rotrhi3" [(set (match_operand:HI 0 "nonimmediate_operand" "") (rotatert:HI (match_operand:HI 1 "nonimmediate_operand" "") - (match_operand:QI 2 "nonmemory_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:QI 2 "nonmemory_operand" "")))] "TARGET_HIMODE_MATH" "ix86_expand_binary_operator (ROTATERT, HImode, operands); DONE;") @@ -13553,8 +13451,7 @@ (define_expand "rotrqi3" [(set (match_operand:QI 0 "nonimmediate_operand" "") (rotatert:QI (match_operand:QI 1 "nonimmediate_operand" "") - (match_operand:QI 2 "nonmemory_operand" ""))) - (clobber (reg:CC FLAGS_REG))] + (match_operand:QI 2 "nonmemory_operand" "")))] "TARGET_QIMODE_MATH" "ix86_expand_binary_operator (ROTATERT, QImode, operands); DONE;") @@ -14040,7 +13937,7 @@ [(set (pc) (if_then_else (match_operator 1 "comparison_operator" [(match_operand:SWI 2 "register_operand" "<r>") - (match_operand:SWI 3 "const0_operand" "n")]) + (match_operand:SWI 3 "const0_operand" "")]) (label_ref (match_operand 0 "" "")) (pc)))] "TARGET_FUSE_CMP_AND_BRANCH && !TARGET_64BIT" @@ -14055,7 +13952,7 @@ [(set (pc) (if_then_else (match_operator 1 "comparison_operator" [(match_operand:SWI 2 "register_operand" "<r>") - (match_operand:SWI 3 "const0_operand" "n")]) + (match_operand:SWI 3 "const0_operand" "")]) (pc) (label_ref (match_operand 0 "" ""))))] "TARGET_FUSE_CMP_AND_BRANCH && !TARGET_64BIT" @@ -14510,7 +14407,7 @@ [(set (pc) (if_then_else (match_operator 0 "comparison_operator" [(match_operand 1 "register_operand" "f") - (match_operand 2 "const0_operand" "X")]) + (match_operand 2 "const0_operand" "")]) (label_ref (match_operand 3 "" "")) (pc))) (clobber (reg:CCFP FPSR_REG)) diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md index 4f2ff6b7c9f..f36c6d4cc4a 100644 --- a/gcc/config/i386/predicates.md +++ b/gcc/config/i386/predicates.md @@ -629,6 +629,12 @@ (and (match_code "const_int") (match_test "IN_RANGE (INTVAL (op), 1, 31)"))) +;; Return nonzero if OP is CONST_INT >= 1 and <= 63 (a valid operand +;; for 64bit shift & compare patterns, as shifting by 0 does not change flags). +(define_predicate "const_1_to_63_operand" + (and (match_code "const_int") + (match_test "IN_RANGE (INTVAL (op), 1, 63)"))) + ;; Match 2 or 3. (define_predicate "const_2_to_3_operand" (and (match_code "const_int") diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 115b382b8d8..84fb001cd63 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -3895,7 +3895,7 @@ (and:TF (not:TF (match_operand:TF 1 "register_operand" "0")) (match_operand:TF 2 "nonimmediate_operand" "xm")))] - "TARGET_64BIT" + "TARGET_SSE2" "pandn\t{%2, %0|%0, %2}" [(set_attr "type" "sselog") (set_attr "prefix_data16" "1") @@ -3936,7 +3936,7 @@ (plogic:TF (match_operand:TF 1 "nonimmediate_operand" "") (match_operand:TF 2 "nonimmediate_operand" "")))] - "TARGET_64BIT" + "TARGET_SSE2" "ix86_fixup_binary_operands_no_copy (<CODE>, TFmode, operands);") (define_insn "*<code>tf3" @@ -3944,7 +3944,7 @@ (plogic:TF (match_operand:TF 1 "nonimmediate_operand" "%0") (match_operand:TF 2 "nonimmediate_operand" "xm")))] - "TARGET_64BIT && ix86_binary_operator_ok (<CODE>, TFmode, operands)" + "TARGET_SSE2 && ix86_binary_operator_ok (<CODE>, TFmode, operands)" "p<plogicprefix>\t{%2, %0|%0, %2}" [(set_attr "type" "sselog") (set_attr "prefix_data16" "1") diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c index 35d7f9f9eac..7fdd89471a8 100644 --- a/gcc/config/i386/winnt.c +++ b/gcc/config/i386/winnt.c @@ -199,7 +199,7 @@ gen_stdcall_or_fastcall_suffix (tree decl, tree id, bool fastcall) } } /* Assume max of 8 base 10 digits in the suffix. */ - p = new_str = alloca (1 + strlen (old_str) + 1 + 8 + 1); + p = new_str = XALLOCAVEC (char, 1 + strlen (old_str) + 1 + 8 + 1); if (fastcall) *p++ = FASTCALL_PREFIX; sprintf (p, "%s@" HOST_WIDE_INT_PRINT_DEC, old_str, total); @@ -380,7 +380,7 @@ i386_pe_unique_section (tree decl, int reloc) else prefix = ".data$"; len = strlen (name) + strlen (prefix); - string = alloca (len + 1); + string = XALLOCAVEC (char, len + 1); sprintf (string, "%s%s", prefix, name); DECL_SECTION_NAME (decl) = build_string (len, string); diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 22d0c0a3ce1..d1928f6b3c7 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -5248,7 +5248,7 @@ void ia64_init_expanders (void) static struct machine_function * ia64_init_machine_status (void) { - return ggc_alloc_cleared (sizeof (struct machine_function)); + return GGC_CNEW (struct machine_function); } static enum attr_itanium_class ia64_safe_itanium_class (rtx); @@ -6772,7 +6772,7 @@ ia64_h_i_d_extended (void) { int new_max_uid = get_max_uid () + 1; - spec_check_no = xrecalloc (spec_check_no, new_max_uid, + spec_check_no = (int *) xrecalloc (spec_check_no, new_max_uid, max_uid, sizeof (*spec_check_no)); max_uid = new_max_uid; } @@ -6781,14 +6781,14 @@ ia64_h_i_d_extended (void) { int new_clocks_length = get_max_uid () + 1; - stops_p = xrecalloc (stops_p, new_clocks_length, clocks_length, 1); + stops_p = (char *) xrecalloc (stops_p, new_clocks_length, clocks_length, 1); if (ia64_tune == PROCESSOR_ITANIUM) { - clocks = xrecalloc (clocks, new_clocks_length, clocks_length, - sizeof (int)); - add_cycles = xrecalloc (add_cycles, new_clocks_length, clocks_length, - sizeof (int)); + clocks = (int *) xrecalloc (clocks, new_clocks_length, clocks_length, + sizeof (int)); + add_cycles = (int *) xrecalloc (add_cycles, new_clocks_length, + clocks_length, sizeof (int)); } clocks_length = new_clocks_length; @@ -7410,7 +7410,7 @@ get_free_bundle_state (void) } else { - result = xmalloc (sizeof (struct bundle_state)); + result = XNEW (struct bundle_state); result->dfa_state = xmalloc (dfa_state_size); result->allocated_states_chain = allocated_bundle_states_chain; allocated_bundle_states_chain = result; @@ -7920,8 +7920,7 @@ bundling (FILE *dump, int verbose, rtx prev_head_insn, rtx tail) bundling_p = 1; dfa_clean_insn_cache (); initiate_bundle_state_table (); - index_to_bundle_states = xmalloc ((insn_num + 2) - * sizeof (struct bundle_state *)); + index_to_bundle_states = XNEWVEC (struct bundle_state *, insn_num + 2); /* First (forward) pass -- generation of bundle states. */ curr_state = get_free_bundle_state (); curr_state->insn = NULL; @@ -8612,11 +8611,11 @@ ia64_reorg (void) PREV_INSN (ia64_nop) = NEXT_INSN (ia64_nop) = NULL_RTX; recog_memoized (ia64_nop); clocks_length = get_max_uid () + 1; - stops_p = xcalloc (1, clocks_length); + stops_p = XCNEWVEC (char, clocks_length); if (ia64_tune == PROCESSOR_ITANIUM) { - clocks = xcalloc (clocks_length, sizeof (int)); - add_cycles = xcalloc (clocks_length, sizeof (int)); + clocks = XCNEWVEC (int, clocks_length); + add_cycles = XCNEWVEC (int, clocks_length); } if (ia64_tune == PROCESSOR_ITANIUM2) { diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c index 2d20a4ba4c2..b66a485dbb1 100644 --- a/gcc/config/iq2000/iq2000.c +++ b/gcc/config/iq2000/iq2000.c @@ -1389,7 +1389,7 @@ iq2000_init_machine_status (void) { struct machine_function *f; - f = ggc_alloc_cleared (sizeof (struct machine_function)); + f = GGC_CNEW (struct machine_function); return f; } diff --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c index 83b73b2414a..314feb183a6 100644 --- a/gcc/config/m68hc11/m68hc11.c +++ b/gcc/config/m68hc11/m68hc11.c @@ -1172,7 +1172,7 @@ m68hc11_encode_label (tree decl) { const char *str = XSTR (XEXP (DECL_RTL (decl), 0), 0); int len = strlen (str); - char *newstr = alloca (len + 2); + char *newstr = XALLOCAVEC (char, len + 2); newstr[0] = '@'; strcpy (&newstr[1], str); diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c index f95e37e9479..046132088bc 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -1,6 +1,6 @@ /* Subroutines for insn-output.c for Motorola 68000 family. Copyright (C) 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2003, 2004, 2005, 2006, 2007 + 2001, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is part of GCC. @@ -500,7 +500,11 @@ m68k_handle_option (size_t code, const char *arg, int value) error ("-mshared-library-id=%s is not between 0 and %d", arg, MAX_LIBRARY_ID); else - asprintf ((char **) &m68k_library_id_string, "%d", (value * -4) - 4); + { + char *tmp; + asprintf (&tmp, "%d", (value * -4) - 4); + m68k_library_id_string = tmp; + } return true; default: @@ -3880,20 +3884,26 @@ print_operand (FILE *file, rtx op, int letter) else if (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == SFmode) { REAL_VALUE_TYPE r; + long l; REAL_VALUE_FROM_CONST_DOUBLE (r, op); - ASM_OUTPUT_FLOAT_OPERAND (letter, file, r); + REAL_VALUE_TO_TARGET_SINGLE (r, l); + asm_fprintf (file, "%I0x%lx", l); } else if (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == XFmode) { REAL_VALUE_TYPE r; + long l[3]; REAL_VALUE_FROM_CONST_DOUBLE (r, op); - ASM_OUTPUT_LONG_DOUBLE_OPERAND (file, r); + REAL_VALUE_TO_TARGET_LONG_DOUBLE (r, l); + asm_fprintf (file, "%I0x%lx%08lx%08lx", l[0], l[1], l[2]); } else if (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == DFmode) { REAL_VALUE_TYPE r; + long l[2]; REAL_VALUE_FROM_CONST_DOUBLE (r, op); - ASM_OUTPUT_DOUBLE_OPERAND (file, r); + REAL_VALUE_TO_TARGET_DOUBLE (r, l); + asm_fprintf (file, "%I0x%lx%08lx", l[0], l[1]); } else { @@ -5446,8 +5456,7 @@ m68k_sched_md_init_global (FILE *sched_dump ATTRIBUTE_UNUSED, { rtx insn; - sched_branch_type = xcalloc (get_max_uid () + 1, - sizeof (*sched_branch_type)); + sched_branch_type = XCNEWVEC (enum attr_type, get_max_uid () + 1); for (insn = get_insns (); insn != NULL_RTX; insn = NEXT_INSN (insn)) { @@ -5504,8 +5513,7 @@ m68k_sched_md_init_global (FILE *sched_dump ATTRIBUTE_UNUSED, case CPU_CFV3: max_insn_size = 3; sched_ib.records.n_insns = 8; - sched_ib.records.adjust = xmalloc (sched_ib.records.n_insns - * sizeof (*sched_ib.records.adjust)); + sched_ib.records.adjust = XNEWVEC (int, sched_ib.records.n_insns); break; default: diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h index 2bb725f0423..55de085d4a0 100644 --- a/gcc/config/m68k/m68k.h +++ b/gcc/config/m68k/m68k.h @@ -1,6 +1,6 @@ /* Definitions of target machine for GCC for Motorola 680x0/ColdFire. Copyright (C) 1987, 1988, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is part of GCC. @@ -1015,40 +1015,6 @@ do { if (cc_prev_status.flags & CC_IN_68881) \ assemble_name ((FILE), (NAME)), \ fprintf ((FILE), ",%u\n", (int)(ROUNDED))) -/* Output a float value (represented as a C double) as an immediate operand. - This macro is m68k-specific. */ -#define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \ - do { \ - if (CODE == 'f') \ - { \ - char dstr[30]; \ - real_to_decimal (dstr, &(VALUE), sizeof (dstr), 9, 0); \ - asm_fprintf ((FILE), "%I0r%s", dstr); \ - } \ - else \ - { \ - long l; \ - REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \ - asm_fprintf ((FILE), "%I0x%lx", l); \ - } \ - } while (0) - -/* Output a double value (represented as a C double) as an immediate operand. - This macro is m68k-specific. */ -#define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \ - do { char dstr[30]; \ - real_to_decimal (dstr, &(VALUE), sizeof (dstr), 0, 1); \ - asm_fprintf (FILE, "%I0r%s", dstr); \ - } while (0) - -/* Note, long double immediate operands are not actually - generated by m68k.md. */ -#define ASM_OUTPUT_LONG_DOUBLE_OPERAND(FILE,VALUE) \ - do { char dstr[30]; \ - real_to_decimal (dstr, &(VALUE), sizeof (dstr), 0, 1); \ - asm_fprintf (FILE, "%I0r%s", dstr); \ - } while (0) - /* On the 68000, we use several CODE characters: '.' for dot needed in Motorola-style opcode names. '-' for an operand pushing on the stack: diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c index 940c833dc3e..227f7dcd8e8 100644 --- a/gcc/config/mcore/mcore.c +++ b/gcc/config/mcore/mcore.c @@ -2851,7 +2851,7 @@ mcore_mark_dllexport (tree decl) if (mcore_dllexport_name_p (oldname)) return; /* Already done. */ - newname = alloca (strlen (oldname) + 4); + newname = XALLOCAVEC (char, strlen (oldname) + 4); sprintf (newname, "@e.%s", oldname); /* We pass newname through get_identifier to ensure it has a unique @@ -2909,7 +2909,7 @@ mcore_mark_dllimport (tree decl) TREE_PUBLIC (decl) = 1; } - newname = alloca (strlen (oldname) + 11); + newname = XALLOCAVEC (char, strlen (oldname) + 11); sprintf (newname, "@i.__imp_%s", oldname); /* We pass newname through get_identifier to ensure it has a unique @@ -3066,7 +3066,7 @@ mcore_unique_section (tree decl, int reloc ATTRIBUTE_UNUSED) prefix = ".data$"; len = strlen (name) + strlen (prefix); - string = alloca (len + 1); + string = XALLOCAVEC (char, len + 1); sprintf (string, "%s%s", prefix, name); diff --git a/gcc/config/mips/loongson.md b/gcc/config/mips/loongson.md index 73d183ac95c..98b5113fbb5 100644 --- a/gcc/config/mips/loongson.md +++ b/gcc/config/mips/loongson.md @@ -83,7 +83,7 @@ (match_operand:VWHB 1 "move_operand" "f,m,f,dYG,dYG,dYG,m"))] "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS" { return mips_output_move (operands[0], operands[1]); } - [(set_attr "type" "fpstore,fpload,mfc,mtc,move,store,load") + [(set_attr "move_type" "fpstore,fpload,mfc,mtc,move,store,load") (set_attr "mode" "DI")]) ;; Initialization of a vector. diff --git a/gcc/config/mips/mips-dsp.md b/gcc/config/mips/mips-dsp.md index 5e6091a3f0a..9a70b665d22 100644 --- a/gcc/config/mips/mips-dsp.md +++ b/gcc/config/mips/mips-dsp.md @@ -1017,8 +1017,7 @@ "ISA_HAS_DSP" "lbux\t%0,%2(%1)" [(set_attr "type" "load") - (set_attr "mode" "SI") - (set_attr "length" "4")]) + (set_attr "mode" "SI")]) (define_insn "mips_lhx" [(set (match_operand:SI 0 "register_operand" "=d") @@ -1029,8 +1028,7 @@ "ISA_HAS_DSP" "lhx\t%0,%2(%1)" [(set_attr "type" "load") - (set_attr "mode" "SI") - (set_attr "length" "4")]) + (set_attr "mode" "SI")]) (define_insn "mips_lwx" [(set (match_operand:SI 0 "register_operand" "=d") @@ -1039,8 +1037,7 @@ "ISA_HAS_DSP" "lwx\t%0,%2(%1)" [(set_attr "type" "load") - (set_attr "mode" "SI") - (set_attr "length" "4")]) + (set_attr "mode" "SI")]) ;; Table 2-8. MIPS DSP ASE Instructions: Branch ;; BPOSGE32 diff --git a/gcc/config/mips/mips-protos.h b/gcc/config/mips/mips-protos.h index b79b83a0bcb..d092cb6f5c1 100644 --- a/gcc/config/mips/mips-protos.h +++ b/gcc/config/mips/mips-protos.h @@ -171,6 +171,7 @@ extern bool mips_legitimate_address_p (enum machine_mode, rtx, bool); extern bool mips_stack_address_p (rtx, enum machine_mode); extern int mips_address_insns (rtx, enum machine_mode, bool); extern int mips_const_insns (rtx); +extern int mips_split_const_insns (rtx); extern int mips_load_store_insns (rtx, rtx); extern int mips_idiv_insns (void); extern rtx mips_emit_move (rtx, rtx); diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 56180054d74..48ba54b1cef 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -42,6 +42,7 @@ along with GCC; see the file COPYING3. If not see #include "function.h" #include "expr.h" #include "optabs.h" +#include "libfuncs.h" #include "flags.h" #include "reload.h" #include "tm_p.h" @@ -2120,6 +2121,21 @@ mips_const_insns (rtx x) } } +/* X is a doubleword constant that can be handled by splitting it into + two words and loading each word separately. Return the number of + instructions required to do this. */ + +int +mips_split_const_insns (rtx x) +{ + unsigned int low, high; + + low = mips_const_insns (mips_subword (x, false)); + high = mips_const_insns (mips_subword (x, true)); + gcc_assert (low > 0 && high > 0); + return low + high; +} + /* Return the number of instructions needed to implement INSN, given that it loads from or stores to MEM. Count extended MIPS16 instructions as two instructions. */ @@ -5832,7 +5848,7 @@ mips_block_move_straight (rtx dest, rtx src, HOST_WIDE_INT length) delta = bits / BITS_PER_UNIT; /* Allocate a buffer for the temporary registers. */ - regs = alloca (sizeof (rtx) * length / delta); + regs = XALLOCAVEC (rtx, length / delta); /* Load as many BITS-sized chunks as possible. Use a normal load if the source has enough alignment, otherwise use left/right pairs. */ @@ -9424,6 +9440,11 @@ mips_init_libfuncs (void) else /* Register the gofast functions if selected using --enable-gofast. */ gofast_maybe_init_libfuncs (); + + /* The MIPS16 ISA does not have an encoding for "sync", so we rely + on an external non-MIPS16 routine to implement __sync_synchronize. */ + if (TARGET_MIPS16) + synchronize_libfunc = init_one_libfunc ("__sync_synchronize"); } /* Return the length of INSN. LENGTH is the initial length computed by @@ -11422,7 +11443,8 @@ struct mips16_rewrite_pool_refs_info { static int mips16_rewrite_pool_refs (rtx *x, void *data) { - struct mips16_rewrite_pool_refs_info *info = data; + struct mips16_rewrite_pool_refs_info *info = + (struct mips16_rewrite_pool_refs_info *) data; if (force_to_mem_operand (*x, Pmode)) { @@ -11597,7 +11619,7 @@ static int mips_sim_wait_regs_2 (rtx *x, void *data) { if (REG_P (*x)) - mips_sim_wait_reg (data, mips_sim_insn, *x); + mips_sim_wait_reg ((struct mips_sim *) data, mips_sim_insn, *x); return 0; } @@ -11651,7 +11673,7 @@ mips_sim_record_set (rtx x, const_rtx pat ATTRIBUTE_UNUSED, void *data) { struct mips_sim *state; - state = data; + state = (struct mips_sim *) data; if (REG_P (x)) { unsigned int regno, end_regno; diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md index 842e582b7f4..6b2f5fac64d 100644 --- a/gcc/config/mips/mips.md +++ b/gcc/config/mips/mips.md @@ -280,6 +280,44 @@ (symbol_ref "TARGET_CALL_CLOBBERED_GP")] (const_string "no"))) +;; Classification of moves, extensions and truncations. Most values +;; are as for "type" (see below) but there are also the following +;; move-specific values: +;; +;; constN move an N-constraint integer into a MIPS16 register +;; sll0 "sll DEST,SRC,0", which on 64-bit targets is guaranteed +;; to produce a sign-extended DEST, even if SRC is not +;; properly sign-extended +;; andi a single ANDI instruction +;; loadpool move a constant into a MIPS16 register by loading it +;; from the pool +;; shift_shift a shift left followed by a shift right +;; lui_movf an LUI followed by a MOVF (for d<-z CC moves) +;; +;; This attribute is used to determine the instruction's length and +;; scheduling type. For doubleword moves, the attribute always describes +;; the split instructions; in some cases, it is more appropriate for the +;; scheduling type to be "multi" instead. +(define_attr "move_type" + "unknown,load,fpload,store,fpstore,mtc,mfc,mthilo,mfhilo,move,fmove, + const,constN,signext,sll0,andi,loadpool,shift_shift,lui_movf" + (const_string "unknown")) + +;; Main data type used by the insn +(define_attr "mode" "unknown,none,QI,HI,SI,DI,TI,SF,DF,TF,FPSW" + (const_string "unknown")) + +;; True if the main data type is twice the size of a word. +(define_attr "dword_mode" "no,yes" + (cond [(and (eq_attr "mode" "DI,DF") + (eq (symbol_ref "TARGET_64BIT") (const_int 0))) + (const_string "yes") + + (and (eq_attr "mode" "TI,TF") + (ne (symbol_ref "TARGET_64BIT") (const_int 0))) + (const_string "yes")] + (const_string "no"))) + ;; Classification of each insn. ;; branch conditional branch ;; jump unconditional jump @@ -293,8 +331,8 @@ ;; prefetch memory prefetch (register + offset) ;; prefetchx memory indexed prefetch (register + register) ;; condmove conditional moves -;; mfc transfer from coprocessor ;; mtc transfer to coprocessor +;; mfc transfer from coprocessor ;; mthilo transfer to hi/lo registers ;; mfhilo transfer from hi/lo registers ;; const load constant @@ -330,15 +368,45 @@ ;; nop no operation ;; ghost an instruction that produces no real code (define_attr "type" - "unknown,branch,jump,call,load,fpload,fpidxload,store,fpstore,fpidxstore,prefetch,prefetchx,condmove,mfc,mtc,mthilo,mfhilo,const,arith,logical,shift,slt,signext,clz,trap,imul,imul3,imadd,idiv,move,fmove,fadd,fmul,fmadd,fdiv,frdiv,frdiv1,frdiv2,fabs,fneg,fcmp,fcvt,fsqrt,frsqrt,frsqrt1,frsqrt2,multi,nop,ghost" + "unknown,branch,jump,call,load,fpload,fpidxload,store,fpstore,fpidxstore, + prefetch,prefetchx,condmove,mtc,mfc,mthilo,mfhilo,const,arith,logical, + shift,slt,signext,clz,trap,imul,imul3,imadd,idiv,move,fmove,fadd,fmul, + fmadd,fdiv,frdiv,frdiv1,frdiv2,fabs,fneg,fcmp,fcvt,fsqrt,frsqrt,frsqrt1, + frsqrt2,multi,nop,ghost" (cond [(eq_attr "jal" "!unset") (const_string "call") - (eq_attr "got" "load") (const_string "load")] + (eq_attr "got" "load") (const_string "load") + + ;; If a doubleword move uses these expensive instructions, + ;; it is usually better to schedule them in the same way + ;; as the singleword form, rather than as "multi". + (eq_attr "move_type" "load") (const_string "load") + (eq_attr "move_type" "fpload") (const_string "fpload") + (eq_attr "move_type" "store") (const_string "store") + (eq_attr "move_type" "fpstore") (const_string "fpstore") + (eq_attr "move_type" "mtc") (const_string "mtc") + (eq_attr "move_type" "mfc") (const_string "mfc") + (eq_attr "move_type" "mthilo") (const_string "mthilo") + (eq_attr "move_type" "mfhilo") (const_string "mfhilo") + + ;; These types of move are always single insns. + (eq_attr "move_type" "fmove") (const_string "fmove") + (eq_attr "move_type" "loadpool") (const_string "load") + (eq_attr "move_type" "signext") (const_string "signext") + (eq_attr "move_type" "sll0") (const_string "shift") + (eq_attr "move_type" "andi") (const_string "logical") + + ;; These types of move are always split. + (eq_attr "move_type" "constN,lui_movf,shift_shift") + (const_string "multi") + + ;; These types of move are split for doubleword modes only. + (and (eq_attr "move_type" "move,const") + (eq_attr "dword_mode" "yes")) + (const_string "multi") + (eq_attr "move_type" "move") (const_string "move") + (eq_attr "move_type" "const") (const_string "const")] (const_string "unknown"))) -;; Main data type used by the insn -(define_attr "mode" "unknown,none,QI,HI,SI,DI,SF,DF,FPSW" - (const_string "unknown")) - ;; Mode for conversion types (fcvt) ;; I2S integer to float single (SI/DI to SF) ;; I2D integer to float double (SI/DI to DF) @@ -352,11 +420,19 @@ ;; Is this an extended instruction in mips16 mode? (define_attr "extended_mips16" "no,yes" - (const_string "no")) + (if_then_else (ior (eq_attr "move_type" "sll0") + (eq_attr "type" "branch") + (eq_attr "jal" "direct")) + (const_string "yes") + (const_string "no"))) ;; Length of instruction in bytes. (define_attr "length" "" - (cond [;; Direct branch instructions have a range of [-0x40000,0x3fffc]. + (cond [(and (eq_attr "extended_mips16" "yes") + (ne (symbol_ref "TARGET_MIPS16") (const_int 0))) + (const_int 8) + + ;; Direct branch instructions have a range of [-0x40000,0x3fffc]. ;; If a branch is outside this range, we have a choice of two ;; sequences. For PIC, an out-of-range branch like: ;; @@ -396,16 +472,49 @@ (const_int 24) ] (const_int 12)) + ;; "Ghost" instructions occupy no space. + (eq_attr "type" "ghost") + (const_int 0) + (eq_attr "got" "load") (const_int 4) (eq_attr "got" "xgot_high") (const_int 8) - (eq_attr "type" "const") + ;; In general, constant-pool loads are extended instructions. + (eq_attr "move_type" "loadpool") + (const_int 8) + + ;; LUI_MOVFs are decomposed into two separate instructions. + (eq_attr "move_type" "lui_movf") + (const_int 8) + + ;; SHIFT_SHIFTs are decomposed into two separate instructions. + ;; They are extended instructions on MIPS16 targets. + (eq_attr "move_type" "shift_shift") + (if_then_else (ne (symbol_ref "TARGET_MIPS16") (const_int 0)) + (const_int 16) + (const_int 8)) + + ;; Check for doubleword moves that are decomposed into two + ;; instructions. + (and (eq_attr "move_type" "mtc,mfc,mthilo,mfhilo,move") + (eq_attr "dword_mode" "yes")) + (const_int 8) + + ;; Doubleword CONST{,N} moves are split into two word + ;; CONST{,N} moves. + (and (eq_attr "move_type" "const,constN") + (eq_attr "dword_mode" "yes")) + (symbol_ref "mips_split_const_insns (operands[1]) * 4") + + ;; Otherwise, constants, loads and stores are handled by external + ;; routines. + (eq_attr "move_type" "const,constN") (symbol_ref "mips_const_insns (operands[1]) * 4") - (eq_attr "type" "load,fpload") + (eq_attr "move_type" "load,fpload") (symbol_ref "mips_load_store_insns (operands[1], insn) * 4") - (eq_attr "type" "store,fpstore") + (eq_attr "move_type" "store,fpstore") (symbol_ref "mips_load_store_insns (operands[0], insn) * 4") ;; In the worst case, a call macro will take 8 instructions: @@ -421,10 +530,6 @@ (eq_attr "jal_macro" "yes") (const_int 32) - (and (eq_attr "extended_mips16" "yes") - (ne (symbol_ref "TARGET_MIPS16") (const_int 0))) - (const_int 8) - ;; Various VR4120 errata require a nop to be inserted after a macc ;; instruction. The assembler does this for us, so account for ;; the worst-case length here. @@ -2509,9 +2614,8 @@ "@ sll\t%0,%1,0 sw\t%1,%0" - [(set_attr "type" "shift,store") - (set_attr "mode" "SI") - (set_attr "extended_mips16" "yes,*")]) + [(set_attr "move_type" "sll0,store") + (set_attr "mode" "SI")]) (define_insn "truncdihi2" [(set (match_operand:HI 0 "nonimmediate_operand" "=d,m") @@ -2520,9 +2624,8 @@ "@ sll\t%0,%1,0 sh\t%1,%0" - [(set_attr "type" "shift,store") - (set_attr "mode" "SI") - (set_attr "extended_mips16" "yes,*")]) + [(set_attr "move_type" "sll0,store") + (set_attr "mode" "SI")]) (define_insn "truncdiqi2" [(set (match_operand:QI 0 "nonimmediate_operand" "=d,m") @@ -2531,9 +2634,8 @@ "@ sll\t%0,%1,0 sb\t%1,%0" - [(set_attr "type" "shift,store") - (set_attr "mode" "SI") - (set_attr "extended_mips16" "yes,*")]) + [(set_attr "move_type" "sll0,store") + (set_attr "mode" "SI")]) ;; Combiner patterns to optimize shift/truncate combinations. @@ -2648,9 +2750,8 @@ (set (match_dup 0) (lshiftrt:DI (match_dup 0) (const_int 32)))] { operands[1] = gen_lowpart (DImode, operands[1]); } - [(set_attr "type" "multi,load") - (set_attr "mode" "DI") - (set_attr "length" "8,*")]) + [(set_attr "move_type" "shift_shift,load") + (set_attr "mode" "DI")]) ;; Combine is not allowed to convert this insn into a zero_extendsidi2 ;; because of TRULY_NOOP_TRUNCATION. @@ -2673,9 +2774,8 @@ (set (match_dup 0) (lshiftrt:DI (match_dup 0) (const_int 32)))] "" - [(set_attr "type" "multi,load") - (set_attr "mode" "DI") - (set_attr "length" "8,*")]) + [(set_attr "move_type" "shift_shift,load") + (set_attr "mode" "DI")]) (define_expand "zero_extend<SHORT:mode><GPR:mode>2" [(set (match_operand:GPR 0 "register_operand") @@ -2701,7 +2801,7 @@ "@ andi\t%0,%1,<SHORT:mask> l<SHORT:size>u\t%0,%1" - [(set_attr "type" "logical,load") + [(set_attr "move_type" "andi,load") (set_attr "mode" "<GPR:MODE>")]) (define_insn "*zero_extend<SHORT:mode><GPR:mode>2_mips16e" @@ -2709,7 +2809,8 @@ (zero_extend:GPR (match_operand:SHORT 1 "register_operand" "0")))] "GENERATE_MIPS16E" "ze<SHORT:size>\t%0" - [(set_attr "type" "arith") + ;; This instruction is effectively a special encoding of ANDI. + [(set_attr "move_type" "andi") (set_attr "mode" "<GPR:MODE>")]) (define_insn "*zero_extend<SHORT:mode><GPR:mode>2_mips16" @@ -2717,7 +2818,7 @@ (zero_extend:GPR (match_operand:SHORT 1 "memory_operand" "m")))] "TARGET_MIPS16" "l<SHORT:size>u\t%0,%1" - [(set_attr "type" "load") + [(set_attr "move_type" "load") (set_attr "mode" "<GPR:MODE>")]) (define_expand "zero_extendqihi2" @@ -2740,7 +2841,7 @@ "@ andi\t%0,%1,0x00ff lbu\t%0,%1" - [(set_attr "type" "logical,load") + [(set_attr "move_type" "andi,load") (set_attr "mode" "HI")]) (define_insn "*zero_extendqihi2_mips16" @@ -2748,7 +2849,7 @@ (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))] "TARGET_MIPS16" "lbu\t%0,%1" - [(set_attr "type" "load") + [(set_attr "move_type" "load") (set_attr "mode" "HI")]) ;; @@ -2782,7 +2883,7 @@ emit_note (NOTE_INSN_DELETED); DONE; } - [(set_attr "type" "arith,load") + [(set_attr "move_type" "move,load") (set_attr "mode" "DI")]) (define_expand "extend<SHORT:mode><GPR:mode>2" @@ -2797,7 +2898,7 @@ "@ se<SHORT:size>\t%0 l<SHORT:size>\t%0,%1" - [(set_attr "type" "signext,load") + [(set_attr "move_type" "signext,load") (set_attr "mode" "<GPR:MODE>")]) (define_insn_and_split "*extend<SHORT:mode><GPR:mode>2" @@ -2816,9 +2917,8 @@ operands[2] = GEN_INT (GET_MODE_BITSIZE (<GPR:MODE>mode) - GET_MODE_BITSIZE (<SHORT:MODE>mode)); } - [(set_attr "type" "arith,load") - (set_attr "mode" "<GPR:MODE>") - (set_attr "length" "8,*")]) + [(set_attr "move_type" "shift_shift,load") + (set_attr "mode" "<GPR:MODE>")]) (define_insn "*extend<SHORT:mode><GPR:mode>2_se<SHORT:size>" [(set (match_operand:GPR 0 "register_operand" "=d,d") @@ -2828,7 +2928,7 @@ "@ se<SHORT:size>\t%0,%1 l<SHORT:size>\t%0,%1" - [(set_attr "type" "signext,load") + [(set_attr "move_type" "signext,load") (set_attr "mode" "<GPR:MODE>")]) (define_expand "extendqihi2" @@ -2843,7 +2943,7 @@ "@ seb\t%0 lb\t%0,%1" - [(set_attr "type" "signext,load") + [(set_attr "move_type" "signext,load") (set_attr "mode" "SI")]) (define_insn_and_split "*extendqihi2" @@ -2863,9 +2963,8 @@ operands[2] = GEN_INT (GET_MODE_BITSIZE (SImode) - GET_MODE_BITSIZE (QImode)); } - [(set_attr "type" "multi,load") - (set_attr "mode" "SI") - (set_attr "length" "8,*")]) + [(set_attr "move_type" "shift_shift,load") + (set_attr "mode" "SI")]) (define_insn "*extendqihi2_seb" [(set (match_operand:HI 0 "register_operand" "=d,d") @@ -2875,7 +2974,7 @@ "@ seb\t%0,%1 lb\t%0,%1" - [(set_attr "type" "signext,load") + [(set_attr "move_type" "signext,load") (set_attr "mode" "SI")]) (define_insn "extendsfdf2" @@ -2913,8 +3012,7 @@ "trunc.w.d %0,%1" [(set_attr "type" "fcvt") (set_attr "mode" "DF") - (set_attr "cnv_mode" "D2I") - (set_attr "length" "4")]) + (set_attr "cnv_mode" "D2I")]) (define_insn "fix_truncdfsi2_macro" [(set (match_operand:SI 0 "register_operand" "=f") @@ -2951,8 +3049,7 @@ "trunc.w.s %0,%1" [(set_attr "type" "fcvt") (set_attr "mode" "SF") - (set_attr "cnv_mode" "S2I") - (set_attr "length" "4")]) + (set_attr "cnv_mode" "S2I")]) (define_insn "fix_truncsfsi2_macro" [(set (match_operand:SI 0 "register_operand" "=f") @@ -2978,8 +3075,7 @@ "trunc.l.d %0,%1" [(set_attr "type" "fcvt") (set_attr "mode" "DF") - (set_attr "cnv_mode" "D2I") - (set_attr "length" "4")]) + (set_attr "cnv_mode" "D2I")]) (define_insn "fix_truncsfdi2" @@ -2989,8 +3085,7 @@ "trunc.l.s %0,%1" [(set_attr "type" "fcvt") (set_attr "mode" "SF") - (set_attr "cnv_mode" "S2I") - (set_attr "length" "4")]) + (set_attr "cnv_mode" "S2I")]) (define_insn "floatsidf2" @@ -3000,8 +3095,7 @@ "cvt.d.w\t%0,%1" [(set_attr "type" "fcvt") (set_attr "mode" "DF") - (set_attr "cnv_mode" "I2D") - (set_attr "length" "4")]) + (set_attr "cnv_mode" "I2D")]) (define_insn "floatdidf2" @@ -3011,8 +3105,7 @@ "cvt.d.l\t%0,%1" [(set_attr "type" "fcvt") (set_attr "mode" "DF") - (set_attr "cnv_mode" "I2D") - (set_attr "length" "4")]) + (set_attr "cnv_mode" "I2D")]) (define_insn "floatsisf2" @@ -3022,8 +3115,7 @@ "cvt.s.w\t%0,%1" [(set_attr "type" "fcvt") (set_attr "mode" "SF") - (set_attr "cnv_mode" "I2S") - (set_attr "length" "4")]) + (set_attr "cnv_mode" "I2S")]) (define_insn "floatdisf2" @@ -3033,8 +3125,7 @@ "cvt.s.l\t%0,%1" [(set_attr "type" "fcvt") (set_attr "mode" "SF") - (set_attr "cnv_mode" "I2S") - (set_attr "length" "4")]) + (set_attr "cnv_mode" "I2S")]) (define_expand "fixuns_truncdfsi2" @@ -3325,7 +3416,7 @@ UNSPEC_LOAD_LEFT))] "!TARGET_MIPS16 && mips_mem_fits_mode_p (<MODE>mode, operands[1])" "<load>l\t%0,%2" - [(set_attr "type" "load") + [(set_attr "move_type" "load") (set_attr "mode" "<MODE>")]) (define_insn "mov_<load>r" @@ -3336,7 +3427,7 @@ UNSPEC_LOAD_RIGHT))] "!TARGET_MIPS16 && mips_mem_fits_mode_p (<MODE>mode, operands[1])" "<load>r\t%0,%2" - [(set_attr "type" "load") + [(set_attr "move_type" "load") (set_attr "mode" "<MODE>")]) (define_insn "mov_<store>l" @@ -3346,7 +3437,7 @@ UNSPEC_STORE_LEFT))] "!TARGET_MIPS16 && mips_mem_fits_mode_p (<MODE>mode, operands[0])" "<store>l\t%z1,%2" - [(set_attr "type" "store") + [(set_attr "move_type" "store") (set_attr "mode" "<MODE>")]) (define_insn "mov_<store>r" @@ -3357,7 +3448,7 @@ UNSPEC_STORE_RIGHT))] "!TARGET_MIPS16 && mips_mem_fits_mode_p (<MODE>mode, operands[0])" "<store>r\t%z1,%2" - [(set_attr "type" "store") + [(set_attr "move_type" "store") (set_attr "mode" "<MODE>")]) ;; An instruction to calculate the high part of a 64-bit SYMBOL_ABSOLUTE. @@ -3563,7 +3654,7 @@ "<d>addiu\t%0,%R2" [(set_attr "type" "arith") (set_attr "mode" "<MODE>") - (set_attr "length" "8")]) + (set_attr "extended_mips16" "yes")]) ;; Allow combine to split complex const_int load sequences, using operand 2 ;; to store the intermediate results. See move_operand for details. @@ -3614,30 +3705,18 @@ (reg:GPR 31))] "TARGET_MIPS16" "<store>\t$31,%0" - [(set_attr "type" "store") + [(set_attr "move_type" "store") (set_attr "mode" "<MODE>")]) (define_insn "*movdi_32bit" - [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,m,*a,*d,*B*C*D,*B*C*D,*d,*m") - (match_operand:DI 1 "move_operand" "d,i,m,d,*J*d,*a,*d,*m,*B*C*D,*B*C*D"))] - "!TARGET_64BIT && !TARGET_FLOAT64 && !TARGET_MIPS16 + [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,m,*a,*d,*f,*f,*d,*m,*B*C*D,*B*C*D,*d,*m") + (match_operand:DI 1 "move_operand" "d,i,m,d,*J*d,*a,*J*d,*m,*f,*f,*d,*m,*B*C*D,*B*C*D"))] + "!TARGET_64BIT && !TARGET_MIPS16 && (register_operand (operands[0], DImode) || reg_or_0_operand (operands[1], DImode))" { return mips_output_move (operands[0], operands[1]); } - [(set_attr "type" "multi,multi,load,store,multi,multi,mtc,load,mfc,store") - (set_attr "mode" "DI") - (set_attr "length" "8,16,*,*,8,8,8,*,8,*")]) - -(define_insn "*movdi_gp32_fp64" - [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,m,*a,*d,*f,*f,*d,*m") - (match_operand:DI 1 "move_operand" "d,i,m,d,*J*d,*a,*J*d,*m,*f,*f"))] - "!TARGET_64BIT && TARGET_FLOAT64 && !TARGET_MIPS16 - && (register_operand (operands[0], DImode) - || reg_or_0_operand (operands[1], DImode))" - { return mips_output_move (operands[0], operands[1]); } - [(set_attr "type" "multi,multi,load,store,multi,multi,mtc,fpload,mfc,fpstore") - (set_attr "mode" "DI") - (set_attr "length" "8,16,*,*,8,8,8,*,8,*")]) + [(set_attr "move_type" "move,const,load,store,mthilo,mfhilo,mtc,fpload,mfc,fpstore,mtc,fpload,mfc,fpstore") + (set_attr "mode" "DI")]) (define_insn "*movdi_32bit_mips16" [(set (match_operand:DI 0 "nonimmediate_operand" "=d,y,d,d,d,d,m,*d") @@ -3646,9 +3725,8 @@ && (register_operand (operands[0], DImode) || register_operand (operands[1], DImode))" { return mips_output_move (operands[0], operands[1]); } - [(set_attr "type" "multi,multi,multi,multi,multi,load,store,multi") - (set_attr "mode" "DI") - (set_attr "length" "8,8,8,8,12,*,*,8")]) + [(set_attr "move_type" "move,move,move,const,constN,load,store,mfhilo") + (set_attr "mode" "DI")]) (define_insn "*movdi_64bit" [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,e,d,m,*f,*f,*d,*m,*a,*d,*B*C*D,*B*C*D,*d,*m") @@ -3657,35 +3735,18 @@ && (register_operand (operands[0], DImode) || reg_or_0_operand (operands[1], DImode))" { return mips_output_move (operands[0], operands[1]); } - [(set_attr "type" "move,const,const,load,store,mtc,fpload,mfc,fpstore,mthilo,mfhilo,mtc,load,mfc,store") - (set_attr "mode" "DI") - (set_attr "length" "4,*,*,*,*,4,*,4,*,4,4,8,*,8,*")]) + [(set_attr "move_type" "move,const,const,load,store,mtc,fpload,mfc,fpstore,mthilo,mfhilo,mtc,fpload,mfc,fpstore") + (set_attr "mode" "DI")]) (define_insn "*movdi_64bit_mips16" [(set (match_operand:DI 0 "nonimmediate_operand" "=d,y,d,d,d,d,d,d,m,*d") - (match_operand:DI 1 "move_operand" "d,d,y,K,N,kf,U,m,d,*a"))] + (match_operand:DI 1 "move_operand" "d,d,y,K,N,U,kf,m,d,*a"))] "TARGET_64BIT && TARGET_MIPS16 && (register_operand (operands[0], DImode) || register_operand (operands[1], DImode))" { return mips_output_move (operands[0], operands[1]); } - [(set_attr "type" "move,move,move,arith,arith,load,const,load,store,mfhilo") - (set_attr "mode" "DI") - (set_attr_alternative "length" - [(const_int 4) - (const_int 4) - (const_int 4) - (if_then_else (match_operand:VOID 1 "m16_uimm8_1") - (const_int 4) - (const_int 8)) - (if_then_else (match_operand:VOID 1 "m16_nuimm8_1") - (const_int 8) - (const_int 12)) - (const_int 8) - (const_string "*") - (const_string "*") - (const_string "*") - (const_int 4)])]) - + [(set_attr "move_type" "move,move,move,const,constN,const,loadpool,load,store,mfhilo") + (set_attr "mode" "DI")]) ;; On the mips16, we can split ld $r,N($r) into an add and a load, ;; when the original load is a 4 byte instruction but the add and the @@ -3752,34 +3813,18 @@ && (register_operand (operands[0], SImode) || reg_or_0_operand (operands[1], SImode))" { return mips_output_move (operands[0], operands[1]); } - [(set_attr "type" "move,const,const,load,store,mtc,fpload,mfc,fpstore,mfc,mtc,mthilo,mfhilo,mtc,load,mfc,store") - (set_attr "mode" "SI") - (set_attr "length" "4,*,*,*,*,4,*,4,*,4,4,4,4,4,*,4,*")]) + [(set_attr "move_type" "move,const,const,load,store,mtc,fpload,mfc,fpstore,mfc,mtc,mthilo,mfhilo,mtc,fpload,mfc,fpstore") + (set_attr "mode" "SI")]) (define_insn "*movsi_mips16" [(set (match_operand:SI 0 "nonimmediate_operand" "=d,y,d,d,d,d,d,d,m,*d") - (match_operand:SI 1 "move_operand" "d,d,y,K,N,kf,U,m,d,*a"))] + (match_operand:SI 1 "move_operand" "d,d,y,K,N,U,kf,m,d,*a"))] "TARGET_MIPS16 && (register_operand (operands[0], SImode) || register_operand (operands[1], SImode))" { return mips_output_move (operands[0], operands[1]); } - [(set_attr "type" "move,move,move,arith,arith,load,const,load,store,mfhilo") - (set_attr "mode" "SI") - (set_attr_alternative "length" - [(const_int 4) - (const_int 4) - (const_int 4) - (if_then_else (match_operand:VOID 1 "m16_uimm8_1") - (const_int 4) - (const_int 8)) - (if_then_else (match_operand:VOID 1 "m16_nuimm8_1") - (const_int 8) - (const_int 12)) - (const_int 8) - (const_string "*") - (const_string "*") - (const_string "*") - (const_int 4)])]) + [(set_attr "move_type" "move,move,move,const,constN,const,loadpool,load,store,mfhilo") + (set_attr "mode" "SI")]) ;; On the mips16, we can split lw $r,N($r) into an add and a load, ;; when the original load is a 4 byte instruction but the add and the @@ -3849,9 +3894,8 @@ (match_operand:CC 1 "general_operand" "z,*d,*m,*d,*f,*d,*f,*m,*f"))] "ISA_HAS_8CC && TARGET_HARD_FLOAT" { return mips_output_move (operands[0], operands[1]); } - [(set_attr "type" "multi,move,load,store,mfc,mtc,fmove,fpload,fpstore") - (set_attr "mode" "SI") - (set_attr "length" "8,4,*,*,4,4,4,*,*")]) + [(set_attr "move_type" "lui_movf,move,load,store,mfc,mtc,fmove,fpload,fpstore") + (set_attr "mode" "SI")]) ;; Reload condition code registers. reload_incc and reload_outcc ;; both handle moves from arbitrary operands into condition code @@ -3930,8 +3974,7 @@ "ISA_HAS_LWXS" "lwxs\t%0,%1(%2)" [(set_attr "type" "load") - (set_attr "mode" "SI") - (set_attr "length" "4")]) + (set_attr "mode" "SI")]) ;; 16-bit Integer moves @@ -3956,9 +3999,8 @@ && (register_operand (operands[0], HImode) || reg_or_0_operand (operands[1], HImode))" { return mips_output_move (operands[0], operands[1]); } - [(set_attr "type" "move,arith,load,store,mthilo,mfhilo") - (set_attr "mode" "HI") - (set_attr "length" "4,4,*,*,4,4")]) + [(set_attr "move_type" "move,const,load,store,mthilo,mfhilo") + (set_attr "mode" "HI")]) (define_insn "*movhi_mips16" [(set (match_operand:HI 0 "nonimmediate_operand" "=d,y,d,d,d,d,m,*d") @@ -3967,22 +4009,8 @@ && (register_operand (operands[0], HImode) || register_operand (operands[1], HImode))" { return mips_output_move (operands[0], operands[1]); } - [(set_attr "type" "move,move,move,arith,arith,load,store,mfhilo") - (set_attr "mode" "HI") - (set_attr_alternative "length" - [(const_int 4) - (const_int 4) - (const_int 4) - (if_then_else (match_operand:VOID 1 "m16_uimm8_1") - (const_int 4) - (const_int 8)) - (if_then_else (match_operand:VOID 1 "m16_nuimm8_1") - (const_int 8) - (const_int 12)) - (const_string "*") - (const_string "*") - (const_string "*")])]) - + [(set_attr "move_type" "move,move,move,const,constN,load,store,mfhilo") + (set_attr "mode" "HI")]) ;; On the mips16, we can split lh $r,N($r) into an add and a load, ;; when the original load is a 4 byte instruction but the add and the @@ -4046,9 +4074,8 @@ && (register_operand (operands[0], QImode) || reg_or_0_operand (operands[1], QImode))" { return mips_output_move (operands[0], operands[1]); } - [(set_attr "type" "move,arith,load,store,mthilo,mfhilo") - (set_attr "mode" "QI") - (set_attr "length" "4,4,*,*,4,4")]) + [(set_attr "move_type" "move,const,load,store,mthilo,mfhilo") + (set_attr "mode" "QI")]) (define_insn "*movqi_mips16" [(set (match_operand:QI 0 "nonimmediate_operand" "=d,y,d,d,d,d,m,*d") @@ -4057,9 +4084,8 @@ && (register_operand (operands[0], QImode) || register_operand (operands[1], QImode))" { return mips_output_move (operands[0], operands[1]); } - [(set_attr "type" "move,move,move,arith,arith,load,store,mfhilo") - (set_attr "mode" "QI") - (set_attr "length" "4,4,4,4,8,*,*,4")]) + [(set_attr "move_type" "move,move,move,const,constN,load,store,mfhilo") + (set_attr "mode" "QI")]) ;; On the mips16, we can split lb $r,N($r) into an add and a load, ;; when the original load is a 4 byte instruction but the add and the @@ -4106,9 +4132,8 @@ && (register_operand (operands[0], SFmode) || reg_or_0_operand (operands[1], SFmode))" { return mips_output_move (operands[0], operands[1]); } - [(set_attr "type" "fmove,mtc,fpload,fpstore,store,mtc,mfc,move,load,store") - (set_attr "mode" "SF") - (set_attr "length" "4,4,*,*,*,4,4,4,*,*")]) + [(set_attr "move_type" "fmove,mtc,fpload,fpstore,store,mtc,mfc,move,load,store") + (set_attr "mode" "SF")]) (define_insn "*movsf_softfloat" [(set (match_operand:SF 0 "nonimmediate_operand" "=d,d,m") @@ -4117,9 +4142,8 @@ && (register_operand (operands[0], SFmode) || reg_or_0_operand (operands[1], SFmode))" { return mips_output_move (operands[0], operands[1]); } - [(set_attr "type" "move,load,store") - (set_attr "mode" "SF") - (set_attr "length" "4,*,*")]) + [(set_attr "move_type" "move,load,store") + (set_attr "mode" "SF")]) (define_insn "*movsf_mips16" [(set (match_operand:SF 0 "nonimmediate_operand" "=d,y,d,d,m") @@ -4128,10 +4152,8 @@ && (register_operand (operands[0], SFmode) || register_operand (operands[1], SFmode))" { return mips_output_move (operands[0], operands[1]); } - [(set_attr "type" "move,move,move,load,store") - (set_attr "mode" "SF") - (set_attr "length" "4,4,4,*,*")]) - + [(set_attr "move_type" "move,move,move,load,store") + (set_attr "mode" "SF")]) ;; 64-bit floating point moves @@ -4144,39 +4166,25 @@ DONE; }) -(define_insn "*movdf_hardfloat_64bit" +(define_insn "*movdf_hardfloat" [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,m,m,*f,*d,*d,*d,*m") (match_operand:DF 1 "move_operand" "f,G,m,f,G,*d,*f,*d*G,*m,*d"))] - "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_64BIT + "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && (register_operand (operands[0], DFmode) || reg_or_0_operand (operands[1], DFmode))" { return mips_output_move (operands[0], operands[1]); } - [(set_attr "type" "fmove,mtc,fpload,fpstore,store,mtc,mfc,move,load,store") - (set_attr "mode" "DF") - (set_attr "length" "4,4,*,*,*,4,4,4,*,*")]) - -;; This pattern applies to both !TARGET_FLOAT64 and TARGET_FLOAT64. -(define_insn "*movdf_hardfloat_32bit" - [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,m,m,*f,*d,*d,*d,*m") - (match_operand:DF 1 "move_operand" "f,G,m,f,G,*d,*f,*d*G,*m,*d"))] - "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && !TARGET_64BIT - && (register_operand (operands[0], DFmode) - || reg_or_0_operand (operands[1], DFmode))" - { return mips_output_move (operands[0], operands[1]); } - [(set_attr "type" "fmove,mtc,fpload,fpstore,store,mtc,mfc,move,load,store") - (set_attr "mode" "DF") - (set_attr "length" "4,8,*,*,*,8,8,8,*,*")]) + [(set_attr "move_type" "fmove,mtc,fpload,fpstore,store,mtc,mfc,move,load,store") + (set_attr "mode" "DF")]) (define_insn "*movdf_softfloat" - [(set (match_operand:DF 0 "nonimmediate_operand" "=d,d,m,d,f,f") - (match_operand:DF 1 "move_operand" "dG,m,dG,f,d,f"))] + [(set (match_operand:DF 0 "nonimmediate_operand" "=d,d,m") + (match_operand:DF 1 "move_operand" "dG,m,dG"))] "(TARGET_SOFT_FLOAT || TARGET_SINGLE_FLOAT) && !TARGET_MIPS16 && (register_operand (operands[0], DFmode) || reg_or_0_operand (operands[1], DFmode))" { return mips_output_move (operands[0], operands[1]); } - [(set_attr "type" "multi,load,store,mfc,mtc,fmove") - (set_attr "mode" "DF") - (set_attr "length" "8,*,*,4,4,4")]) + [(set_attr "move_type" "move,load,store") + (set_attr "mode" "DF")]) (define_insn "*movdf_mips16" [(set (match_operand:DF 0 "nonimmediate_operand" "=d,y,d,d,m") @@ -4185,9 +4193,8 @@ && (register_operand (operands[0], DFmode) || register_operand (operands[1], DFmode))" { return mips_output_move (operands[0], operands[1]); } - [(set_attr "type" "multi,multi,multi,load,store") - (set_attr "mode" "DF") - (set_attr "length" "8,8,8,*,*")]) + [(set_attr "move_type" "move,move,move,load,store") + (set_attr "mode" "DF")]) ;; 128-bit integer moves @@ -4201,15 +4208,15 @@ }) (define_insn "*movti" - [(set (match_operand:TI 0 "nonimmediate_operand" "=d,d,m,*a,*d") - (match_operand:TI 1 "move_operand" "di,m,dJ,*d*J,*a"))] + [(set (match_operand:TI 0 "nonimmediate_operand" "=d,d,d,m,*a,*d") + (match_operand:TI 1 "move_operand" "d,i,m,dJ,*d*J,*a"))] "TARGET_64BIT && !TARGET_MIPS16 && (register_operand (operands[0], TImode) || reg_or_0_operand (operands[1], TImode))" "#" - [(set_attr "type" "multi,load,store,multi,multi") - (set_attr "length" "8,*,*,8,8")]) + [(set_attr "move_type" "move,const,load,store,mthilo,mfhilo") + (set_attr "mode" "TI")]) (define_insn "*movti_mips16" [(set (match_operand:TI 0 "nonimmediate_operand" "=d,y,d,d,d,d,m,*d") @@ -4219,8 +4226,8 @@ && (register_operand (operands[0], TImode) || register_operand (operands[1], TImode))" "#" - [(set_attr "type" "multi,multi,multi,multi,multi,load,store,multi") - (set_attr "length" "8,8,8,12,16,*,*,8")]) + [(set_attr "move_type" "move,move,move,const,constN,load,store,mfhilo") + (set_attr "mode" "TI")]) ;; 128-bit floating point moves @@ -4242,8 +4249,8 @@ && (register_operand (operands[0], TFmode) || reg_or_0_operand (operands[1], TFmode))" "#" - [(set_attr "type" "multi,load,store,multi,multi,fpload,fpstore") - (set_attr "length" "8,*,*,8,8,*,*")]) + [(set_attr "move_type" "move,load,store,mtc,mfc,fpload,fpstore") + (set_attr "mode" "TF")]) (define_insn "*movtf_mips16" [(set (match_operand:TF 0 "nonimmediate_operand" "=d,y,d,d,m") @@ -4253,8 +4260,8 @@ && (register_operand (operands[0], TFmode) || register_operand (operands[1], TFmode))" "#" - [(set_attr "type" "multi,multi,multi,load,store") - (set_attr "length" "8,8,8,*,*")]) + [(set_attr "move_type" "move,move,move,load,store") + (set_attr "mode" "TF")]) (define_split [(set (match_operand:MOVE64 0 "nonimmediate_operand") @@ -4303,31 +4310,16 @@ DONE; }) -(define_insn "movv2sf_hardfloat_64bit" - [(set (match_operand:V2SF 0 "nonimmediate_operand" "=f,f,f,m,m,*f,*d,*d,*d,*m") - (match_operand:V2SF 1 "move_operand" "f,YG,m,f,YG,*d,*f,*d*YG,*m,*d"))] - "TARGET_HARD_FLOAT - && TARGET_PAIRED_SINGLE_FLOAT - && TARGET_64BIT - && (register_operand (operands[0], V2SFmode) - || reg_or_0_operand (operands[1], V2SFmode))" - { return mips_output_move (operands[0], operands[1]); } - [(set_attr "type" "fmove,mtc,fpload,fpstore,store,mtc,mfc,move,load,store") - (set_attr "mode" "SF") - (set_attr "length" "4,4,*,*,*,4,4,4,*,*")]) - -(define_insn "movv2sf_hardfloat_32bit" +(define_insn "*movv2sf" [(set (match_operand:V2SF 0 "nonimmediate_operand" "=f,f,f,m,m,*f,*d,*d,*d,*m") (match_operand:V2SF 1 "move_operand" "f,YG,m,f,YG,*d,*f,*d*YG,*m,*d"))] "TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT - && !TARGET_64BIT && (register_operand (operands[0], V2SFmode) || reg_or_0_operand (operands[1], V2SFmode))" { return mips_output_move (operands[0], operands[1]); } - [(set_attr "type" "fmove,mtc,fpload,fpstore,store,mtc,mfc,move,load,store") - (set_attr "mode" "SF") - (set_attr "length" "4,8,*,*,*,8,8,8,*,*")]) + [(set_attr "move_type" "fmove,mtc,fpload,fpstore,store,mtc,mfc,move,load,store") + (set_attr "mode" "DF")]) ;; Extract the high part of a HI/LO value. See mips_hard_regno_mode_ok_p ;; for the reason why we can't just use (reg:GPR HI_REGNUM). @@ -4341,7 +4333,7 @@ UNSPEC_MFHI))] "" { return ISA_HAS_MACCHI ? "<GPR:d>macchi\t%0,%.,%." : "mfhi\t%0"; } - [(set_attr "type" "mfhilo") + [(set_attr "move_type" "mfhilo") (set_attr "mode" "<GPR:MODE>")]) ;; Set the high part of a HI/LO value, given that the low part has @@ -4354,7 +4346,7 @@ UNSPEC_MTHI))] "" "mthi\t%z1" - [(set_attr "type" "mthilo") + [(set_attr "move_type" "mthilo") (set_attr "mode" "SI")]) ;; Emit a doubleword move in which exactly one of the operands is @@ -4402,7 +4394,7 @@ operands[0] = mips_subword (operands[0], 0); return mips_output_move (operands[0], operands[1]); } - [(set_attr "type" "mtc,fpload") + [(set_attr "move_type" "mtc,fpload") (set_attr "mode" "<HALFMODE>")]) ;; Load the high word of operand 0 from operand 1, preserving the value @@ -4417,7 +4409,7 @@ operands[0] = mips_subword (operands[0], 1); return mips_output_move (operands[0], operands[1]); } - [(set_attr "type" "mtc,fpload") + [(set_attr "move_type" "mtc,fpload") (set_attr "mode" "<HALFMODE>")]) ;; Store one word of operand 1 in operand 0. Operand 2 is 1 to store the @@ -4432,7 +4424,7 @@ operands[1] = mips_subword (operands[1], INTVAL (operands[2])); return mips_output_move (operands[0], operands[1]); } - [(set_attr "type" "mfc,fpstore") + [(set_attr "move_type" "mfc,fpstore") (set_attr "mode" "<HALFMODE>")]) ;; Move operand 1 to the high word of operand 0 using mthc1, preserving the @@ -4444,7 +4436,7 @@ UNSPEC_MTHC1))] "TARGET_HARD_FLOAT && ISA_HAS_MXHC1" "mthc1\t%z1,%0" - [(set_attr "type" "mtc") + [(set_attr "move_type" "mtc") (set_attr "mode" "<HALFMODE>")]) ;; Move high word of operand 1 to operand 0 using mfhc1. @@ -4454,7 +4446,7 @@ UNSPEC_MFHC1))] "TARGET_HARD_FLOAT && ISA_HAS_MXHC1" "mfhc1\t%0,%1" - [(set_attr "type" "mfc") + [(set_attr "move_type" "mfc") (set_attr "mode" "<HALFMODE>")]) ;; Move a constant that satisfies CONST_GP_P into operand 0. @@ -4505,8 +4497,7 @@ "" "" [(set_attr "type" "ghost") - (set_attr "mode" "none") - (set_attr "length" "0")]) + (set_attr "mode" "none")]) ;; Initialize $gp for RTP PIC. Operand 0 is the __GOTT_BASE__ symbol ;; and operand 1 is the __GOTT_INDEX__ symbol. @@ -5493,8 +5484,7 @@ } } [(set_attr "type" "branch") - (set_attr "mode" "none") - (set_attr "length" "8")]) + (set_attr "mode" "none")]) (define_expand "b<code>" [(set (pc) @@ -5746,9 +5736,8 @@ (label_ref (match_operand 0 "" "")))] "TARGET_MIPS16" "b\t%l0" - [(set_attr "type" "branch") - (set_attr "mode" "none") - (set_attr "length" "8")]) + [(set_attr "type" "branch") + (set_attr "mode" "none")]) (define_expand "indirect_jump" [(set (pc) (match_operand 0 "register_operand"))] @@ -5883,8 +5872,7 @@ "" "" [(set_attr "type" "ghost") - (set_attr "mode" "none") - (set_attr "length" "0")]) + (set_attr "mode" "none")]) (define_expand "epilogue" [(const_int 2)] @@ -6070,16 +6058,14 @@ (unspec_volatile:SI [(const_int 0)] UNSPEC_SET_GOT_VERSION))] "TARGET_USE_GOT" "" - [(set_attr "length" "0") - (set_attr "type" "ghost")]) + [(set_attr "type" "ghost")]) (define_insn "update_got_version" [(set (reg:SI GOT_VERSION_REGNUM) (unspec:SI [(reg:SI GOT_VERSION_REGNUM)] UNSPEC_UPDATE_GOT_VERSION))] "TARGET_USE_GOT" "" - [(set_attr "length" "0") - (set_attr "type" "ghost")]) + [(set_attr "type" "ghost")]) ;; Sibling calls. All these patterns use jump instructions. @@ -6205,8 +6191,7 @@ mips_restore_gp (); DONE; } - [(set_attr "jal" "indirect,direct") - (set_attr "extended_mips16" "no,yes")]) + [(set_attr "jal" "indirect,direct")]) ;; A pattern for calls that must be made directly. It is used for ;; MIPS16 calls that the linker may need to redirect to a hard-float @@ -6258,8 +6243,7 @@ mips_restore_gp (); DONE; } - [(set_attr "jal" "indirect,direct") - (set_attr "extended_mips16" "no,yes")]) + [(set_attr "jal" "indirect,direct")]) (define_insn "call_value_split" [(set (match_operand 0 "register_operand" "") @@ -6301,8 +6285,7 @@ mips_restore_gp (); DONE; } - [(set_attr "jal" "indirect,direct") - (set_attr "extended_mips16" "no,yes")]) + [(set_attr "jal" "indirect,direct")]) (define_insn "call_value_multiple_split" [(set (match_operand 0 "register_operand" "") diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c index 2807d08d956..fe38bb01eca 100644 --- a/gcc/config/mmix/mmix.c +++ b/gcc/config/mmix/mmix.c @@ -241,7 +241,7 @@ mmix_init_expanders (void) static struct machine_function * mmix_init_machine_status (void) { - return ggc_alloc_cleared (sizeof (struct machine_function)); + return GGC_CNEW (struct machine_function); } /* DATA_ALIGNMENT. @@ -1158,7 +1158,7 @@ mmix_encode_section_info (tree decl, rtx rtl, int first) const char *str = XSTR (XEXP (rtl, 0), 0); int len = strlen (str); - char *newstr = alloca (len + 2); + char *newstr = XALLOCAVEC (char, len + 2); newstr[0] = '@'; strcpy (newstr + 1, str); XSTR (XEXP (rtl, 0), 0) = ggc_alloc_string (newstr, len + 1); diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 009f5faf10c..0529a86a68c 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -538,7 +538,7 @@ pa_init_builtins (void) static struct machine_function * pa_init_machine_status (void) { - return ggc_alloc_cleared (sizeof (machine_function)); + return GGC_CNEW (machine_function); } /* If FROM is a probable pointer register, mark TO as a probable @@ -7861,7 +7861,7 @@ hppa_encode_label (rtx sym) int len = strlen (str) + 1; char *newstr, *p; - p = newstr = alloca (len + 1); + p = newstr = XALLOCAVEC (char, len + 1); *p++ = '@'; strcpy (p, str); diff --git a/gcc/config/rs6000/aix.h b/gcc/config/rs6000/aix.h index 09e0fe507cf..48072988f33 100644 --- a/gcc/config/rs6000/aix.h +++ b/gcc/config/rs6000/aix.h @@ -201,6 +201,8 @@ /* Define cutoff for using external functions to save floating point. */ #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == 62 || (FIRST_REG) == 63) +/* And similarly for general purpose registers. */ +#define GP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 32) /* __throw will restore its own return address to be the same as the return address of the function that the throw is being made to. diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h index 9479fc312ca..d8550c86dfb 100644 --- a/gcc/config/rs6000/darwin.h +++ b/gcc/config/rs6000/darwin.h @@ -191,6 +191,8 @@ #undef FP_SAVE_INLINE #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64) +#undef GP_SAVE_INLINE +#define GP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 32) /* Darwin uses a function call if everything needs to be saved/restored. */ #undef WORLD_SAVE_P diff --git a/gcc/config/rs6000/e500.h b/gcc/config/rs6000/e500.h index ae909952d8b..c874f08f0ad 100644 --- a/gcc/config/rs6000/e500.h +++ b/gcc/config/rs6000/e500.h @@ -19,7 +19,6 @@ #undef TARGET_SPE_ABI #undef TARGET_SPE #undef TARGET_E500 -#undef TARGET_ISEL #undef TARGET_FPRS #undef TARGET_E500_SINGLE #undef TARGET_E500_DOUBLE @@ -28,13 +27,12 @@ #define TARGET_SPE_ABI rs6000_spe_abi #define TARGET_SPE rs6000_spe #define TARGET_E500 (rs6000_cpu == PROCESSOR_PPC8540) -#define TARGET_ISEL rs6000_isel #define TARGET_FPRS (rs6000_float_gprs == 0) #define TARGET_E500_SINGLE (TARGET_HARD_FLOAT && rs6000_float_gprs == 1) #define TARGET_E500_DOUBLE (TARGET_HARD_FLOAT && rs6000_float_gprs == 2) #define CHECK_E500_OPTIONS \ do { \ - if (TARGET_E500 || TARGET_SPE || TARGET_SPE_ABI || TARGET_ISEL \ + if (TARGET_E500 || TARGET_SPE || TARGET_SPE_ABI \ || TARGET_E500_SINGLE || TARGET_E500_DOUBLE) \ { \ if (TARGET_ALTIVEC) \ diff --git a/gcc/config/rs6000/e500mc.md b/gcc/config/rs6000/e500mc.md new file mode 100644 index 00000000000..86434f95fe1 --- /dev/null +++ b/gcc/config/rs6000/e500mc.md @@ -0,0 +1,200 @@ +;; Pipeline description for Motorola PowerPC e500mc core. +;; Copyright (C) 2008 Free Software Foundation, Inc. +;; Contributed by Edmar Wienskoski (edmar@freescale.com) +;; +;; This file is part of GCC. +;; +;; GCC is free software; you can redistribute it and/or modify it +;; under the terms of the GNU General Public License as published +;; by the Free Software Foundation; either version 3, or (at your +;; option) any later version. +;; +;; GCC is distributed in the hope that it will be useful, but WITHOUT +;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +;; License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with GCC; see the file COPYING3. If not see +;; <http://www.gnu.org/licenses/>. +;; +;; e500mc 32-bit SU(2), LSU, FPU, BPU +;; Max issue 3 insns/clock cycle (includes 1 branch) +;; FP is half clocked, timings of other instructions are as in the e500v2. + +(define_automaton "e500mc_most,e500mc_long,e500mc_retire") +(define_cpu_unit "e500mc_decode_0,e500mc_decode_1" "e500mc_most") +(define_cpu_unit "e500mc_issue_0,e500mc_issue_1" "e500mc_most") +(define_cpu_unit "e500mc_retire_0,e500mc_retire_1" "e500mc_retire") + +;; SU. +(define_cpu_unit "e500mc_su0_stage0,e500mc_su1_stage0" "e500mc_most") + +;; MU. +(define_cpu_unit "e500mc_mu_stage0,e500mc_mu_stage1" "e500mc_most") +(define_cpu_unit "e500mc_mu_stage2,e500mc_mu_stage3" "e500mc_most") + +;; Non-pipelined division. +(define_cpu_unit "e500mc_mu_div" "e500mc_long") + +;; LSU. +(define_cpu_unit "e500mc_lsu" "e500mc_most") + +;; FPU. +(define_cpu_unit "e500mc_fpu" "e500mc_most") + +;; Branch unit. +(define_cpu_unit "e500mc_bu" "e500mc_most") + +;; The following units are used to make the automata deterministic. +(define_cpu_unit "present_e500mc_decode_0" "e500mc_most") +(define_cpu_unit "present_e500mc_issue_0" "e500mc_most") +(define_cpu_unit "present_e500mc_retire_0" "e500mc_retire") +(define_cpu_unit "present_e500mc_su0_stage0" "e500mc_most") + +;; The following sets to make automata deterministic when option ndfa is used. +(presence_set "present_e500mc_decode_0" "e500mc_decode_0") +(presence_set "present_e500mc_issue_0" "e500mc_issue_0") +(presence_set "present_e500mc_retire_0" "e500mc_retire_0") +(presence_set "present_e500mc_su0_stage0" "e500mc_su0_stage0") + +;; Some useful abbreviations. +(define_reservation "e500mc_decode" + "e500mc_decode_0|e500mc_decode_1+present_e500mc_decode_0") +(define_reservation "e500mc_issue" + "e500mc_issue_0|e500mc_issue_1+present_e500mc_issue_0") +(define_reservation "e500mc_retire" + "e500mc_retire_0|e500mc_retire_1+present_e500mc_retire_0") +(define_reservation "e500mc_su_stage0" + "e500mc_su0_stage0|e500mc_su1_stage0+present_e500mc_su0_stage0") + +;; Simple SU insns. +(define_insn_reservation "e500mc_su" 1 + (and (eq_attr "type" "integer,insert_word,insert_dword,cmp,compare,\ + delayed_compare,var_delayed_compare,fast_compare,\ + shift,trap,var_shift_rotate,cntlz,exts") + (eq_attr "cpu" "ppce500mc")) + "e500mc_decode,e500mc_issue+e500mc_su_stage0+e500mc_retire") + +(define_insn_reservation "e500mc_two" 1 + (and (eq_attr "type" "two") + (eq_attr "cpu" "ppce500mc")) + "e500mc_decode,e500mc_issue+e500mc_su_stage0+e500mc_retire,\ + e500mc_issue+e500mc_su_stage0+e500mc_retire") + +(define_insn_reservation "e500mc_three" 1 + (and (eq_attr "type" "three") + (eq_attr "cpu" "ppce500mc")) + "e500mc_decode,e500mc_issue+e500mc_su_stage0+e500mc_retire,\ + e500mc_issue+e500mc_su_stage0+e500mc_retire,\ + e500mc_issue+e500mc_su_stage0+e500mc_retire") + +;; Multiply. +(define_insn_reservation "e500mc_multiply" 4 + (and (eq_attr "type" "imul,imul2,imul3,imul_compare") + (eq_attr "cpu" "ppce500mc")) + "e500mc_decode,e500mc_issue+e500mc_mu_stage0,e500mc_mu_stage1,\ + e500mc_mu_stage2,e500mc_mu_stage3+e500mc_retire") + +;; Divide. We use the average latency time here. +(define_insn_reservation "e500mc_divide" 14 + (and (eq_attr "type" "idiv") + (eq_attr "cpu" "ppce500mc")) + "e500mc_decode,e500mc_issue+e500mc_mu_stage0+e500mc_mu_div,\ + e500mc_mu_div*13") + +;; Branch. +(define_insn_reservation "e500mc_branch" 1 + (and (eq_attr "type" "jmpreg,branch,isync") + (eq_attr "cpu" "ppce500mc")) + "e500mc_decode,e500mc_bu,e500mc_retire") + +;; CR logical. +(define_insn_reservation "e500mc_cr_logical" 1 + (and (eq_attr "type" "cr_logical,delayed_cr") + (eq_attr "cpu" "ppce500mc")) + "e500mc_decode,e500mc_bu,e500mc_retire") + +;; Mfcr. +(define_insn_reservation "e500mc_mfcr" 1 + (and (eq_attr "type" "mfcr") + (eq_attr "cpu" "ppce500mc")) + "e500mc_decode,e500mc_issue+e500mc_su1_stage0+e500mc_retire") + +;; Mtcrf. +(define_insn_reservation "e500mc_mtcrf" 1 + (and (eq_attr "type" "mtcr") + (eq_attr "cpu" "ppce500mc")) + "e500mc_decode,e500mc_issue+e500mc_su1_stage0+e500mc_retire") + +;; Mtjmpr. +(define_insn_reservation "e500mc_mtjmpr" 1 + (and (eq_attr "type" "mtjmpr,mfjmpr") + (eq_attr "cpu" "ppce500mc")) + "e500mc_decode,e500mc_issue+e500mc_su_stage0+e500mc_retire") + +;; Brinc. +(define_insn_reservation "e500mc_brinc" 1 + (and (eq_attr "type" "brinc") + (eq_attr "cpu" "ppce500mc")) + "e500mc_decode,e500mc_issue+e500mc_su_stage0+e500mc_retire") + +;; Loads. +(define_insn_reservation "e500mc_load" 3 + (and (eq_attr "type" "load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,\ + load_l,sync") + (eq_attr "cpu" "ppce500mc")) + "e500mc_decode,e500mc_issue+e500mc_lsu,nothing,e500mc_retire") + +(define_insn_reservation "e500mc_fpload" 4 + (and (eq_attr "type" "fpload,fpload_ux,fpload_u") + (eq_attr "cpu" "ppce500mc")) + "e500mc_decode,e500mc_issue+e500mc_lsu,nothing*2,e500mc_retire") + +;; Stores. +(define_insn_reservation "e500mc_store" 3 + (and (eq_attr "type" "store,store_ux,store_u,store_c") + (eq_attr "cpu" "ppce500mc")) + "e500mc_decode,e500mc_issue+e500mc_lsu,nothing,e500mc_retire") + +(define_insn_reservation "e500mc_fpstore" 3 + (and (eq_attr "type" "fpstore,fpstore_ux,fpstore_u") + (eq_attr "cpu" "ppce500mc")) + "e500mc_decode,e500mc_issue+e500mc_lsu,nothing,e500mc_retire") + +;; The following ignores the retire unit to avoid a large automata. + +;; Simple FP. +(define_insn_reservation "e500mc_simple_float" 8 + (and (eq_attr "type" "fpsimple") + (eq_attr "cpu" "ppce500mc")) + "e500mc_decode,e500mc_issue+e500mc_fpu") +; "e500mc_decode,e500mc_issue+e500mc_fpu,nothing*6,e500mc_retire") + +;; FP. +(define_insn_reservation "e500mc_float" 8 + (and (eq_attr "type" "fp") + (eq_attr "cpu" "ppce500mc")) + "e500mc_decode,e500mc_issue+e500mc_fpu") +; "e500mc_decode,e500mc_issue+e500mc_fpu,nothing*6,e500mc_retire") + +(define_insn_reservation "e500mc_fpcompare" 8 + (and (eq_attr "type" "fpcompare") + (eq_attr "cpu" "ppce500mc")) + "e500mc_decode,e500mc_issue+e500mc_fpu") + +(define_insn_reservation "e500mc_dmul" 10 + (and (eq_attr "type" "dmul") + (eq_attr "cpu" "ppce500mc")) + "e500mc_decode,e500mc_issue+e500mc_fpu") + +;; FP divides are not pipelined. +(define_insn_reservation "e500mc_sdiv" 36 + (and (eq_attr "type" "sdiv") + (eq_attr "cpu" "ppce500mc")) + "e500mc_decode,e500mc_issue+e500mc_fpu,e500mc_fpu*35") + +(define_insn_reservation "e500mc_ddiv" 66 + (and (eq_attr "type" "ddiv") + (eq_attr "cpu" "ppce500mc")) + "e500mc_decode,e500mc_issue+e500mc_fpu,e500mc_fpu*65") diff --git a/gcc/config/rs6000/predicates.md b/gcc/config/rs6000/predicates.md index 3dd4bf560d7..8e97c79acd2 100644 --- a/gcc/config/rs6000/predicates.md +++ b/gcc/config/rs6000/predicates.md @@ -213,6 +213,9 @@ switch (mode) { case TFmode: + if (TARGET_E500_DOUBLE) + return 0; + REAL_VALUE_FROM_CONST_DOUBLE (rv, op); REAL_VALUE_TO_TARGET_LONG_DOUBLE (rv, k); @@ -912,7 +915,7 @@ rtx elt; int count = XVECLEN (op, 0); - if (count != 55) + if (count != 54) return 0; index = 0; @@ -961,9 +964,8 @@ || GET_MODE (SET_SRC (elt)) != Pmode) return 0; - if (GET_CODE (XVECEXP (op, 0, index++)) != USE - || GET_CODE (XVECEXP (op, 0, index++)) != USE - || GET_CODE (XVECEXP (op, 0, index++)) != CLOBBER) + if (GET_CODE (XVECEXP (op, 0, index++)) != SET + || GET_CODE (XVECEXP (op, 0, index++)) != SET) return 0; return 1; }) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 68280a5ff9b..4833ad76d91 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -694,6 +694,25 @@ struct processor_costs ppce300c2c3_cost = { 1, /* prefetch streams /*/ }; +/* Instruction costs on PPCE500MC processors. */ +static const +struct processor_costs ppce500mc_cost = { + COSTS_N_INSNS (4), /* mulsi */ + COSTS_N_INSNS (4), /* mulsi_const */ + COSTS_N_INSNS (4), /* mulsi_const9 */ + COSTS_N_INSNS (4), /* muldi */ + COSTS_N_INSNS (14), /* divsi */ + COSTS_N_INSNS (14), /* divdi */ + COSTS_N_INSNS (8), /* fp */ + COSTS_N_INSNS (10), /* dmul */ + COSTS_N_INSNS (36), /* sdiv */ + COSTS_N_INSNS (66), /* ddiv */ + 64, /* cache line size */ + 32, /* l1 cache */ + 128, /* l2 cache */ + 1, /* prefetch streams /*/ +}; + /* Instruction costs on POWER4 and POWER5 processors. */ static const struct processor_costs power4_cost = { @@ -742,7 +761,7 @@ static bool spe_func_has_64bit_regs_p (void); static void emit_frame_save (rtx, rtx, enum machine_mode, unsigned int, int, HOST_WIDE_INT); static rtx gen_frame_mem_offset (enum machine_mode, rtx, int); -static void rs6000_emit_allocate_stack (HOST_WIDE_INT, int); +static void rs6000_emit_allocate_stack (HOST_WIDE_INT, int, int); static unsigned rs6000_hash_constant (rtx); static unsigned toc_hash_function (const void *); static int toc_hash_eq (const void *, const void *); @@ -752,7 +771,7 @@ static bool legitimate_small_data_p (enum machine_mode, rtx); static bool legitimate_lo_sum_address_p (enum machine_mode, rtx, int); static struct machine_function * rs6000_init_machine_status (void); static bool rs6000_assemble_integer (rtx, unsigned int, int); -static bool no_global_regs_above (int); +static bool no_global_regs_above (int, bool); #ifdef HAVE_GAS_HIDDEN static void rs6000_assemble_visibility (tree, int); #endif @@ -765,7 +784,13 @@ static void rs6000_eliminate_indexed_memrefs (rtx operands[2]); static const char *rs6000_mangle_type (const_tree); extern const struct attribute_spec rs6000_attribute_table[]; static void rs6000_set_default_type_attributes (tree); +static rtx rs6000_savres_routine_sym (rs6000_stack_t *, bool, bool, bool); +static void rs6000_emit_stack_reset (rs6000_stack_t *, rtx, rtx, int, bool); +static rtx rs6000_make_savres_rtx (rs6000_stack_t *, rtx, int, + enum machine_mode, bool, bool, bool); static bool rs6000_reg_live_or_pic_offset_p (int); +static int rs6000_savres_strategy (rs6000_stack_t *, bool, int, int); +static void rs6000_restore_saved_cr (rtx, int); static void rs6000_output_function_prologue (FILE *, HOST_WIDE_INT); static void rs6000_output_function_epilogue (FILE *, HOST_WIDE_INT); static void rs6000_output_mi_thunk (FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT, @@ -1450,6 +1475,7 @@ rs6000_override_options (const char *default_cpu) {"8548", PROCESSOR_PPC8540, POWERPC_BASE_MASK | MASK_STRICT_ALIGN}, {"e300c2", PROCESSOR_PPCE300C2, POWERPC_BASE_MASK | MASK_SOFT_FLOAT}, {"e300c3", PROCESSOR_PPCE300C3, POWERPC_BASE_MASK}, + {"e500mc", PROCESSOR_PPCE500MC, POWERPC_BASE_MASK | MASK_PPC_GFXOPT}, {"860", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT}, {"970", PROCESSOR_POWER4, POWERPC_7400_MASK | MASK_PPC_GPOPT | MASK_MFCRF | MASK_POWERPC64}, @@ -1553,10 +1579,12 @@ rs6000_override_options (const char *default_cpu) } } - if (TARGET_E500 && !rs6000_explicit_options.isel) + if ((TARGET_E500 || rs6000_cpu == PROCESSOR_PPCE500MC) + && !rs6000_explicit_options.isel) rs6000_isel = 1; - if (rs6000_cpu == PROCESSOR_PPCE300C2 || rs6000_cpu == PROCESSOR_PPCE300C3) + if (rs6000_cpu == PROCESSOR_PPCE300C2 || rs6000_cpu == PROCESSOR_PPCE300C3 + || rs6000_cpu == PROCESSOR_PPCE500MC) { if (TARGET_ALTIVEC) error ("AltiVec not supported in this target"); @@ -1673,9 +1701,9 @@ rs6000_override_options (const char *default_cpu) SUB3TARGET_OVERRIDE_OPTIONS; #endif - if (TARGET_E500) + if (TARGET_E500 || rs6000_cpu == PROCESSOR_PPCE500MC) { - /* The e500 does not have string instructions, and we set + /* The e500 and e500mc do not have string instructions, and we set MASK_STRING above when optimizing for size. */ if ((target_flags & MASK_STRING) != 0) target_flags = target_flags & ~MASK_STRING; @@ -1888,6 +1916,10 @@ rs6000_override_options (const char *default_cpu) rs6000_cost = &ppce300c2c3_cost; break; + case PROCESSOR_PPCE500MC: + rs6000_cost = &ppce500mc_cost; + break; + case PROCESSOR_POWER4: case PROCESSOR_POWER5: rs6000_cost = &power4_cost; @@ -11493,7 +11525,7 @@ rs6000_got_register (rtx value ATTRIBUTE_UNUSED) static struct machine_function * rs6000_init_machine_status (void) { - return ggc_alloc_cleared (sizeof (machine_function)); + return GGC_CNEW (machine_function); } /* These macros test for integers and extract the low-order bits. */ @@ -12370,7 +12402,7 @@ print_operand_address (FILE *file, rtx x) char *newname; name = XSTR (symref, 0); - newname = alloca (strlen (name) + sizeof ("@toc")); + newname = XALLOCAVEC (char, strlen (name) + sizeof ("@toc")); strcpy (newname, name); strcat (newname, "@toc"); XSTR (symref, 0) = newname; @@ -14608,7 +14640,7 @@ rs6000_stack_info (void) { /* Align stack so SPE GPR save area is aligned on a double-word boundary. */ - if (info_ptr->spe_gp_size != 0) + if (info_ptr->spe_gp_size != 0 && info_ptr->cr_save_offset != 0) info_ptr->spe_padding_size = 8 - (-info_ptr->cr_save_offset % 8); else @@ -15263,10 +15295,12 @@ rs6000_emit_stack_tie (void) /* Emit the correct code for allocating stack space, as insns. If COPY_R12, make sure a copy of the old frame is left in r12. + If COPY_R11, make sure a copy of the old frame is left in r11, + in preference to r12 if COPY_R12. The generated code may use hard register 0 as a temporary. */ static void -rs6000_emit_allocate_stack (HOST_WIDE_INT size, int copy_r12) +rs6000_emit_allocate_stack (HOST_WIDE_INT size, int copy_r12, int copy_r11) { rtx insn; rtx stack_reg = gen_rtx_REG (Pmode, STACK_POINTER_REGNUM); @@ -15315,8 +15349,11 @@ rs6000_emit_allocate_stack (HOST_WIDE_INT size, int copy_r12) warning (0, "stack limit expression is not supported"); } - if (copy_r12 || ! TARGET_UPDATE) - emit_move_insn (gen_rtx_REG (Pmode, 12), stack_reg); + if (copy_r12 || copy_r11 || ! TARGET_UPDATE) + emit_move_insn (copy_r11 + ? gen_rtx_REG (Pmode, 11) + : gen_rtx_REG (Pmode, 12), + stack_reg); if (TARGET_UPDATE) { @@ -15342,7 +15379,9 @@ rs6000_emit_allocate_stack (HOST_WIDE_INT size, int copy_r12) ? gen_addsi3 (stack_reg, stack_reg, todec) : gen_adddi3 (stack_reg, stack_reg, todec)); emit_move_insn (gen_rtx_MEM (Pmode, stack_reg), - gen_rtx_REG (Pmode, 12)); + copy_r11 + ? gen_rtx_REG (Pmode, 11) + : gen_rtx_REG (Pmode, 12)); } RTX_FRAME_RELATED_P (insn) = 1; @@ -15565,11 +15604,11 @@ gen_frame_mem_offset (enum machine_mode mode, rtx reg, int offset) and cannot use stmw/lmw if there are any in its range. */ static bool -no_global_regs_above (int first_greg) +no_global_regs_above (int first, bool gpr) { int i; - for (i = 0; i < 32 - first_greg; i++) - if (global_regs[first_greg + i]) + for (i = first; i < gpr ? 32 : 64 ; i++) + if (global_regs[i]) return false; return true; } @@ -15578,6 +15617,163 @@ no_global_regs_above (int first_greg) #define TARGET_FIX_AND_CONTINUE 0 #endif +/* It's really GPR 13 and FPR 14, but we need the smaller of the two. */ +#define FIRST_SAVRES_REGISTER FIRST_SAVED_GP_REGNO +#define LAST_SAVRES_REGISTER 31 +#define N_SAVRES_REGISTERS (LAST_SAVRES_REGISTER - FIRST_SAVRES_REGISTER + 1) + +static GTY(()) rtx savres_routine_syms[N_SAVRES_REGISTERS][8]; + +/* Return the symbol for an out-of-line register save/restore routine. + We are saving/restoring GPRs if GPR is true. */ + +static rtx +rs6000_savres_routine_sym (rs6000_stack_t *info, bool savep, bool gpr, bool exitp) +{ + int regno = gpr ? info->first_gp_reg_save : (info->first_fp_reg_save - 32); + rtx sym; + int select = ((savep ? 1 : 0) << 2 + | (gpr + /* On the SPE, we never have any FPRs, but we do have + 32/64-bit versions of the routines. */ + ? (TARGET_SPE_ABI && info->spe_64bit_regs_used ? 1 : 0) + : 0) << 1 + | (exitp ? 1: 0)); + + /* Don't generate bogus routine names. */ + gcc_assert (FIRST_SAVRES_REGISTER <= regno && regno <= LAST_SAVRES_REGISTER); + + sym = savres_routine_syms[regno-FIRST_SAVRES_REGISTER][select]; + + if (sym == NULL) + { + char name[30]; + const char *action; + const char *regkind; + const char *exit_suffix; + + action = savep ? "save" : "rest"; + + /* SPE has slightly different names for its routines depending on + whether we are saving 32-bit or 64-bit registers. */ + if (TARGET_SPE_ABI) + { + /* No floating point saves on the SPE. */ + gcc_assert (gpr); + + regkind = info->spe_64bit_regs_used ? "64gpr" : "32gpr"; + } + else + regkind = gpr ? "gpr" : "fpr"; + + exit_suffix = exitp ? "_x" : ""; + + sprintf (name, "_%s%s_%d%s", action, regkind, regno, exit_suffix); + + sym = savres_routine_syms[regno-FIRST_SAVRES_REGISTER][select] + = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (name)); + } + + return sym; +} + +/* Emit a sequence of insns, including a stack tie if needed, for + resetting the stack pointer. If SAVRES is true, then don't reset the + stack pointer, but move the base of the frame into r11 for use by + out-of-line register restore routines. */ + +static void +rs6000_emit_stack_reset (rs6000_stack_t *info, + rtx sp_reg_rtx, rtx frame_reg_rtx, + int sp_offset, bool savres) +{ + /* This blockage is needed so that sched doesn't decide to move + the sp change before the register restores. */ + if (frame_reg_rtx != sp_reg_rtx + || (TARGET_SPE_ABI + && info->spe_64bit_regs_used != 0 + && info->first_gp_reg_save != 32)) + rs6000_emit_stack_tie (); + + if (frame_reg_rtx != sp_reg_rtx) + { + rs6000_emit_stack_tie (); + if (sp_offset != 0) + emit_insn (gen_addsi3 (sp_reg_rtx, frame_reg_rtx, + GEN_INT (sp_offset))); + else if (!savres) + emit_move_insn (sp_reg_rtx, frame_reg_rtx); + } + else if (sp_offset != 0) + { + /* If we are restoring registers out-of-line, we will be using the + "exit" variants of the restore routines, which will reset the + stack for us. But we do need to point r11 into the right place + for those routines. */ + rtx dest_reg = (savres + ? gen_rtx_REG (Pmode, 11) + : sp_reg_rtx); + + emit_insn (TARGET_32BIT + ? gen_addsi3 (dest_reg, sp_reg_rtx, + GEN_INT (sp_offset)) + : gen_adddi3 (dest_reg, sp_reg_rtx, + GEN_INT (sp_offset))); + } +} + +/* Construct a parallel rtx describing the effect of a call to an + out-of-line register save/restore routine. */ + +static rtx +rs6000_make_savres_rtx (rs6000_stack_t *info, + rtx frame_reg_rtx, int save_area_offset, + enum machine_mode reg_mode, + bool savep, bool gpr, bool exitp) +{ + int i; + int offset, start_reg, end_reg, n_regs; + int reg_size = GET_MODE_SIZE (reg_mode); + rtx sym; + rtvec p; + + offset = 0; + start_reg = (gpr + ? info->first_gp_reg_save + : info->first_fp_reg_save); + end_reg = gpr ? 32 : 64; + n_regs = end_reg - start_reg; + p = rtvec_alloc ((exitp ? 4 : 3) + n_regs); + + /* If we're saving registers, then we should never say we're exiting. */ + gcc_assert ((savep && !exitp) || !savep); + + if (exitp) + RTVEC_ELT (p, offset++) = gen_rtx_RETURN (VOIDmode); + + RTVEC_ELT (p, offset++) + = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (Pmode, 65)); + + sym = rs6000_savres_routine_sym (info, savep, gpr, exitp); + RTVEC_ELT (p, offset++) = gen_rtx_USE (VOIDmode, sym); + RTVEC_ELT (p, offset++) = gen_rtx_USE (VOIDmode, gen_rtx_REG (Pmode, 11)); + + for (i = 0; i < end_reg - start_reg; i++) + { + rtx addr, reg, mem; + reg = gen_rtx_REG (reg_mode, start_reg + i); + addr = gen_rtx_PLUS (Pmode, frame_reg_rtx, + GEN_INT (save_area_offset + reg_size*i)); + mem = gen_frame_mem (reg_mode, addr); + + RTVEC_ELT (p, i + offset) = gen_rtx_SET (VOIDmode, + savep ? mem : reg, + savep ? reg : mem); + } + + return gen_rtx_PARALLEL (VOIDmode, p); +} + /* Determine whether the gp REG is really used. */ static bool @@ -15592,6 +15788,85 @@ rs6000_reg_live_or_pic_offset_p (int reg) || (DEFAULT_ABI == ABI_DARWIN && flag_pic)))); } +enum { + SAVRES_MULTIPLE = 0x1, + SAVRES_INLINE_FPRS = 0x2, + SAVRES_INLINE_GPRS = 0x4 +}; + +/* Determine the strategy for savings/restoring registers. */ + +static int +rs6000_savres_strategy (rs6000_stack_t *info, bool savep, + int using_static_chain_p, int sibcall) +{ + bool using_multiple_p; + bool common; + bool savres_fprs_inline; + bool savres_gprs_inline; + bool noclobber_global_gprs + = no_global_regs_above (info->first_gp_reg_save, /*gpr=*/true); + + using_multiple_p = (TARGET_MULTIPLE && ! TARGET_POWERPC64 + && (!TARGET_SPE_ABI + || info->spe_64bit_regs_used == 0) + && info->first_gp_reg_save < 31 + && noclobber_global_gprs); + /* Don't bother to try to save things out-of-line if r11 is occupied + by the static chain. It would require too much fiddling and the + static chain is rarely used anyway. */ + common = (using_static_chain_p + || sibcall + || crtl->calls_eh_return + || !info->lr_save_p + || cfun->machine->ra_need_lr + || info->total_size > 32767); + savres_fprs_inline = (common + || info->first_fp_reg_save == 64 + || !no_global_regs_above (info->first_fp_reg_save, + /*gpr=*/false) + || FP_SAVE_INLINE (info->first_fp_reg_save)); + savres_gprs_inline = (common + /* Saving CR interferes with the exit routines + used on the SPE, so just punt here. */ + || (!savep + && TARGET_SPE_ABI + && info->spe_64bit_regs_used != 0 + && info->cr_save_p != 0) + || info->first_gp_reg_save == 32 + || !noclobber_global_gprs + || GP_SAVE_INLINE (info->first_gp_reg_save)); + + if (savep) + /* If we are going to use store multiple, then don't even bother + with the out-of-line routines, since the store-multiple instruction + will always be smaller. */ + savres_gprs_inline = savres_gprs_inline || using_multiple_p; + else + { + /* The situation is more complicated with load multiple. We'd + prefer to use the out-of-line routines for restores, since the + "exit" out-of-line routines can handle the restore of LR and + the frame teardown. But we can only use the out-of-line + routines if we know that we've used store multiple or + out-of-line routines in the prologue, i.e. if we've saved all + the registers from first_gp_reg_save. Otherwise, we risk + loading garbage from the stack. Furthermore, we can only use + the "exit" out-of-line gpr restore if we haven't saved any + fprs. */ + bool saved_all = !savres_gprs_inline || using_multiple_p; + + if (saved_all && info->first_fp_reg_save != 64) + /* We can't use the exit routine; use load multiple if it's + available. */ + savres_gprs_inline = savres_gprs_inline || using_multiple_p; + } + + return (using_multiple_p + | (savres_fprs_inline << 1) + | (savres_gprs_inline << 2)); +} + /* Emit function prologue as insns. */ void @@ -15605,8 +15880,13 @@ rs6000_emit_prologue (void) rtx frame_reg_rtx = sp_reg_rtx; rtx cr_save_rtx = NULL_RTX; rtx insn; + int strategy; int saving_FPRs_inline; + int saving_GPRs_inline; int using_store_multiple; + int using_static_chain_p = (cfun->static_chain_decl != NULL_TREE + && df_regs_ever_live_p (STATIC_CHAIN_REGNUM) + && !call_used_regs[STATIC_CHAIN_REGNUM]); HOST_WIDE_INT sp_offset = 0; if (TARGET_FIX_AND_CONTINUE) @@ -15629,15 +15909,12 @@ rs6000_emit_prologue (void) reg_size = 8; } - using_store_multiple = (TARGET_MULTIPLE && ! TARGET_POWERPC64 - && (!TARGET_SPE_ABI - || info->spe_64bit_regs_used == 0) - && info->first_gp_reg_save < 31 - && no_global_regs_above (info->first_gp_reg_save)); - saving_FPRs_inline = (info->first_fp_reg_save == 64 - || FP_SAVE_INLINE (info->first_fp_reg_save) - || crtl->calls_eh_return - || cfun->machine->ra_need_lr); + strategy = rs6000_savres_strategy (info, /*savep=*/true, + /*static_chain_p=*/using_static_chain_p, + /*sibcall=*/0); + using_store_multiple = strategy & SAVRES_MULTIPLE; + saving_FPRs_inline = strategy & SAVRES_INLINE_FPRS; + saving_GPRs_inline = strategy & SAVRES_INLINE_GPRS; /* For V.4, update stack before we do any saving and set back pointer. */ if (! WORLD_SAVE_P (info) @@ -15645,17 +15922,24 @@ rs6000_emit_prologue (void) && (DEFAULT_ABI == ABI_V4 || crtl->calls_eh_return)) { + bool need_r11 = (TARGET_SPE + ? (!saving_GPRs_inline + && info->spe_64bit_regs_used == 0) + : (!saving_FPRs_inline || !saving_GPRs_inline)); if (info->total_size < 32767) sp_offset = info->total_size; else - frame_reg_rtx = frame_ptr_rtx; + frame_reg_rtx = (need_r11 + ? gen_rtx_REG (Pmode, 11) + : frame_ptr_rtx); rs6000_emit_allocate_stack (info->total_size, (frame_reg_rtx != sp_reg_rtx && (info->cr_save_p || info->lr_save_p || info->first_fp_reg_save < 64 || info->first_gp_reg_save < 32 - ))); + )), + need_r11); if (frame_reg_rtx != sp_reg_rtx) rs6000_emit_stack_tie (); } @@ -15832,40 +16116,147 @@ rs6000_emit_prologue (void) } else if (!WORLD_SAVE_P (info) && info->first_fp_reg_save != 64) { + rtx par; + + par = rs6000_make_savres_rtx (info, frame_reg_rtx, + info->fp_save_offset + sp_offset, + DFmode, + /*savep=*/true, /*gpr=*/false, + /*exitp=*/false); + insn = emit_insn (par); + rs6000_frame_related (insn, frame_ptr_rtx, info->total_size, + NULL_RTX, NULL_RTX); + } + + /* Save GPRs. This is done as a PARALLEL if we are using + the store-multiple instructions. */ + if (!WORLD_SAVE_P (info) + && TARGET_SPE_ABI + && info->spe_64bit_regs_used != 0 + && info->first_gp_reg_save != 32) + { int i; - char rname[30]; - const char *alloc_rname; - rtvec p; - p = rtvec_alloc (2 + 64 - info->first_fp_reg_save); + rtx spe_save_area_ptr; + + /* Determine whether we can address all of the registers that need + to be saved with an offset from the stack pointer that fits in + the small const field for SPE memory instructions. */ + int spe_regs_addressable_via_sp + = (SPE_CONST_OFFSET_OK(info->spe_gp_save_offset + sp_offset + + (32 - info->first_gp_reg_save - 1) * reg_size) + && saving_GPRs_inline); + int spe_offset; + + if (spe_regs_addressable_via_sp) + { + spe_save_area_ptr = frame_reg_rtx; + spe_offset = info->spe_gp_save_offset + sp_offset; + } + else + { + /* Make r11 point to the start of the SPE save area. We need + to be careful here if r11 is holding the static chain. If + it is, then temporarily save it in r0. We would use r0 as + our base register here, but using r0 as a base register in + loads and stores means something different from what we + would like. */ + int ool_adjust = (saving_GPRs_inline + ? 0 + : (info->first_gp_reg_save + - (FIRST_SAVRES_REGISTER+1))*8); + HOST_WIDE_INT offset = (info->spe_gp_save_offset + + sp_offset - ool_adjust); + + if (using_static_chain_p) + { + rtx r0 = gen_rtx_REG (Pmode, 0); + gcc_assert (info->first_gp_reg_save > 11); + + emit_move_insn (r0, gen_rtx_REG (Pmode, 11)); + } + + spe_save_area_ptr = gen_rtx_REG (Pmode, 11); + insn = emit_insn (gen_addsi3 (spe_save_area_ptr, + frame_reg_rtx, + GEN_INT (offset))); + /* We need to make sure the move to r11 gets noted for + properly outputting unwind information. */ + if (!saving_GPRs_inline) + rs6000_frame_related (insn, frame_reg_rtx, offset, + NULL_RTX, NULL_RTX); + spe_offset = 0; + } + + if (saving_GPRs_inline) + { + for (i = 0; i < 32 - info->first_gp_reg_save; i++) + if (rs6000_reg_live_or_pic_offset_p (info->first_gp_reg_save + i)) + { + rtx reg = gen_rtx_REG (reg_mode, info->first_gp_reg_save + i); + rtx offset, addr, mem; - RTVEC_ELT (p, 0) = gen_rtx_CLOBBER (VOIDmode, - gen_rtx_REG (Pmode, - LR_REGNO)); - sprintf (rname, "%s%d%s", SAVE_FP_PREFIX, - info->first_fp_reg_save - 32, SAVE_FP_SUFFIX); - alloc_rname = ggc_strdup (rname); - RTVEC_ELT (p, 1) = gen_rtx_USE (VOIDmode, - gen_rtx_SYMBOL_REF (Pmode, - alloc_rname)); - for (i = 0; i < 64 - info->first_fp_reg_save; i++) + /* We're doing all this to ensure that the offset fits into + the immediate offset of 'evstdd'. */ + gcc_assert (SPE_CONST_OFFSET_OK (reg_size * i + spe_offset)); + + offset = GEN_INT (reg_size * i + spe_offset); + addr = gen_rtx_PLUS (Pmode, spe_save_area_ptr, offset); + mem = gen_rtx_MEM (V2SImode, addr); + + insn = emit_move_insn (mem, reg); + + rs6000_frame_related (insn, spe_save_area_ptr, + info->spe_gp_save_offset + + sp_offset + reg_size * i, + offset, const0_rtx); + } + } + else { - rtx addr, reg, mem; - reg = gen_rtx_REG (DFmode, info->first_fp_reg_save + i); - addr = gen_rtx_PLUS (Pmode, frame_reg_rtx, - GEN_INT (info->fp_save_offset - + sp_offset + 8*i)); - mem = gen_frame_mem (DFmode, addr); + rtx par; - RTVEC_ELT (p, i + 2) = gen_rtx_SET (VOIDmode, mem, reg); + par = rs6000_make_savres_rtx (info, gen_rtx_REG (Pmode, 11), + 0, reg_mode, + /*savep=*/true, /*gpr=*/true, + /*exitp=*/false); + insn = emit_insn (par); + rs6000_frame_related (insn, frame_ptr_rtx, info->total_size, + NULL_RTX, NULL_RTX); } - insn = emit_insn (gen_rtx_PARALLEL (VOIDmode, p)); + + + /* Move the static chain pointer back. */ + if (using_static_chain_p && !spe_regs_addressable_via_sp) + emit_move_insn (gen_rtx_REG (Pmode, 11), gen_rtx_REG (Pmode, 0)); + } + else if (!WORLD_SAVE_P (info) && !saving_GPRs_inline) + { + rtx par; + + /* Need to adjust r11 if we saved any FPRs. */ + if (info->first_fp_reg_save != 64) + { + rtx r11 = gen_rtx_REG (reg_mode, 11); + rtx offset = GEN_INT (info->total_size + + (-8 * (64-info->first_fp_reg_save))); + rtx ptr_reg = (sp_reg_rtx == frame_reg_rtx + ? sp_reg_rtx : r11); + + emit_insn (TARGET_32BIT + ? gen_addsi3 (r11, ptr_reg, offset) + : gen_adddi3 (r11, ptr_reg, offset)); + } + + par = rs6000_make_savres_rtx (info, frame_reg_rtx, + info->gp_save_offset + sp_offset, + reg_mode, + /*savep=*/true, /*gpr=*/true, + /*exitp=*/false); + insn = emit_insn (par); rs6000_frame_related (insn, frame_ptr_rtx, info->total_size, NULL_RTX, NULL_RTX); } - - /* Save GPRs. This is done as a PARALLEL if we are using - the store-multiple instructions. */ - if (!WORLD_SAVE_P (info) && using_store_multiple) + else if (!WORLD_SAVE_P (info) && using_store_multiple) { rtvec p; int i; @@ -15886,80 +16277,6 @@ rs6000_emit_prologue (void) rs6000_frame_related (insn, frame_ptr_rtx, info->total_size, NULL_RTX, NULL_RTX); } - else if (!WORLD_SAVE_P (info) - && TARGET_SPE_ABI - && info->spe_64bit_regs_used != 0 - && info->first_gp_reg_save != 32) - { - int i; - rtx spe_save_area_ptr; - int using_static_chain_p = (cfun->static_chain_decl != NULL_TREE - && df_regs_ever_live_p (STATIC_CHAIN_REGNUM) - && !call_used_regs[STATIC_CHAIN_REGNUM]); - - /* Determine whether we can address all of the registers that need - to be saved with an offset from the stack pointer that fits in - the small const field for SPE memory instructions. */ - int spe_regs_addressable_via_sp - = SPE_CONST_OFFSET_OK(info->spe_gp_save_offset + sp_offset - + (32 - info->first_gp_reg_save - 1) * reg_size); - int spe_offset; - - if (spe_regs_addressable_via_sp) - { - spe_save_area_ptr = frame_reg_rtx; - spe_offset = info->spe_gp_save_offset + sp_offset; - } - else - { - /* Make r11 point to the start of the SPE save area. We need - to be careful here if r11 is holding the static chain. If - it is, then temporarily save it in r0. We would use r0 as - our base register here, but using r0 as a base register in - loads and stores means something different from what we - would like. */ - if (using_static_chain_p) - { - rtx r0 = gen_rtx_REG (Pmode, 0); - - gcc_assert (info->first_gp_reg_save > 11); - - emit_move_insn (r0, gen_rtx_REG (Pmode, 11)); - } - - spe_save_area_ptr = gen_rtx_REG (Pmode, 11); - emit_insn (gen_addsi3 (spe_save_area_ptr, frame_reg_rtx, - GEN_INT (info->spe_gp_save_offset + sp_offset))); - - spe_offset = 0; - } - - for (i = 0; i < 32 - info->first_gp_reg_save; i++) - if (rs6000_reg_live_or_pic_offset_p (info->first_gp_reg_save + i)) - { - rtx reg = gen_rtx_REG (reg_mode, info->first_gp_reg_save + i); - rtx offset, addr, mem; - - /* We're doing all this to ensure that the offset fits into - the immediate offset of 'evstdd'. */ - gcc_assert (SPE_CONST_OFFSET_OK (reg_size * i + spe_offset)); - - offset = GEN_INT (reg_size * i + spe_offset); - addr = gen_rtx_PLUS (Pmode, spe_save_area_ptr, offset); - mem = gen_rtx_MEM (V2SImode, addr); - - insn = emit_move_insn (mem, reg); - - rs6000_frame_related (insn, spe_save_area_ptr, - info->spe_gp_save_offset - + sp_offset + reg_size * i, - offset, const0_rtx); - } - - /* Move the static chain pointer back. */ - if (using_static_chain_p && !spe_regs_addressable_via_sp) - emit_move_insn (gen_rtx_REG (Pmode, 11), gen_rtx_REG (Pmode, 0)); - } else if (!WORLD_SAVE_P (info)) { int i; @@ -16059,7 +16376,8 @@ rs6000_emit_prologue (void) (frame_reg_rtx != sp_reg_rtx && ((info->altivec_size != 0) || (info->vrsave_mask != 0) - ))); + )), + FALSE); if (frame_reg_rtx != sp_reg_rtx) rs6000_emit_stack_tie (); } @@ -16215,8 +16533,7 @@ rs6000_output_function_prologue (FILE *file, && !FP_SAVE_INLINE (info->first_fp_reg_save)) fprintf (file, "\t.extern %s%d%s\n\t.extern %s%d%s\n", SAVE_FP_PREFIX, info->first_fp_reg_save - 32, SAVE_FP_SUFFIX, - RESTORE_FP_PREFIX, info->first_fp_reg_save - 32, - RESTORE_FP_SUFFIX); + RESTORE_FP_PREFIX, info->first_fp_reg_save - 32, RESTORE_FP_SUFFIX); /* Write .extern for AIX common mode routines, if needed. */ if (! TARGET_POWER && ! TARGET_POWERPC && ! common_mode_defined) @@ -16264,6 +16581,54 @@ rs6000_output_function_prologue (FILE *file, we restore after the pop when possible. */ #define ALWAYS_RESTORE_ALTIVEC_BEFORE_POP 0 +/* Reload CR from REG. */ + +static void +rs6000_restore_saved_cr (rtx reg, int using_mfcr_multiple) +{ + int count = 0; + int i; + + if (using_mfcr_multiple) + { + for (i = 0; i < 8; i++) + if (df_regs_ever_live_p (CR0_REGNO+i) && ! call_used_regs[CR0_REGNO+i]) + count++; + gcc_assert (count); + } + + if (using_mfcr_multiple && count > 1) + { + rtvec p; + int ndx; + + p = rtvec_alloc (count); + + ndx = 0; + for (i = 0; i < 8; i++) + if (df_regs_ever_live_p (CR0_REGNO+i) && ! call_used_regs[CR0_REGNO+i]) + { + rtvec r = rtvec_alloc (2); + RTVEC_ELT (r, 0) = reg; + RTVEC_ELT (r, 1) = GEN_INT (1 << (7-i)); + RTVEC_ELT (p, ndx) = + gen_rtx_SET (VOIDmode, gen_rtx_REG (CCmode, CR0_REGNO+i), + gen_rtx_UNSPEC (CCmode, r, UNSPEC_MOVESI_TO_CR)); + ndx++; + } + emit_insn (gen_rtx_PARALLEL (VOIDmode, p)); + gcc_assert (ndx == count); + } + else + for (i = 0; i < 8; i++) + if (df_regs_ever_live_p (CR0_REGNO+i) && ! call_used_regs[CR0_REGNO+i]) + { + emit_insn (gen_movsi_to_cr_one (gen_rtx_REG (CCmode, + CR0_REGNO+i), + reg)); + } +} + /* Emit function epilogue as insns. At present, dwarf2out_frame_debug_expr doesn't understand @@ -16275,10 +16640,13 @@ void rs6000_emit_epilogue (int sibcall) { rs6000_stack_t *info; + int restoring_GPRs_inline; int restoring_FPRs_inline; int using_load_multiple; int using_mtcr_multiple; int use_backchain_to_restore_sp; + int restore_lr; + int strategy; int sp_offset = 0; rtx sp_reg_rtx = gen_rtx_REG (Pmode, 1); rtx frame_reg_rtx = sp_reg_rtx; @@ -16294,15 +16662,11 @@ rs6000_emit_epilogue (int sibcall) reg_size = 8; } - using_load_multiple = (TARGET_MULTIPLE && ! TARGET_POWERPC64 - && (!TARGET_SPE_ABI - || info->spe_64bit_regs_used == 0) - && info->first_gp_reg_save < 31 - && no_global_regs_above (info->first_gp_reg_save)); - restoring_FPRs_inline = (sibcall - || crtl->calls_eh_return - || info->first_fp_reg_save == 64 - || FP_SAVE_INLINE (info->first_fp_reg_save)); + strategy = rs6000_savres_strategy (info, /*savep=*/false, + /*static_chain_p=*/0, sibcall); + using_load_multiple = strategy & SAVRES_MULTIPLE; + restoring_FPRs_inline = strategy & SAVRES_INLINE_FPRS; + restoring_GPRs_inline = strategy & SAVRES_INLINE_GPRS; using_mtcr_multiple = (rs6000_cpu == PROCESSOR_PPC601 || rs6000_cpu == PROCESSOR_PPC603 || rs6000_cpu == PROCESSOR_PPC750 @@ -16318,6 +16682,9 @@ rs6000_emit_epilogue (int sibcall) > 32767 || (cfun->calls_alloca && !frame_pointer_needed)); + restore_lr = (info->lr_save_p + && restoring_GPRs_inline + && restoring_FPRs_inline); if (WORLD_SAVE_P (info)) { @@ -16584,8 +16951,9 @@ rs6000_emit_epilogue (int sibcall) emit_insn (generate_set_vrsave (reg, info, 1)); } - /* Get the old lr if we saved it. */ - if (info->lr_save_p) + /* Get the old lr if we saved it. If we are restoring registers + out-of-line, then the out-of-line routines can do this for us. */ + if (restore_lr) { rtx mem = gen_frame_mem_offset (Pmode, frame_reg_rtx, info->lr_save_offset + sp_offset); @@ -16604,7 +16972,7 @@ rs6000_emit_epilogue (int sibcall) } /* Set LR here to try to overlap restores below. */ - if (info->lr_save_p) + if (restore_lr) emit_move_insn (gen_rtx_REG (Pmode, LR_REGNO), gen_rtx_REG (Pmode, 0)); @@ -16640,35 +17008,17 @@ rs6000_emit_epilogue (int sibcall) /* Restore GPRs. This is done as a PARALLEL if we are using the load-multiple instructions. */ - if (using_load_multiple) - { - rtvec p; - p = rtvec_alloc (32 - info->first_gp_reg_save); - for (i = 0; i < 32 - info->first_gp_reg_save; i++) - { - rtx addr = gen_rtx_PLUS (Pmode, frame_reg_rtx, - GEN_INT (info->gp_save_offset - + sp_offset - + reg_size * i)); - rtx mem = gen_frame_mem (reg_mode, addr); - - RTVEC_ELT (p, i) = - gen_rtx_SET (VOIDmode, - gen_rtx_REG (reg_mode, info->first_gp_reg_save + i), - mem); - } - emit_insn (gen_rtx_PARALLEL (VOIDmode, p)); - } - else if (TARGET_SPE_ABI - && info->spe_64bit_regs_used != 0 - && info->first_gp_reg_save != 32) + if (TARGET_SPE_ABI + && info->spe_64bit_regs_used != 0 + && info->first_gp_reg_save != 32) { /* Determine whether we can address all of the registers that need to be saved with an offset from the stack pointer that fits in the small const field for SPE memory instructions. */ int spe_regs_addressable_via_sp - = SPE_CONST_OFFSET_OK(info->spe_gp_save_offset + sp_offset - + (32 - info->first_gp_reg_save - 1) * reg_size); + = (SPE_CONST_OFFSET_OK(info->spe_gp_save_offset + sp_offset + + (32 - info->first_gp_reg_save - 1) * reg_size) + && restoring_GPRs_inline); int spe_offset; if (spe_regs_addressable_via_sp) @@ -16680,10 +17030,17 @@ rs6000_emit_epilogue (int sibcall) not clobbering it when we were saving registers in the prologue. There's no need to worry here because the static chain is passed anew to every function. */ + int ool_adjust = (restoring_GPRs_inline + ? 0 + : (info->first_gp_reg_save + - (FIRST_SAVRES_REGISTER+1))*8); + if (frame_reg_rtx == sp_reg_rtx) frame_reg_rtx = gen_rtx_REG (Pmode, 11); emit_insn (gen_addsi3 (frame_reg_rtx, old_frame_reg_rtx, - GEN_INT (info->spe_gp_save_offset + sp_offset))); + GEN_INT (info->spe_gp_save_offset + + sp_offset + - ool_adjust))); /* Keep the invariant that frame_reg_rtx + sp_offset points at the top of the stack frame. */ sp_offset = -info->spe_gp_save_offset; @@ -16691,26 +17048,80 @@ rs6000_emit_epilogue (int sibcall) spe_offset = 0; } - for (i = 0; i < 32 - info->first_gp_reg_save; i++) - if (rs6000_reg_live_or_pic_offset_p (info->first_gp_reg_save + i)) - { - rtx offset, addr, mem; + if (restoring_GPRs_inline) + { + for (i = 0; i < 32 - info->first_gp_reg_save; i++) + if (rs6000_reg_live_or_pic_offset_p (info->first_gp_reg_save + i)) + { + rtx offset, addr, mem; - /* We're doing all this to ensure that the immediate offset - fits into the immediate field of 'evldd'. */ - gcc_assert (SPE_CONST_OFFSET_OK (spe_offset + reg_size * i)); + /* We're doing all this to ensure that the immediate offset + fits into the immediate field of 'evldd'. */ + gcc_assert (SPE_CONST_OFFSET_OK (spe_offset + reg_size * i)); - offset = GEN_INT (spe_offset + reg_size * i); - addr = gen_rtx_PLUS (Pmode, frame_reg_rtx, offset); - mem = gen_rtx_MEM (V2SImode, addr); + offset = GEN_INT (spe_offset + reg_size * i); + addr = gen_rtx_PLUS (Pmode, frame_reg_rtx, offset); + mem = gen_rtx_MEM (V2SImode, addr); - emit_move_insn (gen_rtx_REG (reg_mode, info->first_gp_reg_save + i), - mem); - } + emit_move_insn (gen_rtx_REG (reg_mode, info->first_gp_reg_save + i), + mem); + } + } + else + { + rtx par; + + par = rs6000_make_savres_rtx (info, gen_rtx_REG (Pmode, 11), + 0, reg_mode, + /*savep=*/false, /*gpr=*/true, + /*exitp=*/true); + emit_jump_insn (par); + + /* We don't want anybody else emitting things after we jumped + back. */ + return; + } } - else - for (i = 0; i < 32 - info->first_gp_reg_save; i++) - if (rs6000_reg_live_or_pic_offset_p (info->first_gp_reg_save + i)) + else if (!restoring_GPRs_inline) + { + /* We are jumping to an out-of-line function. */ + bool can_use_exit = info->first_fp_reg_save == 64; + rtx par; + + /* Emit stack reset code if we need it. */ + if (can_use_exit) + rs6000_emit_stack_reset (info, sp_reg_rtx, frame_reg_rtx, + sp_offset, can_use_exit); + else + emit_insn (gen_addsi3 (gen_rtx_REG (Pmode, 11), + sp_reg_rtx, + GEN_INT (sp_offset - info->fp_size))); + + par = rs6000_make_savres_rtx (info, frame_reg_rtx, + info->gp_save_offset, reg_mode, + /*savep=*/false, /*gpr=*/true, + /*exitp=*/can_use_exit); + + if (can_use_exit) + { + if (info->cr_save_p) + rs6000_restore_saved_cr (gen_rtx_REG (SImode, 12), + using_mtcr_multiple); + + emit_jump_insn (par); + + /* We don't want anybody else emitting things after we jumped + back. */ + return; + } + else + emit_insn (par); + } + else if (using_load_multiple) + { + rtvec p; + p = rtvec_alloc (32 - info->first_gp_reg_save); + for (i = 0; i < 32 - info->first_gp_reg_save; i++) { rtx addr = gen_rtx_PLUS (Pmode, frame_reg_rtx, GEN_INT (info->gp_save_offset @@ -16718,9 +17129,28 @@ rs6000_emit_epilogue (int sibcall) + reg_size * i)); rtx mem = gen_frame_mem (reg_mode, addr); - emit_move_insn (gen_rtx_REG (reg_mode, - info->first_gp_reg_save + i), mem); + RTVEC_ELT (p, i) = + gen_rtx_SET (VOIDmode, + gen_rtx_REG (reg_mode, info->first_gp_reg_save + i), + mem); } + emit_insn (gen_rtx_PARALLEL (VOIDmode, p)); + } + else + { + for (i = 0; i < 32 - info->first_gp_reg_save; i++) + if (rs6000_reg_live_or_pic_offset_p (info->first_gp_reg_save + i)) + { + rtx addr = gen_rtx_PLUS (Pmode, frame_reg_rtx, + GEN_INT (info->gp_save_offset + + sp_offset + + reg_size * i)); + rtx mem = gen_frame_mem (reg_mode, addr); + + emit_move_insn (gen_rtx_REG (reg_mode, + info->first_gp_reg_save + i), mem); + } + } /* Restore fpr's if we need to do it without calling a function. */ if (restoring_FPRs_inline) @@ -16742,69 +17172,12 @@ rs6000_emit_epilogue (int sibcall) /* If we saved cr, restore it here. Just those that were used. */ if (info->cr_save_p) - { - rtx r12_rtx = gen_rtx_REG (SImode, 12); - int count = 0; - - if (using_mtcr_multiple) - { - for (i = 0; i < 8; i++) - if (df_regs_ever_live_p (CR0_REGNO+i) && ! call_used_regs[CR0_REGNO+i]) - count++; - gcc_assert (count); - } - - if (using_mtcr_multiple && count > 1) - { - rtvec p; - int ndx; - - p = rtvec_alloc (count); - - ndx = 0; - for (i = 0; i < 8; i++) - if (df_regs_ever_live_p (CR0_REGNO+i) && ! call_used_regs[CR0_REGNO+i]) - { - rtvec r = rtvec_alloc (2); - RTVEC_ELT (r, 0) = r12_rtx; - RTVEC_ELT (r, 1) = GEN_INT (1 << (7-i)); - RTVEC_ELT (p, ndx) = - gen_rtx_SET (VOIDmode, gen_rtx_REG (CCmode, CR0_REGNO+i), - gen_rtx_UNSPEC (CCmode, r, UNSPEC_MOVESI_TO_CR)); - ndx++; - } - emit_insn (gen_rtx_PARALLEL (VOIDmode, p)); - gcc_assert (ndx == count); - } - else - for (i = 0; i < 8; i++) - if (df_regs_ever_live_p (CR0_REGNO+i) && ! call_used_regs[CR0_REGNO+i]) - { - emit_insn (gen_movsi_to_cr_one (gen_rtx_REG (CCmode, - CR0_REGNO+i), - r12_rtx)); - } - } + rs6000_restore_saved_cr (gen_rtx_REG (SImode, 12), using_mtcr_multiple); /* If this is V.4, unwind the stack pointer after all of the loads have been done. */ - if (frame_reg_rtx != sp_reg_rtx) - { - /* This blockage is needed so that sched doesn't decide to move - the sp change before the register restores. */ - rs6000_emit_stack_tie (); - if (sp_offset != 0) - emit_insn (gen_addsi3 (sp_reg_rtx, frame_reg_rtx, - GEN_INT (sp_offset))); - else - emit_move_insn (sp_reg_rtx, frame_reg_rtx); - } - else if (sp_offset != 0) - emit_insn (TARGET_32BIT - ? gen_addsi3 (sp_reg_rtx, sp_reg_rtx, - GEN_INT (sp_offset)) - : gen_adddi3 (sp_reg_rtx, sp_reg_rtx, - GEN_INT (sp_offset))); + rs6000_emit_stack_reset (info, sp_reg_rtx, frame_reg_rtx, + sp_offset, !restoring_FPRs_inline); if (crtl->calls_eh_return) { @@ -16818,30 +17191,30 @@ rs6000_emit_epilogue (int sibcall) { rtvec p; if (! restoring_FPRs_inline) - p = rtvec_alloc (3 + 64 - info->first_fp_reg_save); + p = rtvec_alloc (4 + 64 - info->first_fp_reg_save); else p = rtvec_alloc (2); RTVEC_ELT (p, 0) = gen_rtx_RETURN (VOIDmode); - RTVEC_ELT (p, 1) = gen_rtx_USE (VOIDmode, - gen_rtx_REG (Pmode, - LR_REGNO)); + RTVEC_ELT (p, 1) = (restoring_FPRs_inline + ? gen_rtx_USE (VOIDmode, gen_rtx_REG (Pmode, 65)) + : gen_rtx_CLOBBER (VOIDmode, + gen_rtx_REG (Pmode, 65))); /* If we have to restore more than two FP registers, branch to the restore function. It will return to our caller. */ if (! restoring_FPRs_inline) { int i; - char rname[30]; - const char *alloc_rname; - - sprintf (rname, "%s%d%s", RESTORE_FP_PREFIX, - info->first_fp_reg_save - 32, RESTORE_FP_SUFFIX); - alloc_rname = ggc_strdup (rname); - RTVEC_ELT (p, 2) = gen_rtx_USE (VOIDmode, - gen_rtx_SYMBOL_REF (Pmode, - alloc_rname)); - + rtx sym; + + sym = rs6000_savres_routine_sym (info, + /*savep=*/false, + /*gpr=*/false, + /*exitp=*/true); + RTVEC_ELT (p, 2) = gen_rtx_USE (VOIDmode, sym); + RTVEC_ELT (p, 3) = gen_rtx_USE (VOIDmode, + gen_rtx_REG (Pmode, 11)); for (i = 0; i < 64 - info->first_fp_reg_save; i++) { rtx addr, mem; @@ -16849,7 +17222,7 @@ rs6000_emit_epilogue (int sibcall) GEN_INT (info->fp_save_offset + 8*i)); mem = gen_frame_mem (DFmode, addr); - RTVEC_ELT (p, i+3) = + RTVEC_ELT (p, i+4) = gen_rtx_SET (VOIDmode, gen_rtx_REG (DFmode, info->first_fp_reg_save + i), mem); @@ -17473,7 +17846,7 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode) toc_hash_table = htab_create_ggc (1021, toc_hash_function, toc_hash_eq, NULL); - h = ggc_alloc (sizeof (*h)); + h = GGC_NEW (struct toc_hash_struct); h->key = x; h->key_mode = mode; h->labelno = labelno; @@ -18661,6 +19034,7 @@ rs6000_issue_rate (void) case CPU_CELL: case CPU_PPCE300C2: case CPU_PPCE300C3: + case CPU_PPCE500MC: return 2; case CPU_RIOS2: case CPU_PPC604: @@ -19531,7 +19905,7 @@ redefine_groups (FILE *dump, int sched_verbose, rtx prev_head_insn, rtx tail) /* Initialize. */ issue_rate = rs6000_issue_rate (); - group_insns = alloca (issue_rate * sizeof (rtx)); + group_insns = XALLOCAVEC (rtx, issue_rate); for (i = 0; i < issue_rate; i++) { group_insns[i] = 0; @@ -20127,7 +20501,7 @@ rs6000_elf_encode_section_info (tree decl, rtx rtl, int first) { rtx sym_ref = XEXP (rtl, 0); size_t len = strlen (XSTR (sym_ref, 0)); - char *str = alloca (len + 2); + char *str = XALLOCAVEC (char, len + 2); str[0] = '.'; memcpy (str + 1, XSTR (sym_ref, 0), len + 1); XSTR (sym_ref, 0) = ggc_alloc_string (str, len + 1); @@ -20426,10 +20800,10 @@ machopic_output_stub (FILE *file, const char *symb, const char *stub) length = strlen (symb); - symbol_name = alloca (length + 32); + symbol_name = XALLOCAVEC (char, length + 32); GEN_SYMBOL_NAME_FOR_SYMBOL (symbol_name, symb, length); - lazy_ptr_name = alloca (length + 32); + lazy_ptr_name = XALLOCAVEC (char, length + 32); GEN_LAZY_PTR_NAME_FOR_SYMBOL (lazy_ptr_name, symb, length); if (flag_pic == 2) @@ -20445,7 +20819,7 @@ machopic_output_stub (FILE *file, const char *symb, const char *stub) fprintf (file, "\t.indirect_symbol %s\n", symbol_name); label++; - local_label_0 = alloca (sizeof ("\"L00000000000$spb\"")); + local_label_0 = XALLOCAVEC (char, sizeof ("\"L00000000000$spb\"")); sprintf (local_label_0, "\"L%011d$spb\"", label); fprintf (file, "\tmflr r0\n"); diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 4c225a3f0e7..8a926e43c44 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -133,6 +133,7 @@ %{mcpu=8548: -me500} \ %{mcpu=e300c2: -me300} \ %{mcpu=e300c3: -me300} \ +%{mcpu=e500mc: -me500mc} \ %{maltivec: -maltivec} \ -many" @@ -282,6 +283,7 @@ enum processor_type PROCESSOR_PPC8540, PROCESSOR_PPCE300C2, PROCESSOR_PPCE300C3, + PROCESSOR_PPCE500MC, PROCESSOR_POWER4, PROCESSOR_POWER5, PROCESSOR_POWER6, @@ -400,7 +402,7 @@ extern enum rs6000_nop_insertion rs6000_sched_insert_nops; #define TARGET_SPE_ABI 0 #define TARGET_SPE 0 #define TARGET_E500 0 -#define TARGET_ISEL 0 +#define TARGET_ISEL rs6000_isel #define TARGET_FPRS 1 #define TARGET_E500_SINGLE 0 #define TARGET_E500_DOUBLE 0 diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index e3912c76646..5efde36de8d 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -133,7 +133,7 @@ ;; Processor type -- this attribute must exactly match the processor_type ;; enumeration in rs6000.h. -(define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppce300c2,ppce300c3,power4,power5,power6,cell" +(define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppce300c2,ppce300c3,ppce500mc,power4,power5,power6,cell" (const (symbol_ref "rs6000_cpu_attr"))) @@ -167,6 +167,7 @@ (include "7450.md") (include "8540.md") (include "e300c2c3.md") +(include "e500mc.md") (include "power4.md") (include "power5.md") (include "power6.md") @@ -14421,12 +14422,25 @@ "{stm|stmw} %2,%1" [(set_attr "type" "store_ux")]) +(define_insn "*save_gpregs_<mode>" + [(match_parallel 0 "any_parallel_operand" + [(clobber (reg:P 65)) + (use (match_operand:P 1 "symbol_ref_operand" "s")) + (use (match_operand:P 2 "gpc_reg_operand" "r")) + (set (match_operand:P 3 "memory_operand" "=m") + (match_operand:P 4 "gpc_reg_operand" "r"))])] + "" + "bl %z1" + [(set_attr "type" "branch") + (set_attr "length" "4")]) + (define_insn "*save_fpregs_<mode>" [(match_parallel 0 "any_parallel_operand" [(clobber (reg:P 65)) - (use (match_operand:P 1 "call_operand" "s")) - (set (match_operand:DF 2 "memory_operand" "=m") - (match_operand:DF 3 "gpc_reg_operand" "f"))])] + (use (match_operand:P 1 "symbol_ref_operand" "s")) + (use (match_operand:P 2 "gpc_reg_operand" "r")) + (set (match_operand:DF 3 "memory_operand" "=m") + (match_operand:DF 4 "gpc_reg_operand" "f"))])] "" "bl %z1" [(set_attr "type" "branch") @@ -14514,15 +14528,43 @@ ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible... +(define_insn "*restore_gpregs_<mode>" + [(match_parallel 0 "any_parallel_operand" + [(clobber (match_operand:P 1 "register_operand" "=l")) + (use (match_operand:P 2 "symbol_ref_operand" "s")) + (use (match_operand:P 3 "gpc_reg_operand" "r")) + (set (match_operand:P 4 "gpc_reg_operand" "=r") + (match_operand:P 5 "memory_operand" "m"))])] + "" + "bl %z2" + [(set_attr "type" "branch") + (set_attr "length" "4")]) + +(define_insn "*return_and_restore_gpregs_<mode>" + [(match_parallel 0 "any_parallel_operand" + [(return) + (clobber (match_operand:P 1 "register_operand" "=l")) + (use (match_operand:P 2 "symbol_ref_operand" "s")) + (use (match_operand:P 3 "gpc_reg_operand" "r")) + (set (match_operand:P 4 "gpc_reg_operand" "=r") + (match_operand:P 5 "memory_operand" "m"))])] + "" + "b %z2" + [(set_attr "type" "branch") + (set_attr "length" "4")]) + (define_insn "*return_and_restore_fpregs_<mode>" [(match_parallel 0 "any_parallel_operand" [(return) - (use (reg:P 65)) - (use (match_operand:P 1 "call_operand" "s")) - (set (match_operand:DF 2 "gpc_reg_operand" "=f") - (match_operand:DF 3 "memory_operand" "m"))])] + (clobber (match_operand:P 1 "register_operand" "=l")) + (use (match_operand:P 2 "symbol_ref_operand" "s")) + (use (match_operand:P 3 "gpc_reg_operand" "r")) + (set (match_operand:DF 4 "gpc_reg_operand" "=f") + (match_operand:DF 5 "memory_operand" "m"))])] "" - "b %z1") + "b %z2" + [(set_attr "type" "branch") + (set_attr "length" "4")]) ; This is used in compiling the unwind routines. (define_expand "eh_return" diff --git a/gcc/config/rs6000/spe.md b/gcc/config/rs6000/spe.md index 1b66343bab2..96be255895b 100644 --- a/gcc/config/rs6000/spe.md +++ b/gcc/config/rs6000/spe.md @@ -3138,3 +3138,41 @@ "TARGET_E500" "cror 4*%0+gt,4*%1+gt,4*%2+gt" [(set_attr "type" "cr_logical")]) + +;; Out-of-line prologues and epilogues. +(define_insn "*save_gpregs_spe" + [(match_parallel 0 "any_parallel_operand" + [(clobber (reg:P 65)) + (use (match_operand:P 1 "symbol_ref_operand" "s")) + (use (match_operand:P 2 "gpc_reg_operand" "r")) + (set (match_operand:V2SI 3 "memory_operand" "=m") + (match_operand:V2SI 4 "gpc_reg_operand" "r"))])] + "TARGET_SPE_ABI" + "bl %z1" + [(set_attr "type" "branch") + (set_attr "length" "4")]) + +(define_insn "*restore_gpregs_spe" + [(match_parallel 0 "any_parallel_operand" + [(clobber (reg:P 65)) + (use (match_operand:P 1 "symbol_ref_operand" "s")) + (use (match_operand:P 2 "gpc_reg_operand" "r")) + (set (match_operand:V2SI 3 "gpc_reg_operand" "=r") + (match_operand:V2SI 4 "memory_operand" "m"))])] + "TARGET_SPE_ABI" + "bl %z1" + [(set_attr "type" "branch") + (set_attr "length" "4")]) + +(define_insn "*return_and_restore_gpregs_spe" + [(match_parallel 0 "any_parallel_operand" + [(return) + (clobber (reg:P 65)) + (use (match_operand:P 1 "symbol_ref_operand" "s")) + (use (match_operand:P 2 "gpc_reg_operand" "r")) + (set (match_operand:V2SI 3 "gpc_reg_operand" "=r") + (match_operand:V2SI 4 "memory_operand" "m"))])] + "TARGET_SPE_ABI" + "b %z1" + [(set_attr "type" "branch") + (set_attr "length" "4")]) diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h index ef7f969ece4..b94de3bbbf4 100644 --- a/gcc/config/rs6000/sysv4.h +++ b/gcc/config/rs6000/sysv4.h @@ -266,19 +266,27 @@ do { \ #endif /* Define cutoff for using external functions to save floating point. - Currently on V.4, always use inline stores. */ -#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64) + Currently on 64-bit V.4, always use inline stores. When optimizing + for size on 32-bit targets, use external functions when + profitable. */ +#define FP_SAVE_INLINE(FIRST_REG) (optimize_size && !TARGET_64BIT \ + ? ((FIRST_REG) == 62 \ + || (FIRST_REG) == 63) \ + : (FIRST_REG) < 64) +/* And similarly for general purpose registers. */ +#define GP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 32 \ + && (TARGET_64BIT || !optimize_size)) /* Put jump tables in read-only memory, rather than in .text. */ #define JUMP_TABLES_IN_TEXT_SECTION 0 /* Prefix and suffix to use to saving floating point. */ #define SAVE_FP_PREFIX "_savefpr_" -#define SAVE_FP_SUFFIX "_l" +#define SAVE_FP_SUFFIX (TARGET_64BIT ? "_l" : "") /* Prefix and suffix to use to restoring floating point. */ #define RESTORE_FP_PREFIX "_restfpr_" -#define RESTORE_FP_SUFFIX "_l" +#define RESTORE_FP_SUFFIX (TARGET_64BIT ? "_l" : "") /* Type used for ptrdiff_t, as a string used in a declaration. */ #define PTRDIFF_TYPE "int" diff --git a/gcc/config/rs6000/t-aix52 b/gcc/config/rs6000/t-aix52 index 37a5d83b828..3b19cbcee44 100644 --- a/gcc/config/rs6000/t-aix52 +++ b/gcc/config/rs6000/t-aix52 @@ -55,3 +55,5 @@ TARGET_LIBGCC2_CFLAGS = -mlong-double-128 # Either 32-bit and 64-bit objects in archives. AR_FLAGS_FOR_TARGET = -X32_64 +# genautomata requires more than 256MB of data +build/genautomata : override LDFLAGS += -Wl,-bmaxdata:0x20000000 diff --git a/gcc/config/rs6000/t-ppccomm b/gcc/config/rs6000/t-ppccomm index 8fc3e71b08e..3645571223f 100644 --- a/gcc/config/rs6000/t-ppccomm +++ b/gcc/config/rs6000/t-ppccomm @@ -3,23 +3,7 @@ LIB2FUNCS_EXTRA += tramp.S $(srcdir)/config/rs6000/darwin-ldouble.c # These can't end up in shared libgcc -LIB2FUNCS_STATIC_EXTRA = eabi.S \ - crtsavfpr.S crtresfpr.S \ - crtsavgpr.S crtresgpr.S \ - crtresxfpr.S crtresxgpr.S \ - e500crtres32gpr.S \ - e500crtres64gpr.S \ - e500crtres64gprctr.S \ - e500crtrest32gpr.S \ - e500crtrest64gpr.S \ - e500crtresx32gpr.S \ - e500crtresx64gpr.S \ - e500crtsav32gpr.S \ - e500crtsav64gpr.S \ - e500crtsav64gprctr.S \ - e500crtsavg32gpr.S \ - e500crtsavg64gpr.S \ - e500crtsavg64gprctr.S +LIB2FUNCS_STATIC_EXTRA = eabi.S eabi.S: $(srcdir)/config/rs6000/eabi.asm cat $(srcdir)/config/rs6000/eabi.asm > eabi.S @@ -52,63 +36,6 @@ ncrti.S: $(srcdir)/config/rs6000/sol-ci.asm ncrtn.S: $(srcdir)/config/rs6000/sol-cn.asm cat $(srcdir)/config/rs6000/sol-cn.asm >ncrtn.S -crtsavfpr.S: $(srcdir)/config/rs6000/crtsavfpr.asm - cat $(srcdir)/config/rs6000/crtsavfpr.asm >crtsavfpr.S - -crtresfpr.S: $(srcdir)/config/rs6000/crtresfpr.asm - cat $(srcdir)/config/rs6000/crtresfpr.asm >crtresfpr.S - -crtsavgpr.S: $(srcdir)/config/rs6000/crtsavgpr.asm - cat $(srcdir)/config/rs6000/crtsavgpr.asm >crtsavgpr.S - -crtresgpr.S: $(srcdir)/config/rs6000/crtresgpr.asm - cat $(srcdir)/config/rs6000/crtresgpr.asm >crtresgpr.S - -crtresxfpr.S: $(srcdir)/config/rs6000/crtresxfpr.asm - cat $(srcdir)/config/rs6000/crtresxfpr.asm >crtresxfpr.S - -crtresxgpr.S: $(srcdir)/config/rs6000/crtresxgpr.asm - cat $(srcdir)/config/rs6000/crtresxgpr.asm >crtresxgpr.S - -e500crtres32gpr.S: $(srcdir)/config/rs6000/e500crtres32gpr.asm - cat $(srcdir)/config/rs6000/e500crtres32gpr.asm >e500crtres32gpr.S - -e500crtres64gpr.S: $(srcdir)/config/rs6000/e500crtres64gpr.asm - cat $(srcdir)/config/rs6000/e500crtres64gpr.asm >e500crtres64gpr.S - -e500crtres64gprctr.S: $(srcdir)/config/rs6000/e500crtres64gprctr.asm - cat $(srcdir)/config/rs6000/e500crtres64gprctr.asm >e500crtres64gprctr.S - -e500crtrest32gpr.S: $(srcdir)/config/rs6000/e500crtrest32gpr.asm - cat $(srcdir)/config/rs6000/e500crtrest32gpr.asm >e500crtrest32gpr.S - -e500crtrest64gpr.S: $(srcdir)/config/rs6000/e500crtrest64gpr.asm - cat $(srcdir)/config/rs6000/e500crtrest64gpr.asm >e500crtrest64gpr.S - -e500crtresx32gpr.S: $(srcdir)/config/rs6000/e500crtresx32gpr.asm - cat $(srcdir)/config/rs6000/e500crtresx32gpr.asm >e500crtresx32gpr.S - -e500crtresx64gpr.S: $(srcdir)/config/rs6000/e500crtresx64gpr.asm - cat $(srcdir)/config/rs6000/e500crtresx64gpr.asm >e500crtresx64gpr.S - -e500crtsav32gpr.S: $(srcdir)/config/rs6000/e500crtsav32gpr.asm - cat $(srcdir)/config/rs6000/e500crtsav32gpr.asm >e500crtsav32gpr.S - -e500crtsav64gpr.S: $(srcdir)/config/rs6000/e500crtsav64gpr.asm - cat $(srcdir)/config/rs6000/e500crtsav64gpr.asm >e500crtsav64gpr.S - -e500crtsav64gprctr.S: $(srcdir)/config/rs6000/e500crtsav64gprctr.asm - cat $(srcdir)/config/rs6000/e500crtsav64gprctr.asm >e500crtsav64gprctr.S - -e500crtsavg32gpr.S: $(srcdir)/config/rs6000/e500crtsavg32gpr.asm - cat $(srcdir)/config/rs6000/e500crtsavg32gpr.asm >e500crtsavg32gpr.S - -e500crtsavg64gpr.S: $(srcdir)/config/rs6000/e500crtsavg64gpr.asm - cat $(srcdir)/config/rs6000/e500crtsavg64gpr.asm >e500crtsavg64gpr.S - -e500crtsavg64gprctr.S: $(srcdir)/config/rs6000/e500crtsavg64gprctr.asm - cat $(srcdir)/config/rs6000/e500crtsavg64gprctr.asm >e500crtsavg64gprctr.S - # Build multiple copies of ?crt{i,n}.o, one for each target switch. $(T)ecrti$(objext): ecrti.S $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c ecrti.S -o $(T)ecrti$(objext) @@ -122,63 +49,6 @@ $(T)ncrti$(objext): ncrti.S $(T)ncrtn$(objext): ncrtn.S $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c ncrtn.S -o $(T)ncrtn$(objext) -$(T)crtsavfpr$(objext): crtsavfpr.S - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtsavfpr.S -o $(T)crtsavfpr$(objext) - -$(T)crtresfpr$(objext): crtresfpr.S - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtresfpr.S -o $(T)crtresfpr$(objext) - -$(T)crtsavgpr$(objext): crtsavgpr.S - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtsavgpr.S -o $(T)crtsavgpr$(objext) - -$(T)crtresgpr$(objext): crtresgpr.S - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtresgpr.S -o $(T)crtresgpr$(objext) - -$(T)crtresxfpr$(objext): crtresxfpr.S - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtresxfpr.S -o $(T)crtresxfpr$(objext) - -$(T)crtresxgpr$(objext): crtresxgpr.S - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtresxgpr.S -o $(T)crtresxgpr$(objext) - -$(T)e500crtres32gpr$(objext): e500crtres32gpr.S - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtres32gpr.S -o $(T)e500crtres32gpr$(objext) - -$(T)e500crtres64gpr$(objext): e500crtres64gpr.S - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtres64gpr.S -o $(T)e500crtres64gpr$(objext) - -$(T)e500crtres64gprctr$(objext): e500crtres64gprctr.S - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtres64gprctr.S -o $(T)e500crtres64gprctr$(objext) - -$(T)e500crtrest32gpr$(objext): e500crtrest32gpr.S - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtrest32gpr.S -o $(T)e500crtrest32gpr$(objext) - -$(T)e500crtrest64gpr$(objext): e500crtrest64gpr.S - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtrest64gpr.S -o $(T)e500crtrest64gpr$(objext) - -$(T)e500crtresx32gpr$(objext): e500crtresx32gpr.S - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtresx32gpr.S -o $(T)e500crtresx32gpr$(objext) - -$(T)e500crtresx64gpr$(objext): e500crtresx64gpr.S - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtresx64gpr.S -o $(T)e500crtresx64gpr$(objext) - -$(T)e500crtsav32gpr$(objext): e500crtsav32gpr.S - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtsav32gpr.S -o $(T)e500crtsav32gpr$(objext) - -$(T)e500crtsav64gpr$(objext): e500crtsav64gpr.S - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtsav64gpr.S -o $(T)e500crtsav64gpr$(objext) - -$(T)e500crtsav64gprctr$(objext): e500crtsav64gprctr.S - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtsav64gprctr.S -o $(T)e500crtsav64gprctr$(objext) - -$(T)e500crtsavg32gpr$(objext): e500crtsavg32gpr.S - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtsavg32gpr.S -o $(T)e500crtsavg32gpr$(objext) - -$(T)e500crtsavg64gpr$(objext): e500crtsavg64gpr.S - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtsavg64gpr.S -o $(T)e500crtsavg64gpr$(objext) - -$(T)e500crtsavg64gprctr$(objext): e500crtsavg64gprctr.S - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtsavg64gprctr.S -o $(T)e500crtsavg64gprctr$(objext) - # It is important that crtbegin.o, etc., aren't surprised by stuff in .sdata. CRTSTUFF_T_CFLAGS = -msdata=none # Make sure crt*.o are built with -fPIC even if configured with diff --git a/gcc/config/rs6000/x-linux64 b/gcc/config/rs6000/x-linux64 deleted file mode 100644 index 4371ca30431..00000000000 --- a/gcc/config/rs6000/x-linux64 +++ /dev/null @@ -1,2 +0,0 @@ -# parts of gcc need more than a 64k TOC. -X_CFLAGS = -mminimal-toc diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index ff2edecb223..b9f231729a6 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -1451,7 +1451,7 @@ s390_narrow_logical_operator (enum rtx_code code, rtx *memop, rtx *immop) static struct machine_function * s390_init_machine_status (void) { - return ggc_alloc_cleared (sizeof (struct machine_function)); + return GGC_CNEW (struct machine_function); } /* Change optimizations to be performed, depending on the diff --git a/gcc/config/score/score.c b/gcc/config/score/score.c index 56c6c477082..4f383da88dd 100644 --- a/gcc/config/score/score.c +++ b/gcc/config/score/score.c @@ -922,7 +922,7 @@ score_block_move_straight (rtx dst, rtx src, HOST_WIDE_INT length) length -= leftover; reg_count = length / UNITS_PER_WORD; - regs = alloca (sizeof (rtx) * reg_count); + regs = XALLOCAVEC (rtx, reg_count); for (i = 0; i < reg_count; i++) regs[i] = gen_reg_rtx (SImode); @@ -1006,7 +1006,7 @@ score_block_move_loop_body (rtx dst_reg, HOST_WIDE_INT dst_align, HOST_WIDE_INT length) { int reg_count = length / UNITS_PER_WORD; - rtx *regs = alloca (sizeof (rtx) * reg_count); + rtx *regs = XALLOCAVEC (rtx, reg_count); int i; bool src_unaligned = (src_align < BITS_PER_WORD); bool dst_unaligned = (dst_align < BITS_PER_WORD); diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 009ab3a2bcf..5e6f5748672 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -8848,7 +8848,7 @@ sparc_can_output_mi_thunk (const_tree thunk_fndecl ATTRIBUTE_UNUSED, static struct machine_function * sparc_init_machine_status (void) { - return ggc_alloc_cleared (sizeof (struct machine_function)); + return GGC_CNEW (struct machine_function); } /* Locate some local-dynamic symbol still in use by this function diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c index 4dd3d7cc0fe..e645adb2281 100644 --- a/gcc/config/spu/spu.c +++ b/gcc/config/spu/spu.c @@ -4576,15 +4576,6 @@ spu_builtin_splats (rtx ops[]) constant_to_array (GET_MODE_INNER (mode), ops[1], arr); emit_move_insn (ops[0], array_to_constant (mode, arr)); } - else if (!flag_pic && GET_MODE (ops[0]) == V4SImode && CONSTANT_P (ops[1])) - { - rtvec v = rtvec_alloc (4); - RTVEC_ELT (v, 0) = ops[1]; - RTVEC_ELT (v, 1) = ops[1]; - RTVEC_ELT (v, 2) = ops[1]; - RTVEC_ELT (v, 3) = ops[1]; - emit_move_insn (ops[0], gen_rtx_CONST_VECTOR (mode, v)); - } else { rtx reg = gen_reg_rtx (TImode); @@ -4903,7 +4894,9 @@ spu_expand_vector_init (rtx target, rtx vals) for (i = 0; i < n_elts; ++i) { x = XVECEXP (vals, 0, i); - if (!CONSTANT_P (x)) + if (!(CONST_INT_P (x) + || GET_CODE (x) == CONST_DOUBLE + || GET_CODE (x) == CONST_FIXED)) ++n_var; else { @@ -4940,8 +4933,13 @@ spu_expand_vector_init (rtx target, rtx vals) /* fill empty slots with the first constant, this increases our chance of using splats in the recursive call below. */ for (i = 0; i < n_elts; ++i) - if (!CONSTANT_P (XVECEXP (constant_parts_rtx, 0, i))) - XVECEXP (constant_parts_rtx, 0, i) = first_constant; + { + x = XVECEXP (constant_parts_rtx, 0, i); + if (!(CONST_INT_P (x) + || GET_CODE (x) == CONST_DOUBLE + || GET_CODE (x) == CONST_FIXED)) + XVECEXP (constant_parts_rtx, 0, i) = first_constant; + } spu_expand_vector_init (target, constant_parts_rtx); } @@ -4957,7 +4955,9 @@ spu_expand_vector_init (rtx target, rtx vals) for (i = 0; i < n_elts; ++i) { x = XVECEXP (vals, 0, i); - if (!CONSTANT_P (x)) + if (!(CONST_INT_P (x) + || GET_CODE (x) == CONST_DOUBLE + || GET_CODE (x) == CONST_FIXED)) { if (!register_operand (x, GET_MODE (x))) x = force_reg (GET_MODE (x), x); diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index a5ca4635248..6e26d76daad 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -1208,7 +1208,7 @@ xtensa_expand_nonlocal_goto (rtx *operands) static struct machine_function * xtensa_init_machine_status (void) { - return ggc_alloc_cleared (sizeof (struct machine_function)); + return GGC_CNEW (struct machine_function); } diff --git a/gcc/configure.ac b/gcc/configure.ac index 9bde4937907..ff400a1016c 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -567,8 +567,7 @@ AC_SUBST(BASILYSMELT_OBJECT) # So, we only use -pedantic if we can disable those warnings. ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wstrict-prototypes \ - -Wmissing-prototypes], [loose_warn]) -ACX_PROG_CC_WARNING_OPTS([-Wc++-compat], [cxx_compat_warn]) + -Wmissing-prototypes -Wcast-qual -Wc++-compat], [loose_warn]) ACX_PROG_CC_WARNING_OPTS([-Wold-style-definition \ -Wmissing-format-attribute], [strict_warn]) ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long -Wno-variadic-macros \ diff --git a/gcc/coverage.c b/gcc/coverage.c index f2d26a29f4e..6432bb1f59a 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -141,7 +141,7 @@ get_gcov_unsigned_t (void) static hashval_t htab_counts_entry_hash (const void *of) { - const counts_entry_t *entry = of; + const counts_entry_t *const entry = (const counts_entry_t *) of; return entry->ident * GCOV_COUNTERS + entry->ctr; } @@ -149,8 +149,8 @@ htab_counts_entry_hash (const void *of) static int htab_counts_entry_eq (const void *of1, const void *of2) { - const counts_entry_t *entry1 = of1; - const counts_entry_t *entry2 = of2; + const counts_entry_t *const entry1 = (const counts_entry_t *) of1; + const counts_entry_t *const entry2 = (const counts_entry_t *) of2; return entry1->ident == entry2->ident && entry1->ctr == entry2->ctr; } @@ -158,7 +158,7 @@ htab_counts_entry_eq (const void *of1, const void *of2) static void htab_counts_entry_del (void *of) { - counts_entry_t *entry = of; + counts_entry_t *const entry = (counts_entry_t *) of; free (entry->counts); free (entry); @@ -343,7 +343,7 @@ get_coverage_counts (unsigned counter, unsigned expected, elt.ident = current_function_funcdef_no + 1; elt.ctr = counter; - entry = htab_find (counts_hash, &elt); + entry = (counts_entry_t *) htab_find (counts_hash, &elt); if (!entry) { warning (0, "no coverage for function %qs found", IDENTIFIER_POINTER diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index df1a46bdf94..dd40a292005 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,33 @@ +2008-06-30 Jakub Jelinek <jakub@redhat.com> + + PR c++/36662 + * decl2.c (is_late_template_attribute): If the first attribute + argument is IDENTIFIER_NODE, don't consider it when checking + if arguments are value or type dependent. + +2008-06-29 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/36655 + * pt.c (do_type_instantiation): In c++0x mode do not warn for + extern template. + +2008-06-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * Make-lang.in (cp-warn): Delete $(CXX_COMPAT_WARN). + +2008-06-28 Jakub Jelinek <jakub@redhat.com> + + PR c++/36364 + * repo.c (repo_emit_p): Put const static data members initialized + by const expr into *.rpo file, just return 2 if IDENTIFIER_REPO_CHOSEN + for it is 0. + +2008-06-27 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/36655 + * pt.c (do_decl_instantiation): In c++0x mode do not warn for + extern template. + 2008-06-24 Jonathan Wakely <jwakely.gcc@gmail.com> PR c++/23194 diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index 3831bb9f91f..6fced350ec4 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -89,7 +89,7 @@ CXX_OBJS = cp/cp-lang.o stub-objc.o $(CXX_AND_OBJCXX_OBJS) c++_OBJS = $(CXX_OBJS) dummy-checksum.o cc1plus-checksum.o cp/g++spec.o # Use strict warnings for this front end. -cp-warn = $(STRICT_WARN) $(CXX_COMPAT_WARN) +cp-warn = $(STRICT_WARN) cc1plus-dummy$(exeext): $(CXX_OBJS) dummy-checksum.o $(BACKEND) $(LIBDEPS) $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index ee229f4e878..a5ece9a6709 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1,6 +1,7 @@ /* Process declarations and variables for C++ compiler. Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008 + Free Software Foundation, Inc. Hacked by Michael Tiemann (tiemann@cygnus.com) This file is part of GCC. @@ -1005,6 +1006,14 @@ is_late_template_attribute (tree attr, tree decl) for (arg = args; arg; arg = TREE_CHAIN (arg)) { tree t = TREE_VALUE (arg); + + /* If the first attribute argument is an identifier, only consider + second and following arguments. Attributes like mode, format, + cleanup and several target specific attributes aren't late + just because they have an IDENTIFIER_NODE as first argument. */ + if (arg == args && TREE_CODE (t) == IDENTIFIER_NODE) + continue; + if (value_dependent_expression_p (t) || type_dependent_expression_p (t)) return true; diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 9926f3d834f..f24b6ff04b3 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -14588,8 +14588,8 @@ do_decl_instantiation (tree decl, tree storage) ; else if (storage == ridpointers[(int) RID_EXTERN]) { - if (pedantic && !in_system_header) - pedwarn ("ISO C++ forbids the use of %<extern%> on explicit " + if (pedantic && !in_system_header && (cxx_dialect == cxx98)) + pedwarn ("ISO C++ 1998 forbids the use of %<extern%> on explicit " "instantiations"); extern_p = 1; } @@ -14676,8 +14676,17 @@ do_type_instantiation (tree t, tree storage, tsubst_flags_t complain) if (storage != NULL_TREE) { if (pedantic && !in_system_header) - pedwarn("ISO C++ forbids the use of %qE on explicit instantiations", - storage); + { + if (storage == ridpointers[(int) RID_EXTERN]) + { + if (cxx_dialect == cxx98) + pedwarn("ISO C++ 1998 forbids the use of %<extern%> on " + "explicit instantiations"); + } + else + pedwarn("ISO C++ forbids the use of %qE on explicit " + "instantiations", storage); + } if (storage == ridpointers[(int) RID_INLINE]) nomem_p = 1; diff --git a/gcc/cp/repo.c b/gcc/cp/repo.c index 1fe96a2ddde..b53062dfe8f 100644 --- a/gcc/cp/repo.c +++ b/gcc/cp/repo.c @@ -280,6 +280,7 @@ finish_repo (void) int repo_emit_p (tree decl) { + int ret = 0; gcc_assert (TREE_PUBLIC (decl)); gcc_assert (TREE_CODE (decl) == FUNCTION_DECL || TREE_CODE (decl) == VAR_DECL); @@ -306,10 +307,12 @@ repo_emit_p (tree decl) return 2; /* Const static data members initialized by constant expressions must be processed where needed so that their definitions are - available. */ + available. Still record them into *.rpo files, so if they + weren't actually emitted and collect2 requests them, they can + be provided. */ if (DECL_INTEGRAL_CONSTANT_VAR_P (decl) && DECL_CLASS_SCOPE_P (decl)) - return 2; + ret = 2; } else if (!DECL_TEMPLATE_INSTANTIATION (decl)) return 2; @@ -343,7 +346,7 @@ repo_emit_p (tree decl) pending_repo = tree_cons (NULL_TREE, decl, pending_repo); } - return IDENTIFIER_REPO_CHOSEN (DECL_ASSEMBLER_NAME (decl)); + return IDENTIFIER_REPO_CHOSEN (DECL_ASSEMBLER_NAME (decl)) ? 1 : ret; } /* Returns true iff the prelinker has explicitly marked CLASS_TYPE for diff --git a/gcc/cse.c b/gcc/cse.c index 02420f1a076..86c0f5408da 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -663,7 +663,7 @@ static int approx_reg_cost_1 (rtx *xp, void *data) { rtx x = *xp; - int *cost_p = data; + int *cost_p = (int *) data; if (x && REG_P (x)) { @@ -4005,7 +4005,7 @@ cse_insn (rtx insn) if (GET_CODE (x) == SET) { - sets = alloca (sizeof (struct set)); + sets = XALLOCA (struct set); sets[0].rtl = x; /* Ignore SETs that are unconditional jumps. @@ -4040,7 +4040,7 @@ cse_insn (rtx insn) { int lim = XVECLEN (x, 0); - sets = alloca (lim * sizeof (struct set)); + sets = XALLOCAVEC (struct set, lim); /* Find all regs explicitly clobbered in this insn, and ensure they are not replaced with any other regs diff --git a/gcc/cselib.c b/gcc/cselib.c index 69ad207f00a..d50d0c44f17 100644 --- a/gcc/cselib.c +++ b/gcc/cselib.c @@ -142,7 +142,7 @@ static inline struct elt_list * new_elt_list (struct elt_list *next, cselib_val *elt) { struct elt_list *el; - el = pool_alloc (elt_list_pool); + el = (struct elt_list *) pool_alloc (elt_list_pool); el->next = next; el->elt = elt; return el; @@ -155,7 +155,7 @@ static inline struct elt_loc_list * new_elt_loc_list (struct elt_loc_list *next, rtx loc) { struct elt_loc_list *el; - el = pool_alloc (elt_loc_list_pool); + el = (struct elt_loc_list *) pool_alloc (elt_loc_list_pool); el->next = next; el->loc = loc; el->setting_insn = cselib_current_insn; @@ -232,7 +232,7 @@ entry_and_rtx_equal_p (const void *entry, const void *x_arg) { struct elt_loc_list *l; const cselib_val *const v = (const cselib_val *) entry; - rtx x = (rtx) x_arg; + rtx x = CONST_CAST_RTX ((const_rtx)x_arg); enum machine_mode mode = GET_MODE (x); gcc_assert (GET_CODE (x) != CONST_INT && GET_CODE (x) != CONST_FIXED @@ -749,7 +749,7 @@ cselib_hash_rtx (rtx x, int create) static inline cselib_val * new_cselib_val (unsigned int value, enum machine_mode mode) { - cselib_val *e = pool_alloc (cselib_val_pool); + cselib_val *e = (cselib_val *) pool_alloc (cselib_val_pool); gcc_assert (value); @@ -759,7 +759,7 @@ new_cselib_val (unsigned int value, enum machine_mode mode) precisely when we can have VALUE RTXen (when cselib is active) so we don't need to put them in garbage collected memory. ??? Why should a VALUE be an RTX in the first place? */ - e->val_rtx = pool_alloc (value_pool); + e->val_rtx = (rtx) pool_alloc (value_pool); memset (e->val_rtx, 0, RTX_HDR_SIZE); PUT_CODE (e->val_rtx, VALUE); PUT_MODE (e->val_rtx, mode); diff --git a/gcc/dbgcnt.c b/gcc/dbgcnt.c index 47ba28a9648..6d101a6a2cc 100644 --- a/gcc/dbgcnt.c +++ b/gcc/dbgcnt.c @@ -129,7 +129,7 @@ dbg_cnt_process_opt (const char *arg) if (next == NULL || *next != 0) { - char *buffer = alloca (arg - start + 2); + char *buffer = XALLOCAVEC (char, arg - start + 2); sprintf (buffer, "%*c", (int)(1 + (arg - start)), '^'); error ("Can not find a valid counter:value pair:"); error ("-fdbg-cnt=%s", start); diff --git a/gcc/dbxout.c b/gcc/dbxout.c index 28f7bfa14a5..95058753075 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -996,7 +996,7 @@ dbxout_init (const char *input_file_name) const char *mapped_name; typevec_len = 100; - typevec = ggc_calloc (typevec_len, sizeof typevec[0]); + typevec = GGC_CNEWVEC (struct typeinfo, typevec_len); /* stabstr_ob contains one string, which will be just fine with 1-byte alignment. */ @@ -1709,8 +1709,7 @@ dbxout_type (tree type, int full) if (next_type_number == typevec_len) { - typevec - = ggc_realloc (typevec, (typevec_len * 2 * sizeof typevec[0])); + typevec = GGC_RESIZEVEC (struct typeinfo, typevec, typevec_len * 2); memset (typevec + typevec_len, 0, typevec_len * sizeof typevec[0]); typevec_len *= 2; } @@ -2404,8 +2403,8 @@ dbxout_expand_expr (tree expr) static int output_used_types_helper (void **slot, void *data) { - tree type = *slot; - VEC(tree, heap) **types_p = data; + tree type = (tree) *slot; + VEC(tree, heap) **types_p = (VEC(tree, heap) **) data; if ((TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == UNION_TYPE diff --git a/gcc/df-core.c b/gcc/df-core.c index 9e23c759469..8e6a4e14825 100644 --- a/gcc/df-core.c +++ b/gcc/df-core.c @@ -1455,7 +1455,7 @@ df_compact_blocks (void) void **problem_temps; int size = last_basic_block * sizeof (void *); bitmap tmp = BITMAP_ALLOC (&df_bitmap_obstack); - problem_temps = xmalloc (size); + problem_temps = XNEWVAR (void *, size); for (p = 0; p < df->num_problems_defined; p++) { diff --git a/gcc/df-problems.c b/gcc/df-problems.c index b9f5eecec08..28c99638ec3 100644 --- a/gcc/df-problems.c +++ b/gcc/df-problems.c @@ -109,8 +109,7 @@ df_grow_bb_info (struct dataflow *dflow) if (dflow->block_info_size < new_size) { new_size += new_size / 4; - dflow->block_info = xrealloc (dflow->block_info, - new_size *sizeof (void*)); + dflow->block_info = XRESIZEVEC (void *, dflow->block_info, new_size); memset (dflow->block_info + dflow->block_info_size, 0, (new_size - dflow->block_info_size) *sizeof (void *)); dflow->block_info_size = new_size; @@ -1862,7 +1861,7 @@ struct df_link * df_chain_create (struct df_ref *src, struct df_ref *dst) { struct df_link *head = DF_REF_CHAIN (src); - struct df_link *link = pool_alloc (df_chain->block_pool); + struct df_link *link = (struct df_link *) pool_alloc (df_chain->block_pool); DF_REF_CHAIN (src) = link; link->next = head; diff --git a/gcc/df-scan.c b/gcc/df-scan.c index 966fd4b255f..5818717651d 100644 --- a/gcc/df-scan.c +++ b/gcc/df-scan.c @@ -60,6 +60,21 @@ along with GCC; see the file COPYING3. If not see #define EPILOGUE_USES(REGNO) 0 #endif +/* The following two macros free the vecs that hold either the refs or + the mw refs. They are a little tricky because the vec has 0 + elements is special and is not to be freed. */ +#define df_scan_free_ref_vec(V) \ + do { \ + if (V && *V) \ + free (V); \ + } while (0) + +#define df_scan_free_mws_vec(V) \ + do { \ + if (V && *V) \ + free (V); \ + } while (0) + /* The bitmap_obstack is used to hold some static variables that should not be reset after each function is compiled. */ @@ -174,11 +189,43 @@ struct df_scan_problem_data typedef struct df_scan_bb_info *df_scan_bb_info_t; + +/* Internal function to shut down the scanning problem. */ static void df_scan_free_internal (void) { struct df_scan_problem_data *problem_data = (struct df_scan_problem_data *) df_scan->problem_data; + unsigned int i; + basic_block bb; + + /* The vectors that hold the refs are not pool allocated because + they come in many sizes. This makes them impossible to delete + all at once. */ + for (i = 0; i < DF_INSN_SIZE(); i++) + { + struct df_insn_info *insn_info = DF_INSN_UID_GET(i); + /* Skip the insns that have no insn_info or have been + deleted. */ + if (insn_info) + { + df_scan_free_ref_vec (insn_info->defs); + df_scan_free_ref_vec (insn_info->uses); + df_scan_free_ref_vec (insn_info->eq_uses); + df_scan_free_mws_vec (insn_info->mw_hardregs); + } + } + + FOR_ALL_BB (bb) + { + unsigned int bb_index = bb->index; + struct df_scan_bb_info *bb_info = df_scan_get_bb_info (bb_index); + if (bb_info) + { + df_scan_free_ref_vec (bb_info->artificial_defs); + df_scan_free_ref_vec (bb_info->artificial_uses); + } + } free (df->def_info.refs); free (df->def_info.begin); @@ -477,20 +524,14 @@ df_grow_reg_info (void) if (df->regs_size < new_size) { new_size += new_size / 4; - df->def_regs = xrealloc (df->def_regs, - new_size *sizeof (struct df_reg_info*)); - df->use_regs = xrealloc (df->use_regs, - new_size *sizeof (struct df_reg_info*)); - df->eq_use_regs = xrealloc (df->eq_use_regs, - new_size *sizeof (struct df_reg_info*)); - df->def_info.begin = xrealloc (df->def_info.begin, - new_size *sizeof (int)); - df->def_info.count = xrealloc (df->def_info.count, - new_size *sizeof (int)); - df->use_info.begin = xrealloc (df->use_info.begin, - new_size *sizeof (int)); - df->use_info.count = xrealloc (df->use_info.count, - new_size *sizeof (int)); + df->def_regs = XRESIZEVEC (struct df_reg_info *, df->def_regs, new_size); + df->use_regs = XRESIZEVEC (struct df_reg_info *, df->use_regs, new_size); + df->eq_use_regs = XRESIZEVEC (struct df_reg_info *, df->eq_use_regs, + new_size); + df->def_info.begin = XRESIZEVEC (unsigned, df->def_info.begin, new_size); + df->def_info.count = XRESIZEVEC (unsigned, df->def_info.count, new_size); + df->use_info.begin = XRESIZEVEC (unsigned, df->use_info.begin, new_size); + df->use_info.count = XRESIZEVEC (unsigned, df->use_info.count, new_size); df->regs_size = new_size; } @@ -498,13 +539,13 @@ df_grow_reg_info (void) { struct df_reg_info *reg_info; - reg_info = pool_alloc (problem_data->reg_pool); + reg_info = (struct df_reg_info *) pool_alloc (problem_data->reg_pool); memset (reg_info, 0, sizeof (struct df_reg_info)); df->def_regs[i] = reg_info; - reg_info = pool_alloc (problem_data->reg_pool); + reg_info = (struct df_reg_info *) pool_alloc (problem_data->reg_pool); memset (reg_info, 0, sizeof (struct df_reg_info)); df->use_regs[i] = reg_info; - reg_info = pool_alloc (problem_data->reg_pool); + reg_info = (struct df_reg_info *) pool_alloc (problem_data->reg_pool); memset (reg_info, 0, sizeof (struct df_reg_info)); df->eq_use_regs[i] = reg_info; df->def_info.begin[i] = 0; @@ -524,8 +565,7 @@ df_grow_ref_info (struct df_ref_info *ref_info, unsigned int new_size) { if (ref_info->refs_size < new_size) { - ref_info->refs = xrealloc (ref_info->refs, - new_size *sizeof (struct df_ref *)); + ref_info->refs = XRESIZEVEC (struct df_ref *, ref_info->refs, new_size); memset (ref_info->refs + ref_info->refs_size, 0, (new_size - ref_info->refs_size) *sizeof (struct df_ref *)); ref_info->refs_size = new_size; @@ -562,8 +602,7 @@ df_grow_insn_info (void) if (DF_INSN_SIZE () < new_size) { new_size += new_size / 4; - df->insns = xrealloc (df->insns, - new_size *sizeof (struct df_insn_info *)); + df->insns = XRESIZEVEC (struct df_insn_info *, df->insns, new_size); memset (df->insns + df->insns_size, 0, (new_size - DF_INSN_SIZE ()) *sizeof (struct df_insn_info *)); DF_INSN_SIZE () = new_size; @@ -703,7 +742,7 @@ df_ref_create (rtx reg, rtx *loc, rtx insn, ref_rec = *ref_rec_ptr; if (count) { - ref_rec = xrealloc (ref_rec, (count+2) * sizeof (struct df_ref*)); + ref_rec = XRESIZEVEC (struct df_ref *, ref_rec, count+2); *ref_rec_ptr = ref_rec; ref_rec[count] = ref; ref_rec[count+1] = NULL; @@ -929,7 +968,7 @@ df_insn_create_insn_record (rtx insn) insn_rec = DF_INSN_INFO_GET (insn); if (!insn_rec) { - insn_rec = pool_alloc (problem_data->insn_pool); + insn_rec = (struct df_insn_info *) pool_alloc (problem_data->insn_pool); DF_INSN_INFO_SET (insn, insn_rec); } memset (insn_rec, 0, sizeof (struct df_insn_info)); @@ -1101,10 +1140,10 @@ df_insn_rescan (rtx insn) struct df_insn_info *insn_info = NULL; basic_block bb = BLOCK_FOR_INSN (insn); struct df_collection_rec collection_rec; - collection_rec.def_vec = alloca (sizeof (struct df_ref*) * 1000); - collection_rec.use_vec = alloca (sizeof (struct df_ref*) * 1000); - collection_rec.eq_use_vec = alloca (sizeof (struct df_ref*) * 1000); - collection_rec.mw_vec = alloca (sizeof (struct df_mw_hardreg*) * 100); + collection_rec.def_vec = XALLOCAVEC (struct df_ref *, 1000); + collection_rec.use_vec = XALLOCAVEC (struct df_ref *, 1000); + collection_rec.eq_use_vec = XALLOCAVEC (struct df_ref *, 1000); + collection_rec.mw_vec = XALLOCAVEC (struct df_mw_hardreg *, 100); if ((!df) || (!INSN_P (insn))) return false; @@ -1985,7 +2024,7 @@ df_mw_hardreg_chain_delete_eq_uses (struct df_insn_info *insn_info) if (count == 0) { - free (insn_info->mw_hardregs); + df_scan_free_mws_vec (insn_info->mw_hardregs); insn_info->mw_hardregs = df_null_mw_rec; return 0; } @@ -2048,8 +2087,8 @@ df_notes_rescan (rtx insn) unsigned int num_deleted; memset (&collection_rec, 0, sizeof (struct df_collection_rec)); - collection_rec.eq_use_vec = alloca (sizeof (struct df_ref*) * 1000); - collection_rec.mw_vec = alloca (sizeof (struct df_mw_hardreg*) * 1000); + collection_rec.eq_use_vec = XALLOCAVEC (struct df_ref *, 1000); + collection_rec.mw_vec = XALLOCAVEC (struct df_mw_hardreg *, 1000); num_deleted = df_mw_hardreg_chain_delete_eq_uses (insn_info); df_ref_chain_delete (insn_info->eq_uses); @@ -2090,9 +2129,9 @@ df_notes_rescan (rtx insn) if (collection_rec.next_mw > num_deleted) { insn_info->mw_hardregs = - xrealloc (insn_info->mw_hardregs, - (count + 1 + collection_rec.next_mw) - * sizeof (struct df_ref*)); + XRESIZEVEC (struct df_mw_hardreg *, + insn_info->mw_hardregs, + count + 1 + collection_rec.next_mw); } memcpy (&insn_info->mw_hardregs[count], collection_rec.mw_vec, (collection_rec.next_mw + 1) * sizeof (struct df_mw_hardreg *)); @@ -2199,12 +2238,12 @@ df_ref_compare (const void *r1, const void *r2) at ref1. */ if (DF_REF_FLAGS_IS_SET (ref1, DF_REF_SIGN_EXTRACT | DF_REF_ZERO_EXTRACT)) { - if (DF_REF_EXTRACT_OFFSET (ref1) != DF_REF_EXTRACT_OFFSET (ref2)) - return DF_REF_EXTRACT_OFFSET (ref1) - DF_REF_EXTRACT_OFFSET (ref2); - if (DF_REF_EXTRACT_WIDTH (ref1) != DF_REF_EXTRACT_WIDTH (ref2)) - return DF_REF_EXTRACT_WIDTH (ref1) - DF_REF_EXTRACT_WIDTH (ref2); - if (DF_REF_EXTRACT_MODE (ref1) != DF_REF_EXTRACT_MODE (ref2)) - return DF_REF_EXTRACT_MODE (ref1) - DF_REF_EXTRACT_MODE (ref2); + if (DF_REF_EXTRACT_OFFSET_CONST (ref1) != DF_REF_EXTRACT_OFFSET_CONST (ref2)) + return DF_REF_EXTRACT_OFFSET_CONST (ref1) - DF_REF_EXTRACT_OFFSET_CONST (ref2); + if (DF_REF_EXTRACT_WIDTH_CONST (ref1) != DF_REF_EXTRACT_WIDTH_CONST (ref2)) + return DF_REF_EXTRACT_WIDTH_CONST (ref1) - DF_REF_EXTRACT_WIDTH_CONST (ref2); + if (DF_REF_EXTRACT_MODE_CONST (ref1) != DF_REF_EXTRACT_MODE_CONST (ref2)) + return DF_REF_EXTRACT_MODE_CONST (ref1) - DF_REF_EXTRACT_MODE_CONST (ref2); } return 0; } @@ -2523,8 +2562,7 @@ df_refs_add_to_chains (struct df_collection_rec *collection_rec, chain specially. */ if (collection_rec->def_vec) { - if (insn_rec->defs && *insn_rec->defs) - free (insn_rec->defs); + df_scan_free_ref_vec (insn_rec->defs); insn_rec->defs = df_install_refs (bb, collection_rec->def_vec, collection_rec->next_def, @@ -2533,8 +2571,7 @@ df_refs_add_to_chains (struct df_collection_rec *collection_rec, } if (collection_rec->use_vec) { - if (insn_rec->uses && *insn_rec->uses) - free (insn_rec->uses); + df_scan_free_ref_vec (insn_rec->uses); insn_rec->uses = df_install_refs (bb, collection_rec->use_vec, collection_rec->next_use, @@ -2543,8 +2580,7 @@ df_refs_add_to_chains (struct df_collection_rec *collection_rec, } if (collection_rec->eq_use_vec) { - if (insn_rec->eq_uses && *insn_rec->eq_uses) - free (insn_rec->eq_uses); + df_scan_free_ref_vec (insn_rec->eq_uses); insn_rec->eq_uses = df_install_refs (bb, collection_rec->eq_use_vec, collection_rec->next_eq_use, @@ -2553,8 +2589,7 @@ df_refs_add_to_chains (struct df_collection_rec *collection_rec, } if (collection_rec->mw_vec) { - if (insn_rec->mw_hardregs && *insn_rec->mw_hardregs) - free (insn_rec->mw_hardregs); + df_scan_free_mws_vec (insn_rec->mw_hardregs); insn_rec->mw_hardregs = df_install_mws (collection_rec->mw_vec, collection_rec->next_mw); @@ -2564,15 +2599,13 @@ df_refs_add_to_chains (struct df_collection_rec *collection_rec, { struct df_scan_bb_info *bb_info = df_scan_get_bb_info (bb->index); - if (bb_info->artificial_defs && *bb_info->artificial_defs) - free (bb_info->artificial_defs); + df_scan_free_ref_vec (bb_info->artificial_defs); bb_info->artificial_defs = df_install_refs (bb, collection_rec->def_vec, collection_rec->next_def, df->def_regs, &df->def_info, false); - if (bb_info->artificial_uses && *bb_info->artificial_uses) - free (bb_info->artificial_uses); + df_scan_free_ref_vec (bb_info->artificial_uses); bb_info->artificial_uses = df_install_refs (bb, collection_rec->use_vec, collection_rec->next_use, @@ -2604,13 +2637,13 @@ df_ref_create_structure (struct df_collection_rec *collection_rec, if (ref_flags & (DF_REF_SIGN_EXTRACT | DF_REF_ZERO_EXTRACT)) { - this_ref = pool_alloc (problem_data->ref_extract_pool); + this_ref = (struct df_ref *) pool_alloc (problem_data->ref_extract_pool); DF_REF_EXTRACT_WIDTH (this_ref) = width; DF_REF_EXTRACT_OFFSET (this_ref) = offset; DF_REF_EXTRACT_MODE (this_ref) = mode; } else - this_ref = pool_alloc (problem_data->ref_pool); + this_ref = (struct df_ref *) pool_alloc (problem_data->ref_pool); DF_REF_ID (this_ref) = -1; DF_REF_REG (this_ref) = reg; DF_REF_REGNO (this_ref) = regno; @@ -2709,7 +2742,7 @@ df_ref_record (struct df_collection_rec *collection_rec, ref_flags |= DF_REF_PARTIAL; ref_flags |= DF_REF_MW_HARDREG; - hardreg = pool_alloc (problem_data->mw_reg_pool); + hardreg = (struct df_mw_hardreg *) pool_alloc (problem_data->mw_reg_pool); hardreg->type = ref_type; hardreg->flags = ref_flags; hardreg->mw_reg = reg; @@ -3482,10 +3515,10 @@ df_bb_refs_record (int bb_index, bool scan_insns) int luid = 0; struct df_scan_bb_info *bb_info; struct df_collection_rec collection_rec; - collection_rec.def_vec = alloca (sizeof (struct df_ref*) * 1000); - collection_rec.use_vec = alloca (sizeof (struct df_ref*) * 1000); - collection_rec.eq_use_vec = alloca (sizeof (struct df_ref*) * 1000); - collection_rec.mw_vec = alloca (sizeof (struct df_mw_hardreg*) * 100); + collection_rec.def_vec = XALLOCAVEC (struct df_ref *, 1000); + collection_rec.use_vec = XALLOCAVEC (struct df_ref *, 1000); + collection_rec.eq_use_vec = XALLOCAVEC (struct df_ref *, 1000); + collection_rec.mw_vec = XALLOCAVEC (struct df_mw_hardreg *, 100); if (!df) return; @@ -3772,7 +3805,7 @@ df_record_entry_block_defs (bitmap entry_block_defs) { struct df_collection_rec collection_rec; memset (&collection_rec, 0, sizeof (struct df_collection_rec)); - collection_rec.def_vec = alloca (sizeof (struct df_ref*) * FIRST_PSEUDO_REGISTER); + collection_rec.def_vec = XALLOCAVEC (struct df_ref *, FIRST_PSEUDO_REGISTER); df_entry_block_defs_collect (&collection_rec, entry_block_defs); @@ -3943,7 +3976,7 @@ df_record_exit_block_uses (bitmap exit_block_uses) { struct df_collection_rec collection_rec; memset (&collection_rec, 0, sizeof (struct df_collection_rec)); - collection_rec.use_vec = alloca (sizeof (struct df_ref*) * FIRST_PSEUDO_REGISTER); + collection_rec.use_vec = XALLOCAVEC (struct df_ref *, FIRST_PSEUDO_REGISTER); df_exit_block_uses_collect (&collection_rec, exit_block_uses); @@ -4317,10 +4350,10 @@ df_bb_verify (basic_block bb) struct df_collection_rec collection_rec; memset (&collection_rec, 0, sizeof (struct df_collection_rec)); - collection_rec.def_vec = alloca (sizeof (struct df_ref*) * 1000); - collection_rec.use_vec = alloca (sizeof (struct df_ref*) * 1000); - collection_rec.eq_use_vec = alloca (sizeof (struct df_ref*) * 1000); - collection_rec.mw_vec = alloca (sizeof (struct df_mw_hardreg*) * 100); + collection_rec.def_vec = XALLOCAVEC (struct df_ref *, 1000); + collection_rec.use_vec = XALLOCAVEC (struct df_ref *, 1000); + collection_rec.eq_use_vec = XALLOCAVEC (struct df_ref *, 1000); + collection_rec.mw_vec = XALLOCAVEC (struct df_mw_hardreg *, 100); gcc_assert (bb_info); @@ -637,8 +637,11 @@ struct df /* The following two macros may only be applied if one of DF_REF_SIGN_EXTRACT | DF_REF_ZERO_EXTRACT is true. */ #define DF_REF_EXTRACT_WIDTH(REF) (((struct df_ref_extract *)(REF))->width) +#define DF_REF_EXTRACT_WIDTH_CONST(REF) (((const struct df_ref_extract *)(REF))->width) #define DF_REF_EXTRACT_OFFSET(REF) (((struct df_ref_extract *)(REF))->offset) +#define DF_REF_EXTRACT_OFFSET_CONST(REF) (((const struct df_ref_extract *)(REF))->offset) #define DF_REF_EXTRACT_MODE(REF) (((struct df_ref_extract *)(REF))->mode) +#define DF_REF_EXTRACT_MODE_CONST(REF) (((const struct df_ref_extract *)(REF))->mode) /* Macros to determine the reference type. */ #define DF_REF_REG_DEF_P(REF) (DF_REF_TYPE (REF) == DF_REF_REG_DEF) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 8ead5a8cf29..56e89265b49 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -3768,13 +3768,13 @@ targets. You can use @code{__declspec (selectany)} as a synonym for compilers. @item weak -The @code{weak} attribute is described in @xref{Function Attributes}. +The @code{weak} attribute is described in @ref{Function Attributes}. @item dllimport -The @code{dllimport} attribute is described in @xref{Function Attributes}. +The @code{dllimport} attribute is described in @ref{Function Attributes}. @item dllexport -The @code{dllexport} attribute is described in @xref{Function Attributes}. +The @code{dllexport} attribute is described in @ref{Function Attributes}. @end table @@ -3955,21 +3955,21 @@ Three attributes currently are defined for PowerPC configurations: @code{altivec}, @code{ms_struct} and @code{gcc_struct}. For full documentation of the struct attributes please see the -documentation in the @xref{i386 Variable Attributes}, section. +documentation in @ref{i386 Variable Attributes}. For documentation of @code{altivec} attribute please see the -documentation in the @xref{PowerPC Type Attributes}, section. +documentation in @ref{PowerPC Type Attributes}. @subsection SPU Variable Attributes The SPU supports the @code{spu_vector} attribute for variables. For -documentation of this attribute please see the documentation in the -@xref{SPU Type Attributes}, section. +documentation of this attribute please see the documentation in +@ref{SPU Type Attributes}. @subsection Xstormy16 Variable Attributes One attribute is currently defined for xstormy16 configurations: -@code{below100} +@code{below100}. @table @code @item below100 @@ -4283,6 +4283,8 @@ and caught in another, the class must have default visibility. Otherwise the two shared objects will be unable to use the same typeinfo node and exception handling will break. +@end table + @subsection ARM Type Attributes On those ARM targets that support @code{dllimport} (such as Symbian @@ -4310,7 +4312,9 @@ most Symbian OS code uses @code{__declspec}.) @subsection i386 Type Attributes Two attributes are currently defined for i386 configurations: -@code{ms_struct} and @code{gcc_struct} +@code{ms_struct} and @code{gcc_struct}. + +@table @code @item ms_struct @itemx gcc_struct @@ -4338,8 +4342,8 @@ packed))}. Three attributes currently are defined for PowerPC configurations: @code{altivec}, @code{ms_struct} and @code{gcc_struct}. -For full documentation of the struct attributes please see the -documentation in the @xref{i386 Type Attributes}, section. +For full documentation of the @code{ms_struct} and @code{gcc_struct} +attributes please see the documentation in @ref{i386 Type Attributes}. The @code{altivec} attribute allows one to declare AltiVec vector data types supported by the AltiVec Programming Interface Manual. The @@ -5283,7 +5287,6 @@ GCC provides three magic variables which hold the name of the current function, as a string. The first of these is @code{__func__}, which is part of the C99 standard: -@display The identifier @code{__func__} is implicitly declared by the translator as if, immediately following the opening brace of each function definition, the declaration @@ -5292,9 +5295,9 @@ definition, the declaration static const char __func__[] = "function-name"; @end smallexample +@noindent appeared, where function-name is the name of the lexically-enclosing function. This name is the unadorned name of the function. -@end display @code{__FUNCTION__} is another name for @code{__func__}. Older versions of GCC recognize only this name. However, it is not @@ -12316,7 +12319,7 @@ interface table mechanism, instead of regular virtual table dispatch. @end table -See also @xref{Namespace Association}. +See also @ref{Namespace Association}. @node Namespace Association @section Namespace Association @@ -12543,7 +12546,7 @@ should work just fine for standard-conforming code. Previously it was possible to use an empty prototype parameter list to indicate an unspecified number of parameters (like C), rather than no parameters, as C++ demands. This feature has been removed, except where -it is required for backwards compatibility @xref{Backwards Compatibility}. +it is required for backwards compatibility. @xref{Backwards Compatibility}. @end table G++ allows a virtual function returning @samp{void *} to be overridden @@ -12594,7 +12597,7 @@ used to be acceptable in previous drafts of the standard, such as the ARM compilation of C++ written to such drafts, G++ contains some backwards compatibilities. @emph{All such backwards compatibility features are liable to disappear in future versions of G++.} They should be considered -deprecated @xref{Deprecated Features}. +deprecated. @xref{Deprecated Features}. @table @code @item For scope diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 3ce62cb07f9..b1b896527ba 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -2591,6 +2591,12 @@ information are. @item @uref{#windows,,Microsoft Windows} @item +@uref{#x-x-cygwin,,*-*-cygwin} +@item +@uref{#x-x-interix,,*-*-interix} +@item +@uref{#x-x-mingw,,*-*-mingw} +@item @uref{#os2,,OS/2} @item @uref{#older,,Older systems} @@ -4020,7 +4026,64 @@ respects, this target is the same as the @html <hr /> @end html -@heading @anchor{windows}Microsoft Windows (32-bit) +@heading @anchor{windows}Microsoft Windows + +@subheading Intel 16-bit versions +The 16-bit versions of Microsoft Windows, such as Windows 3.1, are not +supported. + +However, the 32-bit port has limited support for Microsoft +Windows 3.11 in the Win32s environment, as a target only. See below. + +@subheading Intel 32-bit versions + +The 32-bit versions of Windows, including Windows 95, Windows NT, Windows +XP, and Windows Vista, are supported by several different target +platforms. These targets differ in which Windows subsystem they target +and which C libraries are used. + +@itemize +@item Cygwin @uref{#x-x-cygwin,,*-*-cygwin}: Cygwin provides a user-space +Linux API emulation layer in the Win32 subsystem. +@item Interix @uref{#x-x-interix,,*-*-interix}: The Interix subsystem +provides native support for POSIX. +@item MinGW @uref{#x-x-mingw,,*-*-mingw}: MinGW is a native GCC port for +the Win32 subsystem that provides a subset of POSIX. +@item MKS i386-pc-mks: NuTCracker from MKS. See +@uref{http://www.mkssoftware.com/} for more information. +@end itemize + +@subheading Intel 64-bit versions + +GCC contains support for x86-64 using the mingw-w64 +runtime library, available from @uref{http://mingw-w64.sourceforge.net/}. +This library should be used with the target triple x86_64-pc-mingw32. + +Presently Windows for Itanium is not supported. + +@subheading Windows CE + +Windows CE is supported as a target only on ARM (arm-wince-pe), Hitachi +SuperH (sh-wince-pe), and MIPS (mips-wince-pe). + +@subheading Other Windows Platforms + +GCC no longer supports Windows NT on the Alpha or PowerPC. + +GCC no longer supports the Windows POSIX subsystem. However, it does +support the Interix subsystem. See above. + +Old target names including *-*-winnt and *-*-windowsnt are no longer used. + +PW32 (i386-pc-pw32) support was never completed, and the project seems to +be inactive. See @uref{http://pw32.sourceforge.net/} for more information. + +UWIN support has been removed due to a lack of maintenance. + +@html +<hr /> +@end html +@heading @anchor{x-x-cygwin}*-*-cygwin Ports of GCC are included with the @uref{http://www.cygwin.com/,,Cygwin environment}. @@ -4028,7 +4091,26 @@ Ports of GCC are included with the GCC will build under Cygwin without modification; it does not build with Microsoft's C++ compiler and there are no plans to make it do so. -For MinGW, GCC will build with and support only MinGW runtime 3.12 and later. +Cygwin can be compiled with i?86-pc-cygwin. + +@html +<hr /> +@end html +@heading @anchor{x-x-interix}*-*-interix + +The Interix target is used by OpenNT, Interix, Services For UNIX (SFU), +and Subsystem for UNIX-based Applications (SUA). Applications compiled +with this target run in the Interix subsystem, which is separate from +the Win32 subsystem. This target was last known to work in GCC 3.3. + +For more information, see @uref{http://www.interix.com/}. + +@html +<hr /> +@end html +@heading @anchor{x-x-mingw32}*-*-mingw32 + +GCC will build with and support only MinGW runtime 3.12 and later. Earlier versions of headers are incompatible with the new default semantics of @code{extern inline} in @code{-std=c99} and @code{-std=gnu99} modes. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index f69f0019dec..c59d88e492d 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -13011,11 +13011,11 @@ Supported values for @var{cpu_type} are @samp{401}, @samp{403}, @samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823}, @samp{860}, @samp{970}, @samp{8540}, @samp{e300c2}, @samp{e300c3}, -@samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5}, @samp{power}, -@samp{power2}, @samp{power3}, @samp{power4}, @samp{power5}, -@samp{power5+}, @samp{power6}, @samp{power6x}, @samp{common}, -@samp{powerpc}, @samp{powerpc64}, @samp{rios}, @samp{rios1}, -@samp{rios2}, @samp{rsc}, and @samp{rs64}. +@samp{e500mc}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5}, +@samp{power}, @samp{power2}, @samp{power3}, @samp{power4}, +@samp{power5}, @samp{power5+}, @samp{power6}, @samp{power6x}, +@samp{common}, @samp{powerpc}, @samp{powerpc64}, @samp{rios}, +@samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}. @option{-mcpu=common} selects a completely generic processor. Code generated under this option will run on any POWER or PowerPC processor. diff --git a/gcc/doc/rtl.texi b/gcc/doc/rtl.texi index 2d95256f8b2..e28d5238227 100644 --- a/gcc/doc/rtl.texi +++ b/gcc/doc/rtl.texi @@ -1527,7 +1527,7 @@ with @code{CONST_FIXED_VALUE_LOW}. @item (const_vector:@var{m} [@var{x0} @var{x1} @dots{}]) Represents a vector constant. The square brackets stand for the vector containing the constant elements. @var{x0}, @var{x1} and so on are -the @code{const_int} or @code{const_double} elements. +the @code{const_int}, @code{const_double} or @code{const_fixed} elements. The number of units in a @code{const_vector} is obtained with the macro @code{CONST_VECTOR_NUNITS} as in @code{CONST_VECTOR_NUNITS (@var{v})}. @@ -3188,11 +3188,9 @@ represents @var{x} before @var{x} is modified. @var{x} must be a @var{m} must be the machine mode for pointers on the machine in use. The expression @var{y} must be one of three forms: -@table @code @code{(plus:@var{m} @var{x} @var{z})}, @code{(minus:@var{m} @var{x} @var{z})}, or @code{(plus:@var{m} @var{x} @var{i})}, -@end table where @var{z} is an index register and @var{i} is a constant. Here is an example of its use: diff --git a/gcc/dominance.c b/gcc/dominance.c index 811d2b91300..b4dff4c6c16 100644 --- a/gcc/dominance.c +++ b/gcc/dominance.c @@ -706,7 +706,7 @@ get_immediate_dominator (enum cdi_direction dir, basic_block bb) if (!node->father) return NULL; - return node->father->data; + return (basic_block) node->father->data; } /* Set the immediate dominator of the block possibly removing @@ -749,9 +749,9 @@ get_dominated_by (enum cdi_direction dir, basic_block bb) if (!son) return NULL; - VEC_safe_push (basic_block, heap, bbs, son->data); + VEC_safe_push (basic_block, heap, bbs, (basic_block) son->data); for (ason = son->right, n = 1; ason != son; ason = ason->right) - VEC_safe_push (basic_block, heap, bbs, ason->data); + VEC_safe_push (basic_block, heap, bbs, (basic_block) ason->data); return bbs; } @@ -823,7 +823,7 @@ nearest_common_dominator (enum cdi_direction dir, basic_block bb1, basic_block b if (!bb2) return bb1; - return et_nca (bb1->dom[dir_index], bb2->dom[dir_index])->data; + return (basic_block) et_nca (bb1->dom[dir_index], bb2->dom[dir_index])->data; } @@ -1103,7 +1103,7 @@ succeed: static basic_block root_of_dom_tree (enum cdi_direction dir, basic_block bb) { - return et_root (bb->dom[dom_convert_dir_to_idx (dir)])->data; + return (basic_block) et_root (bb->dom[dom_convert_dir_to_idx (dir)])->data; } /* See the comment in iterate_fix_dominators. Finds the immediate dominators @@ -1313,10 +1313,10 @@ iterate_fix_dominators (enum cdi_direction dir, VEC (basic_block, heap) *bbs, dom_i = (size_t) *pointer_map_contains (map, dom); /* Do not include parallel edges to G. */ - if (bitmap_bit_p (g->vertices[dom_i].data, i)) + if (bitmap_bit_p ((bitmap) g->vertices[dom_i].data, i)) continue; - bitmap_set_bit (g->vertices[dom_i].data, i); + bitmap_set_bit ((bitmap) g->vertices[dom_i].data, i); add_edge (g, dom_i, i); } } @@ -1394,7 +1394,7 @@ first_dom_son (enum cdi_direction dir, basic_block bb) unsigned int dir_index = dom_convert_dir_to_idx (dir); struct et_node *son = bb->dom[dir_index]->son; - return son ? son->data : NULL; + return (basic_block) (son ? son->data : NULL); } /* Returns the next dominance son after BB in the dominator or postdominator @@ -1406,7 +1406,7 @@ next_dom_son (enum cdi_direction dir, basic_block bb) unsigned int dir_index = dom_convert_dir_to_idx (dir); struct et_node *next = bb->dom[dir_index]->right; - return next->father->son == next ? NULL : next->data; + return (basic_block) (next->father->son == next ? NULL : next->data); } /* Return dominance availability for dominance info DIR. */ diff --git a/gcc/dse.c b/gcc/dse.c index 841e4668b27..71d34620110 100644 --- a/gcc/dse.c +++ b/gcc/dse.c @@ -592,7 +592,7 @@ clear_alias_set_lookup (alias_set_type alias_set) slot = htab_find_slot (clear_alias_mode_table, &tmp_holder, NO_INSERT); gcc_assert (*slot); - return *slot; + return (struct clear_alias_mode_holder *) *slot; } @@ -638,7 +638,8 @@ get_group_info (rtx base) { if (!clear_alias_group) { - clear_alias_group = gi = pool_alloc (rtx_group_info_pool); + clear_alias_group = gi = + (group_info_t) pool_alloc (rtx_group_info_pool); memset (gi, 0, sizeof (struct group_info)); gi->id = rtx_group_next_id++; gi->store1_n = BITMAP_ALLOC (NULL); @@ -658,7 +659,7 @@ get_group_info (rtx base) if (gi == NULL) { - *slot = gi = pool_alloc (rtx_group_info_pool); + *slot = gi = (group_info_t) pool_alloc (rtx_group_info_pool); gi->rtx_base = base; gi->id = rtx_group_next_id++; gi->base_mem = gen_rtx_MEM (QImode, base); @@ -1246,7 +1247,7 @@ record_store (rtx body, bb_info_t bb_info) if (clear_alias_group->offset_map_size_p < spill_alias_set) clear_alias_group->offset_map_size_p = spill_alias_set; - store_info = pool_alloc (rtx_store_info_pool); + store_info = (store_info_t) pool_alloc (rtx_store_info_pool); if (dump_file) fprintf (dump_file, " processing spill store %d(%s)\n", @@ -1260,7 +1261,7 @@ record_store (rtx body, bb_info_t bb_info) group_info_t group = VEC_index (group_info_t, rtx_group_vec, group_id); - store_info = pool_alloc (rtx_store_info_pool); + store_info = (store_info_t) pool_alloc (rtx_store_info_pool); set_usage_bits (group, offset, width); if (dump_file) @@ -1277,7 +1278,7 @@ record_store (rtx body, bb_info_t bb_info) insn_info->stack_pointer_based = true; insn_info->contains_cselib_groups = true; - store_info = pool_alloc (cse_store_info_pool); + store_info = (store_info_t) pool_alloc (cse_store_info_pool); group_id = -1; if (dump_file) @@ -1603,7 +1604,8 @@ replace_read (store_info_t store_info, insn_info_t store_insn, if (validate_change (read_insn->insn, loc, read_reg, 0)) { - deferred_change_t deferred_change = pool_alloc (deferred_change_pool); + deferred_change_t deferred_change = + (deferred_change_t) pool_alloc (deferred_change_pool); /* Insert this right before the store insn where it will be safe from later insns that might change it before the read. */ @@ -1713,7 +1715,7 @@ check_mem_read_rtx (rtx *loc, void *data) else width = GET_MODE_SIZE (GET_MODE (mem)); - read_info = pool_alloc (read_info_pool); + read_info = (read_info_t) pool_alloc (read_info_pool); read_info->group_id = group_id; read_info->mem = mem; read_info->alias_set = spill_alias_set; @@ -1933,7 +1935,7 @@ static void scan_insn (bb_info_t bb_info, rtx insn) { rtx body; - insn_info_t insn_info = pool_alloc (insn_info_pool); + insn_info_t insn_info = (insn_info_t) pool_alloc (insn_info_pool); int mems_found = 0; memset (insn_info, 0, sizeof (struct insn_info)); @@ -2124,7 +2126,7 @@ dse_step1 (void) FOR_ALL_BB (bb) { insn_info_t ptr; - bb_info_t bb_info = pool_alloc (bb_info_pool); + bb_info_t bb_info = (bb_info_t) pool_alloc (bb_info_pool); memset (bb_info, 0, sizeof (struct bb_info)); bitmap_set_bit (all_blocks, bb->index); @@ -2425,7 +2427,8 @@ dse_record_singleton_alias_set (alias_set_type alias_set, slot = htab_find_slot (clear_alias_mode_table, &tmp_holder, INSERT); gcc_assert (*slot == NULL); - *slot = entry = pool_alloc (clear_alias_mode_pool); + *slot = entry = + (struct clear_alias_mode_holder *) pool_alloc (clear_alias_mode_pool); entry->alias_set = alias_set; entry->mode = mode; } @@ -3153,43 +3156,30 @@ dse_step6 (bool global_done) group_info_t group; basic_block bb; - if (global_done) - { - for (i = 0; VEC_iterate (group_info_t, rtx_group_vec, i, group); i++) - { - free (group->offset_map_n); - free (group->offset_map_p); - BITMAP_FREE (group->store1_n); - BITMAP_FREE (group->store1_p); - BITMAP_FREE (group->store2_n); - BITMAP_FREE (group->store2_p); - BITMAP_FREE (group->group_kill); - } - - FOR_ALL_BB (bb) - { - bb_info_t bb_info = bb_table[bb->index]; - BITMAP_FREE (bb_info->gen); - if (bb_info->kill) - BITMAP_FREE (bb_info->kill); - if (bb_info->in) - BITMAP_FREE (bb_info->in); - if (bb_info->out) - BITMAP_FREE (bb_info->out); - } - } - else + for (i = 0; VEC_iterate (group_info_t, rtx_group_vec, i, group); i++) { - for (i = 0; VEC_iterate (group_info_t, rtx_group_vec, i, group); i++) - { - BITMAP_FREE (group->store1_n); - BITMAP_FREE (group->store1_p); - BITMAP_FREE (group->store2_n); - BITMAP_FREE (group->store2_p); - BITMAP_FREE (group->group_kill); - } + free (group->offset_map_n); + free (group->offset_map_p); + BITMAP_FREE (group->store1_n); + BITMAP_FREE (group->store1_p); + BITMAP_FREE (group->store2_n); + BITMAP_FREE (group->store2_p); + BITMAP_FREE (group->group_kill); } + if (global_done) + FOR_ALL_BB (bb) + { + bb_info_t bb_info = bb_table[bb->index]; + BITMAP_FREE (bb_info->gen); + if (bb_info->kill) + BITMAP_FREE (bb_info->kill); + if (bb_info->in) + BITMAP_FREE (bb_info->in); + if (bb_info->out) + BITMAP_FREE (bb_info->out); + } + if (clear_alias_sets) { BITMAP_FREE (clear_alias_sets); @@ -3214,7 +3204,6 @@ dse_step6 (bool global_done) } - /* ------------------------------------------------------------------------- DSE ------------------------------------------------------------------------- */ diff --git a/gcc/dwarf2asm.c b/gcc/dwarf2asm.c index a6ed8740a59..ea19b793df5 100644 --- a/gcc/dwarf2asm.c +++ b/gcc/dwarf2asm.c @@ -757,7 +757,7 @@ dw2_force_const_mem (rtx x, bool public) if (public && USE_LINKONCE_INDIRECT) { - char *ref_name = alloca (strlen (str) + sizeof "DW.ref."); + char *ref_name = XALLOCAVEC (char, strlen (str) + sizeof "DW.ref."); sprintf (ref_name, "DW.ref.%s", str); id = get_identifier (ref_name); diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index ba17c3f5c2d..80bdc0a4bb0 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -606,7 +606,7 @@ dwarf_cfi_name (unsigned int cfi_opc) static inline dw_cfi_ref new_cfi (void) { - dw_cfi_ref cfi = ggc_alloc (sizeof (dw_cfi_node)); + dw_cfi_ref cfi = GGC_NEW (dw_cfi_node); cfi->dw_cfi_next = NULL; cfi->dw_cfi_oprnd1.dw_cfi_reg_num = 0; @@ -1251,7 +1251,7 @@ queue_reg_save (const char *label, rtx reg, rtx sreg, HOST_WIDE_INT offset) if (q == NULL) { - q = ggc_alloc (sizeof (*q)); + q = GGC_NEW (struct queued_reg_save); q->next = queued_reg_saves; queued_reg_saves = q; } @@ -2643,8 +2643,7 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED, if (fde_table_in_use == fde_table_allocated) { fde_table_allocated += FDE_TABLE_INCREMENT; - fde_table = ggc_realloc (fde_table, - fde_table_allocated * sizeof (dw_fde_node)); + fde_table = GGC_RESIZEVEC (dw_fde_node, fde_table, fde_table_allocated); memset (fde_table + fde_table_in_use, 0, FDE_TABLE_INCREMENT * sizeof (dw_fde_node)); } @@ -2704,7 +2703,7 @@ void dwarf2out_frame_init (void) { /* Allocate the initial hunk of the fde_table. */ - fde_table = ggc_alloc_cleared (FDE_TABLE_INCREMENT * sizeof (dw_fde_node)); + fde_table = GGC_CNEWVEC (dw_fde_node, FDE_TABLE_INCREMENT); fde_table_allocated = FDE_TABLE_INCREMENT; fde_table_in_use = 0; @@ -3228,7 +3227,7 @@ static inline dw_loc_descr_ref new_loc_descr (enum dwarf_location_atom op, unsigned HOST_WIDE_INT oprnd1, unsigned HOST_WIDE_INT oprnd2) { - dw_loc_descr_ref descr = ggc_alloc_cleared (sizeof (dw_loc_descr_node)); + dw_loc_descr_ref descr = GGC_CNEW (dw_loc_descr_node); descr->dw_loc_opc = op; descr->dw_loc_oprnd1.val_class = dw_val_class_unsigned_const; @@ -4281,7 +4280,7 @@ static int type_is_enum (const_tree); static unsigned int dbx_reg_number (const_rtx); static void add_loc_descr_op_piece (dw_loc_descr_ref *, int); static dw_loc_descr_ref reg_loc_descriptor (rtx, enum var_init_status); -static dw_loc_descr_ref one_reg_loc_descriptor (unsigned int, +static dw_loc_descr_ref one_reg_loc_descriptor (unsigned int, enum var_init_status); static dw_loc_descr_ref multiple_reg_loc_descriptor (rtx, rtx, enum var_init_status); @@ -5747,7 +5746,7 @@ splice_child_die (dw_die_ref parent, dw_die_ref child) static inline dw_die_ref new_die (enum dwarf_tag tag_value, dw_die_ref parent_die, tree t) { - dw_die_ref die = ggc_alloc_cleared (sizeof (die_node)); + dw_die_ref die = GGC_CNEW (die_node); die->die_tag = tag_value; @@ -5757,7 +5756,7 @@ new_die (enum dwarf_tag tag_value, dw_die_ref parent_die, tree t) { limbo_die_node *limbo_node; - limbo_node = ggc_alloc_cleared (sizeof (limbo_die_node)); + limbo_node = GGC_CNEW (limbo_die_node); limbo_node->die = die; limbo_node->created_for = t; limbo_node->next = limbo_die_list; @@ -5804,7 +5803,7 @@ decl_die_table_eq (const void *x, const void *y) static inline dw_die_ref lookup_decl_die (tree decl) { - return htab_find_with_hash (decl_die_table, decl, DECL_UID (decl)); + return (dw_die_ref) htab_find_with_hash (decl_die_table, decl, DECL_UID (decl)); } /* Returns a hash value for X (which really is a var_loc_list). */ @@ -5829,7 +5828,8 @@ decl_loc_table_eq (const void *x, const void *y) static inline var_loc_list * lookup_decl_loc (const_tree decl) { - return htab_find_with_hash (decl_loc_table, decl, DECL_UID (decl)); + return (var_loc_list *) + htab_find_with_hash (decl_loc_table, decl, DECL_UID (decl)); } /* Equate a DIE to a particular declaration. */ @@ -5857,12 +5857,12 @@ add_var_loc_to_decl (tree decl, struct var_loc_node *loc) slot = htab_find_slot_with_hash (decl_loc_table, decl, decl_id, INSERT); if (*slot == NULL) { - temp = ggc_alloc_cleared (sizeof (var_loc_list)); + temp = GGC_CNEW (var_loc_list); temp->decl_id = decl_id; *slot = temp; } else - temp = *slot; + temp = (var_loc_list *) *slot; if (temp->last) { @@ -6354,7 +6354,7 @@ compute_section_prefix (dw_die_ref unit_die) { const char *die_name = get_AT_string (unit_die, DW_AT_name); const char *base = die_name ? lbasename (die_name) : "anonymous"; - char *name = alloca (strlen (base) + 64); + char *name = XALLOCAVEC (char, strlen (base) + 64); char *p; int i, mark; unsigned char checksum[16]; @@ -6476,7 +6476,7 @@ assign_symbol_names (dw_die_ref die) { if (comdat_symbol_id) { - char *p = alloca (strlen (comdat_symbol_id) + 64); + char *p = XALLOCAVEC (char, strlen (comdat_symbol_id) + 64); sprintf (p, "%s.%s.%x", DIE_LABEL_PREFIX, comdat_symbol_id, comdat_symbol_number++); @@ -6500,7 +6500,8 @@ struct cu_hash_table_entry static hashval_t htab_cu_hash (const void *of) { - const struct cu_hash_table_entry *entry = of; + const struct cu_hash_table_entry *const entry = + (const struct cu_hash_table_entry *) of; return htab_hash_string (entry->cu->die_symbol); } @@ -6508,8 +6509,9 @@ htab_cu_hash (const void *of) static int htab_cu_eq (const void *of1, const void *of2) { - const struct cu_hash_table_entry *entry1 = of1; - const struct die_struct *entry2 = of2; + const struct cu_hash_table_entry *const entry1 = + (const struct cu_hash_table_entry *) of1; + const struct die_struct *const entry2 = (const struct die_struct *) of2; return !strcmp (entry1->cu->die_symbol, entry2->die_symbol); } @@ -6517,7 +6519,8 @@ htab_cu_eq (const void *of1, const void *of2) static void htab_cu_del (void *what) { - struct cu_hash_table_entry *next, *entry = what; + struct cu_hash_table_entry *next, + *entry = (struct cu_hash_table_entry *) what; while (entry) { @@ -6737,8 +6740,8 @@ build_abbrev_table (dw_die_ref die) if (abbrev_die_table_in_use >= abbrev_die_table_allocated) { n_alloc = abbrev_die_table_allocated + ABBREV_DIE_TABLE_INCREMENT; - abbrev_die_table = ggc_realloc (abbrev_die_table, - sizeof (dw_die_ref) * n_alloc); + abbrev_die_table = GGC_RESIZEVEC (dw_die_ref, abbrev_die_table, + n_alloc); memset (&abbrev_die_table[abbrev_die_table_allocated], 0, (n_alloc - abbrev_die_table_allocated) * sizeof (dw_die_ref)); @@ -7128,7 +7131,7 @@ static inline dw_loc_list_ref new_loc_list (dw_loc_descr_ref expr, const char *begin, const char *end, const char *section, unsigned int gensym) { - dw_loc_list_ref retlist = ggc_alloc_cleared (sizeof (dw_loc_list_node)); + dw_loc_list_ref retlist = GGC_CNEW (dw_loc_list_node); retlist->begin = begin; retlist->end = end; @@ -7458,7 +7461,7 @@ output_comp_unit (dw_die_ref die, int output_if_empty) oldsym = die->die_symbol; if (oldsym) { - tmp = alloca (strlen (oldsym) + 24); + tmp = XALLOCAVEC (char, strlen (oldsym) + 24); sprintf (tmp, ".gnu.linkonce.wi.%s", oldsym); secname = tmp; @@ -7602,9 +7605,8 @@ add_arange (tree decl, dw_die_ref die) if (arange_table_in_use == arange_table_allocated) { arange_table_allocated += ARANGE_TABLE_INCREMENT; - arange_table = ggc_realloc (arange_table, - (arange_table_allocated - * sizeof (dw_die_ref))); + arange_table = GGC_RESIZEVEC (dw_die_ref, arange_table, + arange_table_allocated); memset (arange_table + arange_table_in_use, 0, ARANGE_TABLE_INCREMENT * sizeof (dw_die_ref)); } @@ -7715,9 +7717,8 @@ add_ranges_num (int num) if (in_use == ranges_table_allocated) { ranges_table_allocated += RANGES_TABLE_INCREMENT; - ranges_table - = ggc_realloc (ranges_table, (ranges_table_allocated - * sizeof (struct dw_ranges_struct))); + ranges_table = GGC_RESIZEVEC (struct dw_ranges_struct, ranges_table, + ranges_table_allocated); memset (ranges_table + ranges_table_in_use, 0, RANGES_TABLE_INCREMENT * sizeof (struct dw_ranges_struct)); } @@ -7748,10 +7749,9 @@ add_ranges_by_labels (const char *begin, const char *end) if (in_use == ranges_by_label_allocated) { ranges_by_label_allocated += RANGES_TABLE_INCREMENT; - ranges_by_label - = ggc_realloc (ranges_by_label, - (ranges_by_label_allocated - * sizeof (struct dw_ranges_by_label_struct))); + ranges_by_label = GGC_RESIZEVEC (struct dw_ranges_by_label_struct, + ranges_by_label, + ranges_by_label_allocated); memset (ranges_by_label + ranges_by_label_in_use, 0, RANGES_TABLE_INCREMENT * sizeof (struct dw_ranges_by_label_struct)); @@ -7876,8 +7876,8 @@ struct dir_info static int file_info_cmp (const void *p1, const void *p2) { - const struct file_info *s1 = p1; - const struct file_info *s2 = p2; + const struct file_info *const s1 = (const struct file_info *) p1; + const struct file_info *const s2 = (const struct file_info *) p2; const unsigned char *cp1; const unsigned char *cp2; @@ -7920,8 +7920,8 @@ struct file_name_acquire_data static int file_name_acquire (void ** slot, void *data) { - struct file_name_acquire_data *fnad = data; - struct dwarf_file_data *d = *slot; + struct file_name_acquire_data *fnad = (struct file_name_acquire_data *) data; + struct dwarf_file_data *d = (struct dwarf_file_data *) *slot; struct file_info *fi; const char *f; @@ -7991,8 +7991,8 @@ output_file_names (void) numfiles = last_emitted_file->emitted_number; /* Allocate the various arrays we need. */ - files = alloca (numfiles * sizeof (struct file_info)); - dirs = alloca (numfiles * sizeof (struct dir_info)); + files = XALLOCAVEC (struct file_info, numfiles); + dirs = XALLOCAVEC (struct dir_info, numfiles); fnad.files = files; fnad.used_files = 0; @@ -8050,8 +8050,8 @@ output_file_names (void) where we would have to check out every combination of every single possible prefix. Instead we use a heuristic which provides nearly optimal results in most cases and never is much off. */ - saved = alloca (ndirs * sizeof (int)); - savehere = alloca (ndirs * sizeof (int)); + saved = XALLOCAVEC (int, ndirs); + savehere = XALLOCAVEC (int, ndirs); memset (saved, '\0', ndirs * sizeof (saved[0])); for (i = 0; i < ndirs; i++) @@ -8117,7 +8117,7 @@ output_file_names (void) /* We have to emit them in the order of emitted_number since that's used in the debug info generation. To do this efficiently we generate a back-mapping of the indices first. */ - backmap = alloca (numfiles * sizeof (int)); + backmap = XALLOCAVEC (int, numfiles); for (i = 0; i < numfiles; i++) backmap[files[i].file_idx->emitted_number - 1] = i; @@ -8910,7 +8910,7 @@ one_reg_loc_descriptor (unsigned int regno, enum var_init_status initialized) designates a value that spans more than one register. */ static dw_loc_descr_ref -multiple_reg_loc_descriptor (rtx rtl, rtx regs, +multiple_reg_loc_descriptor (rtx rtl, rtx regs, enum var_init_status initialized) { int nregs, size, i; @@ -9298,7 +9298,7 @@ mem_loc_descriptor (rtx rtl, enum machine_mode mode, break; case CONCATN: - mem_loc_result = concatn_mem_loc_descriptor (rtl, mode, + mem_loc_result = concatn_mem_loc_descriptor (rtl, mode, VAR_INIT_STATUS_INITIALIZED); break; @@ -9529,7 +9529,7 @@ loc_descriptor_from_tree_1 (tree loc, int want_address) first_op = DW_OP_addr; second_op = DW_OP_form_tls_address; } - + rtl = rtl_for_decl_location (loc); if (rtl == NULL_RTX) return 0; @@ -9543,7 +9543,7 @@ loc_descriptor_from_tree_1 (tree loc, int want_address) ret = new_loc_descr (first_op, 0, 0); ret->dw_loc_oprnd1.val_class = dw_val_class_addr; ret->dw_loc_oprnd1.v.val_addr = rtl; - + ret1 = new_loc_descr (second_op, 0, 0); add_loc_descr (&ret, ret1); @@ -10293,7 +10293,7 @@ add_const_value_attribute (dw_die_ref die, rtx rtl) if (SCALAR_FLOAT_MODE_P (mode)) { unsigned int length = GET_MODE_SIZE (mode); - unsigned char *array = ggc_alloc (length); + unsigned char *array = GGC_NEWVEC (unsigned char, length); insert_float (rtl, array); add_AT_vec (die, DW_AT_const_value, length / 4, 4, array); @@ -10314,7 +10314,7 @@ add_const_value_attribute (dw_die_ref die, rtx rtl) enum machine_mode mode = GET_MODE (rtl); unsigned int elt_size = GET_MODE_UNIT_SIZE (mode); unsigned int length = CONST_VECTOR_NUNITS (rtl); - unsigned char *array = ggc_alloc (length * elt_size); + unsigned char *array = GGC_NEWVEC (unsigned char, length * elt_size); unsigned int i; unsigned char *p; @@ -10887,7 +10887,7 @@ add_location_or_const_value_attribute (dw_die_ref die, tree decl, enum var_init_status initialized = NOTE_VAR_LOCATION_STATUS (node->var_loc_note); varloc = NOTE_VAR_LOCATION (node->var_loc_note); - add_loc_descr_to_loc_list (&list, + add_loc_descr_to_loc_list (&list, loc_descriptor (varloc, initialized), node->label, node->next->label, secname); } @@ -10909,7 +10909,7 @@ add_location_or_const_value_attribute (dw_die_ref die, tree decl, current_function_funcdef_no); endname = ggc_strdup (label_id); } - add_loc_descr_to_loc_list (&list, + add_loc_descr_to_loc_list (&list, loc_descriptor (varloc, initialized), node->label, endname, secname); } @@ -12359,7 +12359,7 @@ premark_used_types_helper (void **slot, void *data ATTRIBUTE_UNUSED) tree type; dw_die_ref die; - type = *slot; + type = (tree) *slot; die = lookup_type_die (type); if (die != NULL) die->die_perennial_p = 1; @@ -14154,13 +14154,13 @@ static void dwarf2out_global_decl (tree decl) { /* Output DWARF2 information for file-scope tentative data object - declarations, file-scope (extern) function declarations (which had no - corresponding body) and file-scope tagged type declarations and - definitions which have not yet been forced out. + declarations, file-scope (extern) function declarations (which + had no corresponding body) and file-scope tagged type declarations + and definitions which have not yet been forced out. - Ignore the global decl of any Fortran COMMON blocks which also wind up here - though they have already been described in the local scope for the - procedures using them. */ + Ignore the global decl of any Fortran COMMON blocks which also + wind up here though they have already been described in the local + scope for the procedures using them. */ if (TREE_CODE (decl) == VAR_DECL && TREE_PUBLIC (decl) && TREE_STATIC (decl) && is_fortran ()) return; @@ -14423,15 +14423,16 @@ dwarf2out_ignore_block (const_tree block) static int file_table_eq (const void *p1_p, const void *p2_p) { - const struct dwarf_file_data * p1 = p1_p; - const char * p2 = p2_p; + const struct dwarf_file_data *const p1 = + (const struct dwarf_file_data *) p1_p; + const char *const p2 = (const char *) p2_p; return strcmp (p1->filename, p2) == 0; } static hashval_t file_table_hash (const void *p_p) { - const struct dwarf_file_data * p = p_p; + const struct dwarf_file_data *const p = (const struct dwarf_file_data *) p_p; return htab_hash_string (p->filename); } @@ -14463,9 +14464,9 @@ lookup_filename (const char *file_name) slot = htab_find_slot_with_hash (file_table, file_name, htab_hash_string (file_name), INSERT); if (*slot) - return *slot; + return (struct dwarf_file_data *) *slot; - created = ggc_alloc (sizeof (struct dwarf_file_data)); + created = GGC_NEW (struct dwarf_file_data); created->filename = file_name; created->emitted_number = 0; *slot = created; @@ -14519,7 +14520,7 @@ dwarf2out_var_location (rtx loc_note) return; prev_insn = PREV_INSN (loc_note); - newloc = ggc_alloc_cleared (sizeof (struct var_loc_node)); + newloc = GGC_CNEW (struct var_loc_node); /* If the insn we processed last time is the previous insn and it is also a var location note, use the label we emitted last time. */ @@ -14607,9 +14608,9 @@ dwarf2out_source_line (unsigned int line, const char *filename) { separate_line_info_table_allocated += LINE_INFO_TABLE_INCREMENT; separate_line_info_table - = ggc_realloc (separate_line_info_table, - separate_line_info_table_allocated - * sizeof (dw_separate_line_info_entry)); + = GGC_RESIZEVEC (dw_separate_line_info_entry, + separate_line_info_table, + separate_line_info_table_allocated); memset (separate_line_info_table + separate_line_info_table_in_use, 0, @@ -14636,9 +14637,8 @@ dwarf2out_source_line (unsigned int line, const char *filename) { line_info_table_allocated += LINE_INFO_TABLE_INCREMENT; line_info_table - = ggc_realloc (line_info_table, - (line_info_table_allocated - * sizeof (dw_line_info_entry))); + = GGC_RESIZEVEC (dw_line_info_entry, line_info_table, + line_info_table_allocated); memset (line_info_table + line_info_table_in_use, 0, LINE_INFO_TABLE_INCREMENT * sizeof (dw_line_info_entry)); } @@ -14749,15 +14749,13 @@ dwarf2out_init (const char *filename ATTRIBUTE_UNUSED) decl_scope_table = VEC_alloc (tree, gc, 256); /* Allocate the initial hunk of the abbrev_die_table. */ - abbrev_die_table = ggc_alloc_cleared (ABBREV_DIE_TABLE_INCREMENT - * sizeof (dw_die_ref)); + abbrev_die_table = GGC_CNEWVEC (dw_die_ref, ABBREV_DIE_TABLE_INCREMENT); abbrev_die_table_allocated = ABBREV_DIE_TABLE_INCREMENT; /* Zero-th entry is allocated, but unused. */ abbrev_die_table_in_use = 1; /* Allocate the initial hunk of the line_info_table. */ - line_info_table = ggc_alloc_cleared (LINE_INFO_TABLE_INCREMENT - * sizeof (dw_line_info_entry)); + line_info_table = GGC_CNEWVEC (dw_line_info_entry, LINE_INFO_TABLE_INCREMENT); line_info_table_allocated = LINE_INFO_TABLE_INCREMENT; /* Zero-th entry is allocated, but unused. */ @@ -15121,8 +15119,8 @@ prune_unused_types (void) static int file_table_relative_p (void ** slot, void *param) { - bool *p = param; - struct dwarf_file_data *d = *slot; + bool *p = (bool *) param; + struct dwarf_file_data *d = (struct dwarf_file_data *) *slot; if (!IS_ABSOLUTE_PATH (d->filename)) { *p = true; diff --git a/gcc/ebitmap.c b/gcc/ebitmap.c index 8a7c7cb7542..d25a163ff14 100644 --- a/gcc/ebitmap.c +++ b/gcc/ebitmap.c @@ -118,7 +118,7 @@ ebitmap_array_grow (ebitmap map, unsigned int newsize) newsize += newsize / 4; map->n_elts = newsize; - map->elts = xrealloc (map->elts, sizeof (EBITMAP_ELT_TYPE) * newsize); + map->elts = XRESIZEVEC (EBITMAP_ELT_TYPE, map->elts, newsize); } /* Grow the internal word array for MAP so it is at least SIZE @@ -161,7 +161,7 @@ ebitmap_array_init (ebitmap map, unsigned int size) { if (size > 0) { - map->elts = xmalloc (sizeof (EBITMAP_ELT_TYPE) * size); + map->elts = XNEWVEC (EBITMAP_ELT_TYPE, size); map->n_elts = size; } else @@ -202,7 +202,7 @@ ebitmap_clear (ebitmap map) ebitmap ebitmap_alloc (unsigned int size) { - ebitmap ret = xmalloc (sizeof (struct ebitmap_def)); + ebitmap ret = XNEW (struct ebitmap_def); if (size == 0) size = EBITMAP_ELT_BITS; ebitmap_array_init (ret, (size + EBITMAP_ELT_BITS - 1) / EBITMAP_ELT_BITS); @@ -595,7 +595,7 @@ ebitmap_ior_into (ebitmap dst, ebitmap src) } } newarraysize = src->numwords + dst->numwords; - newarray = xmalloc (newarraysize * sizeof (EBITMAP_ELT_TYPE)); + newarray = XNEWVEC (EBITMAP_ELT_TYPE, newarraysize); EXECUTE_IF_SET_IN_SBITMAP (tempmask, 0, i, sbi) { @@ -704,7 +704,7 @@ ebitmap_ior (ebitmap dst, ebitmap src1, ebitmap src2) } } newarraysize = src1->numwords + src2->numwords; - newarray = xmalloc (newarraysize * sizeof (EBITMAP_ELT_TYPE)); + newarray = XNEWVEC (EBITMAP_ELT_TYPE, newarraysize); EXECUTE_IF_SET_IN_SBITMAP (tempmask, 0, i, sbi) { @@ -883,7 +883,7 @@ ebitmap_and_compl (ebitmap dst, ebitmap src1, ebitmap src2) sbitmap_copy (tempmask, src1->wordmask); newarraysize = src1->numwords; - newarray = xmalloc (newarraysize * sizeof (EBITMAP_ELT_TYPE)); + newarray = XNEWVEC (EBITMAP_ELT_TYPE, newarraysize); EXECUTE_IF_SET_IN_SBITMAP (src1->wordmask, 0, i, sbi) { diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index fa2b78a4d95..418da241b66 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -349,7 +349,7 @@ get_mem_attrs (alias_set_type alias, tree expr, rtx offset, rtx size, memcpy (*slot, &attrs, sizeof (mem_attrs)); } - return *slot; + return (mem_attrs *) *slot; } /* Returns a hash code for X (which is a really a reg_attrs *). */ @@ -398,7 +398,7 @@ get_reg_attrs (tree decl, int offset) memcpy (*slot, &attrs, sizeof (reg_attrs)); } - return *slot; + return (reg_attrs *) *slot; } @@ -812,7 +812,7 @@ gen_rtvec (int n, ...) if (n == 0) return NULL_RTVEC; /* Don't allocate an empty rtvec... */ - vector = alloca (n * sizeof (rtx)); + vector = XALLOCAVEC (rtx, n); for (i = 0; i < n; i++) vector[i] = va_arg (p, rtx); @@ -893,12 +893,11 @@ gen_reg_rtx (enum machine_mode mode) char *new; rtx *new1; - new = xrealloc (crtl->emit.regno_pointer_align, old_size * 2); + new = XRESIZEVEC (char, crtl->emit.regno_pointer_align, old_size * 2); memset (new + old_size, 0, old_size); crtl->emit.regno_pointer_align = (unsigned char *) new; - new1 = ggc_realloc (regno_reg_rtx, - old_size * 2 * sizeof (rtx)); + new1 = GGC_RESIZEVEC (rtx, regno_reg_rtx, old_size * 2); memset (new1 + old_size, 0, old_size * sizeof (rtx)); regno_reg_rtx = new1; @@ -3102,7 +3101,7 @@ static int find_auto_inc (rtx *xp, void *data) { rtx x = *xp; - rtx reg = data; + rtx reg = (rtx) data; if (GET_RTX_CLASS (GET_CODE (x)) != RTX_AUTOINC) return 0; @@ -4741,7 +4740,7 @@ start_sequence (void) free_sequence_stack = tem->next; } else - tem = ggc_alloc (sizeof (struct sequence_stack)); + tem = GGC_NEW (struct sequence_stack); tem->next = seq_stack; tem->first = first_insn; @@ -5047,11 +5046,10 @@ init_emit (void) crtl->emit.regno_pointer_align_length = LAST_VIRTUAL_REGISTER + 101; crtl->emit.regno_pointer_align - = xcalloc (crtl->emit.regno_pointer_align_length - * sizeof (unsigned char), 1); + = XCNEWVEC (unsigned char, crtl->emit.regno_pointer_align_length); regno_reg_rtx - = ggc_alloc (crtl->emit.regno_pointer_align_length * sizeof (rtx)); + = GGC_NEWVEC (rtx, crtl->emit.regno_pointer_align_length); /* Put copies of all the hard registers into regno_reg_rtx. */ memcpy (regno_reg_rtx, diff --git a/gcc/et-forest.c b/gcc/et-forest.c index 02cbcc16402..e87322c6428 100644 --- a/gcc/et-forest.c +++ b/gcc/et-forest.c @@ -447,7 +447,7 @@ et_new_occ (struct et_node *node) if (!et_occurrences) et_occurrences = create_alloc_pool ("et_occ pool", sizeof (struct et_occ), 300); - nw = pool_alloc (et_occurrences); + nw = (struct et_occ *) pool_alloc (et_occurrences); nw->of = node; nw->parent = NULL; @@ -470,7 +470,7 @@ et_new_tree (void *data) if (!et_nodes) et_nodes = create_alloc_pool ("et_node pool", sizeof (struct et_node), 300); - nw = pool_alloc (et_nodes); + nw = (struct et_node *) pool_alloc (et_nodes); nw->data = data; nw->father = NULL; diff --git a/gcc/except.c b/gcc/except.c index e6a16507cdb..1d9a73639b6 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -409,7 +409,7 @@ init_eh (void) void init_eh_for_function (void) { - cfun->eh = ggc_alloc_cleared (sizeof (struct eh_status)); + cfun->eh = GGC_CNEW (struct eh_status); } /* Routines to generate the exception tree somewhat directly. @@ -426,7 +426,7 @@ gen_eh_region (enum eh_region_type type, struct eh_region *outer) #endif /* Insert a new blank region as a leaf in the tree. */ - new = ggc_alloc_cleared (sizeof (*new)); + new = GGC_CNEW (struct eh_region); new->type = type; new->outer = outer; if (outer) @@ -632,8 +632,8 @@ remove_unreachable_regions (rtx insns) struct eh_region *r; rtx insn; - uid_region_num = xcalloc (get_max_uid (), sizeof(int)); - reachable = xcalloc (cfun->eh->last_region_number + 1, sizeof(bool)); + uid_region_num = XCNEWVEC (int, get_max_uid ()); + reachable = XCNEWVEC (bool, cfun->eh->last_region_number + 1); for (i = cfun->eh->last_region_number; i > 0; --i) { @@ -736,7 +736,7 @@ add_ehl_entry (rtx label, struct eh_region *region) LABEL_PRESERVE_P (label) = 1; - entry = ggc_alloc (sizeof (*entry)); + entry = GGC_NEW (struct ehl_map_entry); entry->label = label; entry->region = region; @@ -847,7 +847,7 @@ duplicate_eh_regions_1 (eh_region old, eh_region outer, int eh_offset) { eh_region ret, n; - ret = n = ggc_alloc (sizeof (struct eh_region)); + ret = n = GGC_NEW (struct eh_region); *n = *old; n->outer = outer; @@ -2587,7 +2587,7 @@ foreach_reachable_handler (int region_number, bool is_resx, static void arh_to_landing_pad (struct eh_region *region, void *data) { - rtx *p_handlers = data; + rtx *p_handlers = (rtx *) data; if (! *p_handlers) *p_handlers = alloc_INSN_LIST (region->landing_pad, NULL_RTX); } @@ -2595,7 +2595,7 @@ arh_to_landing_pad (struct eh_region *region, void *data) static void arh_to_label (struct eh_region *region, void *data) { - rtx *p_handlers = data; + rtx *p_handlers = (rtx *) data; *p_handlers = alloc_INSN_LIST (region->label, *p_handlers); } @@ -3055,7 +3055,7 @@ add_action_record (htab_t ar_hash, int filter, int next) if ((new = *slot) == NULL) { - new = xmalloc (sizeof (*new)); + new = XNEW (struct action_record); new->offset = VARRAY_ACTIVE_SIZE (crtl->eh.action_record_data) + 1; new->filter = filter; new->next = next; @@ -3191,7 +3191,7 @@ add_call_site (rtx landing_pad, int action) { call_site_record record; - record = ggc_alloc (sizeof (struct call_site_record)); + record = GGC_NEW (struct call_site_record); record->landing_pad = landing_pad; record->action = action; @@ -3522,7 +3522,7 @@ switch_to_exception_section (const char * ARG_UNUSED (fnname)) #ifdef HAVE_LD_EH_GC_SECTIONS if (flag_function_sections) { - char *section_name = xmalloc (strlen (fnname) + 32); + char *section_name = XNEWVEC (char, strlen (fnname) + 32); sprintf (section_name, ".gcc_except_table.%s", fnname); s = get_section (section_name, flags, NULL); free (section_name); diff --git a/gcc/expmed.c b/gcc/expmed.c index 27ff0c063cf..bf045fee360 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -2381,8 +2381,8 @@ synth_mult (struct algorithm *alg_out, unsigned HOST_WIDE_INT t, /* We'll be needing a couple extra algorithm structures now. */ - alg_in = alloca (sizeof (struct algorithm)); - best_alg = alloca (sizeof (struct algorithm)); + alg_in = XALLOCA (struct algorithm); + best_alg = XALLOCA (struct algorithm); best_cost = *cost_limit; /* Compute the hash index. */ diff --git a/gcc/expr.c b/gcc/expr.c index 2357170dd16..6d6278a7bc7 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -1614,7 +1614,7 @@ gen_group_rtx (rtx orig) gcc_assert (GET_CODE (orig) == PARALLEL); length = XVECLEN (orig, 0); - tmps = alloca (sizeof (rtx) * length); + tmps = XALLOCAVEC (rtx, length); /* Skip a NULL entry in first slot. */ i = XEXP (XVECEXP (orig, 0, 0), 0) ? 0 : 1; @@ -1819,7 +1819,7 @@ emit_group_load (rtx dst, rtx src, tree type, int ssize) rtx *tmps; int i; - tmps = alloca (sizeof (rtx) * XVECLEN (dst, 0)); + tmps = XALLOCAVEC (rtx, XVECLEN (dst, 0)); emit_group_load_1 (tmps, dst, src, type, ssize); /* Copy the extracted pieces into the proper (probable) hard regs. */ @@ -1939,7 +1939,7 @@ emit_group_store (rtx orig_dst, rtx src, tree type ATTRIBUTE_UNUSED, int ssize) start = 1; finish = XVECLEN (src, 0); - tmps = alloca (sizeof (rtx) * finish); + tmps = XALLOCAVEC (rtx, finish); /* Copy the (probable) hard regs into pseudos. */ for (i = start; i < finish; i++) @@ -4555,7 +4555,7 @@ store_expr (tree exp, rtx target, int call_param_p, bool nontemporal) } str_copy_len = MIN (str_copy_len, exp_len); if (!can_store_by_pieces (str_copy_len, builtin_strncpy_read_str, - (void *) TREE_STRING_POINTER (exp), + CONST_CAST(char *, TREE_STRING_POINTER (exp)), MEM_ALIGN (target), false)) goto normal_expr; @@ -4563,7 +4563,7 @@ store_expr (tree exp, rtx target, int call_param_p, bool nontemporal) dest_mem = store_by_pieces (dest_mem, str_copy_len, builtin_strncpy_read_str, - (void *) TREE_STRING_POINTER (exp), + CONST_CAST(char *, TREE_STRING_POINTER (exp)), MEM_ALIGN (target), false, exp_len > str_copy_len ? 1 : 0); if (exp_len > str_copy_len) diff --git a/gcc/final.c b/gcc/final.c index 5d19e2d2aba..1f673fb7858 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -858,8 +858,7 @@ shorten_branches (rtx first ATTRIBUTE_UNUSED) n_labels = max_labelno - min_labelno + 1; n_old_labels = old - min_labelno + 1; - label_align = xrealloc (label_align, - n_labels * sizeof (struct label_alignment)); + label_align = XRESIZEVEC (struct label_alignment, label_align, n_labels); /* Range of labels grows monotonically in the function. Failing here means that the initialization of array got lost. */ @@ -2181,7 +2180,7 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED, if (asm_noperands (body) >= 0) { unsigned int noperands = asm_noperands (body); - rtx *ops = alloca (noperands * sizeof (rtx)); + rtx *ops = XALLOCAVEC (rtx, noperands); const char *string; location_t loc; expanded_location expanded; @@ -4056,8 +4055,7 @@ debug_queue_symbol (tree decl) if (symbol_queue_index >= symbol_queue_size) { symbol_queue_size += 10; - symbol_queue = xrealloc (symbol_queue, - symbol_queue_size * sizeof (tree)); + symbol_queue = XRESIZEVEC (tree, symbol_queue, symbol_queue_size); } symbol_queue[symbol_queue_index++] = decl; diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 420218fa57c..a54a0b14909 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,27 @@ +2008-06-29 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/36341 + * iresolve.c (gfc_resolve_matmul): Copy shapes + from arguments. + +2008-06-29 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + * invoke.texi: Add documentation for runtime behavior of + -fno-range-check. + +2008-06-28 Daniel Kraft <d@domob.eu> + + * gfc-internals.texi (section gfc_code): Extended documentation about + gfc_code in the internal datastructures chapter including details about + how IF, DO and SELECT blocks look like and an example for how the + block-chaining works. + +2008-06-25 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/36526 + * interface.c (check_intents): Correct error where the actual + arg was checked for a pointer argument, rather than the formal. + 2008-06-24 Paul Thomas <pault@gcc.gnu.org> PR fortran/34371 diff --git a/gcc/fortran/gfc-internals.texi b/gcc/fortran/gfc-internals.texi index 0a91310fe7d..dfe5d161842 100644 --- a/gcc/fortran/gfc-internals.texi +++ b/gcc/fortran/gfc-internals.texi @@ -284,9 +284,12 @@ should exhaust all possible valid combinations of content for these structures. @menu -* gfc_code:: Representation of Executable Statements +* gfc_code:: Representation of Executable Statements. @end menu +@c gfc_code +@c -------- + @node gfc_code @section @code{gfc_code} @cindex statement chaining @@ -309,13 +312,95 @@ current statement. If the current statement is one of @code{IF}, @code{DO}, @code{SELECT} it starts a block, i.e.@: a nested level in the program. In order to represent this, the @code{block} member is set to point to a -@code{gfc_code} structure whose @code{block} member points to the -block in question. The @code{SELECT} and @code{IF} statements may -contain various blocks (the chain of @code{ELSE IF} and @code{ELSE} -blocks or the various @code{CASE}s, respectively). - -@c What would be nice here would be an example program together with -@c an image that says more than the mythical thousand words. +@code{gfc_code} structure whose @code{next} member starts the chain of +statements inside the block; this structure's @code{op} member should be set to +the same value as the parent structure's @code{op} member. The @code{SELECT} +and @code{IF} statements may contain various blocks (the chain of @code{ELSE IF} +and @code{ELSE} blocks or the various @code{CASE}s, respectively). These chains +are linked-lists formed by the @code{block} members. + +Consider the following example code: + +@example +IF (foo < 20) THEN + PRINT *, "Too small" + foo = 20 +ELSEIF (foo > 50) THEN + PRINT *, "Too large" + foo = 50 +ELSE + PRINT *, "Good" +END IF +@end example + +This statement-block will be represented in the internal gfortran tree as +follows, were the horizontal link-chains are those induced by the @code{next} +members and vertical links down are those of @code{block}. @samp{==|} and +@samp{--|} mean @code{NULL} pointers to mark the end of a chain: + +@example +... ==> IF ==> ... + | + +--> IF foo < 20 ==> PRINT *, "Too small" ==> foo = 20 ==| + | + +--> IF foo > 50 ==> PRINT *, "Too large" ==> foo = 50 ==| + | + +--> ELSE ==> PRINT *, "Good" ==| + | + +--| +@end example + + +@subsection IF Blocks + +Conditionals are represented by @code{gfc_code} structures with their +@code{op} member set to @code{EXEC_IF}. This structure's @code{block} +member must point to another @code{gfc_code} node that is the header of the +if-block. This header's @code{op} member must be set to @code{EXEC_IF}, too, +its @code{expr} member holds the condition to check for, and its @code{next} +should point to the code-chain of the statements to execute if the condition is +true. + +If in addition an @code{ELSEIF} or @code{ELSE} block is present, the +@code{block} member of the if-block-header node points to yet another +@code{gfc_code} structure that is the header of the elseif- or else-block. Its +structure is identical to that of the if-block-header, except that in case of an +@code{ELSE} block without a new condition the @code{expr} member should be +@code{NULL}. This block can itself have its @code{block} member point to the +next @code{ELSEIF} or @code{ELSE} block if there's a chain of them. + + +@subsection Loops + +@code{DO} loops are stored in the tree as @code{gfc_code} nodes with their +@code{op} set to @code{EXEC_DO} for a @code{DO} loop with iterator variable and +to @code{EXEC_DO_WHILE} for infinite @code{DO}s and @code{DO WHILE} blocks. +Their @code{block} member should point to a @code{gfc_code} structure heading +the code-chain of the loop body; its @code{op} member should be set to +@code{EXEC_DO} or @code{EXEC_DO_WHILE}, too, respectively. + +For @code{DO WHILE} loops, the loop condition is stored on the top +@code{gfc_code} structure's @code{expr} member; @code{DO} forever loops are +simply @code{DO WHILE} loops with a constant @code{.TRUE.} loop condition in +the internal representation. + +Similarly, @code{DO} loops with an iterator have instead of the condition their +@code{ext.iterator} member set to the correct values for the loop iterator +variable and its range. + + +@subsection @code{SELECT} Statements + +A @code{SELECT} block is introduced by a @code{gfc_code} structure with an +@code{op} member of @code{EXEC_SELECT} and @code{expr} containing the expression +to evaluate and test. Its @code{block} member starts a list of @code{gfc_code} +structures linked together by their @code{block} members that stores the various +@code{CASE} parts. + +Each @code{CASE} node has its @code{op} member set to @code{EXEC_SELECT}, too, +its @code{next} member points to the code-chain to be executed in the current +case-block, and @code{extx.case_list} contains the case-values this block +corresponds to. The @code{block} member links to the next case in the list. @c --------------------------------------------------------------------- diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi index 0879f52d7df..445b4a7d1a9 100644 --- a/gcc/fortran/invoke.texi +++ b/gcc/fortran/invoke.texi @@ -156,8 +156,9 @@ and warnings}. @item Runtime Options @xref{Runtime Options,,Options for influencing runtime behavior}. -@gccoptlist{-fconvert=@var{conversion} -frecord-marker=@var{length} @gol --fmax-subrecord-length=@var{length} -fsign-zero} +@gccoptlist{-fconvert=@var{conversion} -fno-range-check +-frecord-marker=@var{length} @gol -fmax-subrecord-length=@var{length} +-fsign-zero} @item Code Generation Options @xref{Code Gen Options,,Options for code generation conventions}. @@ -938,6 +939,16 @@ representation for unformatted files. The @code{CONVERT} specifier and the GFORTRAN_CONVERT_UNIT environment variable override the default specified by @option{-fconvert}.} + +@item -fno-range-check +@opindex @code{-fno-range-check} +Disable range checking of input values during integer @code{READ} operations. +For example, GNU Fortran will give an error if an input value is +outside of the relevant range of [@code{-HUGE()}:@code{HUGE()}]. In other words, +with @code{INTEGER (kind=4) :: i} , attempting to read @math{-2147483648} will +give an error unless @option{-fno-range-check} is given. + + @item -frecord-marker=@var{length} @opindex @code{frecord-marker=}@var{length} Specify the length of record markers for unformatted files. diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c index acbf5becff0..a1e7622a866 100644 --- a/gcc/fortran/iresolve.c +++ b/gcc/fortran/iresolve.c @@ -1341,6 +1341,34 @@ gfc_resolve_matmul (gfc_expr *f, gfc_expr *a, gfc_expr *b) f->rank = (a->rank == 2 && b->rank == 2) ? 2 : 1; + if (a->rank == 2 && b->rank == 2) + { + if (a->shape && b->shape) + { + f->shape = gfc_get_shape (f->rank); + mpz_init_set (f->shape[0], a->shape[0]); + mpz_init_set (f->shape[1], b->shape[1]); + } + } + else if (a->rank == 1) + { + if (b->shape) + { + f->shape = gfc_get_shape (f->rank); + mpz_init_set (f->shape[0], b->shape[1]); + } + } + else + { + /* b->rank == 1 and a->rank == 2 here, all other cases have + been caught in check.c. */ + if (a->shape) + { + f->shape = gfc_get_shape (f->rank); + mpz_init_set (f->shape[0], a->shape[0]); + } + } + f->value.function.name = gfc_get_string (PREFIX ("matmul_%c%d"), gfc_type_letter (f->ts.type), f->ts.kind); diff --git a/gcc/function.c b/gcc/function.c index 928107e35c2..680b3604859 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -598,7 +598,7 @@ assign_stack_temp_for_type (enum machine_mode mode, HOST_WIDE_INT size, if (best_p->size - rounded_size >= alignment) { - p = ggc_alloc (sizeof (struct temp_slot)); + p = GGC_NEW (struct temp_slot); p->in_use = p->addr_taken = 0; p->size = best_p->size - rounded_size; p->base_offset = best_p->base_offset + rounded_size; @@ -623,7 +623,7 @@ assign_stack_temp_for_type (enum machine_mode mode, HOST_WIDE_INT size, { HOST_WIDE_INT frame_offset_old = frame_offset; - p = ggc_alloc (sizeof (struct temp_slot)); + p = GGC_NEW (struct temp_slot); /* We are passing an explicit alignment request to assign_stack_local. One side effect of that is assign_stack_local will not round SIZE @@ -3841,9 +3841,7 @@ allocate_struct_function (tree fndecl, bool abstract_p) tree result; tree fntype = fndecl ? TREE_TYPE (fndecl) : NULL_TREE; - cfun = ggc_alloc_cleared (sizeof (struct function)); - - current_function_funcdef_no = get_next_funcdef_no (); + cfun = GGC_CNEW (struct function); cfun->function_frequency = FUNCTION_FREQUENCY_NORMAL; @@ -3860,6 +3858,7 @@ allocate_struct_function (tree fndecl, bool abstract_p) { DECL_STRUCT_FUNCTION (fndecl) = cfun; cfun->decl = fndecl; + current_function_funcdef_no = get_next_funcdef_no (); result = DECL_RESULT (fndecl); if (!abstract_p && aggregate_value_p (result, fndecl)) @@ -5251,7 +5250,7 @@ match_asm_constraints_1 (rtx insn, rtx *p_sets, int noutputs) rtx op = SET_SRC (p_sets[0]); int ninputs = ASM_OPERANDS_INPUT_LENGTH (op); rtvec inputs = ASM_OPERANDS_INPUT_VEC (op); - bool *output_matched = alloca (noutputs * sizeof (bool)); + bool *output_matched = XALLOCAVEC (bool, noutputs); memset (output_matched, 0, noutputs * sizeof (bool)); for (i = 0; i < ninputs; i++) diff --git a/gcc/gcc.c b/gcc/gcc.c index 7c23b98e12f..3da40a8c2a7 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -1242,7 +1242,7 @@ translate_options (int *argcp, const char *const **argvp) } newvsize += spaces * sizeof (const char *); - newv = xrealloc (newv, newvsize); + newv = XRESIZEVAR (const char *, newv, newvsize); sp = target_option_translations[tott_idx].replacements; np = xstrdup (sp); @@ -3409,15 +3409,14 @@ process_command (int argc, const char **argv) for (baselen = strlen (progname); baselen > 0; baselen--) if (IS_DIR_SEPARATOR (progname[baselen-1])) break; - new_argv0 = (char *) xmemdup (progname, baselen, + new_argv0 = XDUPVAR (char, progname, baselen, baselen + concat_length (new_version, new_machine, "-gcc-", NULL) + 1); strcpy (new_argv0 + baselen, new_machine); strcat (new_argv0, "-gcc-"); strcat (new_argv0, new_version); - new_argv = (char **) xmemdup (argv, (argc + 1) * sizeof (argv[0]), - (argc + 1) * sizeof (argv[0])); + new_argv = XDUPVEC (char *, argv, argc + 1); new_argv[0] = new_argv0; execvp (new_argv0, new_argv); @@ -3956,7 +3955,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" for (j = 0; j < ARRAY_SIZE (modify_target); j++) if (! strcmp (argv[i], modify_target[j].sw)) { - char *new_name = xmalloc (strlen (modify_target[j].str) + char *new_name = XNEWVEC (char, strlen (modify_target[j].str) + strlen (spec_machine)); const char *p, *r; char *q; diff --git a/gcc/gcov-io.c b/gcc/gcov-io.c index 665b98681c2..98a9287debd 100644 --- a/gcc/gcov-io.c +++ b/gcc/gcov-io.c @@ -196,7 +196,7 @@ gcov_allocate (unsigned length) new_size *= 2; gcov_var.alloc = new_size; - gcov_var.buffer = xrealloc (gcov_var.buffer, new_size << 2); + gcov_var.buffer = XRESIZEVAR (gcov_unsigned_t, gcov_var.buffer, new_size << 2); } #endif diff --git a/gcc/gcse.c b/gcc/gcse.c index f7e42fb0641..771df43a321 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -638,6 +638,20 @@ static void local_cprop_find_used_regs (rtx *, void *); static bool do_local_cprop (rtx, rtx, bool); static void local_cprop_pass (bool); static bool is_too_expensive (const char *); + +#define GNEW(T) ((T *) gmalloc (sizeof (T))) +#define GCNEW(T) ((T *) gcalloc (1, sizeof (T))) + +#define GNEWVEC(T, N) ((T *) gmalloc (sizeof (T) * (N))) +#define GCNEWVEC(T, N) ((T *) gcalloc ((N), sizeof (T))) +#define GRESIZEVEC(T, P, N) ((T *) grealloc ((void *) (P), sizeof (T) * (N))) + +#define GNEWVAR(T, S) ((T *) gmalloc ((S))) +#define GCNEWVAR(T, S) ((T *) gcalloc (1, (S))) +#define GRESIZEVAR(T, P, S) ((T *) grealloc ((P), (S))) + +#define GOBNEW(T) ((T *) gcse_alloc (sizeof (T))) +#define GOBNEWVAR(T, S) ((T *) gcse_alloc ((S))) /* Entry point for global common subexpression elimination. @@ -698,7 +712,7 @@ gcse_main (rtx f ATTRIBUTE_UNUSED) pass = 0; initial_bytes_used = bytes_used; max_pass_bytes = 0; - gcse_obstack_bottom = gcse_alloc (1); + gcse_obstack_bottom = GOBNEWVAR (char, 1); changed = 1; while (changed && pass < MAX_GCSE_PASSES) { @@ -736,8 +750,8 @@ gcse_main (rtx f ATTRIBUTE_UNUSED) if (changed) { free_modify_mem_tables (); - modify_mem_list = gcalloc (last_basic_block, sizeof (rtx)); - canon_modify_mem_list = gcalloc (last_basic_block, sizeof (rtx)); + modify_mem_list = GCNEWVEC (rtx, last_basic_block); + canon_modify_mem_list = GCNEWVEC (rtx, last_basic_block); } free_reg_set_mem (); alloc_reg_set_mem (max_reg_num ()); @@ -931,7 +945,7 @@ alloc_gcse_mem (void) but we should never see those anyway, so this is OK.) */ max_uid = get_max_uid (); - uid_cuid = gcalloc (max_uid + 1, sizeof (int)); + uid_cuid = GCNEWVEC (int, max_uid + 1); i = 0; FOR_EACH_BB (bb) FOR_BB_INSNS (bb, insn) @@ -951,8 +965,8 @@ alloc_gcse_mem (void) reg_set_in_block = sbitmap_vector_alloc (last_basic_block, max_gcse_regno); /* Allocate array to keep a list of insns which modify memory in each basic block. */ - modify_mem_list = gcalloc (last_basic_block, sizeof (rtx)); - canon_modify_mem_list = gcalloc (last_basic_block, sizeof (rtx)); + modify_mem_list = GCNEWVEC (rtx, last_basic_block); + canon_modify_mem_list = GCNEWVEC (rtx, last_basic_block); modify_mem_list_set = BITMAP_ALLOC (NULL); blocks_with_calls = BITMAP_ALLOC (NULL); } @@ -1076,7 +1090,7 @@ static void alloc_reg_set_mem (int n_regs) { reg_set_table_size = n_regs + REG_SET_TABLE_SLOP; - reg_set_table = gcalloc (reg_set_table_size, sizeof (struct reg_set *)); + reg_set_table = GCNEWVEC (struct reg_set *, reg_set_table_size); gcc_obstack_init (®_set_obstack); } @@ -1101,14 +1115,13 @@ record_one_set (int regno, rtx insn) { int new_size = regno + REG_SET_TABLE_SLOP; - reg_set_table = grealloc (reg_set_table, - new_size * sizeof (struct reg_set *)); + reg_set_table = GRESIZEVEC (struct reg_set *, reg_set_table, new_size); memset (reg_set_table + reg_set_table_size, 0, (new_size - reg_set_table_size) * sizeof (struct reg_set *)); reg_set_table_size = new_size; } - new_reg_info = obstack_alloc (®_set_obstack, sizeof (struct reg_set)); + new_reg_info = XOBNEW (®_set_obstack, struct reg_set); bytes_used += sizeof (struct reg_set); new_reg_info->bb_index = BLOCK_NUM (insn); new_reg_info->next = reg_set_table[regno]; @@ -1509,7 +1522,7 @@ insert_expr_in_table (rtx x, enum machine_mode mode, rtx insn, int antic_p, if (! found) { - cur_expr = gcse_alloc (sizeof (struct expr)); + cur_expr = GOBNEW (struct expr); bytes_used += sizeof (struct expr); if (table->table[hash] == NULL) /* This is the first pattern that hashed to this index. */ @@ -1542,7 +1555,7 @@ insert_expr_in_table (rtx x, enum machine_mode mode, rtx insn, int antic_p, else { /* First occurrence of this expression in this basic block. */ - antic_occr = gcse_alloc (sizeof (struct occr)); + antic_occr = GOBNEW (struct occr); bytes_used += sizeof (struct occr); antic_occr->insn = insn; antic_occr->next = cur_expr->antic_occr; @@ -1566,7 +1579,7 @@ insert_expr_in_table (rtx x, enum machine_mode mode, rtx insn, int antic_p, else { /* First occurrence of this expression in this basic block. */ - avail_occr = gcse_alloc (sizeof (struct occr)); + avail_occr = GOBNEW (struct occr); bytes_used += sizeof (struct occr); avail_occr->insn = insn; avail_occr->next = cur_expr->avail_occr; @@ -1606,7 +1619,7 @@ insert_set_in_table (rtx x, rtx insn, struct hash_table *table) if (! found) { - cur_expr = gcse_alloc (sizeof (struct expr)); + cur_expr = GOBNEW (struct expr); bytes_used += sizeof (struct expr); if (table->table[hash] == NULL) /* This is the first pattern that hashed to this index. */ @@ -1639,7 +1652,7 @@ insert_set_in_table (rtx x, rtx insn, struct hash_table *table) else { /* First occurrence of this expression in this basic block. */ - cur_occr = gcse_alloc (sizeof (struct occr)); + cur_occr = GOBNEW (struct occr); bytes_used += sizeof (struct occr); cur_occr->insn = insn; @@ -1878,8 +1891,8 @@ dump_hash_table (FILE *file, const char *name, struct hash_table *table) unsigned int *hash_val; struct expr *expr; - flat_table = xcalloc (table->n_elems, sizeof (struct expr *)); - hash_val = xmalloc (table->n_elems * sizeof (unsigned int)); + flat_table = XCNEWVEC (struct expr *, table->n_elems); + hash_val = XNEWVEC (unsigned int, table->n_elems); for (i = 0; i < (int) table->size; i++) for (expr = table->table[i]; expr != NULL; expr = expr->next_same_hash) @@ -2048,7 +2061,7 @@ compute_hash_table_work (struct hash_table *table) /* re-Cache any INSN_LIST nodes we have allocated. */ clear_modify_mem_tables (); /* Some working arrays used to track first and last set in each block. */ - reg_avail_info = gmalloc (max_gcse_regno * sizeof (struct reg_avail_info)); + reg_avail_info = GNEWVEC (struct reg_avail_info, max_gcse_regno); for (i = 0; i < max_gcse_regno; ++i) reg_avail_info[i].last_bb = NULL; @@ -2116,7 +2129,7 @@ alloc_hash_table (int n_insns, struct hash_table *table, int set_p) ??? Later take some measurements. */ table->size |= 1; n = table->size * sizeof (struct expr *); - table->table = gmalloc (n); + table->table = GNEWVAR (struct expr *, n); table->set_p = set_p; } @@ -4988,14 +5001,15 @@ static hashval_t pre_ldst_expr_hash (const void *p) { int do_not_record_p = 0; - const struct ls_expr *x = p; + const struct ls_expr *const x = (const struct ls_expr *) p; return hash_rtx (x->pattern, GET_MODE (x->pattern), &do_not_record_p, NULL, false); } static int pre_ldst_expr_eq (const void *p1, const void *p2) { - const struct ls_expr *ptr1 = p1, *ptr2 = p2; + const struct ls_expr *const ptr1 = (const struct ls_expr *) p1, + *const ptr2 = (const struct ls_expr *) p2; return expr_equiv_p (ptr1->pattern, ptr2->pattern); } @@ -5117,7 +5131,7 @@ find_rtx_in_ldst (rtx x) slot = htab_find_slot (pre_ldst_table, &e, NO_INSERT); if (!slot || ((struct ls_expr *)*slot)->invalid) return NULL; - return *slot; + return (struct ls_expr *) *slot; } /* Assign each element of the list of mems a monotonically increasing value. */ @@ -5425,7 +5439,7 @@ static void reg_set_info (rtx dest, const_rtx setter ATTRIBUTE_UNUSED, void *data) { - sbitmap bb_reg = data; + sbitmap bb_reg = (sbitmap) data; if (GET_CODE (dest) == SUBREG) dest = SUBREG_REG (dest); @@ -5445,7 +5459,7 @@ static void reg_clear_last_set (rtx dest, const_rtx setter ATTRIBUTE_UNUSED, void *data) { - int *dead_vec = data; + int *dead_vec = (int *) data; if (GET_CODE (dest) == SUBREG) dest = SUBREG_REG (dest); diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c index 47b6ec13c9f..079c81f9552 100644 --- a/gcc/genattrtab.c +++ b/gcc/genattrtab.c @@ -286,7 +286,8 @@ static rtx one_fn (rtx); static rtx max_fn (rtx); static rtx min_fn (rtx); -#define oballoc(size) obstack_alloc (hash_obstack, size) +#define oballoc(T) XOBNEW (hash_obstack, T) +#define oballocvec(T, N) XOBNEWVEC (hash_obstack, T, (N)) /* Hash table for sharing RTL and strings. */ @@ -326,7 +327,7 @@ attr_hash_add_rtx (int hashcode, rtx rtl) { struct attr_hash *h; - h = obstack_alloc (hash_obstack, sizeof (struct attr_hash)); + h = XOBNEW (hash_obstack, struct attr_hash); h->hashcode = hashcode; h->u.rtl = rtl; h->next = attr_hash_table[hashcode % RTL_HASH_SIZE]; @@ -340,7 +341,7 @@ attr_hash_add_string (int hashcode, char *str) { struct attr_hash *h; - h = obstack_alloc (hash_obstack, sizeof (struct attr_hash)); + h = XOBNEW (hash_obstack, struct attr_hash); h->hashcode = -hashcode; h->u.str = str; h->next = attr_hash_table[hashcode % RTL_HASH_SIZE]; @@ -601,7 +602,7 @@ attr_string (const char *str, int len) return h->u.str; /* <-- return if found. */ /* Not found; create a permanent copy and add it to the hash table. */ - new_str = obstack_alloc (hash_obstack, len + 1); + new_str = XOBNEWVAR (hash_obstack, char, len + 1); memcpy (new_str, str, len); new_str[len] = '\0'; attr_hash_add_string (hashcode, new_str); @@ -1297,7 +1298,7 @@ get_attr_value (rtx value, struct attr_desc *attr, int insn_code) || insn_alternatives[av->first_insn->def->insn_code])) return av; - av = oballoc (sizeof (struct attr_value)); + av = oballoc (struct attr_value); av->value = value; av->next = attr->first_value; attr->first_value = av; @@ -1440,7 +1441,7 @@ fill_attr (struct attr_desc *attr) else av = get_attr_value (value, attr, id->insn_code); - ie = oballoc (sizeof (struct insn_ent)); + ie = oballoc (struct insn_ent); ie->def = id; insert_insn_ent (av, ie); } @@ -1571,7 +1572,7 @@ make_length_attrs (void) no_address_fn[i], address_fn[i]), new_attr, ie->def->insn_code); - new_ie = oballoc (sizeof (struct insn_ent)); + new_ie = oballoc (struct insn_ent); new_ie->def = ie->def; insert_insn_ent (new_av, new_ie); } @@ -2949,7 +2950,7 @@ gen_attr (rtx exp, int lineno) name_ptr = XSTR (exp, 1); while ((p = next_comma_elt (&name_ptr)) != NULL) { - av = oballoc (sizeof (struct attr_value)); + av = oballoc (struct attr_value); av->value = attr_rtx (CONST_STRING, p); av->next = attr->first_value; attr->first_value = av; @@ -3062,7 +3063,7 @@ gen_insn (rtx exp, int lineno) { struct insn_def *id; - id = oballoc (sizeof (struct insn_def)); + id = oballoc (struct insn_def); id->next = defs; defs = id; id->def = exp; @@ -3126,7 +3127,7 @@ gen_delay (rtx def, int lineno) have_annul_false = 1; } - delay = oballoc (sizeof (struct delay_desc)); + delay = oballoc (struct delay_desc); delay->def = def; delay->num = ++num_delays; delay->next = delays; @@ -4158,7 +4159,7 @@ find_attr (const char **name_p, int create) if (! create) return NULL; - attr = oballoc (sizeof (struct attr_desc)); + attr = oballoc (struct attr_desc); attr->name = DEF_ATTR_STRING (name); attr->first_value = attr->default_val = NULL; attr->is_numeric = attr->is_const = attr->is_special = 0; @@ -4297,7 +4298,7 @@ static size_t n_insn_reservs; static void gen_insn_reserv (rtx def) { - struct insn_reserv *decl = oballoc (sizeof (struct insn_reserv)); + struct insn_reserv *decl = oballoc (struct insn_reserv); decl->name = DEF_ATTR_STRING (XSTR (def, 0)); decl->default_latency = XINT (def, 1); @@ -4338,7 +4339,7 @@ gen_bypass_1 (const char *s, size_t len) if (s == b->insn) return; /* already got that one */ - b = oballoc (sizeof (struct bypass_list)); + b = oballoc (struct bypass_list); b->insn = s; b->next = all_bypasses; all_bypasses = b; @@ -4544,13 +4545,13 @@ from the machine description file `md'. */\n\n"); printf ("#define operands recog_data.operand\n\n"); /* Make `insn_alternatives'. */ - insn_alternatives = oballoc (insn_code_number * sizeof (int)); + insn_alternatives = oballocvec (int, insn_code_number); for (id = defs; id; id = id->next) if (id->insn_code >= 0) insn_alternatives[id->insn_code] = (1 << id->num_alternatives) - 1; /* Make `insn_n_alternatives'. */ - insn_n_alternatives = oballoc (insn_code_number * sizeof (int)); + insn_n_alternatives = oballocvec (int, insn_code_number); for (id = defs; id; id = id->next) if (id->insn_code >= 0) insn_n_alternatives[id->insn_code] = id->num_alternatives; diff --git a/gcc/genautomata.c b/gcc/genautomata.c index 59c1af06544..3709c557fb3 100644 --- a/gcc/genautomata.c +++ b/gcc/genautomata.c @@ -1085,6 +1085,14 @@ regexp_mode_check_failed (enum regexp_mode mode, #endif /* #if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007) */ +#define XCREATENODE(T) ((T *) create_node (sizeof (T))) +#define XCREATENODEVEC(T, N) ((T *) create_node (sizeof (T) * (N))) +#define XCREATENODEVAR(T, S) ((T *) create_node ((S))) + +#define XCOPYNODE(T, P) ((T *) copy_node ((P), sizeof (T))) +#define XCOPYNODEVEC(T, P, N) ((T *) copy_node ((P), sizeof (T) * (N))) +#define XCOPYNODEVAR(T, P, S) ((T *) copy_node ((P), (S))) + /* Create IR structure (node). */ static void * create_node (size_t size) @@ -1242,7 +1250,7 @@ gen_cpu_unit (rtx def) fatal ("invalid string `%s' in define_cpu_unit", XSTR (def, 0)); for (i = 0; i < vect_length; i++) { - decl = create_node (sizeof (struct decl)); + decl = XCREATENODE (struct decl); decl->mode = dm_unit; decl->pos = 0; DECL_UNIT (decl)->name = check_name (str_cpu_units [i], decl->pos); @@ -1272,7 +1280,7 @@ gen_query_cpu_unit (rtx def) fatal ("invalid string `%s' in define_query_cpu_unit", XSTR (def, 0)); for (i = 0; i < vect_length; i++) { - decl = create_node (sizeof (struct decl)); + decl = XCREATENODE (struct decl); decl->mode = dm_unit; decl->pos = 0; DECL_UNIT (decl)->name = check_name (str_cpu_units [i], decl->pos); @@ -1306,7 +1314,7 @@ gen_bypass (rtx def) for (i = 0; i < out_length; i++) for (j = 0; j < in_length; j++) { - decl = create_node (sizeof (struct decl)); + decl = XCREATENODE (struct decl); decl->mode = dm_bypass; decl->pos = 0; DECL_BYPASS (decl)->latency = XINT (def, 0); @@ -1341,7 +1349,7 @@ gen_excl_set (rtx def) if (second_str_cpu_units == NULL) fatal ("invalid second string `%s' in exclusion_set", XSTR (def, 1)); length += first_vect_length; - decl = create_node (sizeof (struct decl) + (length - 1) * sizeof (char *)); + decl = XCREATENODEVAR (struct decl, sizeof (struct decl) + (length - 1) * sizeof (char *)); decl->mode = dm_excl; decl->pos = 0; DECL_EXCL (decl)->all_names_num = length; @@ -1394,14 +1402,14 @@ gen_presence_absence_set (rtx def, int presence_p, int final_p) : (final_p ? "invalid second string `%s' in final_absence_set" : "invalid second string `%s' in absence_set")), XSTR (def, 1)); - str_patterns = obstack_alloc (&irp, patterns_length * sizeof (char **)); + str_patterns = XOBNEWVEC (&irp, char **, patterns_length); for (i = 0; i < patterns_length; i++) { str_patterns [i] = get_str_vect (str_pattern_lists [i], &length, ' ', FALSE); gcc_assert (str_patterns [i]); } - decl = create_node (sizeof (struct decl)); + decl = XCREATENODE (struct decl); decl->pos = 0; if (presence_p) { @@ -1486,7 +1494,7 @@ gen_automaton (rtx def) fatal ("invalid string `%s' in define_automaton", XSTR (def, 0)); for (i = 0; i < vect_length; i++) { - decl = create_node (sizeof (struct decl)); + decl = XCREATENODE (struct decl); decl->mode = dm_automaton; decl->pos = 0; DECL_AUTOMATON (decl)->name = check_name (str_automata [i], decl->pos); @@ -1539,19 +1547,19 @@ gen_regexp_el (const char *str) len = strlen (str); if (str [len - 1] != ')') fatal ("garbage after ) in reservation `%s'", reserv_str); - dstr = alloca (len - 1); + dstr = XALLOCAVAR (char, len - 1); memcpy (dstr, str + 1, len - 2); dstr [len-2] = '\0'; regexp = gen_regexp_sequence (dstr); } else if (strcmp (str, NOTHING_NAME) == 0) { - regexp = create_node (sizeof *regexp); + regexp = XCREATENODE (struct regexp); regexp->mode = rm_nothing; } else { - regexp = create_node (sizeof *regexp); + regexp = XCREATENODE (struct regexp); regexp->mode = rm_unit; REGEXP_UNIT (regexp)->name = str; } @@ -1576,7 +1584,7 @@ gen_regexp_repeat (const char *str) regexp = gen_regexp_el (repeat_vect [0]); for (i = 1; i < els_num; i++) { - repeat = create_node (sizeof (struct regexp)); + repeat = XCREATENODE (struct regexp); repeat->mode = rm_repeat; REGEXP_REPEAT (repeat)->regexp = regexp; REGEXP_REPEAT (repeat)->repeat_num = atoi (repeat_vect [i]); @@ -1605,8 +1613,8 @@ gen_regexp_allof (const char *str) fatal ("invalid `%s' in reservation `%s'", str, reserv_str); if (els_num > 1) { - allof = create_node (sizeof (struct regexp) - + sizeof (regexp_t) * (els_num - 1)); + allof = XCREATENODEVAR (struct regexp, sizeof (struct regexp) + + sizeof (regexp_t) * (els_num - 1)); allof->mode = rm_allof; REGEXP_ALLOF (allof)->regexps_num = els_num; for (i = 0; i < els_num; i++) @@ -1631,8 +1639,8 @@ gen_regexp_oneof (const char *str) fatal ("invalid `%s' in reservation `%s'", str, reserv_str); if (els_num > 1) { - oneof = create_node (sizeof (struct regexp) - + sizeof (regexp_t) * (els_num - 1)); + oneof = XCREATENODEVAR (struct regexp, sizeof (struct regexp) + + sizeof (regexp_t) * (els_num - 1)); oneof->mode = rm_oneof; REGEXP_ONEOF (oneof)->regexps_num = els_num; for (i = 0; i < els_num; i++) @@ -1655,8 +1663,8 @@ gen_regexp_sequence (const char *str) sequence_vect = get_str_vect (str, &els_num, ',', TRUE); if (els_num > 1) { - sequence = create_node (sizeof (struct regexp) - + sizeof (regexp_t) * (els_num - 1)); + sequence = XCREATENODEVAR (struct regexp, sizeof (struct regexp) + + sizeof (regexp_t) * (els_num - 1)); sequence->mode = rm_sequence; REGEXP_SEQUENCE (sequence)->regexps_num = els_num; for (i = 0; i < els_num; i++) @@ -1686,7 +1694,7 @@ gen_reserv (rtx def) { decl_t decl; - decl = create_node (sizeof (struct decl)); + decl = XCREATENODE (struct decl); decl->mode = dm_reserv; decl->pos = 0; DECL_RESERV (decl)->name = check_name (XSTR (def, 0), decl->pos); @@ -1704,7 +1712,7 @@ gen_insn_reserv (rtx def) { decl_t decl; - decl = create_node (sizeof (struct decl)); + decl = XCREATENODE (struct decl); decl->mode = dm_insn_reserv; decl->pos = 0; DECL_INSN_RESERV (decl)->name @@ -2052,7 +2060,7 @@ process_excls (char **names, int num, pos_t excl_pos ATTRIBUTE_UNUSED) error ("`%s' in exclusion is not unit", names [i]); else { - new_el = create_node (sizeof (struct unit_set_el)); + new_el = XCREATENODE (struct unit_set_el); new_el->unit_decl = DECL_UNIT (decl_in_table); new_el->next_unit_set_el = NULL; if (last_el == NULL) @@ -2105,7 +2113,7 @@ add_excls (unit_set_el_t dest_list, unit_set_el_t source_list, if (curr_el == NULL) { /* Element not found - insert. */ - copy = copy_node (src, sizeof (*src)); + copy = XCOPYNODE (struct unit_set_el, src); copy->next_unit_set_el = NULL; if (prev_el == NULL) dst->unit_decl->excl_list = copy; @@ -2152,7 +2160,7 @@ process_presence_absence_names (char **names, int num, : "`%s' in absence set is not unit")), names [i]); else { - new_el = create_node (sizeof (struct unit_set_el)); + new_el = XCREATENODE (struct unit_set_el); new_el->unit_decl = DECL_UNIT (decl_in_table); new_el->next_unit_set_el = NULL; if (last_el == NULL) @@ -2187,8 +2195,9 @@ process_presence_absence_patterns (char ***patterns, int num, { for (j = 0; patterns [i] [j] != NULL; j++) ; - new_el = create_node (sizeof (struct pattern_set_el) - + sizeof (struct unit_decl *) * j); + new_el = XCREATENODEVAR (struct pattern_set_el, + sizeof (struct pattern_set_el) + + sizeof (struct unit_decl *) * j); new_el->unit_decls = (struct unit_decl **) ((char *) new_el + sizeof (struct pattern_set_el)); @@ -2334,7 +2343,7 @@ add_presence_absence (unit_set_el_t dest_list, prev_el != NULL && prev_el->next_pattern_set_el != NULL; prev_el = prev_el->next_pattern_set_el) ; - copy = copy_node (pat, sizeof (*pat)); + copy = XCOPYNODE (struct pattern_set_el, pat); copy->next_pattern_set_el = NULL; if (prev_el == NULL) { @@ -2664,7 +2673,7 @@ process_regexp (regexp_t regexp) case dm_reserv: DECL_RESERV (decl_in_table)->reserv_is_used = 1; - new_regexp = create_node (sizeof (struct regexp)); + new_regexp = XCREATENODE (struct regexp); new_regexp->mode = rm_reserv; new_regexp->pos = regexp->pos; REGEXP_RESERV (new_regexp)->name = REGEXP_UNIT (regexp)->name; @@ -3105,7 +3114,7 @@ static decl_t advance_cycle_insn_decl; static void add_advance_cycle_insn_decl (void) { - advance_cycle_insn_decl = create_node (sizeof (struct decl)); + advance_cycle_insn_decl = XCREATENODE (struct decl); advance_cycle_insn_decl->mode = dm_insn_reserv; advance_cycle_insn_decl->pos = no_pos; DECL_INSN_RESERV (advance_cycle_insn_decl)->regexp = NULL; @@ -3148,7 +3157,7 @@ get_free_alt_state (void) #ifndef NDEBUG allocated_alt_states_num++; #endif - result = create_node (sizeof (struct alt_state)); + result = XCREATENODE (struct alt_state); } result->state = NULL; result->next_alt_state = NULL; @@ -3623,7 +3632,7 @@ get_free_state (int with_reservs, automaton_t automaton) #ifndef NDEBUG allocated_states_num++; #endif - result = create_node (sizeof (struct state)); + result = XCREATENODE (struct state); result->automaton = automaton; result->first_out_arc = NULL; result->unique_num = curr_unique_state_num; @@ -3890,7 +3899,7 @@ add_arc (state_t from_state, state_t to_state, ainsn_t ainsn) #ifndef NDEBUG allocated_arcs_num++; #endif - new_arc = create_node (sizeof (struct arc)); + new_arc = XCREATENODE (struct arc); new_arc->to_state = NULL; new_arc->insn = NULL; new_arc->next_out_arc = NULL; @@ -3964,7 +3973,7 @@ get_free_automata_list_el (void) = first_free_automata_list_el->next_automata_list_el; } else - result = create_node (sizeof (struct automata_list_el)); + result = XCREATENODE (struct automata_list_el); result->automaton = NULL; result->next_automata_list_el = NULL; return result; @@ -4191,7 +4200,7 @@ form_reserv_sets_list (pattern_set_el_t pattern_list) prev = first = NULL; for (el = pattern_list; el != NULL; el = el->next_pattern_set_el) { - curr = create_node (sizeof (struct pattern_reserv)); + curr = XCREATENODE (struct pattern_reserv); curr->reserv = alloc_empty_reserv_sets (); curr->next_pattern_reserv = NULL; for (i = 0; i < el->units_num; i++) @@ -4362,44 +4371,44 @@ copy_insn_regexp (regexp_t regexp) break; case rm_unit: - result = copy_node (regexp, sizeof (struct regexp)); + result = XCOPYNODE (struct regexp, regexp); break; case rm_repeat: - result = copy_node (regexp, sizeof (struct regexp)); + result = XCOPYNODE (struct regexp, regexp); REGEXP_REPEAT (result)->regexp = copy_insn_regexp (REGEXP_REPEAT (regexp)->regexp); break; case rm_sequence: - result = copy_node (regexp, - sizeof (struct regexp) + sizeof (regexp_t) - * (REGEXP_SEQUENCE (regexp)->regexps_num - 1)); + result = XCOPYNODEVAR (struct regexp, regexp, + sizeof (struct regexp) + sizeof (regexp_t) + * (REGEXP_SEQUENCE (regexp)->regexps_num - 1)); for (i = 0; i <REGEXP_SEQUENCE (regexp)->regexps_num; i++) REGEXP_SEQUENCE (result)->regexps [i] = copy_insn_regexp (REGEXP_SEQUENCE (regexp)->regexps [i]); break; case rm_allof: - result = copy_node (regexp, - sizeof (struct regexp) + sizeof (regexp_t) - * (REGEXP_ALLOF (regexp)->regexps_num - 1)); + result = XCOPYNODEVAR (struct regexp, regexp, + sizeof (struct regexp) + sizeof (regexp_t) + * (REGEXP_ALLOF (regexp)->regexps_num - 1)); for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++) REGEXP_ALLOF (result)->regexps [i] = copy_insn_regexp (REGEXP_ALLOF (regexp)->regexps [i]); break; case rm_oneof: - result = copy_node (regexp, - sizeof (struct regexp) + sizeof (regexp_t) - * (REGEXP_ONEOF (regexp)->regexps_num - 1)); + result = XCOPYNODEVAR (struct regexp, regexp, + sizeof (struct regexp) + sizeof (regexp_t) + * (REGEXP_ONEOF (regexp)->regexps_num - 1)); for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++) REGEXP_ONEOF (result)->regexps [i] = copy_insn_regexp (REGEXP_ONEOF (regexp)->regexps [i]); break; case rm_nothing: - result = copy_node (regexp, sizeof (struct regexp)); + result = XCOPYNODE (struct regexp, regexp); break; default: @@ -4428,8 +4437,8 @@ transform_1 (regexp_t regexp) gcc_assert (repeat_num > 1); operand = REGEXP_REPEAT (regexp)->regexp; pos = regexp->mode; - regexp = create_node (sizeof (struct regexp) + sizeof (regexp_t) - * (repeat_num - 1)); + regexp = XCREATENODEVAR (struct regexp, sizeof (struct regexp) + + sizeof (regexp_t) * (repeat_num - 1)); regexp->mode = rm_sequence; regexp->pos = pos; REGEXP_SEQUENCE (regexp)->regexps_num = repeat_num; @@ -4465,11 +4474,11 @@ transform_2 (regexp_t regexp) { gcc_assert (REGEXP_SEQUENCE (sequence)->regexps_num > 1 && REGEXP_SEQUENCE (regexp)->regexps_num > 1); - result = create_node (sizeof (struct regexp) - + sizeof (regexp_t) - * (REGEXP_SEQUENCE (regexp)->regexps_num - + REGEXP_SEQUENCE (sequence)->regexps_num - - 2)); + result = XCREATENODEVAR (struct regexp, sizeof (struct regexp) + + sizeof (regexp_t) + * (REGEXP_SEQUENCE (regexp)->regexps_num + + REGEXP_SEQUENCE (sequence)->regexps_num + - 2)); result->mode = rm_sequence; result->pos = regexp->pos; REGEXP_SEQUENCE (result)->regexps_num @@ -4509,10 +4518,10 @@ transform_2 (regexp_t regexp) { gcc_assert (REGEXP_ALLOF (allof)->regexps_num > 1 && REGEXP_ALLOF (regexp)->regexps_num > 1); - result = create_node (sizeof (struct regexp) - + sizeof (regexp_t) - * (REGEXP_ALLOF (regexp)->regexps_num - + REGEXP_ALLOF (allof)->regexps_num - 2)); + result = XCREATENODEVAR (struct regexp, sizeof (struct regexp) + + sizeof (regexp_t) + * (REGEXP_ALLOF (regexp)->regexps_num + + REGEXP_ALLOF (allof)->regexps_num - 2)); result->mode = rm_allof; result->pos = regexp->pos; REGEXP_ALLOF (result)->regexps_num @@ -4552,10 +4561,10 @@ transform_2 (regexp_t regexp) { gcc_assert (REGEXP_ONEOF (oneof)->regexps_num > 1 && REGEXP_ONEOF (regexp)->regexps_num > 1); - result = create_node (sizeof (struct regexp) - + sizeof (regexp_t) - * (REGEXP_ONEOF (regexp)->regexps_num - + REGEXP_ONEOF (oneof)->regexps_num - 2)); + result = XCREATENODEVAR (struct regexp, sizeof (struct regexp) + + sizeof (regexp_t) + * (REGEXP_ONEOF (regexp)->regexps_num + + REGEXP_ONEOF (oneof)->regexps_num - 2)); result->mode = rm_oneof; result->pos = regexp->pos; REGEXP_ONEOF (result)->regexps_num @@ -4607,9 +4616,9 @@ transform_3 (regexp_t regexp) { gcc_assert (REGEXP_ONEOF (oneof)->regexps_num > 1 && REGEXP_SEQUENCE (regexp)->regexps_num > 1); - result = create_node (sizeof (struct regexp) - + sizeof (regexp_t) - * (REGEXP_ONEOF (oneof)->regexps_num - 1)); + result = XCREATENODEVAR (struct regexp, sizeof (struct regexp) + + sizeof (regexp_t) + * (REGEXP_ONEOF (oneof)->regexps_num - 1)); result->mode = rm_oneof; result->pos = regexp->pos; REGEXP_ONEOF (result)->regexps_num @@ -4617,9 +4626,9 @@ transform_3 (regexp_t regexp) for (i = 0; i < REGEXP_ONEOF (result)->regexps_num; i++) { sequence - = create_node (sizeof (struct regexp) - + sizeof (regexp_t) - * (REGEXP_SEQUENCE (regexp)->regexps_num - 1)); + = XCREATENODEVAR (struct regexp, sizeof (struct regexp) + + sizeof (regexp_t) + * (REGEXP_SEQUENCE (regexp)->regexps_num - 1)); sequence->mode = rm_sequence; sequence->pos = regexp->pos; REGEXP_SEQUENCE (sequence)->regexps_num @@ -4659,9 +4668,9 @@ transform_3 (regexp_t regexp) { gcc_assert (REGEXP_ONEOF (oneof)->regexps_num > 1 && REGEXP_ALLOF (regexp)->regexps_num > 1); - result = create_node (sizeof (struct regexp) - + sizeof (regexp_t) - * (REGEXP_ONEOF (oneof)->regexps_num - 1)); + result = XCREATENODEVAR (struct regexp, sizeof (struct regexp) + + sizeof (regexp_t) + * (REGEXP_ONEOF (oneof)->regexps_num - 1)); result->mode = rm_oneof; result->pos = regexp->pos; REGEXP_ONEOF (result)->regexps_num @@ -4669,9 +4678,9 @@ transform_3 (regexp_t regexp) for (i = 0; i < REGEXP_ONEOF (result)->regexps_num; i++) { allof - = create_node (sizeof (struct regexp) - + sizeof (regexp_t) - * (REGEXP_ALLOF (regexp)->regexps_num - 1)); + = XCREATENODEVAR (struct regexp, sizeof (struct regexp) + + sizeof (regexp_t) + * (REGEXP_ALLOF (regexp)->regexps_num - 1)); allof->mode = rm_allof; allof->pos = regexp->pos; REGEXP_ALLOF (allof)->regexps_num @@ -4714,8 +4723,8 @@ transform_3 (regexp_t regexp) { gcc_assert (max_seq_length != 1 && REGEXP_ALLOF (regexp)->regexps_num > 1); - result = create_node (sizeof (struct regexp) - + sizeof (regexp_t) * (max_seq_length - 1)); + result = XCREATENODEVAR (struct regexp, sizeof (struct regexp) + + sizeof (regexp_t) * (max_seq_length - 1)); result->mode = rm_sequence; result->pos = regexp->pos; REGEXP_SEQUENCE (result)->regexps_num = max_seq_length; @@ -4752,9 +4761,9 @@ transform_3 (regexp_t regexp) REGEXP_SEQUENCE (result)->regexps [i] = allof_op; else { - allof = create_node (sizeof (struct regexp) - + sizeof (regexp_t) - * (allof_length - 1)); + allof = XCREATENODEVAR (struct regexp, sizeof (struct regexp) + + sizeof (regexp_t) + * (allof_length - 1)); allof->mode = rm_allof; allof->pos = regexp->pos; REGEXP_ALLOF (allof)->regexps_num = allof_length; @@ -5669,7 +5678,7 @@ cache_presence (state_t state) sz = (description->query_units_num + sizeof (int) * CHAR_BIT - 1) / (sizeof (int) * CHAR_BIT); - state->presence_signature = create_node (sz * sizeof (int)); + state->presence_signature = XCREATENODEVEC (unsigned int, sz); for (i = 0; i < description->units_num; i++) if (units_array [i]->query_p) { @@ -6397,7 +6406,7 @@ create_ainsns (void) decl = description->decls [i]; if (decl->mode == dm_insn_reserv) { - curr_ainsn = create_node (sizeof (struct ainsn)); + curr_ainsn = XCREATENODE (struct ainsn); curr_ainsn->insn_reserv_decl = DECL_INSN_RESERV (decl); curr_ainsn->important_p = FALSE; curr_ainsn->next_ainsn = NULL; @@ -6455,7 +6464,7 @@ create_automata (void) curr_automaton_num < automata_num; curr_automaton_num++, prev_automaton = curr_automaton) { - curr_automaton = create_node (sizeof (struct automaton)); + curr_automaton = XCREATENODE (struct automaton); curr_automaton->ainsn_list = create_ainsns (); curr_automaton->corresponding_automaton_decl = NULL; curr_automaton->next_automaton = NULL; @@ -6476,7 +6485,7 @@ create_automata (void) if (decl->mode == dm_automaton && DECL_AUTOMATON (decl)->automaton_is_used) { - curr_automaton = create_node (sizeof (struct automaton)); + curr_automaton = XCREATENODE (struct automaton); curr_automaton->ainsn_list = create_ainsns (); curr_automaton->corresponding_automaton_decl = DECL_AUTOMATON (decl); @@ -6493,7 +6502,7 @@ create_automata (void) } if (curr_automaton_num == 0) { - curr_automaton = create_node (sizeof (struct automaton)); + curr_automaton = XCREATENODE (struct automaton); curr_automaton->ainsn_list = create_ainsns (); curr_automaton->corresponding_automaton_decl = NULL; curr_automaton->next_automaton = NULL; @@ -6994,7 +7003,7 @@ create_state_ainsn_table (automaton_t automaton) int full_vect_length; int i; - tab = create_node (sizeof (struct state_ainsn_table)); + tab = XCREATENODE (struct state_ainsn_table); tab->automaton = automaton; tab->comb_vect = VEC_alloc (vect_el_t,heap, 10000); @@ -7908,8 +7917,8 @@ dfa_insn_code_enlarge (int uid)\n\ {\n\ int i = %s;\n\ %s = 2 * uid;\n\ - %s = xrealloc (%s,\n\ - %s * sizeof(int));\n\ + %s = XRESIZEVEC (int, %s,\n\ + %s);\n\ for (; i < %s; i++)\n\ %s[i] = -1;\n}\n\n", DFA_INSN_CODES_LENGTH_VARIABLE_NAME, @@ -7954,8 +7963,8 @@ output_trans_func (void) fprintf (output_file, "{\n int %s;\n", INTERNAL_INSN_CODE_NAME); output_internal_insn_code_evaluation (INSN_PARAMETER_NAME, INTERNAL_INSN_CODE_NAME, -1); - fprintf (output_file, " return %s (%s, %s);\n}\n\n", - INTERNAL_TRANSITION_FUNC_NAME, INTERNAL_INSN_CODE_NAME, STATE_NAME); + fprintf (output_file, " return %s (%s, (struct %s *) %s);\n}\n\n", + INTERNAL_TRANSITION_FUNC_NAME, INTERNAL_INSN_CODE_NAME, CHIP_NAME, STATE_NAME); } /* Output function `min_issue_delay'. */ @@ -7973,9 +7982,9 @@ output_min_issue_delay_func (void) INTERNAL_INSN_CODE_NAME, ADVANCE_CYCLE_VALUE_NAME); fprintf (output_file, " }\n else\n %s = %s;\n", INTERNAL_INSN_CODE_NAME, ADVANCE_CYCLE_VALUE_NAME); - fprintf (output_file, "\n return %s (%s, %s);\n", + fprintf (output_file, "\n return %s (%s, (struct %s *) %s);\n", INTERNAL_MIN_ISSUE_DELAY_FUNC_NAME, INTERNAL_INSN_CODE_NAME, - STATE_NAME); + CHIP_NAME, STATE_NAME); fprintf (output_file, "}\n\n"); } @@ -8008,8 +8017,8 @@ output_dead_lock_func (void) { fprintf (output_file, "int\n%s (%s %s)\n", DEAD_LOCK_FUNC_NAME, STATE_TYPE_NAME, STATE_NAME); - fprintf (output_file, "{\n return %s (%s);\n}\n\n", - INTERNAL_DEAD_LOCK_FUNC_NAME, STATE_NAME); + fprintf (output_file, "{\n return %s ((struct %s *) %s);\n}\n\n", + INTERNAL_DEAD_LOCK_FUNC_NAME, CHIP_NAME, STATE_NAME); } /* Output function `internal_reset'. */ @@ -8036,8 +8045,8 @@ output_reset_func (void) { fprintf (output_file, "void\n%s (%s %s)\n", RESET_FUNC_NAME, STATE_TYPE_NAME, STATE_NAME); - fprintf (output_file, "{\n %s (%s);\n}\n\n", INTERNAL_RESET_FUNC_NAME, - STATE_NAME); + fprintf (output_file, "{\n %s ((struct %s *) %s);\n}\n\n", INTERNAL_RESET_FUNC_NAME, + CHIP_NAME, STATE_NAME); } /* Output function `min_insn_conflict_delay'. */ @@ -8284,7 +8293,7 @@ output_get_cpu_unit_code_func (void) LOW_VARIABLE_NAME, MIDDLE_VARIABLE_NAME, HIGH_VARIABLE_NAME); fprintf (output_file, " static struct %s %s [] =\n {\n", NAME_CODE_STRUCT_NAME, NAME_CODE_TABLE_NAME); - units = xmalloc (sizeof (unit_decl_t) * description->units_num); + units = XNEWVEC (unit_decl_t, description->units_num); memcpy (units, units_array, sizeof (unit_decl_t) * description->units_num); qsort (units, description->units_num, sizeof (unit_decl_t), units_cmp); for (i = 0; i < description->units_num; i++) @@ -8416,7 +8425,7 @@ output_dfa_start_func (void) fprintf (output_file, "void\n%s (void)\n{\n %s = get_max_uid ();\n", DFA_START_FUNC_NAME, DFA_INSN_CODES_LENGTH_VARIABLE_NAME); - fprintf (output_file, " %s = xmalloc (%s * sizeof (int));\n", + fprintf (output_file, " %s = XNEWVEC (int, %s);\n", DFA_INSN_CODES_VARIABLE_NAME, DFA_INSN_CODES_LENGTH_VARIABLE_NAME); fprintf (output_file, " %s ();\n}\n\n", DFA_CLEAN_INSN_CACHE_FUNC_NAME); } @@ -9099,9 +9108,10 @@ expand_automata (void) { int i; - description = create_node (sizeof (struct description) - /* One entry for cycle advancing insn. */ - + sizeof (decl_t) * VEC_length (decl_t, decls)); + description = XCREATENODEVAR (struct description, + sizeof (struct description) + /* One entry for cycle advancing insn. */ + + sizeof (decl_t) * VEC_length (decl_t, decls)); description->decls_num = VEC_length (decl_t, decls); description->query_units_num = 0; for (i = 0; i < description->decls_num; i++) diff --git a/gcc/genextract.c b/gcc/genextract.c index 2631e2adfe3..cfc7037528a 100644 --- a/gcc/genextract.c +++ b/gcc/genextract.c @@ -152,7 +152,7 @@ gen_insn (rtx insn, int insn_code_number) /* Otherwise, make a new extraction method. We stash the arrays after the extraction structure in memory. */ - p = xmalloc (sizeof (struct extraction) + p = XNEWVAR (struct extraction, sizeof (struct extraction) + op_count*sizeof (char *) + dup_count*sizeof (char *) + dup_count*sizeof (int)); diff --git a/gcc/gengtype-lex.l b/gcc/gengtype-lex.l index 8cec71b30ff..822c84cbed4 100644 --- a/gcc/gengtype-lex.l +++ b/gcc/gengtype-lex.l @@ -116,7 +116,7 @@ EOID [^[:alnum:]_] "nested_ptr"/{EOID} { return NESTED_PTR; } [0-9]+ { return NUM; } "param"[0-9]*"_is"/{EOID} { - *yylval = xmemdup (yytext, yyleng, yyleng+1); + *yylval = XDUPVAR (const char, yytext, yyleng, yyleng+1); return PARAM_IS; } @@ -127,28 +127,28 @@ EOID [^[:alnum:]_] for (len = yyleng; ISSPACE (yytext[len-1]); len--) ; - *yylval = xmemdup (yytext, len, len+1); + *yylval = XDUPVAR (const char, yytext, len, len+1); update_lineno (yytext, yyleng); return SCALAR; } {ID}/{EOID} { - *yylval = xmemdup (yytext, yyleng, yyleng+1); + *yylval = XDUPVAR (const char, yytext, yyleng, yyleng+1); return ID; } \"([^"\\]|\\.)*\" { - *yylval = xmemdup (yytext+1, yyleng-2, yyleng-1); + *yylval = XDUPVAR (const char, yytext+1, yyleng-2, yyleng-1); return STRING; } /* This "terminal" avoids having to parse integer constant expressions. */ "["[^\[\]]*"]" { - *yylval = xmemdup (yytext+1, yyleng-2, yyleng-1); + *yylval = XDUPVAR (const char, yytext+1, yyleng-2, yyleng-1); return ARRAY; } "'"("\\".|[^\\])"'" { - *yylval = xmemdup (yytext+1, yyleng-2, yyleng); + *yylval = XDUPVAR (const char, yytext+1, yyleng-2, yyleng); return CHAR; } diff --git a/gcc/gengtype.c b/gcc/gengtype.c index 4237926a9d8..b73fdfa7495 100644 --- a/gcc/gengtype.c +++ b/gcc/gengtype.c @@ -439,7 +439,7 @@ read_input_list (const char *listname) : lang_dir_names[langno - 1]); bmap |= curlangs; - set_lang_bitmap ((char *)gt_files[i], bmap); + set_lang_bitmap (CONST_CAST(char *, gt_files[i]), bmap); here = committed; goto next_line; } @@ -1272,9 +1272,9 @@ adjust_field_type (type_p t, options_p opt) if (params[num] != NULL) error_at_line (&lexer_line, "duplicate `%s' option", opt->name); if (! ISDIGIT (opt->name[5])) - params[num] = create_pointer ((type_p) opt->info); + params[num] = create_pointer (CONST_CAST2(type_p, const char *, opt->info)); else - params[num] = (type_p) opt->info; + params[num] = CONST_CAST2 (type_p, const char *, opt->info); } else if (strcmp (opt->name, "special") == 0) { @@ -1323,7 +1323,8 @@ process_gc_options (options_p opt, enum gc_used_enum level, int *maybe_undef, options_p o; for (o = opt; o; o = o->next) if (strcmp (o->name, "ptr_alias") == 0 && level == GC_POINTED_TO) - set_gc_used_type ((type_p) o->info, GC_POINTED_TO, NULL); + set_gc_used_type (CONST_CAST2 (type_p, const char *, o->info), + GC_POINTED_TO, NULL); else if (strcmp (o->name, "maybe_undef") == 0) *maybe_undef = 1; else if (strcmp (o->name, "use_params") == 0) diff --git a/gcc/genoutput.c b/gcc/genoutput.c index be4fb00bc7c..3592388bd64 100644 --- a/gcc/genoutput.c +++ b/gcc/genoutput.c @@ -1173,7 +1173,7 @@ note_constraint (rtx exp, int lineno) return; } } - new = xmalloc (sizeof (struct constraint_data) + namelen); + new = XNEWVAR (struct constraint_data, sizeof (struct constraint_data) + namelen); strcpy ((char *)new + offsetof(struct constraint_data, name), name); new->namelen = namelen; new->lineno = lineno; diff --git a/gcc/genpreds.c b/gcc/genpreds.c index b292784247a..bf53944e297 100644 --- a/gcc/genpreds.c +++ b/gcc/genpreds.c @@ -732,7 +732,7 @@ mangle (const char *name) } obstack_1grow (rtl_obstack, '\0'); - return obstack_finish (rtl_obstack); + return XOBFINISH (rtl_obstack, const char *); } /* Add one constraint, of any sort, to the tables. NAME is its name; @@ -897,7 +897,7 @@ add_constraint (const char *name, const char *regclass, } - c = obstack_alloc (rtl_obstack, sizeof (struct constraint_data)); + c = XOBNEW (rtl_obstack, struct constraint_data); c->name = name; c->c_name = need_mangled_name ? mangle (name) : name; c->lineno = lineno; diff --git a/gcc/genrecog.c b/gcc/genrecog.c index 43afa7f449c..1713f133314 100644 --- a/gcc/genrecog.c +++ b/gcc/genrecog.c @@ -366,7 +366,7 @@ compute_predicate_codes (rtx exp, char codes[NUM_RTX_CODE]) static void process_define_predicate (rtx desc) { - struct pred_data *pred = xcalloc (sizeof (struct pred_data), 1); + struct pred_data *pred = XCNEW (struct pred_data); char codes[NUM_RTX_CODE]; int i; @@ -474,7 +474,7 @@ extern void debug_decision_list static struct decision * new_decision (const char *position, struct decision_head *last) { - struct decision *new = xcalloc (1, sizeof (struct decision)); + struct decision *new = XCNEW (struct decision); new->success = *last; new->position = xstrdup (position); @@ -890,7 +890,7 @@ add_to_sequence (rtx pattern, struct decision_head *last, const char *position, if (depth > max_depth) max_depth = depth; - subpos = xmalloc (depth + 2); + subpos = XNEWVAR (char, depth + 2); strcpy (subpos, position); subpos[depth + 1] = 0; diff --git a/gcc/gensupport.c b/gcc/gensupport.c index f455eb97260..912b81b79c6 100644 --- a/gcc/gensupport.c +++ b/gcc/gensupport.c @@ -1434,7 +1434,7 @@ record_insn_name (int code, const char *name) { int new_size; new_size = (insn_name_ptr_size ? insn_name_ptr_size * 2 : 512); - insn_name_ptr = xrealloc (insn_name_ptr, sizeof(char *) * new_size); + insn_name_ptr = XRESIZEVEC (char *, insn_name_ptr, new_size); memset (insn_name_ptr + insn_name_ptr_size, 0, sizeof(char *) * (new_size - insn_name_ptr_size)); insn_name_ptr_size = new_size; @@ -1442,7 +1442,7 @@ record_insn_name (int code, const char *name) if (!name || name[0] == '\0') { - new = xmalloc (strlen (last_real_name) + 10); + new = XNEWVAR (char, strlen (last_real_name) + 10); sprintf (new, "%s+%d", last_real_name, code - last_real_code); } else diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c index 17c1f50b608..a01fa3f0b01 100644 --- a/gcc/ggc-common.c +++ b/gcc/ggc-common.c @@ -116,7 +116,8 @@ ggc_mark_roots (void) if (*cti->base) { ggc_set_mark (*cti->base); - htab_traverse_noresize (*cti->base, ggc_htab_delete, (void *) cti); + htab_traverse_noresize (*cti->base, ggc_htab_delete, + CONST_CAST (void *, (const void *)cti)); ggc_set_mark ((*cti->base)->entries); } @@ -264,12 +265,12 @@ gt_pch_note_object (void *obj, void *note_ptr_cookie, return 0; } - *slot = xcalloc (sizeof (struct ptr_data), 1); + *slot = XCNEW (struct ptr_data); (*slot)->obj = obj; (*slot)->note_ptr_fn = note_ptr_fn; (*slot)->note_ptr_cookie = note_ptr_cookie; if (note_ptr_fn == gt_pch_p_S) - (*slot)->size = strlen (obj) + 1; + (*slot)->size = strlen ((const char *)obj) + 1; else (*slot)->size = ggc_get_size (obj); (*slot)->type = type; @@ -287,7 +288,8 @@ gt_pch_note_reorder (void *obj, void *note_ptr_cookie, if (obj == NULL || obj == (void *) 1) return; - data = htab_find_with_hash (saving_htab, obj, POINTER_HASH (obj)); + data = (struct ptr_data *) + htab_find_with_hash (saving_htab, obj, POINTER_HASH (obj)); gcc_assert (data && data->note_ptr_cookie == note_ptr_cookie); data->reorder_fn = reorder_fn; @@ -370,7 +372,8 @@ relocate_ptrs (void *ptr_p, void *state_p) if (*ptr == NULL || *ptr == (void *)1) return; - result = htab_find_with_hash (saving_htab, *ptr, POINTER_HASH (*ptr)); + result = (struct ptr_data *) + htab_find_with_hash (saving_htab, *ptr, POINTER_HASH (*ptr)); gcc_assert (result); *ptr = result->new_addr; } @@ -398,8 +401,8 @@ write_pch_globals (const struct ggc_root_tab * const *tab, } else { - new_ptr = htab_find_with_hash (saving_htab, ptr, - POINTER_HASH (ptr)); + new_ptr = (struct ptr_data *) + htab_find_with_hash (saving_htab, ptr, POINTER_HASH (ptr)); if (fwrite (&new_ptr->new_addr, sizeof (void *), 1, state->f) != 1) fatal_error ("can't write PCH file: %m"); @@ -502,7 +505,7 @@ gt_pch_save (FILE *f) if (this_object_size < state.ptrs[i]->size) { this_object_size = state.ptrs[i]->size; - this_object = xrealloc (this_object, this_object_size); + this_object = XRESIZEVAR (char, this_object, this_object_size); } memcpy (this_object, state.ptrs[i]->obj, state.ptrs[i]->size); if (state.ptrs[i]->reorder_fn != NULL) diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c index 416f9114122..4ac73d4af4f 100644 --- a/gcc/ggc-page.c +++ b/gcc/ggc-page.c @@ -503,7 +503,7 @@ push_depth (unsigned int i) if (G.depth_in_use >= G.depth_max) { G.depth_max *= 2; - G.depth = xrealloc (G.depth, G.depth_max * sizeof (unsigned int)); + G.depth = XRESIZEVEC (unsigned int, G.depth, G.depth_max); } G.depth[G.depth_in_use++] = i; } @@ -516,10 +516,9 @@ push_by_depth (page_entry *p, unsigned long *s) if (G.by_depth_in_use >= G.by_depth_max) { G.by_depth_max *= 2; - G.by_depth = xrealloc (G.by_depth, - G.by_depth_max * sizeof (page_entry *)); - G.save_in_use = xrealloc (G.save_in_use, - G.by_depth_max * sizeof (unsigned long *)); + G.by_depth = XRESIZEVEC (page_entry *, G.by_depth, G.by_depth_max); + G.save_in_use = XRESIZEVEC (unsigned long *, G.save_in_use, + G.by_depth_max); } G.by_depth[G.by_depth_in_use] = p; G.save_in_use[G.by_depth_in_use++] = s; @@ -611,7 +610,7 @@ set_page_table_entry (void *p, page_entry *entry) goto found; /* Not found -- allocate a new table. */ - table = xcalloc (1, sizeof(*table)); + table = XCNEW (struct page_table_chain); table->next = G.lookup; table->high_bits = high_bits; G.lookup = table; @@ -657,12 +656,12 @@ static inline char * alloc_anon (char *pref ATTRIBUTE_UNUSED, size_t size) { #ifdef HAVE_MMAP_ANON - char *page = mmap (pref, size, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + char *page = (char *) mmap (pref, size, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); #endif #ifdef HAVE_MMAP_DEV_ZERO - char *page = mmap (pref, size, PROT_READ | PROT_WRITE, - MAP_PRIVATE, G.dev_zero_fd, 0); + char *page = (char *) mmap (pref, size, PROT_READ | PROT_WRITE, + MAP_PRIVATE, G.dev_zero_fd, 0); #endif if (page == (char *) MAP_FAILED) @@ -772,7 +771,7 @@ alloc_page (unsigned order) memory order. */ for (i = GGC_QUIRE_SIZE - 1; i >= 1; i--) { - e = xcalloc (1, page_entry_size); + e = XCNEWVAR (struct page_entry, page_entry_size); e->order = order; e->bytes = G.pagesize; e->page = page + (i << G.lg_pagesize); @@ -857,7 +856,7 @@ alloc_page (unsigned order) #endif if (entry == NULL) - entry = xcalloc (1, page_entry_size); + entry = XCNEWVAR (struct page_entry, page_entry_size); entry->bytes = entry_size; entry->page = page; @@ -1285,7 +1284,7 @@ gt_ggc_m_S (const void *p) a STRING_CST. */ gcc_assert (offset == offsetof (struct tree_string, str)); p = ((const char *) p) - offset; - gt_ggc_mx_lang_tree_node ((void *) p); + gt_ggc_mx_lang_tree_node (CONST_CAST (void *, p)); return; } @@ -1666,7 +1665,7 @@ clear_marks (void) if (p->context_depth < G.context_depth) { if (! save_in_use_p (p)) - save_in_use_p (p) = xmalloc (bitmap_size); + save_in_use_p (p) = XNEWVAR (unsigned long, bitmap_size); memcpy (save_in_use_p (p), p->in_use_p, bitmap_size); } @@ -2272,7 +2271,7 @@ ggc_pch_read (FILE *f, void *addr) { struct ggc_pch_ondisk d; unsigned i; - char *offs = addr; + char *offs = (char *) addr; unsigned long count_old_page_tables; unsigned long count_new_page_tables; @@ -2318,9 +2317,9 @@ ggc_pch_read (FILE *f, void *addr) bytes = ROUND_UP (d.totals[i] * OBJECT_SIZE (i), G.pagesize); num_objs = bytes / OBJECT_SIZE (i); - entry = xcalloc (1, (sizeof (struct page_entry) - - sizeof (long) - + BITMAP_SIZE (num_objs + 1))); + entry = XCNEWVAR (struct page_entry, (sizeof (struct page_entry) + - sizeof (long) + + BITMAP_SIZE (num_objs + 1))); entry->bytes = bytes; entry->page = offs; entry->context_depth = 0; diff --git a/gcc/gimplify.c b/gcc/gimplify.c index bf81bb0c09a..c3af34bf27e 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -2809,8 +2809,19 @@ gimplify_modify_expr_to_memcpy (tree *expr_p, tree size, bool want_value) static enum gimplify_status gimplify_modify_expr_to_memset (tree *expr_p, tree size, bool want_value) { - tree t, to, to_ptr; + tree t, from, to, to_ptr; + /* Assert our assumptions, to abort instead of producing wrong code + silently if they are not met. Beware that the RHS CONSTRUCTOR might + not be immediately exposed. */ + from = GENERIC_TREE_OPERAND (*expr_p, 1); + if (TREE_CODE (from) == WITH_SIZE_EXPR) + from = TREE_OPERAND (from, 0); + + gcc_assert (TREE_CODE (from) == CONSTRUCTOR + && VEC_empty (constructor_elt, CONSTRUCTOR_ELTS (from))); + + /* Now proceed. */ to = GENERIC_TREE_OPERAND (*expr_p, 0); to_ptr = build_fold_addr_expr (to); @@ -5049,15 +5060,16 @@ omp_is_private (struct gimplify_omp_ctx *ctx, tree decl) error ("iteration variable %qs should not be reduction", IDENTIFIER_POINTER (DECL_NAME (decl))); } - return true; + return (ctx == gimplify_omp_ctxp + || (ctx->region_type == ORT_COMBINED_PARALLEL + && gimplify_omp_ctxp->outer_context == ctx)); } if (ctx->region_type != ORT_WORKSHARE) return false; else if (ctx->outer_context) return omp_is_private (ctx->outer_context, decl); - else - return !is_global_var (decl); + return false; } /* Return true if DECL is private within a parallel region diff --git a/gcc/global.c b/gcc/global.c index cddcac3d0ac..9c22e91f857 100644 --- a/gcc/global.c +++ b/gcc/global.c @@ -206,7 +206,9 @@ static void build_insn_chain (void); This will normally be called with ELIM_SET as the file static variable eliminable_regset, and NO_GLOBAL_SET as the file static - variable NO_GLOBAL_ALLOC_REGS. */ + variable NO_GLOBAL_ALLOC_REGS. + + It also initializes global flag frame_pointer_needed. */ static void compute_regsets (HARD_REG_SET *elim_set, @@ -216,17 +218,25 @@ compute_regsets (HARD_REG_SET *elim_set, /* Like regs_ever_live, but 1 if a reg is set or clobbered from an asm. Unlike regs_ever_live, elements of this array corresponding to eliminable regs like the frame pointer are set if an asm sets them. */ - char *regs_asm_clobbered = alloca (FIRST_PSEUDO_REGISTER * sizeof (char)); + char *regs_asm_clobbered = XALLOCAVEC (char, FIRST_PSEUDO_REGISTER); #ifdef ELIMINABLE_REGS static const struct {const int from, to; } eliminables[] = ELIMINABLE_REGS; size_t i; #endif + + /* FIXME: If EXIT_IGNORE_STACK is set, we will not save and restore + sp for alloca. So we can't eliminate the frame pointer in that + case. At some point, we should improve this by emitting the + sp-adjusting insns for this case. */ int need_fp = (! flag_omit_frame_pointer || (cfun->calls_alloca && EXIT_IGNORE_STACK) + || crtl->accesses_prior_frames || FRAME_POINTER_REQUIRED); + frame_pointer_needed = need_fp; + max_regno = max_reg_num (); compact_blocks (); diff --git a/gcc/graph.c b/gcc/graph.c index 56fbc8c0b4d..e59adbc3677 100644 --- a/gcc/graph.c +++ b/gcc/graph.c @@ -226,7 +226,7 @@ print_rtl_graph_with_bb (const char *base, rtx rtx_first) rtx tmp_rtx; size_t namelen = strlen (base); size_t extlen = strlen (graph_ext[graph_dump_format]) + 1; - char *buf = alloca (namelen + extlen); + char *buf = XALLOCAVEC (char, namelen + extlen); FILE *fp; if (basic_block_info == NULL) @@ -389,7 +389,7 @@ clean_graph_dump_file (const char *base) { size_t namelen = strlen (base); size_t extlen = strlen (graph_ext[graph_dump_format]) + 1; - char *buf = alloca (namelen + extlen); + char *buf = XALLOCAVEC (char, namelen + extlen); FILE *fp; memcpy (buf, base, namelen); @@ -413,7 +413,7 @@ finish_graph_dump_file (const char *base) { size_t namelen = strlen (base); size_t extlen = strlen (graph_ext[graph_dump_format]) + 1; - char *buf = alloca (namelen + extlen); + char *buf = XALLOCAVEC (char, namelen + extlen); FILE *fp; memcpy (buf, base, namelen); diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index bb799f96c3c..8d5b38bbf32 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -2179,7 +2179,7 @@ schedule_block (basic_block *target_bb, int rgn_n_insns1) q_ptr = 0; q_size = 0; - insn_queue = alloca ((max_insn_queue_index + 1) * sizeof (rtx)); + insn_queue = XALLOCAVEC (rtx, max_insn_queue_index + 1); memset (insn_queue, 0, (max_insn_queue_index + 1) * sizeof (rtx)); /* Start just before the beginning of time. */ @@ -3158,7 +3158,8 @@ extend_h_i_d (void) pseudos which do not cross calls. */ int new_max_uid = get_max_uid () + 1; - h_i_d = xrecalloc (h_i_d, new_max_uid, old_max_uid, sizeof (*h_i_d)); + h_i_d = (struct haifa_insn_data *) + xrecalloc (h_i_d, new_max_uid, old_max_uid, sizeof (*h_i_d)); old_max_uid = new_max_uid; if (targetm.sched.h_i_d_extended) @@ -3175,8 +3176,8 @@ extend_ready (int n_new_insns) readyp->veclen = rgn_n_insns + n_new_insns + 1 + issue_rate; readyp->vec = XRESIZEVEC (rtx, readyp->vec, readyp->veclen); - ready_try = xrecalloc (ready_try, rgn_n_insns + n_new_insns + 1, - rgn_n_insns + 1, sizeof (char)); + ready_try = (char *) xrecalloc (ready_try, rgn_n_insns + n_new_insns + 1, + rgn_n_insns + 1, sizeof (char)); rgn_n_insns += n_new_insns; @@ -4098,7 +4099,7 @@ unlink_bb_notes (basic_block first, basic_block last) if (first == last) return; - bb_header = xmalloc (last_basic_block * sizeof (*bb_header)); + bb_header = XNEWVEC (rtx, last_basic_block); /* Make a sentinel. */ if (last->next_bb != EXIT_BLOCK_PTR) diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index e1601b1eacb..da8afde3106 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -2614,7 +2614,11 @@ cond_move_process_if_block (struct noce_if_info *if_info) /* Make sure the blocks are suitable. */ if (!check_cond_move_block (then_bb, then_vals, then_regs, cond) || (else_bb && !check_cond_move_block (else_bb, else_vals, else_regs, cond))) - return FALSE; + { + VEC_free (int, heap, then_regs); + VEC_free (int, heap, else_regs); + return FALSE; + } /* Make sure the blocks can be used together. If the same register is set in both blocks, and is not set to a constant in both @@ -2635,7 +2639,11 @@ cond_move_process_if_block (struct noce_if_info *if_info) if (!CONSTANT_P (then_vals[reg]) && !CONSTANT_P (else_vals[reg]) && !rtx_equal_p (then_vals[reg], else_vals[reg])) - return FALSE; + { + VEC_free (int, heap, then_regs); + VEC_free (int, heap, else_regs); + return FALSE; + } } } @@ -2649,7 +2657,11 @@ cond_move_process_if_block (struct noce_if_info *if_info) branches, since if we convert we are going to always execute them. */ if (c > MAX_CONDITIONAL_EXECUTE) - return FALSE; + { + VEC_free (int, heap, then_regs); + VEC_free (int, heap, else_regs); + return FALSE; + } /* Try to emit the conditional moves. First do the then block, then do anything left in the else blocks. */ @@ -2661,11 +2673,17 @@ cond_move_process_if_block (struct noce_if_info *if_info) then_vals, else_vals, true))) { end_sequence (); + VEC_free (int, heap, then_regs); + VEC_free (int, heap, else_regs); return FALSE; } seq = end_ifcvt_sequence (if_info); if (!seq) - return FALSE; + { + VEC_free (int, heap, then_regs); + VEC_free (int, heap, else_regs); + return FALSE; + } loc_insn = first_active_insn (then_bb); if (!loc_insn) @@ -2698,7 +2716,6 @@ cond_move_process_if_block (struct noce_if_info *if_info) VEC_free (int, heap, then_regs); VEC_free (int, heap, else_regs); - return TRUE; } diff --git a/gcc/integrate.c b/gcc/integrate.c index 4ed42ef896a..d29aab6627e 100644 --- a/gcc/integrate.c +++ b/gcc/integrate.c @@ -237,19 +237,18 @@ get_hard_reg_initial_val (enum machine_mode mode, unsigned int regno) ivs = crtl->hard_reg_initial_vals; if (ivs == 0) { - ivs = ggc_alloc (sizeof (initial_value_struct)); + ivs = GGC_NEW (initial_value_struct); ivs->num_entries = 0; ivs->max_entries = 5; - ivs->entries = ggc_alloc (5 * sizeof (initial_value_pair)); + ivs->entries = GGC_NEWVEC (initial_value_pair, 5); crtl->hard_reg_initial_vals = ivs; } if (ivs->num_entries >= ivs->max_entries) { ivs->max_entries += 5; - ivs->entries = ggc_realloc (ivs->entries, - ivs->max_entries - * sizeof (initial_value_pair)); + ivs->entries = GGC_RESIZEVEC (initial_value_pair, ivs->entries, + ivs->max_entries); } ivs->entries[ivs->num_entries].hard_reg = gen_rtx_REG (mode, regno); diff --git a/gcc/intl.c b/gcc/intl.c index f76dbada97b..dfc015d2123 100644 --- a/gcc/intl.c +++ b/gcc/intl.c @@ -91,7 +91,7 @@ size_t gcc_gettext_width (const char *msgstr) { size_t nwcs = mbstowcs (0, msgstr, 0); - wchar_t *wmsgstr = alloca ((nwcs + 1) * sizeof (wchar_t)); + wchar_t *wmsgstr = XALLOCAVEC (wchar_t, nwcs + 1); mbstowcs (wmsgstr, msgstr, nwcs + 1); return wcswidth (wmsgstr, nwcs); diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index f0403634c10..c5b4c9a80c8 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -52,7 +52,7 @@ ipa_push_func_to_list (struct ipa_func_list **wl, struct cgraph_node *mt) { struct ipa_func_list *temp; - temp = xcalloc (1, sizeof (struct ipa_func_list)); + temp = XCNEW (struct ipa_func_list); temp->node = mt; temp->next = *wl; *wl = temp; diff --git a/gcc/ipa-struct-reorg.c b/gcc/ipa-struct-reorg.c index cce9b3f6fc7..fffb454d831 100644 --- a/gcc/ipa-struct-reorg.c +++ b/gcc/ipa-struct-reorg.c @@ -1954,7 +1954,7 @@ gen_var_name (tree orig_decl, unsigned HOST_WIDE_INT i) appropriate new name for the new variable. */ old_name = IDENTIFIER_POINTER (DECL_NAME (orig_decl)); - prefix = alloca (strlen (old_name) + 1); + prefix = XALLOCAVEC (char, strlen (old_name) + 1); strcpy (prefix, old_name); ASM_FORMAT_PRIVATE_NAME (new_name, prefix, i); return get_identifier (new_name); @@ -2827,7 +2827,7 @@ gen_cluster_name (tree decl, int clust_num, int str_num) ASM_FORMAT_PRIVATE_NAME(tmp_name, "struct", str_num); len = strlen (tmp_name ? tmp_name : orig_name) + strlen ("_sub"); - prefix = alloca (len + 1); + prefix = XALLOCAVEC (char, len + 1); memcpy (prefix, tmp_name ? tmp_name : orig_name, strlen (tmp_name ? tmp_name : orig_name)); strcpy (prefix + strlen (tmp_name ? tmp_name : orig_name), "_sub"); diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 65a28f4f853..b5ceb09f1b9 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,7 @@ +2008-06-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * Make-lang.in (java/jcf-io.o-warn): New. + 2008-06-24 Tom Tromey <tromey@redhat.com> * jcf-path.c (jcf_path_init): Don't name variable 'try'. diff --git a/gcc/java/Make-lang.in b/gcc/java/Make-lang.in index d1201cd7034..badbb7fdfbf 100644 --- a/gcc/java/Make-lang.in +++ b/gcc/java/Make-lang.in @@ -101,6 +101,9 @@ jvspec.o-warn = -Wno-error # Bison-1.75 output often yields (harmless) -Wtraditional warnings java/parse.o-warn = -Wno-error +# java/jcf-io.c contains a -Wc++compat warning. +java/jcf-io.o-warn = -Wno-error + jc1$(exeext): $(JAVA_OBJS) $(BACKEND) $(LIBDEPS) attribs.o rm -f $@ $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ diff --git a/gcc/libfuncs.h b/gcc/libfuncs.h index f7f6a6299c4..ef636da36bb 100644 --- a/gcc/libfuncs.h +++ b/gcc/libfuncs.h @@ -40,6 +40,8 @@ enum libfunc_index LTI_profile_function_entry, LTI_profile_function_exit, + LTI_synchronize, + LTI_gcov_flush, LTI_MAX @@ -69,6 +71,8 @@ extern GTY(()) rtx libfunc_table[LTI_MAX]; #define profile_function_entry_libfunc (libfunc_table[LTI_profile_function_entry]) #define profile_function_exit_libfunc (libfunc_table[LTI_profile_function_exit]) +#define synchronize_libfunc (libfunc_table[LTI_synchronize]) + #define gcov_flush_libfunc (libfunc_table[LTI_gcov_flush]) #endif /* GCC_LIBFUNCS_H */ diff --git a/gcc/local-alloc.c b/gcc/local-alloc.c index 0ee20b2c3ab..e1c8e47cdc8 100644 --- a/gcc/local-alloc.c +++ b/gcc/local-alloc.c @@ -806,7 +806,7 @@ update_equiv_regs (void) bitmap cleared_regs; reg_equiv = XCNEWVEC (struct equivalence, max_regno); - reg_equiv_init = ggc_alloc_cleared (max_regno * sizeof (rtx)); + reg_equiv_init = GGC_CNEWVEC (rtx, max_regno); reg_equiv_init_size = max_regno; init_alias_analysis (); diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c index dd75b3a3a8f..40e70ba18c0 100644 --- a/gcc/loop-invariant.c +++ b/gcc/loop-invariant.c @@ -164,8 +164,7 @@ check_invariant_table_size (void) if (invariant_table_size < DF_DEFS_TABLE_SIZE()) { unsigned int new_size = DF_DEFS_TABLE_SIZE () + (DF_DEFS_TABLE_SIZE () / 4); - invariant_table = xrealloc (invariant_table, - sizeof (struct rtx_iv *) * new_size); + invariant_table = XRESIZEVEC (struct invariant *, invariant_table, new_size); memset (&invariant_table[invariant_table_size], 0, (new_size - invariant_table_size) * sizeof (struct rtx_iv *)); invariant_table_size = new_size; @@ -417,7 +416,8 @@ invariant_expr_equal_p (rtx insn1, rtx e1, rtx insn2, rtx e2) static hashval_t hash_invariant_expr (const void *e) { - const struct invariant_expr_entry *entry = e; + const struct invariant_expr_entry *const entry = + (const struct invariant_expr_entry *) e; return entry->hash; } @@ -427,8 +427,10 @@ hash_invariant_expr (const void *e) static int eq_invariant_expr (const void *e1, const void *e2) { - const struct invariant_expr_entry *entry1 = e1; - const struct invariant_expr_entry *entry2 = e2; + const struct invariant_expr_entry *const entry1 = + (const struct invariant_expr_entry *) e1; + const struct invariant_expr_entry *const entry2 = + (const struct invariant_expr_entry *) e2; if (entry1->mode != entry2->mode) return 0; @@ -454,7 +456,7 @@ find_or_insert_inv (htab_t eq, rtx expr, enum machine_mode mode, pentry.inv = inv; pentry.mode = mode; slot = htab_find_slot_with_hash (eq, &pentry, hash, INSERT); - entry = *slot; + entry = (struct invariant_expr_entry *) *slot; if (entry) return entry->inv; diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c index b7b1cd32ec0..e0635970bff 100644 --- a/gcc/loop-iv.c +++ b/gcc/loop-iv.c @@ -173,8 +173,7 @@ check_iv_ref_table_size (void) if (iv_ref_table_size < DF_DEFS_TABLE_SIZE()) { unsigned int new_size = DF_DEFS_TABLE_SIZE () + (DF_DEFS_TABLE_SIZE () / 4); - iv_ref_table = xrealloc (iv_ref_table, - sizeof (struct rtx_iv *) * new_size); + iv_ref_table = XRESIZEVEC (struct rtx_iv *, iv_ref_table, new_size); memset (&iv_ref_table[iv_ref_table_size], 0, (new_size - iv_ref_table_size) * sizeof (struct rtx_iv *)); iv_ref_table_size = new_size; @@ -819,7 +818,8 @@ record_iv (struct df_ref *def, struct rtx_iv *iv) static bool analyzed_for_bivness_p (rtx def, struct rtx_iv *iv) { - struct biv_entry *biv = htab_find_with_hash (bivs, def, REGNO (def)); + struct biv_entry *biv = + (struct biv_entry *) htab_find_with_hash (bivs, def, REGNO (def)); if (!biv) return false; @@ -1304,7 +1304,7 @@ altered_reg_used (rtx *reg, void *alt) if (!REG_P (*reg)) return 0; - return REGNO_REG_SET_P (alt, REGNO (*reg)); + return REGNO_REG_SET_P ((bitmap) alt, REGNO (*reg)); } /* Marks registers altered by EXPR in set ALT. */ @@ -1317,7 +1317,7 @@ mark_altered (rtx expr, const_rtx by ATTRIBUTE_UNUSED, void *alt) if (!REG_P (expr)) return; - SET_REGNO_REG_SET (alt, REGNO (expr)); + SET_REGNO_REG_SET ((bitmap) alt, REGNO (expr)); } /* Checks whether RHS is simple enough to process. */ diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c index e57e8e665b2..b6dc266d7c6 100644 --- a/gcc/loop-unroll.c +++ b/gcc/loop-unroll.c @@ -1491,8 +1491,8 @@ si_info_hash (const void *ivts) static int si_info_eq (const void *ivts1, const void *ivts2) { - const struct iv_to_split *i1 = ivts1; - const struct iv_to_split *i2 = ivts2; + const struct iv_to_split *const i1 = (const struct iv_to_split *) ivts1; + const struct iv_to_split *const i2 = (const struct iv_to_split *) ivts2; return i1->insn == i2->insn; } @@ -1511,8 +1511,8 @@ ve_info_hash (const void *ves) static int ve_info_eq (const void *ivts1, const void *ivts2) { - const struct var_to_expand *i1 = ivts1; - const struct var_to_expand *i2 = ivts2; + const struct var_to_expand *const i1 = (const struct var_to_expand *) ivts1; + const struct var_to_expand *const i2 = (const struct var_to_expand *) ivts2; return i1->insn == i2->insn; } @@ -1867,7 +1867,7 @@ get_ivts_expr (rtx expr, struct iv_to_split *ivts) static int allocate_basic_variable (void **slot, void *data ATTRIBUTE_UNUSED) { - struct iv_to_split *ivts = *slot; + struct iv_to_split *ivts = (struct iv_to_split *) *slot; rtx expr = *get_ivts_expr (single_set (ivts->insn), ivts); ivts->base_var = gen_reg_rtx (GET_MODE (expr)); @@ -2040,7 +2040,7 @@ expand_var_during_unrolling (struct var_to_expand *ve, rtx insn) static int insert_var_expansion_initialization (void **slot, void *place_p) { - struct var_to_expand *ve = *slot; + struct var_to_expand *ve = (struct var_to_expand *) *slot; basic_block place = (basic_block)place_p; rtx seq, var, zero_init, insn; unsigned i; @@ -2088,7 +2088,7 @@ insert_var_expansion_initialization (void **slot, void *place_p) static int combine_var_copies_in_loop_exit (void **slot, void *place_p) { - struct var_to_expand *ve = *slot; + struct var_to_expand *ve = (struct var_to_expand *) *slot; basic_block place = (basic_block)place_p; rtx sum = ve->reg; rtx expr, seq, var, insn; @@ -2181,7 +2181,8 @@ apply_opt_in_copies (struct opt_info *opt_info, /* Apply splitting iv optimization. */ if (opt_info->insns_to_split) { - ivts = htab_find (opt_info->insns_to_split, &ivts_templ); + ivts = (struct iv_to_split *) + htab_find (opt_info->insns_to_split, &ivts_templ); if (ivts) { @@ -2196,7 +2197,8 @@ apply_opt_in_copies (struct opt_info *opt_info, /* Apply variable expansion optimization. */ if (unrolling && opt_info->insns_with_var_to_expand) { - ves = htab_find (opt_info->insns_with_var_to_expand, &ve_templ); + ves = (struct var_to_expand *) + htab_find (opt_info->insns_with_var_to_expand, &ve_templ); if (ves) { gcc_assert (GET_CODE (PATTERN (insn)) @@ -2246,7 +2248,8 @@ apply_opt_in_copies (struct opt_info *opt_info, ivts_templ.insn = orig_insn; if (opt_info->insns_to_split) { - ivts = htab_find (opt_info->insns_to_split, &ivts_templ); + ivts = (struct iv_to_split *) + htab_find (opt_info->insns_to_split, &ivts_templ); if (ivts) { if (!delta) @@ -2266,7 +2269,7 @@ apply_opt_in_copies (struct opt_info *opt_info, static int release_var_copies (void **slot, void *data ATTRIBUTE_UNUSED) { - struct var_to_expand *ve = *slot; + struct var_to_expand *ve = (struct var_to_expand *) *slot; VEC_free (rtx, heap, ve->var_expansions); diff --git a/gcc/matrix-reorg.c b/gcc/matrix-reorg.c index 50ac7e87b0b..33bb0b4e8f4 100644 --- a/gcc/matrix-reorg.c +++ b/gcc/matrix-reorg.c @@ -358,7 +358,8 @@ static bool check_transpose_p; static hashval_t mat_acc_phi_hash (const void *p) { - const struct matrix_access_phi_node *ma_phi = p; + const struct matrix_access_phi_node *const ma_phi = + (const struct matrix_access_phi_node *) p; return htab_hash_pointer (ma_phi->phi); } @@ -368,8 +369,10 @@ mat_acc_phi_hash (const void *p) static int mat_acc_phi_eq (const void *p1, const void *p2) { - const struct matrix_access_phi_node *phi1 = p1; - const struct matrix_access_phi_node *phi2 = p2; + const struct matrix_access_phi_node *const phi1 = + (const struct matrix_access_phi_node *) p1; + const struct matrix_access_phi_node *const phi2 = + (const struct matrix_access_phi_node *) p2; if (phi1->phi == phi2->phi) return 1; @@ -397,8 +400,8 @@ mtt_info_hash (const void *mtt) static int mtt_info_eq (const void *mtt1, const void *mtt2) { - const struct matrix_info *i1 = mtt1; - const struct matrix_info *i2 = mtt2; + const struct matrix_info *const i1 = (const struct matrix_info *) mtt1; + const struct matrix_info *const i2 = (const struct matrix_info *) mtt2; if (i1->decl == i2->decl) return true; @@ -521,7 +524,7 @@ analyze_matrix_decl (tree var_decl) /* Check to see if this pointer is already in there. */ tmpmi.decl = var_decl; - mi = htab_find (matrices_to_reorg, &tmpmi); + mi = (struct matrix_info *) htab_find (matrices_to_reorg, &tmpmi); if (mi) return NULL; @@ -738,13 +741,13 @@ add_allocation_site (struct matrix_info *mi, tree stmt, int level) calls like calloc and realloc. */ if (!mi->malloc_for_level) { - mi->malloc_for_level = xcalloc (level + 1, sizeof (tree)); + mi->malloc_for_level = XCNEWVEC (tree, level + 1); mi->max_malloced_level = level + 1; } else if (mi->max_malloced_level <= level) { mi->malloc_for_level - = xrealloc (mi->malloc_for_level, (level + 1) * sizeof (tree)); + = XRESIZEVEC (tree, mi->malloc_for_level, level + 1); /* Zero the newly allocated items. */ memset (&(mi->malloc_for_level[mi->max_malloced_level + 1]), @@ -879,7 +882,7 @@ analyze_matrix_allocation_site (struct matrix_info *mi, tree stmt, static int analyze_transpose (void **slot, void *data ATTRIBUTE_UNUSED) { - struct matrix_info *mi = *slot; + struct matrix_info *mi = (struct matrix_info *) *slot; int min_escape_l = mi->min_indirect_level_escape; struct loop *loop; affine_iv iv; @@ -1079,7 +1082,8 @@ analyze_accesses_for_phi_node (struct matrix_info *mi, tree use_stmt, struct matrix_access_phi_node tmp_maphi, *maphi, **pmaphi; tmp_maphi.phi = use_stmt; - if ((maphi = htab_find (htab_mat_acc_phi_nodes, &tmp_maphi))) + if ((maphi = (struct matrix_access_phi_node *) + htab_find (htab_mat_acc_phi_nodes, &tmp_maphi))) { if (maphi->indirection_level == current_indirect_level) return; @@ -1358,7 +1362,7 @@ check_var_notmodified_p (tree * tp, int *walk_subtrees, void *data) { basic_block bb; tree t = *tp; - tree fn = data; + tree fn = (tree) data; block_stmt_iterator bsi; tree stmt; @@ -1482,7 +1486,7 @@ check_allocation_function (void **slot, void *data ATTRIBUTE_UNUSED) int level; block_stmt_iterator bsi; basic_block bb_level_0; - struct matrix_info *mi = *slot; + struct matrix_info *mi = (struct matrix_info *) *slot; sbitmap visited; if (!mi->malloc_for_level) @@ -1587,7 +1591,8 @@ find_sites_in_func (bool record) && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) == VAR_DECL) { tmpmi.decl = GIMPLE_STMT_OPERAND (stmt, 0); - if ((mi = htab_find (matrices_to_reorg, &tmpmi))) + if ((mi = (struct matrix_info *) htab_find (matrices_to_reorg, + &tmpmi))) { sbitmap_zero (visited_stmts_1); analyze_matrix_allocation_site (mi, stmt, 0, visited_stmts_1); @@ -1598,7 +1603,8 @@ find_sites_in_func (bool record) && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == VAR_DECL) { tmpmi.decl = GIMPLE_STMT_OPERAND (stmt, 1); - if ((mi = htab_find (matrices_to_reorg, &tmpmi))) + if ((mi = (struct matrix_info *) htab_find (matrices_to_reorg, + &tmpmi))) { sbitmap_zero (visited_stmts_1); analyze_matrix_accesses (mi, @@ -1645,7 +1651,7 @@ record_all_accesses_in_func (void) chain for this SSA_VAR and check for escapes or apply the flattening. */ tmpmi.decl = rhs; - if ((mi = htab_find (matrices_to_reorg, &tmpmi))) + if ((mi = (struct matrix_info *) htab_find (matrices_to_reorg, &tmpmi))) { /* This variable will track the visited PHI nodes, so we can limit its size to the maximum number of SSA names. */ @@ -1714,7 +1720,7 @@ static int transform_access_sites (void **slot, void *data ATTRIBUTE_UNUSED) { block_stmt_iterator bsi; - struct matrix_info *mi = *slot; + struct matrix_info *mi = (struct matrix_info *) *slot; int min_escape_l = mi->min_indirect_level_escape; struct access_site_info *acc_info; int i; @@ -1942,7 +1948,7 @@ transform_allocation_sites (void **slot, void *data ATTRIBUTE_UNUSED) int min_escape_l; int id; - mi = *slot; + mi = (struct matrix_info *) *slot; min_escape_l = mi->min_indirect_level_escape; @@ -2184,7 +2190,7 @@ transform_allocation_sites (void **slot, void *data ATTRIBUTE_UNUSED) static int dump_matrix_reorg_analysis (void **slot, void *data ATTRIBUTE_UNUSED) { - struct matrix_info *mi = *slot; + struct matrix_info *mi = (struct matrix_info *) *slot; if (!dump_file) return 1; diff --git a/gcc/omp-low.c b/gcc/omp-low.c index db5f8584405..e5680077bd0 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -1097,7 +1097,7 @@ debug_all_omp_regions (void) struct omp_region * new_omp_region (basic_block bb, enum tree_code type, struct omp_region *parent) { - struct omp_region *region = xcalloc (1, sizeof (*region)); + struct omp_region *region = XCNEW (struct omp_region); region->outer = parent; region->entry = bb; @@ -1493,7 +1493,7 @@ create_omp_child_function_name (bool task_copy) const char *suffix; suffix = task_copy ? "_omp_cpyfn" : "_omp_fn"; - prefix = alloca (len + strlen (suffix) + 1); + prefix = XALLOCAVEC (char, len + strlen (suffix) + 1); memcpy (prefix, IDENTIFIER_POINTER (name), len); strcpy (prefix + len, suffix); #ifndef NO_DOT_IN_LABEL @@ -1853,8 +1853,8 @@ check_omp_nesting_restrictions (tree t, omp_context *ctx) static tree scan_omp_1 (tree *tp, int *walk_subtrees, void *data) { - struct walk_stmt_info *wi = data; - omp_context *ctx = wi->info; + struct walk_stmt_info *wi = (struct walk_stmt_info *) data; + omp_context *ctx = (omp_context *) wi->info; tree t = *tp; if (EXPR_HAS_LOCATION (t)) @@ -3140,7 +3140,7 @@ expand_omp_taskreg (struct omp_region *region) { basic_block entry_bb, exit_bb, new_bb; struct function *child_cfun; - tree child_fn, block, t, ws_args; + tree child_fn, block, t, ws_args, *tp; block_stmt_iterator si; tree entry_stmt; edge e; @@ -3251,6 +3251,7 @@ expand_omp_taskreg (struct omp_region *region) block = DECL_INITIAL (child_fn); BLOCK_VARS (block) = list2chain (child_cfun->local_decls); DECL_SAVED_TREE (child_fn) = bb_stmt_list (single_succ (entry_bb)); + TREE_USED (block) = 1; /* Reset DECL_CONTEXT on function arguments. */ for (t = DECL_ARGUMENTS (child_fn); t; t = TREE_CHAIN (t)) @@ -3287,11 +3288,22 @@ expand_omp_taskreg (struct omp_region *region) init_ssa_operands (); cfun->gimple_df->in_ssa_p = true; pop_cfun (); + block = NULL_TREE; } - new_bb = move_sese_region_to_fn (child_cfun, entry_bb, exit_bb); + else + block = TREE_BLOCK (entry_stmt); + + new_bb = move_sese_region_to_fn (child_cfun, entry_bb, exit_bb, block); if (exit_bb) single_succ_edge (new_bb)->flags = EDGE_FALLTHRU; + /* Remove non-local VAR_DECLs from child_cfun->local_decls list. */ + for (tp = &child_cfun->local_decls; *tp; ) + if (DECL_CONTEXT (TREE_VALUE (*tp)) != cfun->decl) + tp = &TREE_CHAIN (*tp); + else + *tp = TREE_CHAIN (*tp); + /* Inform the callgraph about the new function. */ DECL_STRUCT_FUNCTION (child_fn)->curr_properties = cfun->curr_properties; @@ -5030,6 +5042,8 @@ expand_omp (struct omp_region *region) { while (region) { + location_t saved_location; + /* First, determine whether this is a combined parallel+workshare region. */ if (region->type == OMP_PARALLEL) @@ -5038,6 +5052,10 @@ expand_omp (struct omp_region *region) if (region->inner) expand_omp (region->inner); + saved_location = input_location; + if (EXPR_HAS_LOCATION (last_stmt (region->entry))) + input_location = EXPR_LOCATION (last_stmt (region->entry)); + switch (region->type) { case OMP_PARALLEL: @@ -5075,11 +5093,11 @@ expand_omp (struct omp_region *region) expand_omp_atomic (region); break; - default: gcc_unreachable (); } + input_location = saved_location; region = region->next; } } @@ -5312,12 +5330,18 @@ lower_omp_sections (tree *stmt_p, omp_context *ctx) olist = NULL_TREE; lower_reduction_clauses (OMP_SECTIONS_CLAUSES (stmt), &olist, ctx); - pop_gimplify_context (NULL_TREE); - record_vars_into (ctx->block_vars, ctx->cb.dst_fn); - - new_stmt = build3 (BIND_EXPR, void_type_node, NULL, NULL, NULL); + block = make_node (BLOCK); + new_stmt = build3 (BIND_EXPR, void_type_node, NULL, NULL, block); TREE_SIDE_EFFECTS (new_stmt) = 1; + pop_gimplify_context (new_stmt); + + BIND_EXPR_VARS (new_stmt) + = chainon (BIND_EXPR_VARS (new_stmt), ctx->block_vars); + BLOCK_VARS (block) = BIND_EXPR_VARS (new_stmt); + if (BLOCK_VARS (block)) + TREE_USED (block) = 1; + new_body = alloc_stmt_list (); append_to_statement_list (ilist, &new_body); append_to_statement_list (stmt, &new_body); @@ -5491,6 +5515,8 @@ lower_omp_single (tree *stmt_p, omp_context *ctx) BIND_EXPR_VARS (bind) = chainon (BIND_EXPR_VARS (bind), ctx->block_vars); BLOCK_VARS (block) = BIND_EXPR_VARS (bind); + if (BLOCK_VARS (block)) + TREE_USED (block) = 1; } @@ -5714,7 +5740,7 @@ lower_omp_for_lastprivate (struct omp_for_data *fd, tree *body_p, static void lower_omp_for (tree *stmt_p, omp_context *ctx) { - tree t, stmt, ilist, dlist, new_stmt, *body_p, *rhs_p; + tree t, stmt, ilist, dlist, new_stmt, block, *body_p, *rhs_p; struct omp_for_data fd; int i; @@ -5725,14 +5751,17 @@ lower_omp_for (tree *stmt_p, omp_context *ctx) lower_omp (&OMP_FOR_PRE_BODY (stmt), ctx); lower_omp (&OMP_FOR_BODY (stmt), ctx); + block = make_node (BLOCK); + new_stmt = build3 (BIND_EXPR, void_type_node, NULL, NULL, block); + TREE_SIDE_EFFECTS (new_stmt) = 1; + body_p = &BIND_EXPR_BODY (new_stmt); + /* Move declaration of temporaries in the loop body before we make it go away. */ if (TREE_CODE (OMP_FOR_BODY (stmt)) == BIND_EXPR) - record_vars_into (BIND_EXPR_VARS (OMP_FOR_BODY (stmt)), ctx->cb.dst_fn); - - new_stmt = build3 (BIND_EXPR, void_type_node, NULL, NULL, NULL); - TREE_SIDE_EFFECTS (new_stmt) = 1; - body_p = &BIND_EXPR_BODY (new_stmt); + BIND_EXPR_VARS (new_stmt) + = chainon (BIND_EXPR_VARS (new_stmt), + BIND_EXPR_VARS (OMP_FOR_BODY (stmt))); /* The pre-body and input clauses go before the lowered OMP_FOR. */ ilist = NULL; @@ -5786,8 +5815,12 @@ lower_omp_for (tree *stmt_p, omp_context *ctx) OMP_RETURN_NOWAIT (t) = fd.have_nowait; append_to_statement_list (t, body_p); - pop_gimplify_context (NULL_TREE); - record_vars_into (ctx->block_vars, ctx->cb.dst_fn); + pop_gimplify_context (new_stmt); + BIND_EXPR_VARS (new_stmt) + = chainon (BIND_EXPR_VARS (new_stmt), ctx->block_vars); + BLOCK_VARS (block) = BIND_EXPR_VARS (new_stmt); + if (BLOCK_VARS (block)) + TREE_USED (block) = 1; OMP_FOR_BODY (stmt) = NULL_TREE; OMP_FOR_PRE_BODY (stmt) = NULL_TREE; @@ -5800,8 +5833,8 @@ lower_omp_for (tree *stmt_p, omp_context *ctx) static tree check_combined_parallel (tree *tp, int *walk_subtrees, void *data) { - struct walk_stmt_info *wi = data; - int *info = wi->info; + struct walk_stmt_info *wi = (struct walk_stmt_info *) data; + int *info = (int *) wi->info; *walk_subtrees = 0; switch (TREE_CODE (*tp)) @@ -6157,8 +6190,9 @@ lower_omp_taskreg (tree *stmt_p, omp_context *ctx) /* Once all the expansions are done, sequence all the different fragments inside OMP_TASKREG_BODY. */ - bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, NULL); - append_to_statement_list (ilist, &BIND_EXPR_BODY (bind)); + bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, + BIND_EXPR_BLOCK (par_bind)); + TREE_SIDE_EFFECTS (bind) = 1; new_body = alloc_stmt_list (); @@ -6180,7 +6214,14 @@ lower_omp_taskreg (tree *stmt_p, omp_context *ctx) OMP_TASKREG_BODY (stmt) = new_body; append_to_statement_list (stmt, &BIND_EXPR_BODY (bind)); - append_to_statement_list (olist, &BIND_EXPR_BODY (bind)); + if (ilist || olist) + { + append_to_statement_list (bind, &ilist); + append_to_statement_list (olist, &ilist); + bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, NULL); + TREE_SIDE_EFFECTS (bind) = 1; + append_to_statement_list (ilist, &BIND_EXPR_BODY (bind)); + } *stmt_p = bind; @@ -6194,7 +6235,7 @@ static tree lower_omp_2 (tree *tp, int *walk_subtrees, void *data) { tree t = *tp; - omp_context *ctx = data; + omp_context *ctx = (omp_context *) data; /* Any variable with DECL_VALUE_EXPR needs to be regimplified. */ if (TREE_CODE (t) == VAR_DECL @@ -6363,7 +6404,9 @@ lower_omp_1 (tree *tp, omp_context *ctx, tree_stmt_iterator *tsi) static void lower_omp (tree *stmt_p, omp_context *ctx) { + location_t saved_location = input_location; lower_omp_1 (stmt_p, ctx, NULL); + input_location = saved_location; } /* Main entry point. */ @@ -6470,7 +6513,7 @@ diagnose_sb_0 (tree *stmt_p, tree branch_ctx, tree label_ctx) static tree diagnose_sb_1 (tree *tp, int *walk_subtrees, void *data) { - struct walk_stmt_info *wi = data; + struct walk_stmt_info *wi = (struct walk_stmt_info *) data; tree context = (tree) wi->info; tree inner_context; tree t = *tp; @@ -6532,7 +6575,7 @@ diagnose_sb_1 (tree *tp, int *walk_subtrees, void *data) static tree diagnose_sb_2 (tree *tp, int *walk_subtrees, void *data) { - struct walk_stmt_info *wi = data; + struct walk_stmt_info *wi = (struct walk_stmt_info *) data; tree context = (tree) wi->info; splay_tree_node n; tree t = *tp; diff --git a/gcc/optabs.c b/gcc/optabs.c index 558a708c5f9..32a6396bd70 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -3801,7 +3801,7 @@ struct no_conflict_data static void no_conflict_move_test (rtx dest, const_rtx set, void *p0) { - struct no_conflict_data *p= p0; + struct no_conflict_data *p= (struct no_conflict_data *) p0; /* If this inns directly contributes to setting the target, it must stay. */ if (reg_overlap_mentioned_p (p->target, dest)) @@ -5463,7 +5463,7 @@ gen_libfunc (optab optable, const char *opname, int suffix, enum machine_mode mo unsigned opname_len = strlen (opname); const char *mname = GET_MODE_NAME (mode); unsigned mname_len = strlen (mname); - char *libfunc_name = alloca (2 + opname_len + mname_len + 1 + 1); + char *libfunc_name = XALLOCAVEC (char, 2 + opname_len + mname_len + 1 + 1); char *p; const char *q; @@ -5511,7 +5511,7 @@ gen_fp_libfunc (optab optable, const char *opname, char suffix, gen_libfunc (optable, opname, suffix, mode); if (DECIMAL_FLOAT_MODE_P (mode)) { - dec_opname = alloca (sizeof (DECIMAL_PREFIX) + strlen (opname)); + dec_opname = XALLOCAVEC (char, sizeof (DECIMAL_PREFIX) + strlen (opname)); /* For BID support, change the name to have either a bid_ or dpd_ prefix depending on the low level floating format used. */ memcpy (dec_opname, DECIMAL_PREFIX, sizeof (DECIMAL_PREFIX) - 1); @@ -5579,7 +5579,7 @@ gen_intv_fp_libfunc (optab optable, const char *name, char suffix, if (GET_MODE_CLASS (mode) == MODE_INT) { int len = strlen (name); - char *v_name = alloca (len + 2); + char *v_name = XALLOCAVEC (char, len + 2); strcpy (v_name, name); v_name[len] = 'v'; v_name[len + 1] = 0; @@ -5683,13 +5683,13 @@ gen_interclass_conv_libfunc (convert_optab tab, mname_len = strlen (GET_MODE_NAME (tmode)) + strlen (GET_MODE_NAME (fmode)); - nondec_name = alloca (2 + opname_len + mname_len + 1 + 1); + nondec_name = XALLOCAVEC (char, 2 + opname_len + mname_len + 1 + 1); nondec_name[0] = '_'; nondec_name[1] = '_'; memcpy (&nondec_name[2], opname, opname_len); nondec_suffix = nondec_name + opname_len + 2; - dec_name = alloca (2 + dec_len + opname_len + mname_len + 1 + 1); + dec_name = XALLOCAVEC (char, 2 + dec_len + opname_len + mname_len + 1 + 1); dec_name[0] = '_'; dec_name[1] = '_'; memcpy (&dec_name[2], DECIMAL_PREFIX, dec_len); @@ -5808,13 +5808,13 @@ gen_intraclass_conv_libfunc (convert_optab tab, const char *opname, mname_len = strlen (GET_MODE_NAME (tmode)) + strlen (GET_MODE_NAME (fmode)); - nondec_name = alloca (2 + opname_len + mname_len + 1 + 1); + nondec_name = XALLOCAVEC (char, 2 + opname_len + mname_len + 1 + 1); nondec_name[0] = '_'; nondec_name[1] = '_'; memcpy (&nondec_name[2], opname, opname_len); nondec_suffix = nondec_name + opname_len + 2; - dec_name = alloca (2 + dec_len + opname_len + mname_len + 1 + 1); + dec_name = XALLOCAVEC (char, 2 + dec_len + opname_len + mname_len + 1 + 1); dec_name[0] = '_'; dec_name[1] = '_'; memcpy (&dec_name[2], DECIMAL_PREFIX, dec_len); @@ -5984,28 +5984,58 @@ gen_satfractuns_conv_libfunc (convert_optab tab, gen_interclass_conv_libfunc (tab, opname, tmode, fmode); } -rtx -init_one_libfunc (const char *name) -{ - rtx symbol; +/* A table of previously-created libfuncs, hashed by name. */ +static GTY ((param_is (union tree_node))) htab_t libfunc_decls; - /* Create a FUNCTION_DECL that can be passed to - targetm.encode_section_info. */ - /* ??? We don't have any type information except for this is - a function. Pretend this is "int foo()". */ - tree decl = build_decl (FUNCTION_DECL, get_identifier (name), - build_function_type (integer_type_node, NULL_TREE)); - DECL_ARTIFICIAL (decl) = 1; - DECL_EXTERNAL (decl) = 1; - TREE_PUBLIC (decl) = 1; +/* Hashtable callbacks for libfunc_decls. */ - symbol = XEXP (DECL_RTL (decl), 0); +static hashval_t +libfunc_decl_hash (const void *entry) +{ + return htab_hash_string (IDENTIFIER_POINTER (DECL_NAME ((const_tree) entry))); +} - /* Zap the nonsensical SYMBOL_REF_DECL for this. What we're left with - are the flags assigned by targetm.encode_section_info. */ - SET_SYMBOL_REF_DECL (symbol, 0); +static int +libfunc_decl_eq (const void *entry1, const void *entry2) +{ + return DECL_NAME ((const_tree) entry1) == (const_tree) entry2; +} - return symbol; +rtx +init_one_libfunc (const char *name) +{ + tree id, decl; + void **slot; + hashval_t hash; + + if (libfunc_decls == NULL) + libfunc_decls = htab_create_ggc (37, libfunc_decl_hash, + libfunc_decl_eq, NULL); + + /* See if we have already created a libfunc decl for this function. */ + id = get_identifier (name); + hash = htab_hash_string (name); + slot = htab_find_slot_with_hash (libfunc_decls, id, hash, INSERT); + decl = (tree) *slot; + if (decl == NULL) + { + /* Create a new decl, so that it can be passed to + targetm.encode_section_info. */ + /* ??? We don't have any type information except for this is + a function. Pretend this is "int foo()". */ + decl = build_decl (FUNCTION_DECL, get_identifier (name), + build_function_type (integer_type_node, NULL_TREE)); + DECL_ARTIFICIAL (decl) = 1; + DECL_EXTERNAL (decl) = 1; + TREE_PUBLIC (decl) = 1; + + /* Zap the nonsensical SYMBOL_REF_DECL for this. What we're left with + are the flags assigned by targetm.encode_section_info. */ + SET_SYMBOL_REF_DECL (XEXP (DECL_RTL (decl), 0), NULL); + + *slot = decl; + } + return XEXP (DECL_RTL (decl), 0); } /* Call this to reset the function entry for one optab (OPTABLE) in mode @@ -6026,7 +6056,7 @@ set_optab_libfunc (optab optable, enum machine_mode mode, const char *name) val = 0; slot = (struct libfunc_entry **) htab_find_slot (libfunc_hash, &e, INSERT); if (*slot == NULL) - *slot = ggc_alloc (sizeof (struct libfunc_entry)); + *slot = GGC_NEW (struct libfunc_entry); (*slot)->optab = (size_t) (optable - &optab_table[0]); (*slot)->mode1 = mode; (*slot)->mode2 = VOIDmode; @@ -6053,7 +6083,7 @@ set_conv_libfunc (convert_optab optable, enum machine_mode tmode, val = 0; slot = (struct libfunc_entry **) htab_find_slot (libfunc_hash, &e, INSERT); if (*slot == NULL) - *slot = ggc_alloc (sizeof (struct libfunc_entry)); + *slot = GGC_NEW (struct libfunc_entry); (*slot)->optab = (size_t) (optable - &convert_optab_table[0]); (*slot)->mode1 = tmode; (*slot)->mode2 = fmode; diff --git a/gcc/opts-common.c b/gcc/opts-common.c index 5a6786d1105..af8e44c6afb 100644 --- a/gcc/opts-common.c +++ b/gcc/opts-common.c @@ -131,8 +131,8 @@ void prune_options (int *argcp, char ***argvp) { int argc = *argcp; - int *options = xmalloc (argc * sizeof (*options)); - char **argv = xmalloc (argc * sizeof (char *)); + int *options = XNEWVEC (int, argc); + char **argv = XNEWVEC (char *, argc); int i, arg_count, need_prune = 0; const struct cl_option *option; size_t opt_index; diff --git a/gcc/opts.c b/gcc/opts.c index 6d6d380fdb7..226030bcde0 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -651,7 +651,7 @@ static void add_input_filename (const char *filename) { num_in_fnames++; - in_fnames = xrealloc (in_fnames, num_in_fnames * sizeof (in_fnames[0])); + in_fnames = XRESIZEVEC (const char *, in_fnames, num_in_fnames); in_fnames[num_in_fnames - 1] = filename; } @@ -1134,7 +1134,7 @@ print_filtered_help (unsigned int include_flags, } if (!printed) - printed = xcalloc (1, cl_options_count); + printed = XCNEWVAR (char, cl_options_count); for (i = 0; i < cl_options_count; i++) { @@ -2143,7 +2143,7 @@ get_option_state (int option, struct cl_option_state *state) state->data = *(const char **) cl_options[option].flag_var; if (state->data == 0) state->data = ""; - state->size = strlen (state->data) + 1; + state->size = strlen ((const char *) state->data) + 1; break; } return true; diff --git a/gcc/params.c b/gcc/params.c index 569ae47f040..2c653cf6157 100644 --- a/gcc/params.c +++ b/gcc/params.c @@ -40,8 +40,8 @@ void add_params (const param_info params[], size_t n) { /* Allocate enough space for the new parameters. */ - compiler_params = xrealloc (compiler_params, - (num_compiler_params + n) * sizeof (param_info)); + compiler_params = XRESIZEVEC (param_info, compiler_params, + num_compiler_params + n); /* Copy them into the table. */ memcpy (compiler_params + num_compiler_params, params, diff --git a/gcc/passes.c b/gcc/passes.c index e26bfb8dd4c..ca69454a3cc 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -349,7 +349,7 @@ set_pass_for_id (int id, struct opt_pass *pass) pass->static_pass_number = id; if (passes_by_id_size <= id) { - passes_by_id = xrealloc (passes_by_id, (id + 1) * sizeof (void *)); + passes_by_id = XRESIZEVEC (struct opt_pass *, passes_by_id, id + 1); memset (passes_by_id + passes_by_id_size, 0, (id + 1 - passes_by_id_size) * sizeof (void *)); passes_by_id_size = id + 1; @@ -452,7 +452,7 @@ next_pass_1 (struct opt_pass **list, struct opt_pass *pass) { struct opt_pass *new; - new = xmalloc (sizeof (*new)); + new = XNEW (struct opt_pass); memcpy (new, pass, sizeof (*new)); new->next = NULL; @@ -895,7 +895,7 @@ do_per_function_toporder (void (*callback) (void *data), void *data) else { gcc_assert (!order); - order = ggc_alloc (sizeof (*order) * cgraph_n_nodes); + order = GGC_NEWVEC (struct cgraph_node *, cgraph_n_nodes); nnodes = cgraph_postorder (order); for (i = nnodes - 1; i >= 0; i--) { @@ -1161,7 +1161,7 @@ pass_fini_dump_file (struct opt_pass *pass) static void update_properties_after_pass (void *data) { - struct opt_pass *pass = data; + struct opt_pass *pass = (struct opt_pass *) data; cfun->curr_properties = (cfun->curr_properties | pass->properties_provided) & ~pass->properties_destroyed; } diff --git a/gcc/postreload.c b/gcc/postreload.c index 527bd8b0bef..dcac71ba4d9 100644 --- a/gcc/postreload.c +++ b/gcc/postreload.c @@ -394,9 +394,9 @@ reload_cse_simplify_operands (rtx insn, rtx testreg) if (! constrain_operands (1)) fatal_insn_not_found (insn); - alternative_reject = alloca (recog_data.n_alternatives * sizeof (int)); - alternative_nregs = alloca (recog_data.n_alternatives * sizeof (int)); - alternative_order = alloca (recog_data.n_alternatives * sizeof (int)); + alternative_reject = XALLOCAVEC (int, recog_data.n_alternatives); + alternative_nregs = XALLOCAVEC (int, recog_data.n_alternatives); + alternative_order = XALLOCAVEC (int, recog_data.n_alternatives); memset (alternative_reject, 0, recog_data.n_alternatives * sizeof (int)); memset (alternative_nregs, 0, recog_data.n_alternatives * sizeof (int)); @@ -487,7 +487,7 @@ reload_cse_simplify_operands (rtx insn, rtx testreg) int regno; const char *p; - op_alt_regno[i] = alloca (recog_data.n_alternatives * sizeof (int)); + op_alt_regno[i] = XALLOCAVEC (int, recog_data.n_alternatives); for (j = 0; j < recog_data.n_alternatives; j++) op_alt_regno[i][j] = -1; diff --git a/gcc/predict.c b/gcc/predict.c index 2d6faf35679..ca7f9448d01 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -211,7 +211,7 @@ tree_predicted_by_p (const_basic_block bb, enum br_predictor predictor) if (!preds) return false; - for (i = *preds; i; i = i->ep_next) + for (i = (struct edge_prediction *) *preds; i; i = i->ep_next) if (i->ep_predictor == predictor) return true; return false; @@ -316,7 +316,7 @@ tree_predict_edge (edge e, enum br_predictor predictor, int probability) struct edge_prediction *i = XNEW (struct edge_prediction); void **preds = pointer_map_insert (bb_predictions, e->src); - i->ep_next = *preds; + i->ep_next = (struct edge_prediction *) *preds; *preds = i; i->ep_probability = probability; i->ep_predictor = predictor; @@ -366,7 +366,7 @@ clear_bb_predictions (basic_block bb) if (!preds) return; - for (pred = *preds; pred; pred = next) + for (pred = (struct edge_prediction *) *preds; pred; pred = next) { next = pred->ep_next; free (pred); @@ -638,7 +638,7 @@ combine_predictions_for_bb (basic_block bb) { /* We implement "first match" heuristics and use probability guessed by predictor with smallest index. */ - for (pred = *preds; pred; pred = pred->ep_next) + for (pred = (struct edge_prediction *) *preds; pred; pred = pred->ep_next) { int predictor = pred->ep_predictor; int probability = pred->ep_probability; @@ -688,7 +688,7 @@ combine_predictions_for_bb (basic_block bb) if (preds) { - for (pred = *preds; pred; pred = pred->ep_next) + for (pred = (struct edge_prediction *) *preds; pred; pred = pred->ep_next) { int predictor = pred->ep_predictor; int probability = pred->ep_probability; @@ -144,7 +144,7 @@ add_neighbor (int alloc_no, int neighbor) if (adjlist == NULL || adjlist->index == ADJACENCY_VEC_LENGTH) { - adjacency_t *new = pool_alloc (adjacency_pool); + adjacency_t *new = (adjacency_t *) pool_alloc (adjacency_pool); new->index = 0; new->next = adjlist; adjlist = new; diff --git a/gcc/recog.c b/gcc/recog.c index bf4c2b4a64f..a176ed30af6 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -145,8 +145,8 @@ check_asm_operands (rtx x) if (noperands == 0) return 1; - operands = alloca (noperands * sizeof (rtx)); - constraints = alloca (noperands * sizeof (char *)); + operands = XALLOCAVEC (rtx, noperands); + constraints = XALLOCAVEC (const char *, noperands); decode_asm_operands (x, operands, NULL, constraints, NULL, NULL); @@ -221,7 +221,7 @@ validate_change_1 (rtx object, rtx *loc, rtx new, bool in_group, bool unshare) else changes_allocated *= 2; - changes = xrealloc (changes, sizeof (change_t) * changes_allocated); + changes = XRESIZEVEC (change_t, changes, changes_allocated); } changes[num_changes].object = object; diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c index 5a6443bd1ab..ffa06fd5752 100644 --- a/gcc/reg-stack.c +++ b/gcc/reg-stack.c @@ -503,7 +503,7 @@ check_asm_stack_operands (rtx insn) if (GET_CODE (body) == PARALLEL) { - clobber_reg = alloca (XVECLEN (body, 0) * sizeof (rtx)); + clobber_reg = XALLOCAVEC (rtx, XVECLEN (body, 0)); for (i = 0; i < XVECLEN (body, 0); i++) if (GET_CODE (XVECEXP (body, 0, i)) == CLOBBER) @@ -2012,9 +2012,9 @@ subst_asm_stack_regs (rtx insn, stack regstack) for (i = 0, note = REG_NOTES (insn); note; note = XEXP (note, 1)) i++; - note_reg = alloca (i * sizeof (rtx)); - note_loc = alloca (i * sizeof (rtx *)); - note_kind = alloca (i * sizeof (enum reg_note)); + note_reg = XALLOCAVEC (rtx, i); + note_loc = XALLOCAVEC (rtx *, i); + note_kind = XALLOCAVEC (enum reg_note, i); n_notes = 0; for (note = REG_NOTES (insn); note; note = XEXP (note, 1)) @@ -2045,8 +2045,8 @@ subst_asm_stack_regs (rtx insn, stack regstack) if (GET_CODE (body) == PARALLEL) { - clobber_reg = alloca (XVECLEN (body, 0) * sizeof (rtx)); - clobber_loc = alloca (XVECLEN (body, 0) * sizeof (rtx *)); + clobber_reg = XALLOCAVEC (rtx, XVECLEN (body, 0)); + clobber_loc = XALLOCAVEC (rtx *, XVECLEN (body, 0)); for (i = 0; i < XVECLEN (body, 0); i++) if (GET_CODE (XVECEXP (body, 0, i)) == CLOBBER) diff --git a/gcc/regclass.c b/gcc/regclass.c index f72a80258b3..dab3377976c 100644 --- a/gcc/regclass.c +++ b/gcc/regclass.c @@ -1310,7 +1310,7 @@ regclass (rtx f, int nregs) init_recog (); - reg_renumber = xmalloc (max_regno * sizeof (short)); + reg_renumber = XNEWVEC (short, max_regno); reg_pref = XCNEWVEC (struct reg_pref, max_regno); memset (reg_renumber, -1, max_regno * sizeof (short)); @@ -2500,15 +2500,18 @@ static htab_t subregs_of_mode; static hashval_t som_hash (const void *x) { - const struct subregs_of_mode_node *a = x; + const struct subregs_of_mode_node *const a = + (const struct subregs_of_mode_node *) x; return a->block; } static int som_eq (const void *x, const void *y) { - const struct subregs_of_mode_node *a = x; - const struct subregs_of_mode_node *b = y; + const struct subregs_of_mode_node *const a = + (const struct subregs_of_mode_node *) x; + const struct subregs_of_mode_node *const b = + (const struct subregs_of_mode_node *) y; return a->block == b->block; } @@ -2533,7 +2536,7 @@ record_subregs_of_mode (rtx subreg) dummy.block = regno & -8; slot = htab_find_slot_with_hash (subregs_of_mode, &dummy, dummy.block, INSERT); - node = *slot; + node = (struct subregs_of_mode_node *) *slot; if (node == NULL) { node = XCNEW (struct subregs_of_mode_node); @@ -2605,7 +2608,8 @@ cannot_change_mode_set_regs (HARD_REG_SET *used, enum machine_mode from, gcc_assert (subregs_of_mode); dummy.block = regno & -8; - node = htab_find_with_hash (subregs_of_mode, &dummy, dummy.block); + node = (struct subregs_of_mode_node *) + htab_find_with_hash (subregs_of_mode, &dummy, dummy.block); if (node == NULL) return; @@ -2632,7 +2636,8 @@ invalid_mode_change_p (unsigned int regno, gcc_assert (subregs_of_mode); dummy.block = regno & -8; - node = htab_find_with_hash (subregs_of_mode, &dummy, dummy.block); + node = (struct subregs_of_mode_node *) + htab_find_with_hash (subregs_of_mode, &dummy, dummy.block); if (node == NULL) return false; diff --git a/gcc/regmove.c b/gcc/regmove.c index 81891b9661e..4a53defed24 100644 --- a/gcc/regmove.c +++ b/gcc/regmove.c @@ -916,7 +916,7 @@ reg_is_remote_constant_p (rtx reg, rtx insn) if (!reg_set_in_bb) { max_reg_computed = max = max_reg_num (); - reg_set_in_bb = xcalloc (max, sizeof (*reg_set_in_bb)); + reg_set_in_bb = XCNEWVEC (basic_block, max); FOR_EACH_BB (bb) FOR_BB_INSNS (bb, p) diff --git a/gcc/regrename.c b/gcc/regrename.c index cfc0881be1f..8e48ad58a94 100644 --- a/gcc/regrename.c +++ b/gcc/regrename.c @@ -189,7 +189,7 @@ regrename_optimize (void) memset (tick, 0, sizeof tick); gcc_obstack_init (&rename_obstack); - first_obj = obstack_alloc (&rename_obstack, 0); + first_obj = XOBNEWVAR (&rename_obstack, char, 0); FOR_EACH_BB (bb) { @@ -385,8 +385,7 @@ scan_rtx_reg (rtx insn, rtx *loc, enum reg_class cl, { if (type == OP_OUT) { - struct du_chain *this - = obstack_alloc (&rename_obstack, sizeof (struct du_chain)); + struct du_chain *this = XOBNEW (&rename_obstack, struct du_chain); this->next_use = 0; this->next_chain = open_chains; this->loc = loc; @@ -438,7 +437,7 @@ scan_rtx_reg (rtx insn, rtx *loc, enum reg_class cl, be replaced with, terminate the chain. */ if (cl != NO_REGS) { - this = obstack_alloc (&rename_obstack, sizeof (struct du_chain)); + this = XOBNEW (&rename_obstack, struct du_chain); this->next_use = 0; this->next_chain = (*p)->next_chain; this->loc = loc; @@ -813,7 +812,7 @@ build_def_use (basic_block bb) OP_IN, 0); for (i = 0; i < recog_data.n_dups; i++) - *recog_data.dup_loc[i] = copy_rtx (old_dups[i]); + *recog_data.dup_loc[i] = old_dups[i]; for (i = 0; i < n_ops; i++) *recog_data.operand_loc[i] = old_operands[i]; if (recog_data.n_dups) @@ -1165,7 +1164,7 @@ init_value_data (struct value_data *vd) static void kill_clobbered_value (rtx x, const_rtx set, void *data) { - struct value_data *vd = data; + struct value_data *const vd = (struct value_data *) data; if (GET_CODE (set) == CLOBBER) kill_value (x, vd); } @@ -1176,7 +1175,7 @@ kill_clobbered_value (rtx x, const_rtx set, void *data) static void kill_set_value (rtx x, const_rtx set, void *data) { - struct value_data *vd = data; + struct value_data *const vd = (struct value_data *) data; if (GET_CODE (set) != CLOBBER) { kill_value (x, vd); @@ -1193,7 +1192,7 @@ static int kill_autoinc_value (rtx *px, void *data) { rtx x = *px; - struct value_data *vd = data; + struct value_data *const vd = (struct value_data *) data; if (GET_RTX_CLASS (GET_CODE (x)) == RTX_AUTOINC) { diff --git a/gcc/regstat.c b/gcc/regstat.c index 26f96070472..2ec8c5bd739 100644 --- a/gcc/regstat.c +++ b/gcc/regstat.c @@ -60,7 +60,7 @@ regstat_init_n_sets_and_refs (void) df_grow_reg_info (); gcc_assert (!regstat_n_sets_and_refs); - regstat_n_sets_and_refs = xmalloc (max_regno * sizeof (struct regstat_n_sets_and_refs_t)); + regstat_n_sets_and_refs = XNEWVEC (struct regstat_n_sets_and_refs_t, max_regno); for (i = 0; i < max_regno; i++) { @@ -344,7 +344,7 @@ regstat_compute_ri (void) setjmp_crosses = BITMAP_ALLOC (&df_bitmap_obstack); max_regno = max_reg_num (); reg_info_p_size = max_regno; - reg_info_p = xcalloc (max_regno, sizeof (struct reg_info_t)); + reg_info_p = XCNEWVEC (struct reg_info_t, max_regno); FOR_EACH_BB (bb) { @@ -488,7 +488,7 @@ regstat_compute_calls_crossed (void) timevar_push (TV_REG_STATS); max_regno = max_reg_num (); reg_info_p_size = max_regno; - reg_info_p = xcalloc (max_regno, sizeof (struct reg_info_t)); + reg_info_p = XCNEWVEC (struct reg_info_t, max_regno); FOR_EACH_BB (bb) { diff --git a/gcc/reload1.c b/gcc/reload1.c index 48424abb68f..297acbf8aa5 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -498,7 +498,7 @@ init_reload (void) /* Initialize obstack for our rtl allocation. */ gcc_obstack_init (&reload_obstack); - reload_startobj = obstack_alloc (&reload_obstack, 0); + reload_startobj = XOBNEWVAR (&reload_obstack, char, 0); INIT_REG_SET (&spilled_pseudos); INIT_REG_SET (&pseudos_counted); @@ -515,7 +515,7 @@ new_insn_chain (void) if (unused_insn_chains == 0) { - c = obstack_alloc (&reload_obstack, sizeof (struct insn_chain)); + c = XOBNEW (&reload_obstack, struct insn_chain); INIT_REG_SET (&c->live_throughout); INIT_REG_SET (&c->dead_or_set); } @@ -633,7 +633,7 @@ has_nonexceptional_receiver (void) return true; /* First determine which blocks can reach exit via normal paths. */ - tos = worklist = xmalloc (sizeof (basic_block) * (n_basic_blocks + 1)); + tos = worklist = XNEWVEC (basic_block, n_basic_blocks + 1); FOR_EACH_BB (bb) bb->flags &= ~BB_REACHABLE; @@ -710,7 +710,7 @@ reload (rtx first, int global) failure = 0; - reload_firstobj = obstack_alloc (&reload_obstack, 0); + reload_firstobj = XOBNEWVAR (&reload_obstack, char, 0); /* Make sure that the last insn in the chain is not something that needs reloading. */ @@ -1031,7 +1031,7 @@ reload (rtx first, int global) { save_call_clobbered_regs (); /* That might have allocated new insn_chain structures. */ - reload_firstobj = obstack_alloc (&reload_obstack, 0); + reload_firstobj = XOBNEWVAR (&reload_obstack, char, 0); } calculate_needs_all_insns (global); @@ -1500,10 +1500,9 @@ static void copy_reloads (struct insn_chain *chain) { chain->n_reloads = n_reloads; - chain->rld = obstack_alloc (&reload_obstack, - n_reloads * sizeof (struct reload)); + chain->rld = XOBNEWVEC (&reload_obstack, struct reload, n_reloads); memcpy (chain->rld, rld, n_reloads * sizeof (struct reload)); - reload_insn_firstobj = obstack_alloc (&reload_obstack, 0); + reload_insn_firstobj = XOBNEWVAR (&reload_obstack, char, 0); } /* Walk the chain of insns, and determine for each whether it needs reloads @@ -1517,7 +1516,7 @@ calculate_needs_all_insns (int global) something_needs_elimination = 0; - reload_insn_firstobj = obstack_alloc (&reload_obstack, 0); + reload_insn_firstobj = XOBNEWVAR (&reload_obstack, char, 0); for (chain = reload_insn_chain; chain != 0; chain = next) { rtx insn = chain->insn; @@ -3696,7 +3695,9 @@ elimination_target_reg_p (rtx x) return false; } -/* Initialize the table of registers to eliminate. */ +/* Initialize the table of registers to eliminate. + Pre-condition: global flag frame_pointer_needed has been set before + calling this function. */ static void init_elim_table (void) @@ -3707,20 +3708,7 @@ init_elim_table (void) #endif if (!reg_eliminate) - reg_eliminate = xcalloc (sizeof (struct elim_table), NUM_ELIMINABLE_REGS); - - /* Does this function require a frame pointer? */ - - frame_pointer_needed = (! flag_omit_frame_pointer - /* ?? If EXIT_IGNORE_STACK is set, we will not save - and restore sp for alloca. So we can't eliminate - the frame pointer in that case. At some point, - we should improve this by emitting the - sp-adjusting insns for this case. */ - || (cfun->calls_alloca - && EXIT_IGNORE_STACK) - || crtl->accesses_prior_frames - || FRAME_POINTER_REQUIRED); + reg_eliminate = XCNEWVEC (struct elim_table, NUM_ELIMINABLE_REGS); num_eliminable = 0; diff --git a/gcc/reorg.c b/gcc/reorg.c index c20c337d944..7135a188574 100644 --- a/gcc/reorg.c +++ b/gcc/reorg.c @@ -3834,7 +3834,7 @@ dbr_schedule (rtx first) epilogue_insn = insn; } - uid_to_ruid = xmalloc ((max_uid + 1) * sizeof (int)); + uid_to_ruid = XNEWVEC (int, max_uid + 1); for (i = 0, insn = first; insn; i++, insn = NEXT_INSN (insn)) uid_to_ruid[INSN_UID (insn)] = i; @@ -3842,7 +3842,7 @@ dbr_schedule (rtx first) if (unfilled_firstobj == 0) { gcc_obstack_init (&unfilled_slots_obstack); - unfilled_firstobj = obstack_alloc (&unfilled_slots_obstack, 0); + unfilled_firstobj = XOBNEWVAR (&unfilled_slots_obstack, rtx, 0); } for (insn = next_active_insn (first); insn; insn = next_active_insn (insn)) @@ -3917,7 +3917,7 @@ dbr_schedule (rtx first) obstack_free (&unfilled_slots_obstack, unfilled_firstobj); /* It is not clear why the line below is needed, but it does seem to be. */ - unfilled_firstobj = obstack_alloc (&unfilled_slots_obstack, 0); + unfilled_firstobj = XOBNEWVAR (&unfilled_slots_obstack, rtx, 0); if (dump_file) { diff --git a/gcc/rtl-factoring.c b/gcc/rtl-factoring.c index 128c99087a5..07c66e20cc3 100644 --- a/gcc/rtl-factoring.c +++ b/gcc/rtl-factoring.c @@ -323,14 +323,14 @@ compute_rtx_cost (rtx insn) tmp_bucket.hash = compute_hash (insn); /* Select the hash group. */ - bucket = htab_find (hash_buckets, &tmp_bucket); + bucket = (p_hash_bucket) htab_find (hash_buckets, &tmp_bucket); if (bucket) { tmp_elem.insn = insn; /* Select the insn. */ - elem = htab_find (bucket->seq_candidates, &tmp_elem); + elem = (p_hash_elem) htab_find (bucket->seq_candidates, &tmp_elem); /* If INSN is parsed the cost will be the cached length. */ if (elem) @@ -1319,7 +1319,7 @@ fill_hash_bucket (void) tmp_bucket.hash = compute_hash (insn); /* Select the hash group. */ - bucket = htab_find (hash_buckets, &tmp_bucket); + bucket = (p_hash_bucket) htab_find (hash_buckets, &tmp_bucket); if (!bucket) { diff --git a/gcc/rtl.c b/gcc/rtl.c index edf393f29d2..6d53a7800d1 100644 --- a/gcc/rtl.c +++ b/gcc/rtl.c @@ -323,7 +323,7 @@ shallow_copy_rtx_stat (const_rtx orig MEM_STAT_DECL) { const unsigned int size = rtx_size (orig); rtx const copy = (rtx) ggc_alloc_zone_pass_stat (size, &rtl_zone); - return memcpy (copy, orig, size); + return (rtx) memcpy (copy, orig, size); } /* Nonzero when we are generating CONCATs. */ diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index 56311d970e9..dec7daf0e3d 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -3266,7 +3266,7 @@ struct parms_set_data static void parms_set (rtx x, const_rtx pat ATTRIBUTE_UNUSED, void *data) { - struct parms_set_data *d = data; + struct parms_set_data *const d = (struct parms_set_data *) data; if (REG_P (x) && REGNO (x) < FIRST_PSEUDO_REGISTER && TEST_HARD_REG_BIT (d->regs, REGNO (x))) { diff --git a/gcc/sbitmap.c b/gcc/sbitmap.c index cab4ec0e0ed..689cf975576 100644 --- a/gcc/sbitmap.c +++ b/gcc/sbitmap.c @@ -79,7 +79,7 @@ sbitmap_alloc (unsigned int n_elms) bytes = size * sizeof (SBITMAP_ELT_TYPE); amt = (sizeof (struct simple_bitmap_def) + bytes - sizeof (SBITMAP_ELT_TYPE)); - bmap = xmalloc (amt); + bmap = (sbitmap) xmalloc (amt); bmap->n_bits = n_elms; bmap->size = size; bmap->popcount = NULL; @@ -92,7 +92,7 @@ sbitmap sbitmap_alloc_with_popcount (unsigned int n_elms) { sbitmap const bmap = sbitmap_alloc (n_elms); - bmap->popcount = xmalloc (bmap->size * sizeof (unsigned char)); + bmap->popcount = XNEWVEC (unsigned char, bmap->size); return bmap; } @@ -112,10 +112,9 @@ sbitmap_resize (sbitmap bmap, unsigned int n_elms, int def) { amt = (sizeof (struct simple_bitmap_def) + bytes - sizeof (SBITMAP_ELT_TYPE)); - bmap = xrealloc (bmap, amt); + bmap = (sbitmap) xrealloc (bmap, amt); if (bmap->popcount) - bmap->popcount = xrealloc (bmap->popcount, - size * sizeof (unsigned char)); + bmap->popcount = XRESIZEVEC (unsigned char, bmap->popcount, size); } if (n_elms > bmap->n_bits) @@ -218,7 +217,7 @@ sbitmap_vector_alloc (unsigned int n_vecs, unsigned int n_elms) } amt = vector_bytes + (n_vecs * elm_bytes); - bitmap_vector = xmalloc (amt); + bitmap_vector = (sbitmap *) xmalloc (amt); for (i = 0, offset = vector_bytes; i < n_vecs; i++, offset += elm_bytes) { diff --git a/gcc/sched-ebb.c b/gcc/sched-ebb.c index 7e22874601c..58a89346cf0 100644 --- a/gcc/sched-ebb.c +++ b/gcc/sched-ebb.c @@ -335,7 +335,7 @@ earliest_block_with_similiar_load (basic_block last_block, rtx load_insn) /* insn2 not guaranteed to be a 1 base reg load. */ continue; - for (bb = last_block; bb; bb = bb->aux) + for (bb = last_block; bb; bb = (basic_block) bb->aux) if (insn2_block == bb) break; @@ -382,7 +382,7 @@ add_deps_for_risky_insns (rtx head, rtx tail) bb = earliest_block_with_similiar_load (last_block, insn); if (bb) { - bb = bb->aux; + bb = (basic_block) bb->aux; if (!bb) break; prev = BB_END (bb); @@ -436,7 +436,7 @@ add_deps_for_risky_insns (rtx head, rtx tail) /* Maintain the invariant that bb->aux is clear after use. */ while (last_block) { - bb = last_block->aux; + bb = (basic_block) last_block->aux; last_block->aux = NULL; last_block = bb; } diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c index ca090dea4da..abb2c8d6f6c 100644 --- a/gcc/sched-rgn.c +++ b/gcc/sched-rgn.c @@ -700,7 +700,7 @@ find_rgns (void) extend_regions_p = PARAM_VALUE (PARAM_MAX_SCHED_EXTEND_REGIONS_ITERS) > 0; if (extend_regions_p) { - degree1 = xmalloc (last_basic_block * sizeof (int)); + degree1 = XNEWVEC (int, last_basic_block); extended_rgn_header = sbitmap_alloc (last_basic_block); sbitmap_zero (extended_rgn_header); } @@ -990,7 +990,7 @@ gather_region_statistics (int **rsp) if (nr_blocks > a_sz) { - a = xrealloc (a, nr_blocks * sizeof (*a)); + a = XRESIZEVEC (int, a, nr_blocks); do a[a_sz++] = 0; while (a_sz != nr_blocks); @@ -1047,9 +1047,9 @@ extend_rgns (int *degree, int *idxp, sbitmap header, int *loop_hdr) max_iter = PARAM_VALUE (PARAM_MAX_SCHED_EXTEND_REGIONS_ITERS); - max_hdr = xmalloc (last_basic_block * sizeof (*max_hdr)); + max_hdr = XNEWVEC (int, last_basic_block); - order = xmalloc (last_basic_block * sizeof (*order)); + order = XNEWVEC (int, last_basic_block); post_order_compute (order, false, false); for (i = nblocks - 1; i >= 0; i--) @@ -2685,7 +2685,7 @@ schedule_region (int rgn) current_blocks = RGN_BLOCKS (rgn); /* See comments in add_block1, for what reasons we allocate +1 element. */ - ebb_head = xrealloc (ebb_head, (current_nr_blocks + 1) * sizeof (*ebb_head)); + ebb_head = XRESIZEVEC (int, ebb_head, current_nr_blocks + 1); for (bb = 0; bb <= current_nr_blocks; bb++) ebb_head[bb] = current_blocks + bb; diff --git a/gcc/sdbout.c b/gcc/sdbout.c index 6d9689ceff0..8836a975e38 100644 --- a/gcc/sdbout.c +++ b/gcc/sdbout.c @@ -1636,7 +1636,7 @@ sdbout_start_source_file (unsigned int line ATTRIBUTE_UNUSED, const char *filename ATTRIBUTE_UNUSED) { #ifdef MIPS_DEBUGGING_INFO - struct sdb_file *n = xmalloc (sizeof *n); + struct sdb_file *n = XNEW (struct sdb_file); n->next = current_file; n->name = filename; @@ -1668,7 +1668,7 @@ sdbout_init (const char *input_file_name ATTRIBUTE_UNUSED) tree t; #ifdef MIPS_DEBUGGING_INFO - current_file = xmalloc (sizeof *current_file); + current_file = XNEW (struct sdb_file); current_file->next = NULL; current_file->name = input_file_name; #endif diff --git a/gcc/see.c b/gcc/see.c index 2d664e17cfb..3dfaa41245f 100644 --- a/gcc/see.c +++ b/gcc/see.c @@ -807,8 +807,10 @@ see_gen_normalized_extension (rtx reg, enum rtx_code extension_code, static int eq_descriptor_pre_extension (const void *p1, const void *p2) { - const struct see_pre_extension_expr *extension1 = p1; - const struct see_pre_extension_expr *extension2 = p2; + const struct see_pre_extension_expr *const extension1 = + (const struct see_pre_extension_expr *) p1; + const struct see_pre_extension_expr *const extension2 = + (const struct see_pre_extension_expr *) p2; rtx set1 = single_set (extension1->se_insn); rtx set2 = single_set (extension2->se_insn); rtx rhs1, rhs2; @@ -828,7 +830,8 @@ eq_descriptor_pre_extension (const void *p1, const void *p2) static hashval_t hash_descriptor_pre_extension (const void *p) { - const struct see_pre_extension_expr *extension = p; + const struct see_pre_extension_expr *const extension = + (const struct see_pre_extension_expr *) p; rtx set = single_set (extension->se_insn); rtx rhs; @@ -846,7 +849,8 @@ hash_descriptor_pre_extension (const void *p) static void hash_del_pre_extension (void *p) { - struct see_pre_extension_expr *extension = p; + struct see_pre_extension_expr *const extension = + (struct see_pre_extension_expr *) p; struct see_occr *curr_occr = extension->antic_occr; struct see_occr *next_occr = NULL; @@ -884,8 +888,10 @@ hash_del_pre_extension (void *p) static int eq_descriptor_properties (const void *p1, const void *p2) { - const struct see_register_properties *curr_prop1 = p1; - const struct see_register_properties *curr_prop2 = p2; + const struct see_register_properties *const curr_prop1 = + (const struct see_register_properties *) p1; + const struct see_register_properties *const curr_prop2 = + (const struct see_register_properties *) p2; return curr_prop1->regno == curr_prop2->regno; } @@ -897,7 +903,8 @@ eq_descriptor_properties (const void *p1, const void *p2) static hashval_t hash_descriptor_properties (const void *p) { - const struct see_register_properties *curr_prop = p; + const struct see_register_properties *const curr_prop = + (const struct see_register_properties *) p; return curr_prop->regno; } @@ -906,7 +913,8 @@ hash_descriptor_properties (const void *p) static void hash_del_properties (void *p) { - struct see_register_properties *curr_prop = p; + struct see_register_properties *const curr_prop = + (struct see_register_properties *) p; free (curr_prop); } @@ -1031,7 +1039,7 @@ see_seek_pre_extension_expr (rtx extension, enum extension_type type) /* This is the first time this extension instruction is encountered. Store it in the hash. */ { - (*slot_pre_exp) = xmalloc (sizeof (struct see_pre_extension_expr)); + (*slot_pre_exp) = XNEW (struct see_pre_extension_expr); (*slot_pre_exp)->se_insn = extension; (*slot_pre_exp)->bitmap_index = (htab_elements (see_pre_extension_hash) - 1); @@ -1352,16 +1360,16 @@ see_initialize_data_structures (void) } /* Allocate web entries array for the union-find data structure. */ - def_entry = xcalloc (defs_num, sizeof (struct web_entry)); - use_entry = xcalloc (uses_num, sizeof (struct web_entry)); + def_entry = XCNEWVEC (struct web_entry, defs_num); + use_entry = XCNEWVEC (struct web_entry, uses_num); /* Allocate an array of splay trees. One splay tree for each basic block. */ - see_bb_splay_ar = xcalloc (last_bb, sizeof (splay_tree)); + see_bb_splay_ar = XCNEWVEC (splay_tree, last_bb); /* Allocate an array of hashes. One hash for each basic block. */ - see_bb_hash_ar = xcalloc (last_bb, sizeof (htab_t)); + see_bb_hash_ar = XCNEWVEC (htab_t, last_bb); /* Allocate the extension hash. It will hold the extensions that we want to PRE. */ @@ -1478,7 +1486,8 @@ see_want_to_be_merged_with_extension (rtx ref, rtx extension, static int see_print_register_properties (void **slot, void *b ATTRIBUTE_UNUSED) { - struct see_register_properties *prop = *slot; + const struct see_register_properties *const prop = + (const struct see_register_properties *) *slot; gcc_assert (prop); fprintf (dump_file, "Property found for register %d\n", prop->regno); @@ -1495,7 +1504,8 @@ see_print_register_properties (void **slot, void *b ATTRIBUTE_UNUSED) static int see_print_pre_extension_expr (void **slot, void *b ATTRIBUTE_UNUSED) { - struct see_pre_extension_expr *pre_extension = *slot; + const struct see_pre_extension_expr *const pre_extension = + (const struct see_pre_extension_expr *) *slot; gcc_assert (pre_extension && pre_extension->se_insn @@ -1520,7 +1530,7 @@ see_print_pre_extension_expr (void **slot, void *b ATTRIBUTE_UNUSED) static int see_delete_merged_def_extension (void **slot, void *b ATTRIBUTE_UNUSED) { - rtx def_se = *slot; + rtx def_se = (rtx) *slot; if (dump_file) { @@ -1548,7 +1558,7 @@ see_delete_merged_def_extension (void **slot, void *b ATTRIBUTE_UNUSED) static int see_delete_unmerged_def_extension (void **slot, void *b ATTRIBUTE_UNUSED) { - rtx def_se = *slot; + rtx def_se = (rtx) *slot; if (dump_file) { @@ -1571,7 +1581,7 @@ see_delete_unmerged_def_extension (void **slot, void *b ATTRIBUTE_UNUSED) static int see_emit_use_extension (void **slot, void *b) { - rtx use_se = *slot; + rtx use_se = (rtx) *slot; struct see_ref_s *curr_ref_s = (struct see_ref_s *) b; if (INSN_DELETED_P (use_se)) @@ -1737,7 +1747,8 @@ see_pre_insert_extensions (struct see_pre_extension_expr **index_map) static int see_pre_delete_extension (void **slot, void *b ATTRIBUTE_UNUSED) { - struct see_pre_extension_expr *expr = *slot; + struct see_pre_extension_expr *const expr = + (struct see_pre_extension_expr *) *slot; struct see_occr *occr; int indx = expr->bitmap_index; @@ -1768,8 +1779,9 @@ see_pre_delete_extension (void **slot, void *b ATTRIBUTE_UNUSED) static int see_map_extension (void **slot, void *b) { - struct see_pre_extension_expr *expr = *slot; - struct see_pre_extension_expr **index_map = + struct see_pre_extension_expr *const expr = + (struct see_pre_extension_expr *) *slot; + struct see_pre_extension_expr **const index_map = (struct see_pre_extension_expr **) b; index_map[expr->bitmap_index] = expr; @@ -1792,8 +1804,7 @@ see_commit_changes (void) bool did_insert = false; int i; - index_map = xcalloc (pre_extension_num, - sizeof (struct see_pre_extension_expr *)); + index_map = XCNEWVEC (struct see_pre_extension_expr *, pre_extension_num); if (dump_file) fprintf (dump_file, @@ -1842,7 +1853,7 @@ see_commit_changes (void) static int see_analyze_merged_def_local_prop (void **slot, void *b) { - rtx def_se = *slot; + rtx def_se = (rtx) *slot; struct see_ref_s *curr_ref_s = (struct see_ref_s *) b; rtx ref = curr_ref_s->insn; struct see_pre_extension_expr *extension_expr; @@ -1880,7 +1891,7 @@ see_analyze_merged_def_local_prop (void **slot, void *b) /* Set the available bit. */ SET_BIT (comp[bb_num], indx); /* Record the available occurrence. */ - curr_occr = xmalloc (sizeof (struct see_occr)); + curr_occr = XNEW (struct see_occr); curr_occr->next = NULL; curr_occr->insn = def_se; curr_occr->block_num = bb_num; @@ -1910,7 +1921,7 @@ see_analyze_merged_def_local_prop (void **slot, void *b) static int see_analyze_unmerged_def_local_prop (void **slot, void *b) { - rtx def_se = *slot; + rtx def_se = (rtx) *slot; struct see_ref_s *curr_ref_s = (struct see_ref_s *) b; rtx ref = curr_ref_s->insn; struct see_pre_extension_expr *extension_expr; @@ -1958,7 +1969,7 @@ static int see_analyze_use_local_prop (void **slot, void *b) { struct see_ref_s *curr_ref_s = (struct see_ref_s *) b; - rtx use_se = *slot; + rtx use_se = (rtx) *slot; rtx ref = curr_ref_s->insn; rtx dest_extension_reg = see_get_extension_reg (use_se, 1); struct see_pre_extension_expr *extension_expr; @@ -1990,7 +2001,7 @@ see_analyze_use_local_prop (void **slot, void *b) /* Set the anticipatable bit. */ SET_BIT (antloc[bb_num], indx); /* Record the anticipatable occurrence. */ - curr_occr = xmalloc (sizeof (struct see_occr)); + curr_occr = XNEW (struct see_occr); curr_occr->next = NULL; curr_occr->insn = use_se; curr_occr->block_num = bb_num; @@ -2008,7 +2019,7 @@ see_analyze_use_local_prop (void **slot, void *b) /* Set the available bit. */ SET_BIT (comp[bb_num], indx); /* Record the available occurrence. */ - curr_occr = xmalloc (sizeof (struct see_occr)); + curr_occr = XNEW (struct see_occr); curr_occr->next = NULL; curr_occr->insn = use_se; curr_occr->block_num = bb_num; @@ -2032,7 +2043,7 @@ see_analyze_use_local_prop (void **slot, void *b) /* Reset the killed bit. */ RESET_BIT (ae_kill[bb_num], indx); /* Record the available occurrence. */ - curr_occr = xmalloc (sizeof (struct see_occr)); + curr_occr = XNEW (struct see_occr); curr_occr->next = NULL; curr_occr->insn = use_se; curr_occr->block_num = bb_num; @@ -2155,7 +2166,7 @@ see_execute_LCM (void) static int see_set_prop_merged_def (void **slot, void *b) { - rtx def_se = *slot; + rtx def_se = (rtx) *slot; struct see_ref_s *curr_ref_s = (struct see_ref_s *) b; rtx insn = curr_ref_s->insn; rtx dest_extension_reg = see_get_extension_reg (def_se, 1); @@ -2194,7 +2205,7 @@ see_set_prop_merged_def (void **slot, void *b) else { /* Property doesn't exist yet. */ - curr_prop = xmalloc (sizeof (struct see_register_properties)); + curr_prop = XNEW (struct see_register_properties); curr_prop->regno = REGNO (dest_extension_reg); curr_prop->last_def = ref_luid; curr_prop->first_se_before_any_def = -1; @@ -2226,7 +2237,7 @@ see_set_prop_merged_def (void **slot, void *b) static int see_set_prop_unmerged_def (void **slot, void *b) { - rtx def_se = *slot; + rtx def_se = (rtx) *slot; struct see_ref_s *curr_ref_s = (struct see_ref_s *) b; rtx insn = curr_ref_s->insn; rtx dest_extension_reg = see_get_extension_reg (def_se, 1); @@ -2265,7 +2276,7 @@ see_set_prop_unmerged_def (void **slot, void *b) else { /* Property doesn't exist yet. */ - curr_prop = xmalloc (sizeof (struct see_register_properties)); + curr_prop = XNEW (struct see_register_properties); curr_prop->regno = REGNO (dest_extension_reg); curr_prop->last_def = ref_luid; curr_prop->first_se_before_any_def = -1; @@ -2299,7 +2310,7 @@ see_set_prop_unmerged_def (void **slot, void *b) static int see_set_prop_unmerged_use (void **slot, void *b) { - rtx use_se = *slot; + rtx use_se = (rtx) *slot; struct see_ref_s *curr_ref_s = (struct see_ref_s *) b; rtx insn = curr_ref_s->insn; rtx dest_extension_reg = see_get_extension_reg (use_se, 1); @@ -2359,7 +2370,7 @@ see_set_prop_unmerged_use (void **slot, void *b) else { /* Property doesn't exist yet. Create a new one. */ - curr_prop = xmalloc (sizeof (struct see_register_properties)); + curr_prop = XNEW (struct see_register_properties); curr_prop->regno = REGNO (dest_extension_reg); curr_prop->last_def = -1; curr_prop->first_se_before_any_def = ref_luid; @@ -2389,7 +2400,7 @@ see_set_prop_unmerged_use (void **slot, void *b) static int see_print_one_extension (void **slot, void *b ATTRIBUTE_UNUSED) { - rtx def_se = *slot; + rtx def_se = (rtx) *slot; gcc_assert (def_se && INSN_P (def_se)); print_rtl_single (dump_file, def_se); @@ -2619,7 +2630,7 @@ static int see_merge_one_use_extension (void **slot, void *b) { struct see_ref_s *curr_ref_s = (struct see_ref_s *) b; - rtx use_se = *slot; + rtx use_se = (rtx) *slot; rtx ref = curr_ref_s->merged_insn ? curr_ref_s->merged_insn : curr_ref_s->insn; rtx merged_ref_next = curr_ref_s->merged_insn @@ -2780,7 +2791,7 @@ static int see_merge_one_def_extension (void **slot, void *b) { struct see_ref_s *curr_ref_s = (struct see_ref_s *) b; - rtx def_se = *slot; + rtx def_se = (rtx) *slot; /* If the original insn was already merged with an extension before, take the merged one. */ rtx ref = curr_ref_s->merged_insn @@ -3160,7 +3171,7 @@ see_store_reference_and_extension (rtx ref_insn, rtx se_insn, tree. */ if (!stn) { - ref_s = xmalloc (sizeof (struct see_ref_s)); + ref_s = XNEW (struct see_ref_s); ref_s->luid = DF_INSN_LUID (ref_insn); ref_s->insn = ref_insn; ref_s->merged_insn = NULL; @@ -3409,7 +3420,7 @@ see_update_uses_relevancy (rtx insn, struct df_ref *ref, } DF_REF_ID (ref) = index; - curr_entry_extra_info = xmalloc (sizeof (struct see_entry_extra_info)); + curr_entry_extra_info = XNEW (struct see_entry_extra_info); curr_entry_extra_info->relevancy = et; curr_entry_extra_info->local_relevancy = et; use_entry[index].extra_info = curr_entry_extra_info; @@ -3583,7 +3594,7 @@ see_update_defs_relevancy (rtx insn, struct df_ref *ref, unsigned int index) { struct see_entry_extra_info *curr_entry_extra_info - = xmalloc (sizeof (struct see_entry_extra_info)); + = XNEW (struct see_entry_extra_info); curr_entry_extra_info->relevancy = et; curr_entry_extra_info->local_relevancy = et; diff --git a/gcc/statistics.c b/gcc/statistics.c index 1f0090c7e7b..d2f665f3b20 100644 --- a/gcc/statistics.c +++ b/gcc/statistics.c @@ -53,7 +53,7 @@ static unsigned nr_statistics_hashes; static hashval_t hash_statistics_hash (const void *p) { - statistics_counter_t *c = (statistics_counter_t *)p; + const statistics_counter_t *const c = (const statistics_counter_t *)p; return htab_hash_string (c->id) + c->val; } @@ -62,8 +62,8 @@ hash_statistics_hash (const void *p) static int hash_statistics_eq (const void *p, const void *q) { - statistics_counter_t *c1 = (statistics_counter_t *)p; - statistics_counter_t *c2 = (statistics_counter_t *)q; + const statistics_counter_t *const c1 = (const statistics_counter_t *)p; + const statistics_counter_t *const c2 = (const statistics_counter_t *)q; return c1->val == c2->val && strcmp (c1->id, c2->id) == 0; } @@ -72,7 +72,7 @@ hash_statistics_eq (const void *p, const void *q) static void hash_statistics_free (void *p) { - free ((void *)((statistics_counter_t *)p)->id); + free (CONST_CAST(char *, ((statistics_counter_t *)p)->id)); free (p); } @@ -90,8 +90,7 @@ curr_statistics_hash (void) if (idx >= nr_statistics_hashes) { - statistics_hashes = xrealloc (statistics_hashes, - (idx + 1) * sizeof (htab_t)); + statistics_hashes = XRESIZEVEC (struct htab *, statistics_hashes, idx+1); memset (statistics_hashes + nr_statistics_hashes, 0, (idx + 1 - nr_statistics_hashes) * sizeof (htab_t)); nr_statistics_hashes = idx + 1; diff --git a/gcc/stmt.c b/gcc/stmt.c index 2908f082ea3..af02f3402ce 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -333,7 +333,7 @@ parse_output_constraint (const char **constraint_p, int operand_num, *p, operand_num); /* Make a copy of the constraint. */ - buf = alloca (c_len + 1); + buf = XALLOCAVEC (char, c_len + 1); strcpy (buf, constraint); /* Swap the first character and the `=' or `+'. */ buf[p - constraint] = buf[0]; @@ -565,7 +565,7 @@ decl_overlaps_hard_reg_set_p (tree *declp, int *walk_subtrees ATTRIBUTE_UNUSED, void *data) { tree decl = *declp; - const HARD_REG_SET *regs = data; + const HARD_REG_SET *const regs = (const HARD_REG_SET *) data; if (TREE_CODE (decl) == VAR_DECL) { @@ -651,13 +651,11 @@ expand_asm_operands (tree string, tree outputs, tree inputs, tree t; int i; /* Vector of RTX's of evaluated output operands. */ - rtx *output_rtx = alloca (noutputs * sizeof (rtx)); - int *inout_opnum = alloca (noutputs * sizeof (int)); - rtx *real_output_rtx = alloca (noutputs * sizeof (rtx)); - enum machine_mode *inout_mode - = alloca (noutputs * sizeof (enum machine_mode)); - const char **constraints - = alloca ((noutputs + ninputs) * sizeof (const char *)); + rtx *output_rtx = XALLOCAVEC (rtx, noutputs); + int *inout_opnum = XALLOCAVEC (int, noutputs); + rtx *real_output_rtx = XALLOCAVEC (rtx, noutputs); + enum machine_mode *inout_mode = XALLOCAVEC (enum machine_mode, noutputs); + const char **constraints = XALLOCAVEC (const char *, noutputs + ninputs); int old_generating_concat_p = generating_concat_p; /* An ASM with no outputs needs to be treated as volatile, for now. */ @@ -1616,7 +1614,7 @@ expand_return (tree retval) int n_regs = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD; unsigned int bitsize = MIN (TYPE_ALIGN (TREE_TYPE (retval_rhs)), BITS_PER_WORD); - rtx *result_pseudos = alloca (sizeof (rtx) * n_regs); + rtx *result_pseudos = XALLOCAVEC (rtx, n_regs); rtx result_reg, src = NULL_RTX, dst = NULL_RTX; rtx result_val = expand_normal (retval_rhs); enum machine_mode tmpmode, result_reg_mode; @@ -2182,8 +2180,8 @@ bool lshift_cheap_p (void) static int case_bit_test_cmp (const void *p1, const void *p2) { - const struct case_bit_test *d1 = p1; - const struct case_bit_test *d2 = p2; + const struct case_bit_test *const d1 = (const struct case_bit_test *) p1; + const struct case_bit_test *const d2 = (const struct case_bit_test *) p2; if (d2->bits != d1->bits) return d2->bits - d1->bits; @@ -2547,7 +2545,7 @@ expand_case (tree exp) /* Get table of labels to jump to, in order of case index. */ ncases = tree_low_cst (range, 0) + 1; - labelvec = alloca (ncases * sizeof (rtx)); + labelvec = XALLOCAVEC (rtx, ncases); memset (labelvec, 0, ncases * sizeof (rtx)); for (n = case_list; n; n = n->right) diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 41c8fefc108..2b48ea60370 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -506,7 +506,7 @@ relayout_decl (tree decl) record_layout_info start_record_layout (tree t) { - record_layout_info rli = xmalloc (sizeof (struct record_layout_info_s)); + record_layout_info rli = XNEW (struct record_layout_info_s); rli->t = t; diff --git a/gcc/stringpool.c b/gcc/stringpool.c index cc2dd35368d..9146fbf4f7d 100644 --- a/gcc/stringpool.c +++ b/gcc/stringpool.c @@ -93,7 +93,7 @@ ggc_alloc_string (const char *contents, int length) if (length == 1 && ISDIGIT (contents[0])) return digit_string (contents[0] - '0'); - result = ggc_alloc (length + 1); + result = GGC_NEWVAR (char, length + 1); memcpy (result, contents, length + 1); return (const char *) result; } @@ -207,8 +207,8 @@ gt_pch_p_S (void *obj ATTRIBUTE_UNUSED, void *x ATTRIBUTE_UNUSED, void gt_pch_n_S (const void *x) { - gt_pch_note_object ((void *)x, (void *)x, >_pch_p_S, - gt_types_enum_last); + gt_pch_note_object (CONST_CAST (void *, x), CONST_CAST (void *, x), + >_pch_p_S, gt_types_enum_last); } /* Handle saving and restoring the string pool for PCH. */ @@ -234,10 +234,10 @@ static GTY(()) struct string_pool_data * spd; void gt_pch_save_stringpool (void) { - spd = ggc_alloc (sizeof (*spd)); + spd = GGC_NEW (struct string_pool_data); spd->nslots = ident_hash->nslots; spd->nelements = ident_hash->nelements; - spd->entries = ggc_alloc (sizeof (spd->entries[0]) * spd->nslots); + spd->entries = GGC_NEWVEC (struct ht_identifier *, spd->nslots); memcpy (spd->entries, ident_hash->entries, spd->nslots * sizeof (spd->entries[0])); } diff --git a/gcc/system.h b/gcc/system.h index 6b121f2ec9e..75caa67e7a1 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -806,11 +806,9 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; #define CONST_CAST_RTX(X) CONST_CAST(struct rtx_def *, (X)) #define CONST_CAST_BB(X) CONST_CAST(struct basic_block_def *, (X)) -/* Activate -Wcast-qual and -Wc++-compat as warnings (not errors via - the -Werror flag). */ +/* Activate certain diagnostics as warnings (not errors via the + -Werror flag). */ #if GCC_VERSION >= 4003 -#pragma GCC diagnostic warning "-Wcast-qual" -#pragma GCC diagnostic warning "-Wc++-compat" /* If asserts are disabled, activate -Wuninitialized as a warning (not an error/-Werror). */ #ifndef ENABLE_ASSERT_CHECKING diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6bcc8e70ead..07999bd2384 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,136 @@ +2008-06-30 Andy Hutchinson <hutchinsonandy@aim.com> + + PR target/36598 + * gcc.dg/memcpy-1.c: Mark test XFAIL for avr target. + +2008-06-30 Uros Bizjak <ubizjak@gmail.com> + + * gcc.target/i386/movti.c: New test. + +2008-06-30 Jakub Jelinek <jakub@redhat.com> + + PR c++/36662 + * g++.dg/ext/altivec-16.C: New test. + +2008-06-30 Ira Rosen <irar@il.ibm.com> + + PR tree-optimization/36648 + * g++.dg/vect/pr36648.cc: New testcase. + +2008-06-29 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/36655 + * g++.dg/cpp0x/extern_template-2.C: New. + * g++.dg/cpp0x/extern_template.C: Rename to... + * g++.dg/cpp0x/extern_template-1.C: ... this. + +2008-06-29 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/36341 + * gfortran.dg/matmul_bounds_1.f90: New test. + +2008-06-29 Jakub Jelinek <jakub@redhat.com> + + PR testsuite/36620 + * gcc.dg/pr36504.c: Add -w to dg-options. + +2008-06-29 Ira Rosen <irar@il.ibm.com> + + * gcc.dg/vect/pr36493.c: Require vect_long. + +2008-06-28 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + * gfortran.dg/namelist_50.f90: New test. + +2008-06-28 Joseph Myers <joseph@codesourcery.com> + + * gcc.c-torture/compile/20080628-1.c: New test. + +2008-06-28 Richard Guenther <rguenther@suse.de> + + * gcc.c-torture/execute/pta-field-1.c: Add return 0. + * gcc.c-torture/execute/pta-field-2.c: Likewise. + +2008-06-28 Richard Guenther <rguenther@suse.de> + + * gcc.dg/tree-ssa/pr24287.c: Remove XFAIL. + +2008-06-27 Mark Mitchell <mark@codesourcery.com> + + * g++.dg/abi/arm_cxa_vec2.C: New test. + +2008-06-28 Jakub Jelinek <jakub@redhat.com> + + PR c++/36364 + * g++.dg/template/repo9.C: New test. + +2008-06-27 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/36655 + * g++.dg/cpp0x/extern_template.C: New. + +2008-06-27 Jakub Jelinek <jakub@redhat.com> + + * gcc.dg/gomp/pr27388-3.c: Adjust dg-final. + +2008-06-27 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/36400 + PR tree-optimization/36373 + PR tree-optimization/36344 + * gcc.dg/torture/pr36373-1.c: New testcase. + * gcc.dg/torture/pr36373-2.c: Likewise. + * gcc.dg/torture/pr36373-3.c: Likewise. + * gcc.dg/torture/pr36373-4.c: Likewise. + * gcc.dg/torture/pr36373-5.c: Likewise. + * gcc.dg/torture/pr36373-6.c: Likewise. + * gcc.dg/torture/pr36373-7.c: Likewise. + * gcc.dg/torture/pr36373-8.c: Likewise. + * gcc.dg/torture/pr36373-9.c: Likewise. + * gcc.dg/torture/pr36373-10.c: Likewise. + * gcc.dg/torture/pr36400.c: Likewise. + * gcc.c-torture/execute/pta-field-1.c: Likewise. + * gcc.c-torture/execute/pta-field-2.c: Likewise. + * gcc.dg/tree-ssa/loadpre8.c: Remove XFAIL. + * gcc.dg/tree-ssa/pr24287.c: XFAIL. + +2008-06-27 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/aggr9.ad[sb]: New test. + * gnat.dg/aggr9_pkg.ads: New helper. + +2008-06-27 Olivier Hainque <hainque@adacore.com> + + * gnat.dg/aligned_vla.adb: New test. + +2008-06-26 Joseph Myers <joseph@codesourcery.com> + + * gcc.dg/inline-32.c, gcc.dg/inline-32a.c: New tests. + +2008-06-26 Ira Rosen <irar@il.ibm.com> + + * lib/target-supports.exp + (check_effective_target_vect_cmdline_needed): Add SPU to the list + of targets that do not need command line argument to enable SIMD. + +2008-06-26 Ira Rosen <irar@il.ibm.com> + + * gcc.dg/vect/vect.exp: Run tests with -funroll-loops for SPU in case + of -O3. + +2008-06-26 Ira Rosen <irar@il.ibm.com> + + PR target/36510 + * gcc.dg/vect/costmodel/ppc/costmodel-vect-31d.c: Change the loop + bound. + * gcc.dg/vect/costmodel/ppc/costmodel-vect-76c.c, + gcc.dg/vect/costmodel/ppc/costmodel-vect-68d.c: Likewise. + +2008-06-25 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/36526 + * gfortran.dg/proc_formal_proc_2.f90: New test. + 2008-06-25 Richard Guenther <rguenther@suse.de> * gcc.c-torture/compile/20080625-1.c: New testcase. @@ -22,9 +155,9 @@ 2008-06-23 Uros Bizjak <ubizjak@gmail.com> - PR middle-end/PR36584 - * testsuite/gcc.dg/pr36584.c: New test. - * testsuite/gcc.target/i386/local2.c: Remove invalid test. + PR middle-end/36584 + * gcc.dg/pr36584.c: New test. + * gcc.target/i386/local2.c: Remove invalid test. 2008-06-23 Jakub Jelinek <jakub@redhat.com> @@ -55,7 +188,7 @@ * gcc.dg/tree-ssa/vrp02.c:: Ditto. * gcc.dg/tree-ssa/vrp07.c:: Ditto. * gcc.dg/tree-ssa/vrp08.c:: Ditto. - + 2008-06-19 Andy Hutchinson <hutchinsonandy@aim.com> * gcc.dg/pragma-pack-4.c: Skip for AVR target. @@ -63,12 +196,12 @@ 2008-06-18 Andy Hutchinson <hutchinsonandy@aim.com> * gcc.dg/builtin-apply2.c: Mark skip for avr target. - + 2008-06-18 Andy Hutchinson <hutchinsonandy@aim.com> PR c/36571 * gcc.dg/builtin-return-1.c: Mark as xfail on AVR. - + 2008-06-18 Andy Hutchinson <hutchinsonandy@aim.com> * gcc.dg/tree-ssa/loop-35.c: xfail avr target. Add new avr specific @@ -128,7 +261,7 @@ * gcc.dg/utf-cvt.c: Skip tests and mark excess xfail for AVR. * gcc.dg/Wtype-limits-Wextra.c: Ditto. * gcc.dg/Wtype-limits.c: Ditto. - + 2008-06-18 Joseph Myers <joseph@codesourcery.com> * gcc.dg/dfp/convert-bfp-6.c, gcc.dg/dfp/convert-bfp-9.c: XFAIL @@ -372,7 +505,7 @@ PR fortran/36459 * gfortran.dg/proc_decl_16.f90: New. - + 2008-06-08 Tobias Burnus <burnus@net-b.de> PR fortran/35830 @@ -654,7 +787,7 @@ * gfortran.dg/gomp/reduction3.f90: Fixed invalid code. * gfortran.dg/proc_decl_12.f90: New: * gfortran.dg/external_procedures_1.f90: Fixed error message. - + 2008-05-28 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> PR fortran/36319 @@ -816,8 +949,8 @@ 2008-05-23 Rafael Espindola <espindola@google.com> - * gcc/testsuite/gcc.c-torture/compile/20080522-1.c: Move to gcc.dg. - * gcc/testsuite/gcc.dg/20080522-1.c: Moved from gcc.c-torture. + * gcc.c-torture/compile/20080522-1.c: Move to gcc.dg. + * gcc.dg/20080522-1.c: Moved from gcc.c-torture. 2008-05-23 Paul Brook <paul@codesourcery.com> Carlos O'Donell <carlos@codesourcery.com> @@ -954,7 +1087,7 @@ * gcc.dg/array-quals-1.c: xfail read only section check for avr target. - + 2008-05-20 Andy Hutchinson <hutchinsonandy@aim.com> PR testsuite/34889 @@ -972,7 +1105,7 @@ 2008-05-20 Andy Hutchinson <hutchinsonandy@aim.com> * gcc.dg/builtins-config.h: AVR does not have C99 runtime. - + 2008-05-20 Janis Johnson <janis187@us.ibm.com> PR testsuite/22523 @@ -1035,7 +1168,7 @@ Sebastian Pop <sebastian.pop@amd.com> PR tree-optimization/36206 - * testsuite/gfortran.dg/pr36206.f: New. + * gfortran.dg/pr36206.f: New. 2008-05-20 Arnaud Charlet <charlet@adacore.com> @@ -1639,7 +1772,7 @@ 2008-05-08 Sa Liu <saliu@de.ibm.com> - * testsuite/gcc.target/spu/subti3.c: New. + * gcc.target/spu/subti3.c: New. 2008-05-08 Richard Guenther <rguenther@suse.de> @@ -1706,7 +1839,7 @@ 2008-05-06 Olivier Hainque <hainque@adacore.com> * gnat.dg/fatp_sra.adb: New test. - + 2008-05-05 Andrew Pinski <andrew_pinski@playstation.sony.com> PR middle-end/36141 @@ -1778,23 +1911,23 @@ 2008-05-01 Simon Baldwin <simonb@google.com> PR bootstrap/36108 - * testsuite/gcc.dg/Warray-bounds.c: Removed frontend warnings update. - * testsuite/g++.dg/warn/Warray-bounds.c: Ditto. - * testsuite/gcc.dg/Warray-bounds-noopt.c: Removed testcase. - * testsuite/g++.dg/warn/Warray-bounds-noopt.c: Ditto. + * gcc.dg/Warray-bounds.c: Removed frontend warnings update. + * g++.dg/warn/Warray-bounds.c: Ditto. + * gcc.dg/Warray-bounds-noopt.c: Removed testcase. + * g++.dg/warn/Warray-bounds-noopt.c: Ditto. 2008-05-01 Bud Davis <bdavis9659@sbcglobal.net> - PR fortran/PR35940 + PR fortran/35940 * gfortran.dg/index.f90: New test. 2008-05-01 Simon Baldwin <simonb@google.com> - * testsuite/gcc.dg/Warray-bounds.c: Updated for frontend warnings, + * gcc.dg/Warray-bounds.c: Updated for frontend warnings, additional tests for arrays of size 0 and size 1. - * testsuite/g++.dg/warn/Warray-bounds.c: Ditto. - * testsuite/gcc.dg/Warray-bounds-noopt.c: New testcase. - * testsuite/g++.dg/warn/Warray-bounds-noopt.c: Ditto. + * g++.dg/warn/Warray-bounds.c: Ditto. + * gcc.dg/Warray-bounds-noopt.c: New testcase. + * g++.dg/warn/Warray-bounds-noopt.c: Ditto. 2008-05-01 Richard Guenther <rguenther@suse.de> @@ -1865,7 +1998,7 @@ 2008-04-29 Kai Tietz <kai.tietz@onevision.com> - * testsuite/gcc.dg/sync-2.c: Set dg-options "-ansi". + * gcc.dg/sync-2.c: Set dg-options "-ansi". 2008-04-29 Jakub Jelinek <jakub@redhat.com> @@ -1935,7 +2068,7 @@ 2008-04-26 George Helffrich <george@gcc.gnu.org> - PRs fortran/PR35154, fortran/PR23057 + PRs fortran/35154, fortran/23057 * gfortran.dg/debug/pr35154-stabs.f: New test case for .stabs functionality. * gfortran.dg/debug/pr35154-dwarf2.f: New test case for @@ -2166,7 +2299,7 @@ PR fortran/35882 * gfortran.dg/continuation_5.f: Add some comment lines. * gfortran.dg/continuation_3.f90: Add some comment lines. - + 2008-04-20 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/35960 @@ -2195,7 +2328,7 @@ PR fortran/35892 * gfortran.dg/pr35154-dwarf2.f: Remove. * gfortran.dg/pr35154-stabs.f: Remove. - + 2008-04-18 Ian Lance Taylor <iant@google.com> PR tree-optimization/35977 @@ -2269,7 +2402,7 @@ 2008-04-17 Christian Bruel <christian.bruel@st.com> * gcc.dg/long-long-compare-1.c: New testcase. - + 2008-04-16 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/35724 @@ -2392,7 +2525,7 @@ * gfortran.dg/continuation_3.f90: Update test. * gfortran.dg/continuation_5.f: Update test. * gfortran.dg/continuation_10.f90: New test. - + 2008-04-13 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/32972 @@ -2401,7 +2534,7 @@ * gfortran.dg/intrinsic_spread_1.f90: Likewise. * gfortran.dg/intrinsic_pack_1.f90: Likewise. * gfortran.dg/intrinsic_unpack_1.f90: Likewise. - + 2008-04-13 Samuel Tardieu <sam@rfc1149.net> PR ada/17985 @@ -2853,7 +2986,7 @@ 2008-03-29 Laurent GUERBY <laurent@guerby.net> * gnat.dg/socket2.adb: Remove since identical to socket1.adb. - + 2008-03-29 Paul Thomas <pault@gcc.gnu.org> PR fortran/35698 @@ -3014,7 +3147,7 @@ PR objc/29197 * objc.dg/method-20.m: New testcase. - + 2008-03-25 Richard Sandiford <rsandifo@nildram.co.uk> PR rtl-optimization/35232 @@ -3288,8 +3421,8 @@ 2008-03-19 Richard Guenther <rguenther@suse.de> PR middle-end/35609 - * gcc.dg/testsuite/uninit-15.c: New testcase. - * gcc.dg/testsuite/uninit-16.c: Likewise. + * gcc.dg/uninit-15.c: New testcase. + * gcc.dg/uninit-16.c: Likewise. 2008-03-18 Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz> @@ -3448,7 +3581,7 @@ 2008-03-13 Alon Dayan <alond@il.ibm.com> Olga Golovanevsky <olga@il.ibm.com> - + PR tree-optimization/35041 * gcc.dg/struct/wo_prof_double_malloc.c: New test. @@ -3782,7 +3915,7 @@ * g++.dg/cpp/string-2.C: This is a warning now. * g++.dg/cpp/pedantic-errors.C: -pedantic-errors is not enabled by default, so add it. - + 2008-03-01 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/cpp0x/auto1.C: New. @@ -3931,15 +4064,15 @@ __builtin_stdarg_start. * pr17301-1.c: Likewise. * pr17301-2.c: Likewise. - + 2008-02-26 Manuel Lopez-Ibanez <manu@gcc.gnu.org> - + * gcc.dg/pr34351.c: New. - + 2008-02-26 Manuel Lopez-Ibanez <manu@gcc.gnu.org> * gcc.dg/Wlarger-than2.c: New. - + 2008-02-26 Paolo Carlini <pcarlini@suse.de> PR c++/35323 @@ -3979,9 +4112,9 @@ * gcc.dg/Wswitch-error.c: New. * gcc.dg/20011021-1.c: Use two directives to match two different messages. - + 2008-02-26 Manuel Lopez-Ibanez <manu@gcc.gnu.org> - + PR 28322 * gcc.dg/pr28322.c: New. * gcc.dg/pr28322-2.c: New. @@ -4151,7 +4284,7 @@ PR libfortran/35132 * gfortran.dg/streamio_15.f90: New test. - + 2008-02-20 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/35036 @@ -4229,7 +4362,7 @@ PR target/33555 * gcc.target/i386/pr33555.c: New test. - + 2008-02-18 H.J. Lu <hongjiu.lu@intel.com> PR target/35189 @@ -4489,7 +4622,7 @@ * lib/target-supports.exp (check_effective_target_hard_float): Remove special case for xtensa-*-*. - + 2008-02-05 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> PR fortran/35037 @@ -5009,7 +5142,7 @@ PR tree-optimization/34701 * gcc.dg/struct/wo_prof_array_field.c: New test. - + 2008-01-20 Paolo Carlini <pcarlini@suse.de> PR c++/34891 @@ -5051,7 +5184,7 @@ PR libfortran/34795 * gfortran.dg/inquire_13.f90: New test. - + PR libfortran/34659 * gfortran.dg/continuation_9.f90: New test. @@ -5259,7 +5392,7 @@ * gfortran.dg/argument_checking_14.f90: New. 2008-01-15 Thomas Koenig <tkoenig@gcc.gnu.org> - + PR libfortran/34671 * gfortran.dg/anyallcount_1.f90: New test. @@ -5304,7 +5437,7 @@ PR c++/34052 * g++.dg/cpp0x/vt-34052.C: New. * g++.dg/template/ttp26.C: New. - + 2008-01-14 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/rep_clause2.ad[sb]: New test. @@ -5315,7 +5448,7 @@ PR c++/24924 * g++.dg/cpp/pedantic-errors.C: Delete. * g++.dg/cpp/permissive.C: Delete. - + 2008-01-14 Eric Botcazou <ebotcazou@adacore.com> * gcc.c-torture/compile/20080114-1.c: New test. diff --git a/gcc/testsuite/g++.dg/abi/arm_cxa_vec2.C b/gcc/testsuite/g++.dg/abi/arm_cxa_vec2.C new file mode 100644 index 00000000000..76f327acaab --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/arm_cxa_vec2.C @@ -0,0 +1,41 @@ +// Check that ARM vector delete functions accept NULL pointers as +// inputs. +// { dg-do run { target arm*-*-* } } + +#ifdef __ARM_EABI__ +#include <cxxabi.h> + +typedef void *(dtor_type)(void *); + +extern "C" { + void abort(); + void *__aeabi_vec_dtor_cookie(void *, dtor_type); + void __aeabi_vec_delete(void *, dtor_type); + void __aeabi_vec_delete3(void *, + dtor_type, + void (*)(void *, __SIZE_TYPE__)); + void __aeabi_vec_delete3_nodtor(void *, + void (*)(void *, __SIZE_TYPE__)); +} + +// These functions should never be called. +void* dtor(void *) +{ + abort (); +} + +void dealloc(void *, size_t) { + abort (); +} + +int main () { + if (__aeabi_vec_dtor_cookie (NULL, &dtor) != NULL) + return 1; + // These do not return values, but should not crash. + __aeabi_vec_delete (NULL, &dtor); + __aeabi_vec_delete3 (NULL, &dtor, &dealloc); + __aeabi_vec_delete3_nodtor (NULL, &dealloc); +} +#else +int main () {} +#endif diff --git a/gcc/testsuite/g++.dg/cpp0x/extern_template-1.C b/gcc/testsuite/g++.dg/cpp0x/extern_template-1.C new file mode 100644 index 00000000000..ec2cb784e19 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/extern_template-1.C @@ -0,0 +1,4 @@ +// { dg-options "-std=c++0x -pedantic" } + +template <typename> void f() {} +extern template void f<int>(); diff --git a/gcc/testsuite/g++.dg/cpp0x/extern_template-2.C b/gcc/testsuite/g++.dg/cpp0x/extern_template-2.C new file mode 100644 index 00000000000..89a9ceb5a77 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/extern_template-2.C @@ -0,0 +1,4 @@ +// { dg-options "-std=c++0x -pedantic" } + +template <typename> class S {}; +extern template class S<int>; diff --git a/gcc/testsuite/g++.dg/ext/altivec-16.C b/gcc/testsuite/g++.dg/ext/altivec-16.C new file mode 100644 index 00000000000..91230d26138 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/altivec-16.C @@ -0,0 +1,19 @@ +// PR c++/36662 +// { dg-do compile { target powerpc*-*-* } } +// { dg-require-effective-target powerpc_altivec_ok } +// { dg-options "-maltivec" } + +#define vector __attribute__((altivec (vector__))) + +template <typename c> struct S {}; + +template <> struct S<vector float> +{ + static vector float zero; +}; + +template <int> +void g (void) +{ + vector float t = S<vector float>::zero; +} diff --git a/gcc/testsuite/g++.dg/template/repo9.C b/gcc/testsuite/g++.dg/template/repo9.C new file mode 100644 index 00000000000..f55024cb001 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/repo9.C @@ -0,0 +1,48 @@ +// PR c++/36364 +// { dg-options "-frepo" } +// { dg-final { cleanup-repo-files } } +// { dg-require-host-local "" } + +template <typename C> struct A +{ + static void assign (C &c1, const C &c2) { c1 = c2; } +}; + +template <typename C, typename T> struct B +{ + struct D + { + static const C terminal; + static unsigned long stor[]; + static D &empty_rep () + { + void *p = reinterpret_cast <void *>(&stor); + return *reinterpret_cast <D *>(p); + } + void test (unsigned long n) + { + T::assign (this->refdata ()[n], terminal); + } + C *refdata () throw () + { + return reinterpret_cast <C *>(this + 1); + } + }; + C *dataplus; + C *data () const { return dataplus; } + D *rep () const { return &((reinterpret_cast < D * >(data ()))[-1]); } + static D & empty_rep () { return D::empty_rep (); } + B () : dataplus (empty_rep ().refdata ()) { } + ~B () { } + void push_back (C c) { rep ()->test (10); } +}; + +template <typename C, typename T> const C B <C, T>::D::terminal = C (); +template <typename C, typename T> unsigned long B <C, T>::D::stor[64]; + +int +main () +{ + B <char, A <char> > s; + s.push_back ('a'); +} diff --git a/gcc/testsuite/g++.dg/vect/pr36648.cc b/gcc/testsuite/g++.dg/vect/pr36648.cc new file mode 100644 index 00000000000..b2933034b55 --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr36648.cc @@ -0,0 +1,24 @@ +/* { dg-require-effective-target vect_float } */ + +struct vector +{ + vector() : x(0), y(0), z(0) { } + float x,y,z; +}; + +struct Foo +{ + int dummy; + /* Misaligned access. */ + vector array_of_vectors[4]; +}; + +Foo foo; + +int main() { } + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } }*/ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + + diff --git a/gcc/testsuite/gcc.c-torture/compile/20080628-1.c b/gcc/testsuite/gcc.c-torture/compile/20080628-1.c new file mode 100644 index 00000000000..aca4ff82777 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080628-1.c @@ -0,0 +1,15 @@ +void f (long double, long double); + +struct s { + char c; + struct s *p; +} *p; + +void +g (void) +{ + long double ld; + p->p->c = 1; + ld = p->p->c; + f (ld, 1.0L); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pta-field-1.c b/gcc/testsuite/gcc.c-torture/execute/pta-field-1.c new file mode 100644 index 00000000000..b03dff9b1a8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pta-field-1.c @@ -0,0 +1,29 @@ +struct Foo { + int *p; + int *q; +}; + +void __attribute__((noinline)) +bar (int **x) +{ + struct Foo *f = (struct Foo *)x; + *(f->q) = 0; +} + +int foo(void) +{ + struct Foo f; + int i = 1, j = 2; + f.p = &i; + f.q = &j; + bar(&f.p); + return j; +} + +extern void abort (void); +int main() +{ + if (foo () != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pta-field-2.c b/gcc/testsuite/gcc.c-torture/execute/pta-field-2.c new file mode 100644 index 00000000000..dffd7154ce0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pta-field-2.c @@ -0,0 +1,29 @@ +struct Foo { + int *p; + int *q; +}; + +void __attribute__((noinline)) +bar (int **x) +{ + struct Foo *f = (struct Foo *)(x - 1); + *(f->p) = 0; +} + +int foo(void) +{ + struct Foo f; + int i = 1, j = 2; + f.p = &i; + f.q = &j; + bar(&f.q); + return i; +} + +extern void abort (void); +int main() +{ + if (foo () != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/gomp/pr27388-3.c b/gcc/testsuite/gcc.dg/gomp/pr27388-3.c index a6f4647aa5f..2cddb23c7d8 100644 --- a/gcc/testsuite/gcc.dg/gomp/pr27388-3.c +++ b/gcc/testsuite/gcc.dg/gomp/pr27388-3.c @@ -19,5 +19,5 @@ foo (void) } } -/* { dg-final { scan-tree-dump-times "omp for\[^\\n\]*private" 0 "omplower" } } */ +/* { dg-final { scan-tree-dump-times "omp for\[^\\n\]*private" 2 "omplower" } } */ /* { dg-final { cleanup-tree-dump "omplower" } } */ diff --git a/gcc/testsuite/gcc.dg/inline-32.c b/gcc/testsuite/gcc.dg/inline-32.c new file mode 100644 index 00000000000..bfcafd5dbba --- /dev/null +++ b/gcc/testsuite/gcc.dg/inline-32.c @@ -0,0 +1,11 @@ +/* { dg-do link } */ +/* { dg-options "-std=c99 -pedantic-errors" } */ +/* { dg-additional-sources inline-32a.c } */ +inline int f (void) { return 0; } + +int +main (void) +{ + extern int f(); + return f (); +} diff --git a/gcc/testsuite/gcc.dg/inline-32a.c b/gcc/testsuite/gcc.dg/inline-32a.c new file mode 100644 index 00000000000..a2bde0aac4b --- /dev/null +++ b/gcc/testsuite/gcc.dg/inline-32a.c @@ -0,0 +1,3 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -pedantic-errors" } */ +int f (void) { return 0; } diff --git a/gcc/testsuite/gcc.dg/memcpy-1.c b/gcc/testsuite/gcc.dg/memcpy-1.c index 7098f83955d..2b11098b286 100644 --- a/gcc/testsuite/gcc.dg/memcpy-1.c +++ b/gcc/testsuite/gcc.dg/memcpy-1.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fdump-tree-optimized" } */ -/* { dg-final { scan-tree-dump-times "nasty_local" 0 "optimized" } } */ +/* PR36598 AVR fail maybe due to cost metrics */ +/* { dg-final { scan-tree-dump-times "nasty_local" 0 "optimized" { xfail { "avr-*-*" } } } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */ struct a {int a,b,c;} a; int test(struct a a) diff --git a/gcc/testsuite/gcc.dg/pr36504.c b/gcc/testsuite/gcc.dg/pr36504.c index 0db6ebced8d..dbcf76648bf 100644 --- a/gcc/testsuite/gcc.dg/pr36504.c +++ b/gcc/testsuite/gcc.dg/pr36504.c @@ -1,6 +1,6 @@ /* PR tree-optimization/36504 */ /* { dg-do compile } */ -/* { dg-options "-O3 -fprefetch-loop-arrays" } */ +/* { dg-options "-O3 -fprefetch-loop-arrays -w" } */ struct A { struct { int a; } b[8]; }; struct B { int c; int d; }; diff --git a/gcc/testsuite/gcc.dg/torture/pr36373-1.c b/gcc/testsuite/gcc.dg/torture/pr36373-1.c new file mode 100644 index 00000000000..9cd02c57a40 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr36373-1.c @@ -0,0 +1,35 @@ +/* { dg-do run } */ +/* { dg-options "-fno-tree-sra" } */ + +extern void abort (void); +struct Bar { + struct Foo { + int *p; + } x; + int *q; +}; +struct Foo __attribute__((noinline)) +bar(int *p) +{ + struct Foo f; + f.p = p; + return f; +} +void __attribute__((noinline)) +foo(struct Foo f) +{ + *f.p = 0; +} +int main() +{ + int a, b; + a = 0; + b = 1; + struct Bar f; + f.x = bar (&b); + f.q = &a; + foo(f.x); + if (b != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr36373-10.c b/gcc/testsuite/gcc.dg/torture/pr36373-10.c new file mode 100644 index 00000000000..b84e2544152 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr36373-10.c @@ -0,0 +1,21 @@ +/* { dg-do run } */ + +typedef unsigned long uintptr_t; + +void __attribute__((noinline)) +foo(uintptr_t l) +{ + int *p = (int *)l; + *p = 1; +} + +extern void abort (void); +int main() +{ + int b = 0; + uintptr_t l = (uintptr_t)&b; + foo(l); + if (b != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr36373-2.c b/gcc/testsuite/gcc.dg/torture/pr36373-2.c new file mode 100644 index 00000000000..2653182a52c --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr36373-2.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-options "-fno-tree-sra" } */ + +extern void abort (void); +struct Foo { + int *p; +}; +struct Bar { + struct Foo *x; + int *q; +}; +struct Foo __attribute__((noinline)) +bar(int *p) +{ + struct Foo f; + f.p = p; + return f; +} +void __attribute__((noinline)) +foo(struct Foo f) +{ + *f.p = 0; +} +int main() +{ + int a, b; + a = 0; + b = 1; + struct Bar f; + struct Foo g = bar (&b); + f.x = &g; + f.q = &a; + foo(*f.x); + if (b != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr36373-3.c b/gcc/testsuite/gcc.dg/torture/pr36373-3.c new file mode 100644 index 00000000000..d5ad93e1b9b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr36373-3.c @@ -0,0 +1,36 @@ +/* { dg-do run } */ + +extern void abort (void); +struct Foo { + int *p; +}; +struct Bar { + struct Foo *x; + int *q; +}; +struct Foo __attribute__((noinline)) +bar(int *p) +{ + struct Foo f; + f.p = p; + return f; +} +void __attribute__((noinline)) +foo(struct Foo f) +{ + *f.p = 0; +} +int main() +{ + int a, b; + a = 0; + b = 1; + struct Bar f; + struct Foo g = bar (&b); + f.x = &g; + f.q = &a; + foo(*f.x); + if (b != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr36373-4.c b/gcc/testsuite/gcc.dg/torture/pr36373-4.c new file mode 100644 index 00000000000..5f3b8334901 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr36373-4.c @@ -0,0 +1,33 @@ +/* { dg-do run } */ + +extern void abort (void); +struct Foo { + int *p; + int *q; +}; +struct Foo __attribute__((noinline)) +bar(int *p) +{ + struct Foo f; + f.p = p; + return f; +} +void __attribute__((noinline)) +foo(struct Foo f) +{ + *f.p = 0; +} +int main() +{ + int a, b; + a = 0; + b = 1; + struct Foo f; + f = bar (&b); + f.q = &a; + foo(f); + if (b != 0) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.dg/torture/pr36373-5.c b/gcc/testsuite/gcc.dg/torture/pr36373-5.c new file mode 100644 index 00000000000..0061ef418ee --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr36373-5.c @@ -0,0 +1,34 @@ +/* { dg-do run } */ +/* { dg-options "-fno-tree-sra" } */ + +extern void abort (void); +struct Foo { + int *p; + int *q; +}; +struct Foo __attribute__((noinline)) +bar(int *p) +{ + struct Foo f; + f.p = p; + return f; +} +void __attribute__((noinline)) +foo(struct Foo f) +{ + *f.p = 0; +} +int main() +{ + int a, b; + a = 0; + b = 1; + struct Foo f; + f = bar (&b); + f.q = &a; + foo(f); + if (b != 0) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.dg/torture/pr36373-6.c b/gcc/testsuite/gcc.dg/torture/pr36373-6.c new file mode 100644 index 00000000000..c55e3ff3fab --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr36373-6.c @@ -0,0 +1,30 @@ +/* { dg-do run } */ +/* { dg-options "-fno-tree-sra" } */ + +extern void abort (void); +struct Foo { + int *p; +} x; +struct Foo __attribute__((noinline)) +bar(int *p) +{ + struct Foo f; + f.p = p; + return f; +} +void __attribute__((noinline)) +foo() +{ + *x.p = 0; +} +int main() +{ + int b; + b = 1; + struct Foo g = bar (&b); + x = g; + foo(); + if (b != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr36373-7.c b/gcc/testsuite/gcc.dg/torture/pr36373-7.c new file mode 100644 index 00000000000..103694e1517 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr36373-7.c @@ -0,0 +1,29 @@ +/* { dg-do run } */ + +extern void abort (void); +struct Foo { + int *p; +} x; +struct Foo __attribute__((noinline)) +bar(int *p) +{ + struct Foo f; + f.p = p; + return f; +} +void __attribute__((noinline)) +foo() +{ + *x.p = 0; +} +int main() +{ + int b; + b = 1; + struct Foo g = bar (&b); + x = g; + foo(); + if (b != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr36373-8.c b/gcc/testsuite/gcc.dg/torture/pr36373-8.c new file mode 100644 index 00000000000..9f77ea13734 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr36373-8.c @@ -0,0 +1,24 @@ +/* { dg-do run } */ +/* { dg-options "-fno-tree-sra" } */ + +extern void abort (void); +struct Foo { + int *p; +} x; +void __attribute__((noinline)) +foo() +{ + *x.p = 0; +} +int main() +{ + int b; + struct Foo g; + b = 1; + g.p = &b; + x = g; + foo(); + if (b != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr36373-9.c b/gcc/testsuite/gcc.dg/torture/pr36373-9.c new file mode 100644 index 00000000000..5588eadae99 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr36373-9.c @@ -0,0 +1,23 @@ +/* { dg-do run } */ + +extern void abort (void); +struct Foo { + int *p; +} x; +void __attribute__((noinline)) +foo() +{ + *x.p = 0; +} +int main() +{ + int b; + struct Foo g; + b = 1; + g.p = &b; + x = g; + foo(); + if (b != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr36400.c b/gcc/testsuite/gcc.dg/torture/pr36400.c new file mode 100644 index 00000000000..bd9f35a5f76 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr36400.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ + +struct barstruct { char const* some_string; }; + +void changethepointer(struct barstruct***); + +void baz() +{ + struct barstruct bar1; + struct barstruct* barptr = &bar1; + struct barstruct** barptr2 = &barptr; + changethepointer(&barptr2); + barptr->some_string = "Everything OK"; +} + +/* { dg-final { scan-assembler "Everything OK" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loadpre8.c b/gcc/testsuite/gcc.dg/tree-ssa/loadpre8.c index 6be2b3ec7fd..056c3fd6354 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/loadpre8.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/loadpre8.c @@ -93,5 +93,5 @@ rewrite_add_phi_arguments (basic_block bb) get_reaching_def ((get_def_from_ptr (get_phi_result_ptr (phi)))->ssa_name.var); } } -/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre" } } */ /* { dg-final { cleanup-tree-dump "pre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr24287.c b/gcc/testsuite/gcc.dg/tree-ssa/pr24287.c index 8e7f18691dc..63120457c4d 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr24287.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr24287.c @@ -21,5 +21,5 @@ int g(void) link_error (); return t2 == 2; } -/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-31d.c b/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-31d.c index 3c811f0a4ac..d9ea5d12638 100644 --- a/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-31d.c +++ b/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-31d.c @@ -3,7 +3,7 @@ #include <stdarg.h> #include "../../tree-vect.h" -#define N 32 +#define N 5 struct t{ int k[N]; @@ -17,20 +17,20 @@ struct s{ struct t d; /* aligned (offset 2NB) */ struct t e; /* unaligned (offset 2N+4N+4 B) */ }; - + int main1 () { int i; struct s tmp; /* unaligned */ - for (i = 0; i < N/2; i++) + for (i = 0; i < N; i++) { tmp.e.k[i] = 8; } /* check results: */ - for (i = 0; i <N/2; i++) + for (i = 0; i < N; i++) { if (tmp.e.k[i] != 8) abort (); diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-68d.c b/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-68d.c index df30caae047..7fc25946587 100644 --- a/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-68d.c +++ b/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-68d.c @@ -3,7 +3,7 @@ #include <stdarg.h> #include "../../tree-vect.h" -#define N 20 +#define N 11 struct s{ int m; diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-76c.c b/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-76c.c index f6127ba873b..d18f416a07c 100644 --- a/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-76c.c +++ b/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-76c.c @@ -3,7 +3,7 @@ #include <stdarg.h> #include "../../tree-vect.h" -#define N 8 +#define N 32 #define OFF 4 /* Check handling of accesses for which the "initial condition" - diff --git a/gcc/testsuite/gcc.dg/vect/pr36493.c b/gcc/testsuite/gcc.dg/vect/pr36493.c index d96e96221d4..0a3d2029c9f 100644 --- a/gcc/testsuite/gcc.dg/vect/pr36493.c +++ b/gcc/testsuite/gcc.dg/vect/pr36493.c @@ -1,4 +1,4 @@ -/* { dg-require-effective-target vect_int } */ +/* { dg-require-effective-target vect_long } */ #include "tree-vect.h" diff --git a/gcc/testsuite/gcc.dg/vect/vect.exp b/gcc/testsuite/gcc.dg/vect/vect.exp index 2fb14b1b08e..e67b2e4b467 100644 --- a/gcc/testsuite/gcc.dg/vect/vect.exp +++ b/gcc/testsuite/gcc.dg/vect/vect.exp @@ -245,6 +245,9 @@ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/Os-vect-*.\[cS\]]] \ # With -O3 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS lappend DEFAULT_VECTCFLAGS "-O3" +if [istarget "spu-*-*"] { + lappend DEFAULT_VECTCFLAGS "-funroll-loops" +} dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O3-*.\[cS\]]] \ "" $DEFAULT_VECTCFLAGS diff --git a/gcc/testsuite/gcc.target/i386/movti.c b/gcc/testsuite/gcc.target/i386/movti.c new file mode 100644 index 00000000000..e306c1e3f01 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/movti.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target dfp } */ +/* { dg-options "-O -std=gnu99" } */ + +_Decimal128 test (void) +{ + return 1234123412341234.123412341234dl; +} + +/* { dg-final { scan-assembler-not "movabs" } } */ diff --git a/gcc/testsuite/gfortran.dg/matmul_bounds_1.f90 b/gcc/testsuite/gfortran.dg/matmul_bounds_1.f90 new file mode 100644 index 00000000000..1d180a0d458 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/matmul_bounds_1.f90 @@ -0,0 +1,25 @@ +! { dg-do compile } +program matmul_bounds_1 + implicit none + real, dimension(3,2) :: a + real, dimension(2,3) :: b + real, dimension(3,2) :: rab + real, dimension(2,2) :: rok + real, dimension(2) :: rv + real, dimension(3) :: rw + real, dimension(3) :: x + real, dimension(2) :: y + a = 1 + b = 2 + x = 3 + y = 4 + ! These tests should throw an error + rab = matmul(a,b) ! { dg-error "Different shape" } + rv = matmul(a,y) ! { dg-error "Different shape" } + rv = matmul(x,b) ! { dg-error "Different shape" } + ! These are ok. + rw = matmul(a,y) + rv = matmul(x,a) + rok = matmul(b,a) +end program matmul_bounds_1 + diff --git a/gcc/testsuite/gfortran.dg/namelist_50.f90 b/gcc/testsuite/gfortran.dg/namelist_50.f90 new file mode 100644 index 00000000000..57e93fcbf25 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/namelist_50.f90 @@ -0,0 +1,16 @@ +! { dg-do run } +! PR36657 Namelist string constant immediately followed by comment +program gfcbug79 + implicit none + integer, parameter :: nnml = 10 + character(len=8) :: model = "" + namelist /NML/ model + open (nnml, status="scratch") + write(nnml,*) "&nml! This is a just comment" + write(nnml,*) " model='foo'! This is a just comment" + write(nnml,*) "/" + rewind(nnml) + read (nnml, nml=NML) + if (model /= 'foo') call abort + close(nnml) +end program gfcbug79 diff --git a/gcc/testsuite/gfortran.dg/pure_formal_proc_2.f90 b/gcc/testsuite/gfortran.dg/pure_formal_proc_2.f90 new file mode 100644 index 00000000000..ec7d06eec78 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pure_formal_proc_2.f90 @@ -0,0 +1,48 @@ +! { dg-do compile } +! Tests the fix for PR36526, in which the call to getStrLen would +! generate an error due to the use of a wrong symbol in interface.c +! +! Contributed by Bálint Aradi <aradi@bccms.uni-bremen.de> +! +module TestPure + implicit none + + type T1 + character(10) :: str + end type T1 + +contains + + pure function getT1Len(self) result(t1len) + type(T1), pointer :: self + integer :: t1len + + t1len = getStrLen(self%str) + + end function getT1Len + + + pure function getStrLen(str) result(length) + character(*), intent(in) :: str + integer :: length + + length = len_trim(str) + + end function getStrLen + +end module TestPure + + +program Test + use TestPure + implicit none + + type(T1), pointer :: pT1 + + allocate(pT1) + pT1%str = "test" + write (*,*) getT1Len(pT1) + deallocate(pT1) + +end program Test +! { dg-final { cleanup-modules "TestPure" } } diff --git a/gcc/testsuite/gnat.dg/aggr9.adb b/gcc/testsuite/gnat.dg/aggr9.adb new file mode 100644 index 00000000000..70d026fdd28 --- /dev/null +++ b/gcc/testsuite/gnat.dg/aggr9.adb @@ -0,0 +1,12 @@ +-- { dg-do compile } +-- { dg-options "-O" } + +package body Aggr9 is + + procedure Proc (X : R1) is + M : R2 := (F => X); + begin + Send (M); + end; + +end Aggr9; diff --git a/gcc/testsuite/gnat.dg/aggr9.ads b/gcc/testsuite/gnat.dg/aggr9.ads new file mode 100644 index 00000000000..cb5757b64af --- /dev/null +++ b/gcc/testsuite/gnat.dg/aggr9.ads @@ -0,0 +1,7 @@ +with Aggr9_Pkg; use Aggr9_Pkg; + +package Aggr9 is + + procedure Proc (X : R1); + +end Aggr9; diff --git a/gcc/testsuite/gnat.dg/aggr9_pkg.ads b/gcc/testsuite/gnat.dg/aggr9_pkg.ads new file mode 100644 index 00000000000..c7c7b9e10b8 --- /dev/null +++ b/gcc/testsuite/gnat.dg/aggr9_pkg.ads @@ -0,0 +1,17 @@ +package Aggr9_Pkg is + + type Byte is range 0 .. 255; + + type R1 is + record + A,B : Byte; + end record; + + type R2 is + record + F : R1; + end record; + + procedure Send (M : R2); + +end Aggr9_Pkg; diff --git a/gcc/testsuite/gnat.dg/aligned_vla.adb b/gcc/testsuite/gnat.dg/aligned_vla.adb new file mode 100644 index 00000000000..bd3eb7158e5 --- /dev/null +++ b/gcc/testsuite/gnat.dg/aligned_vla.adb @@ -0,0 +1,23 @@ +-- { dg-do run } + +procedure Aligned_Vla is + + type Table is array (Integer range <>) of Integer; + for Table'Alignment use Long_Float'Alignment; + + K : constant := 1; + Konstants : Table (1 .. 4) := (others => K); + + procedure Check_Copy (Len : Integer) is + My_Konstants : Table (1 .. Len) := Konstants (1 .. 1 + Len - 1); + begin + for I in My_Konstants'Range loop + if My_Konstants (I) /= K then + raise Program_Error; + end if; + end loop; + end; + +begin + Check_Copy (Len => 4); +end; diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 223ee16d9ee..ecca42118b2 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -1130,7 +1130,8 @@ proc check_effective_target_vect_cmdline_needed { } { && [check_effective_target_lp64]) || ([istarget powerpc*-*-*] && ([check_effective_target_powerpc_spe] - || [check_effective_target_powerpc_altivec]))} { + || [check_effective_target_powerpc_altivec])) + || [istarget spu-*-*] } { set et_vect_cmdline_needed_saved 0 } } diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 50f53a080e8..341a1de749d 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -5665,7 +5665,8 @@ replace_ssa_name (tree name, struct pointer_map_t *vars_map, struct move_stmt_d { - tree block; + tree orig_block; + tree new_block; tree from_context; tree to_context; struct pointer_map_t *vars_map; @@ -5674,8 +5675,8 @@ struct move_stmt_d }; /* Helper for move_block_to_fn. Set TREE_BLOCK in every expression - contained in *TP and change the DECL_CONTEXT of every local - variable referenced in *TP. */ + contained in *TP if it has been ORIG_BLOCK previously and change the + DECL_CONTEXT of every local variable referenced in *TP. */ static tree move_stmt_r (tree *tp, int *walk_subtrees, void *data) @@ -5683,9 +5684,22 @@ move_stmt_r (tree *tp, int *walk_subtrees, void *data) struct move_stmt_d *p = (struct move_stmt_d *) data; tree t = *tp; - if (p->block - && (EXPR_P (t) || GIMPLE_STMT_P (t))) - TREE_BLOCK (t) = p->block; + if (EXPR_P (t) || GIMPLE_STMT_P (t)) + { + tree block = TREE_BLOCK (t); + if (p->orig_block == NULL_TREE + || block == p->orig_block + || block == NULL_TREE) + TREE_BLOCK (t) = p->new_block; +#ifdef ENABLE_CHECKING + else if (block != p->new_block) + { + while (block && block != p->orig_block) + block = BLOCK_SUPERCONTEXT (block); + gcc_assert (block); + } +#endif + } if (OMP_DIRECTIVE_P (t) && TREE_CODE (t) != OMP_RETURN @@ -5792,14 +5806,12 @@ mark_virtual_ops_in_region (VEC (basic_block,heap) *bbs) static void move_block_to_fn (struct function *dest_cfun, basic_block bb, basic_block after, bool update_edge_count_p, - struct pointer_map_t *vars_map, htab_t new_label_map, - int eh_offset) + struct move_stmt_d *d, int eh_offset) { struct control_flow_graph *cfg; edge_iterator ei; edge e; block_stmt_iterator si; - struct move_stmt_d d; unsigned old_len, new_len; tree phi, next_phi; @@ -5856,33 +5868,22 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb, continue; } - SET_PHI_RESULT (phi, replace_ssa_name (op, vars_map, dest_cfun->decl)); + SET_PHI_RESULT (phi, + replace_ssa_name (op, d->vars_map, dest_cfun->decl)); FOR_EACH_PHI_ARG (use, phi, oi, SSA_OP_USE) { op = USE_FROM_PTR (use); if (TREE_CODE (op) == SSA_NAME) - SET_USE (use, replace_ssa_name (op, vars_map, dest_cfun->decl)); + SET_USE (use, replace_ssa_name (op, d->vars_map, dest_cfun->decl)); } } - /* The statements in BB need to be associated with a new TREE_BLOCK. - Labels need to be associated with a new label-to-block map. */ - memset (&d, 0, sizeof (d)); - d.vars_map = vars_map; - d.from_context = cfun->decl; - d.to_context = dest_cfun->decl; - d.new_label_map = new_label_map; - for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si)) { tree stmt = bsi_stmt (si); int region; - d.remap_decls_p = true; - if (TREE_BLOCK (stmt)) - d.block = DECL_INITIAL (dest_cfun->decl); - - walk_tree (&stmt, move_stmt_r, &d, NULL); + walk_tree (&stmt, move_stmt_r, d, NULL); if (TREE_CODE (stmt) == LABEL_EXPR) { @@ -5989,6 +5990,35 @@ new_label_mapper (tree decl, void *data) return m->to; } +/* Change DECL_CONTEXT of all BLOCK_VARS in block, including + subblocks. */ + +static void +replace_block_vars_by_duplicates (tree block, struct pointer_map_t *vars_map, + tree to_context) +{ + tree *tp, t; + + for (tp = &BLOCK_VARS (block); *tp; tp = &TREE_CHAIN (*tp)) + { + t = *tp; + replace_by_duplicate_decl (&t, vars_map, to_context); + if (t != *tp) + { + if (TREE_CODE (*tp) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (*tp)) + { + SET_DECL_VALUE_EXPR (t, DECL_VALUE_EXPR (*tp)); + DECL_HAS_VALUE_EXPR_P (t) = 1; + } + TREE_CHAIN (t) = TREE_CHAIN (*tp); + *tp = t; + } + } + + for (block = BLOCK_SUBBLOCKS (block); block; block = BLOCK_CHAIN (block)) + replace_block_vars_by_duplicates (block, vars_map, to_context); +} + /* Move a single-entry, single-exit region delimited by ENTRY_BB and EXIT_BB to function DEST_CFUN. The whole region is replaced by a single basic block in the original CFG and the new basic block is @@ -5999,13 +6029,17 @@ new_label_mapper (tree decl, void *data) is that ENTRY_BB should be the only entry point and it must dominate EXIT_BB. + Change TREE_BLOCK of all statements in ORIG_BLOCK to the new + functions outermost BLOCK, move all subblocks of ORIG_BLOCK + to the new function. + All local variables referenced in the region are assumed to be in the corresponding BLOCK_VARS and unexpanded variable lists associated with DEST_CFUN. */ basic_block move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, - basic_block exit_bb) + basic_block exit_bb, tree orig_block) { VEC(basic_block,heap) *bbs, *dom_bbs; basic_block dom_entry = get_immediate_dominator (CDI_DOMINATORS, entry_bb); @@ -6019,6 +6053,7 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, htab_t new_label_map; struct pointer_map_t *vars_map; struct loop *loop = entry_bb->loop_father; + struct move_stmt_d d; /* If ENTRY does not strictly dominate EXIT, this cannot be an SESE region. */ @@ -6115,16 +6150,42 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, gcc_assert (VEC_length (basic_block, bbs) >= 2); after = dest_cfun->cfg->x_entry_block_ptr; vars_map = pointer_map_create (); + + memset (&d, 0, sizeof (d)); + d.vars_map = vars_map; + d.from_context = cfun->decl; + d.to_context = dest_cfun->decl; + d.new_label_map = new_label_map; + d.remap_decls_p = true; + d.orig_block = orig_block; + d.new_block = DECL_INITIAL (dest_cfun->decl); + for (i = 0; VEC_iterate (basic_block, bbs, i, bb); i++) { /* No need to update edge counts on the last block. It has already been updated earlier when we detached the region from the original CFG. */ - move_block_to_fn (dest_cfun, bb, after, bb != exit_bb, vars_map, - new_label_map, eh_offset); + move_block_to_fn (dest_cfun, bb, after, bb != exit_bb, &d, eh_offset); after = bb; } + /* Rewire BLOCK_SUBBLOCKS of orig_block. */ + if (orig_block) + { + tree block; + gcc_assert (BLOCK_SUBBLOCKS (DECL_INITIAL (dest_cfun->decl)) + == NULL_TREE); + BLOCK_SUBBLOCKS (DECL_INITIAL (dest_cfun->decl)) + = BLOCK_SUBBLOCKS (orig_block); + for (block = BLOCK_SUBBLOCKS (orig_block); + block; block = BLOCK_CHAIN (block)) + BLOCK_SUPERCONTEXT (block) = DECL_INITIAL (dest_cfun->decl); + BLOCK_SUBBLOCKS (orig_block) = NULL_TREE; + } + + replace_block_vars_by_duplicates (DECL_INITIAL (dest_cfun->decl), + vars_map, dest_cfun->decl); + if (new_label_map) htab_delete (new_label_map); pointer_map_destroy (vars_map); diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index bf9516cd672..c024b74e09c 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -4780,8 +4780,9 @@ known_dependences_p (VEC (ddr_p, heap) *dependence_relations) static hashval_t hash_stmt_vertex_info (const void *elt) { - struct rdg_vertex_info *rvi = (struct rdg_vertex_info *) elt; - tree stmt = rvi->stmt; + const struct rdg_vertex_info *const rvi = + (const struct rdg_vertex_info *) elt; + const_tree stmt = rvi->stmt; return htab_hash_pointer (stmt); } @@ -4982,7 +4983,8 @@ have_similar_memory_accesses (tree s1, tree s2) static int have_similar_memory_accesses_1 (const void *s1, const void *s2) { - return have_similar_memory_accesses ((tree) s1, (tree) s2); + return have_similar_memory_accesses (CONST_CAST_TREE ((const_tree)s1), + CONST_CAST_TREE ((const_tree)s2)); } /* Helper function for the hashtab. */ @@ -4990,7 +4992,7 @@ have_similar_memory_accesses_1 (const void *s1, const void *s2) static hashval_t ref_base_address_1 (const void *s) { - tree stmt = (tree) s; + tree stmt = CONST_CAST_TREE((const_tree)s); unsigned i; VEC (data_ref_loc, heap) *refs; data_ref_loc *ref; diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index a1780399cc6..285af39b3ca 100644 --- a/gcc/tree-dfa.c +++ b/gcc/tree-dfa.c @@ -746,6 +746,7 @@ remove_referenced_var (tree var) unsigned int uid = DECL_UID (var); clear_call_clobbered (var); + bitmap_clear_bit (gimple_call_used_vars (cfun), uid); if ((v_ann = var_ann (var))) { /* Preserve var_anns of globals, but clear their alias info. */ diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h index 90fcf12c079..f700ab8347c 100644 --- a/gcc/tree-flow-inline.h +++ b/gcc/tree-flow-inline.h @@ -66,6 +66,15 @@ gimple_call_clobbered_vars (const struct function *fun) return fun->gimple_df->call_clobbered_vars; } +/* Call-used variables in the function. If bit I is set, then + REFERENCED_VARS (I) is call-used at pure function call-sites. */ +static inline bitmap +gimple_call_used_vars (const struct function *fun) +{ + gcc_assert (fun && fun->gimple_df); + return fun->gimple_df->call_used_vars; +} + /* Array of all variables referenced in the function. */ static inline htab_t gimple_referenced_vars (const struct function *fun) diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h index 855f0807951..961054703db 100644 --- a/gcc/tree-flow.h +++ b/gcc/tree-flow.h @@ -1,5 +1,5 @@ /* Data and Control Flow Analysis for Trees. - Copyright (C) 2001, 2003, 2004, 2005, 2006, 2007 + Copyright (C) 2001, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. Contributed by Diego Novillo <dnovillo@redhat.com> @@ -162,6 +162,10 @@ struct gimple_df GTY(()) REFERENCED_VARS (I) is call-clobbered. */ bitmap call_clobbered_vars; + /* Call-used variables in the function. If bit I is set, then + REFERENCED_VARS (I) is call-used at pure function call-sites. */ + bitmap call_used_vars; + /* Addressable variables in the function. If bit I is set, then REFERENCED_VARS (I) has had its address taken. Note that CALL_CLOBBERED_VARS and ADDRESSABLE_VARS are not related. An @@ -788,7 +792,7 @@ extern void replace_uses_by (tree, tree); extern void start_recording_case_labels (void); extern void end_recording_case_labels (void); extern basic_block move_sese_region_to_fn (struct function *, basic_block, - basic_block); + basic_block, tree); void remove_edge_and_dominated_blocks (edge); void mark_virtual_ops_in_bb (basic_block); @@ -1173,7 +1177,8 @@ tree gimple_fold_indirect_ref (tree); /* In tree-ssa-structalias.c */ bool find_what_p_points_to (tree); -bool clobber_what_p_points_to (tree); +bool clobber_what_escaped (void); +void compute_call_used_vars (void); /* In tree-ssa-live.c */ extern void remove_unused_locals (void); diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c index c0bebf73bf0..c9e99efa9d1 100644 --- a/gcc/tree-into-ssa.c +++ b/gcc/tree-into-ssa.c @@ -985,66 +985,6 @@ prune_unused_phi_nodes (bitmap phis, bitmap kills, bitmap uses) free (defs); } -/* Given a set of blocks with variable definitions (DEF_BLOCKS), - return a bitmap with all the blocks in the iterated dominance - frontier of the blocks in DEF_BLOCKS. DFS contains dominance - frontier information as returned by compute_dominance_frontiers. - - The resulting set of blocks are the potential sites where PHI nodes - are needed. The caller is responsible for freeing the memory - allocated for the return value. */ - -static bitmap -compute_idf (bitmap def_blocks, bitmap *dfs) -{ - bitmap_iterator bi; - unsigned bb_index, i; - VEC(int,heap) *work_stack; - bitmap phi_insertion_points; - - work_stack = VEC_alloc (int, heap, n_basic_blocks); - phi_insertion_points = BITMAP_ALLOC (NULL); - - /* Seed the work list with all the blocks in DEF_BLOCKS. We use - VEC_quick_push here for speed. This is safe because we know that - the number of definition blocks is no greater than the number of - basic blocks, which is the initial capacity of WORK_STACK. */ - EXECUTE_IF_SET_IN_BITMAP (def_blocks, 0, bb_index, bi) - VEC_quick_push (int, work_stack, bb_index); - - /* Pop a block off the worklist, add every block that appears in - the original block's DF that we have not already processed to - the worklist. Iterate until the worklist is empty. Blocks - which are added to the worklist are potential sites for - PHI nodes. */ - while (VEC_length (int, work_stack) > 0) - { - bb_index = VEC_pop (int, work_stack); - - /* Since the registration of NEW -> OLD name mappings is done - separately from the call to update_ssa, when updating the SSA - form, the basic blocks where new and/or old names are defined - may have disappeared by CFG cleanup calls. In this case, - we may pull a non-existing block from the work stack. */ - gcc_assert (bb_index < (unsigned) last_basic_block); - - EXECUTE_IF_AND_COMPL_IN_BITMAP (dfs[bb_index], phi_insertion_points, - 0, i, bi) - { - /* Use a safe push because if there is a definition of VAR - in every basic block, then WORK_STACK may eventually have - more than N_BASIC_BLOCK entries. */ - VEC_safe_push (int, heap, work_stack, i); - bitmap_set_bit (phi_insertion_points, i); - } - } - - VEC_free (int, heap, work_stack); - - return phi_insertion_points; -} - - /* Return the set of blocks where variable VAR is defined and the blocks where VAR is live on entry (livein). Return NULL, if no entry is found in DEF_BLOCKS. */ @@ -1171,8 +1111,8 @@ insert_phi_nodes_for (tree var, bitmap phi_insertion_points, bool update_p) } else { - tree sym = DECL_P (var) ? var : SSA_NAME_VAR (var); - phi = create_phi_node (sym, bb); + gcc_assert (DECL_P (var)); + phi = create_phi_node (var, bb); } /* Mark this PHI node as interesting for update_ssa. */ diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 748ff31684e..ee0f4a7316a 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -166,6 +166,40 @@ along with GCC; see the file COPYING3. If not see Lastly, we delete partitions with no symbols, and clean up after ourselves. */ + +/* Alias information used by compute_may_aliases and its helpers. */ +struct alias_info +{ + /* SSA names visited while collecting points-to information. If bit I + is set, it means that SSA variable with version I has already been + visited. */ + sbitmap ssa_names_visited; + + /* Array of SSA_NAME pointers processed by the points-to collector. */ + VEC(tree,heap) *processed_ptrs; + + /* ADDRESSABLE_VARS contains all the global variables and locals that + have had their address taken. */ + struct alias_map_d **addressable_vars; + size_t num_addressable_vars; + + /* POINTERS contains all the _DECL pointers with unique memory tags + that have been referenced in the program. */ + struct alias_map_d **pointers; + size_t num_pointers; + + /* Variables that have been written to directly (i.e., not through a + pointer dereference). */ + struct pointer_set_t *written_vars; + + /* Pointers that have been used in an indirect store operation. */ + struct pointer_set_t *dereferenced_ptrs_store; + + /* Pointers that have been used in an indirect load operation. */ + struct pointer_set_t *dereferenced_ptrs_load; +}; + + /* Structure to map a variable to its alias set. */ struct alias_map_d { @@ -205,6 +239,7 @@ static struct alias_info *init_alias_info (void); static void delete_alias_info (struct alias_info *); static void compute_flow_sensitive_aliasing (struct alias_info *); static void setup_pointers_and_addressables (struct alias_info *); +static void update_alias_info (struct alias_info *); static void create_global_var (void); static void maybe_create_global_var (void); static void set_pt_anything (tree); @@ -505,7 +540,7 @@ compute_tag_properties (void) VEC_free (tree, heap, taglist); } -/* Set up the initial variable clobbers and globalness. +/* Set up the initial variable clobbers, call-uses and globalness. When this function completes, only tags whose aliases need to be clobbered will be set clobbered. Tags clobbered because they contain call clobbered vars are handled in compute_tag_properties. */ @@ -537,6 +572,14 @@ set_initial_properties (struct alias_info *ai) } } + if (!clobber_what_escaped ()) + { + any_pt_anything = true; + pt_anything_mask |= ESCAPE_TO_CALL; + } + + compute_call_used_vars (); + for (i = 0; VEC_iterate (tree, ai->processed_ptrs, i, ptr); i++) { struct ptr_info_def *pi = SSA_NAME_PTR_INFO (ptr); @@ -557,18 +600,6 @@ set_initial_properties (struct alias_info *ai) if (tag) mark_call_clobbered (tag, pi->escape_mask); - - /* Defer to points-to analysis if possible, otherwise - clobber all addressable variables. Parameters cannot - point to local memory though. - ??? Properly tracking which pointers point to non-local - memory only would make a big difference here. */ - if (!clobber_what_p_points_to (ptr) - && !(pi->escape_mask & ESCAPE_IS_PARM)) - { - any_pt_anything = true; - pt_anything_mask |= pi->escape_mask; - } } /* If the name tag is call clobbered, so is the symbol tag @@ -1726,7 +1757,12 @@ compute_may_aliases (void) address of V escapes the current function, making V call-clobbered (i.e., whether &V is stored in a global variable or if its passed as a function call argument). */ - compute_points_to_sets (ai); + compute_points_to_sets (); + + /* Update various related attributes like escaped addresses, + pointer dereferences for loads and stores. This is used + when creating name tags and alias sets. */ + update_alias_info (ai); /* Collect all pointers and addressable variables, compute alias sets, create memory tags for pointers and promote variables whose address is @@ -2006,6 +2042,9 @@ reset_alias_info (void) /* There should be no call-clobbered variable left. */ gcc_assert (bitmap_empty_p (gimple_call_clobbered_vars (cfun))); + /* Clear the call-used variables. */ + bitmap_clear (gimple_call_used_vars (cfun)); + /* Clear flow-sensitive points-to information from each SSA name. */ for (i = 1; i < num_ssa_names; i++) { @@ -2439,6 +2478,270 @@ create_alias_map_for (tree var, struct alias_info *ai) } +/* Update related alias information kept in AI. This is used when + building name tags, alias sets and deciding grouping heuristics. + STMT is the statement to process. This function also updates + ADDRESSABLE_VARS. */ + +static void +update_alias_info_1 (tree stmt, struct alias_info *ai) +{ + bitmap addr_taken; + use_operand_p use_p; + ssa_op_iter iter; + bool stmt_dereferences_ptr_p; + enum escape_type stmt_escape_type = is_escape_site (stmt); + struct mem_ref_stats_d *mem_ref_stats = gimple_mem_ref_stats (cfun); + + stmt_dereferences_ptr_p = false; + + if (stmt_escape_type == ESCAPE_TO_CALL + || stmt_escape_type == ESCAPE_TO_PURE_CONST) + { + mem_ref_stats->num_call_sites++; + if (stmt_escape_type == ESCAPE_TO_PURE_CONST) + mem_ref_stats->num_pure_const_call_sites++; + } + else if (stmt_escape_type == ESCAPE_TO_ASM) + mem_ref_stats->num_asm_sites++; + + /* Mark all the variables whose address are taken by the statement. */ + addr_taken = addresses_taken (stmt); + if (addr_taken) + bitmap_ior_into (gimple_addressable_vars (cfun), addr_taken); + + /* Process each operand use. For pointers, determine whether they + are dereferenced by the statement, or whether their value + escapes, etc. */ + FOR_EACH_PHI_OR_STMT_USE (use_p, stmt, iter, SSA_OP_USE) + { + tree op, var; + var_ann_t v_ann; + struct ptr_info_def *pi; + unsigned num_uses, num_loads, num_stores; + + op = USE_FROM_PTR (use_p); + + /* If STMT is a PHI node, OP may be an ADDR_EXPR. If so, add it + to the set of addressable variables. */ + if (TREE_CODE (op) == ADDR_EXPR) + { + bitmap addressable_vars = gimple_addressable_vars (cfun); + + gcc_assert (TREE_CODE (stmt) == PHI_NODE); + gcc_assert (addressable_vars); + + /* PHI nodes don't have annotations for pinning the set + of addresses taken, so we collect them here. + + FIXME, should we allow PHI nodes to have annotations + so that they can be treated like regular statements? + Currently, they are treated as second-class + statements. */ + add_to_addressable_set (TREE_OPERAND (op, 0), &addressable_vars); + continue; + } + + /* Ignore constants (they may occur in PHI node arguments). */ + if (TREE_CODE (op) != SSA_NAME) + continue; + + var = SSA_NAME_VAR (op); + v_ann = var_ann (var); + + /* The base variable of an SSA name must be a GIMPLE register, and thus + it cannot be aliased. */ + gcc_assert (!may_be_aliased (var)); + + /* We are only interested in pointers. */ + if (!POINTER_TYPE_P (TREE_TYPE (op))) + continue; + + pi = get_ptr_info (op); + + /* Add OP to AI->PROCESSED_PTRS, if it's not there already. */ + if (!TEST_BIT (ai->ssa_names_visited, SSA_NAME_VERSION (op))) + { + SET_BIT (ai->ssa_names_visited, SSA_NAME_VERSION (op)); + VEC_safe_push (tree, heap, ai->processed_ptrs, op); + } + + /* If STMT is a PHI node, then it will not have pointer + dereferences and it will not be an escape point. */ + if (TREE_CODE (stmt) == PHI_NODE) + continue; + + /* Determine whether OP is a dereferenced pointer, and if STMT + is an escape point, whether OP escapes. */ + count_uses_and_derefs (op, stmt, &num_uses, &num_loads, &num_stores); + + /* For directly dereferenced pointers we can apply + TBAA-pruning to their points-to set. We may not count the + implicit dereferences &PTR->FLD here. */ + if (num_loads + num_stores > 0) + pi->is_dereferenced = 1; + + /* Handle a corner case involving address expressions of the + form '&PTR->FLD'. The problem with these expressions is that + they do not represent a dereference of PTR. However, if some + other transformation propagates them into an INDIRECT_REF + expression, we end up with '*(&PTR->FLD)' which is folded + into 'PTR->FLD'. + + So, if the original code had no other dereferences of PTR, + the aliaser will not create memory tags for it, and when + &PTR->FLD gets propagated to INDIRECT_REF expressions, the + memory operations will receive no VDEF/VUSE operands. + + One solution would be to have count_uses_and_derefs consider + &PTR->FLD a dereference of PTR. But that is wrong, since it + is not really a dereference but an offset calculation. + + What we do here is to recognize these special ADDR_EXPR + nodes. Since these expressions are never GIMPLE values (they + are not GIMPLE invariants), they can only appear on the RHS + of an assignment and their base address is always an + INDIRECT_REF expression. */ + if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT + && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == ADDR_EXPR + && !is_gimple_val (GIMPLE_STMT_OPERAND (stmt, 1))) + { + /* If the RHS if of the form &PTR->FLD and PTR == OP, then + this represents a potential dereference of PTR. */ + tree rhs = GIMPLE_STMT_OPERAND (stmt, 1); + tree base = get_base_address (TREE_OPERAND (rhs, 0)); + if (TREE_CODE (base) == INDIRECT_REF + && TREE_OPERAND (base, 0) == op) + num_loads++; + } + + if (num_loads + num_stores > 0) + { + /* Mark OP as dereferenced. In a subsequent pass, + dereferenced pointers that point to a set of + variables will be assigned a name tag to alias + all the variables OP points to. */ + pi->memory_tag_needed = 1; + + /* ??? For always executed direct dereferences we can + apply TBAA-pruning to their escape set. */ + + /* If this is a store operation, mark OP as being + dereferenced to store, otherwise mark it as being + dereferenced to load. */ + if (num_stores > 0) + pointer_set_insert (ai->dereferenced_ptrs_store, var); + else + pointer_set_insert (ai->dereferenced_ptrs_load, var); + + /* Update the frequency estimate for all the dereferences of + pointer OP. */ + update_mem_sym_stats_from_stmt (op, stmt, num_loads, num_stores); + + /* Indicate that STMT contains pointer dereferences. */ + stmt_dereferences_ptr_p = true; + } + + if (stmt_escape_type != NO_ESCAPE && num_loads + num_stores < num_uses) + { + /* If STMT is an escape point and STMT contains at + least one direct use of OP, then the value of OP + escapes and so the pointed-to variables need to + be marked call-clobbered. */ + pi->value_escapes_p = 1; + pi->escape_mask |= stmt_escape_type; + + /* If the statement makes a function call, assume + that pointer OP will be dereferenced in a store + operation inside the called function. */ + if (get_call_expr_in (stmt) + || stmt_escape_type == ESCAPE_STORED_IN_GLOBAL) + { + pointer_set_insert (ai->dereferenced_ptrs_store, var); + pi->memory_tag_needed = 1; + } + } + } + + if (TREE_CODE (stmt) == PHI_NODE) + return; + + /* Mark stored variables in STMT as being written to and update the + memory reference stats for all memory symbols referenced by STMT. */ + if (stmt_references_memory_p (stmt)) + { + unsigned i; + bitmap_iterator bi; + + mem_ref_stats->num_mem_stmts++; + + /* Notice that we only update memory reference stats for symbols + loaded and stored by the statement if the statement does not + contain pointer dereferences and it is not a call/asm site. + This is to avoid double accounting problems when creating + memory partitions. After computing points-to information, + pointer dereference statistics are used to update the + reference stats of the pointed-to variables, so here we + should only update direct references to symbols. + + Indirect references are not updated here for two reasons: (1) + The first time we compute alias information, the sets + LOADED/STORED are empty for pointer dereferences, (2) After + partitioning, LOADED/STORED may have references to + partitions, not the original pointed-to variables. So, if we + always counted LOADED/STORED here and during partitioning, we + would count many symbols more than once. + + This does cause some imprecision when a statement has a + combination of direct symbol references and pointer + dereferences (e.g., MEMORY_VAR = *PTR) or if a call site has + memory symbols in its argument list, but these cases do not + occur so frequently as to constitute a serious problem. */ + if (STORED_SYMS (stmt)) + EXECUTE_IF_SET_IN_BITMAP (STORED_SYMS (stmt), 0, i, bi) + { + tree sym = referenced_var (i); + pointer_set_insert (ai->written_vars, sym); + if (!stmt_dereferences_ptr_p + && stmt_escape_type != ESCAPE_TO_CALL + && stmt_escape_type != ESCAPE_TO_PURE_CONST + && stmt_escape_type != ESCAPE_TO_ASM) + update_mem_sym_stats_from_stmt (sym, stmt, 0, 1); + } + + if (!stmt_dereferences_ptr_p + && LOADED_SYMS (stmt) + && stmt_escape_type != ESCAPE_TO_CALL + && stmt_escape_type != ESCAPE_TO_PURE_CONST + && stmt_escape_type != ESCAPE_TO_ASM) + EXECUTE_IF_SET_IN_BITMAP (LOADED_SYMS (stmt), 0, i, bi) + update_mem_sym_stats_from_stmt (referenced_var (i), stmt, 1, 0); + } +} + +/* Update various related attributes like escaped addresses, + pointer dereferences for loads and stores. This is used + when creating name tags and alias sets. */ + +static void +update_alias_info (struct alias_info *ai) +{ + basic_block bb; + + FOR_EACH_BB (bb) + { + block_stmt_iterator bsi; + tree phi; + + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) + if (is_gimple_reg (PHI_RESULT (phi))) + update_alias_info_1 (phi, ai); + + for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi)) + update_alias_info_1 (bsi_stmt (bsi), ai); + } +} + /* Create memory tags for all the dereferenced pointers and build the ADDRESSABLE_VARS and POINTERS arrays used for building the may-alias sets. Based on the address escape and points-to information collected @@ -2906,6 +3209,12 @@ is_escape_site (tree stmt) if (TREE_CODE (lhs) == SSA_NAME) return NO_ESCAPE; + /* If the LHS is a non-global decl, it isn't a non-local memory store. + If the LHS escapes, the RHS escape is dealt with in the PTA solver. */ + if (DECL_P (lhs) + && !is_global_var (lhs)) + return NO_ESCAPE; + /* FIXME: LHS is not an SSA_NAME. Even if it's an assignment to a local variables we cannot be sure if it will escape, because we don't have information about objects not in SSA form. Need to diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c index 71fb883f84a..0aeea9f7f93 100644 --- a/gcc/tree-ssa-operands.c +++ b/gcc/tree-ssa-operands.c @@ -1660,7 +1660,10 @@ add_call_clobber_ops (tree stmt, tree callee) bitmap_iterator bi; stmt_ann_t s_ann = stmt_ann (stmt); bitmap not_read_b, not_written_b; - + tree call = get_call_expr_in (stmt); + + gcc_assert (!(call_expr_flags (call) & (ECF_PURE | ECF_CONST))); + /* If we created .GLOBAL_VAR earlier, just use it. */ if (gimple_global_var (cfun)) { @@ -1674,12 +1677,10 @@ add_call_clobber_ops (tree stmt, tree callee) or write that variable. */ not_read_b = callee ? ipa_reference_get_not_read_global (callee) : NULL; not_written_b = callee ? ipa_reference_get_not_written_global (callee) : NULL; - /* Add a VDEF operand for every call clobbered variable. */ EXECUTE_IF_SET_IN_BITMAP (gimple_call_clobbered_vars (cfun), 0, u, bi) { tree var = referenced_var_lookup (u); - unsigned int escape_mask = var_ann (var)->escape_mask; tree real_var = var; bool not_read; bool not_written; @@ -1697,24 +1698,6 @@ add_call_clobber_ops (tree stmt, tree callee) /* See if this variable is really clobbered by this function. */ - /* Trivial case: Things escaping only to pure/const are not - clobbered by non-pure-const, and only read by pure/const. */ - if ((escape_mask & ~(ESCAPE_TO_PURE_CONST)) == 0) - { - tree call = get_call_expr_in (stmt); - if (call_expr_flags (call) & (ECF_CONST | ECF_PURE)) - { - add_virtual_operand (var, s_ann, opf_use, NULL, 0, -1, true); - clobber_stats.unescapable_clobbers_avoided++; - continue; - } - else - { - clobber_stats.unescapable_clobbers_avoided++; - continue; - } - } - if (not_written) { clobber_stats.static_write_clobbers_avoided++; @@ -1739,18 +1722,47 @@ add_call_read_ops (tree stmt, tree callee) bitmap_iterator bi; stmt_ann_t s_ann = stmt_ann (stmt); bitmap not_read_b; + tree call = get_call_expr_in (stmt); + + /* Const functions do not reference memory. */ + if (call_expr_flags (call) & ECF_CONST) + return; - /* if the function is not pure, it may reference memory. Add - a VUSE for .GLOBAL_VAR if it has been created. See add_referenced_var - for the heuristic used to decide whether to create .GLOBAL_VAR. */ + not_read_b = callee ? ipa_reference_get_not_read_global (callee) : NULL; + + /* For pure functions we compute non-escaped uses separately. */ + if (call_expr_flags (call) & ECF_PURE) + EXECUTE_IF_SET_IN_BITMAP (gimple_call_used_vars (cfun), 0, u, bi) + { + tree var = referenced_var_lookup (u); + tree real_var = var; + bool not_read; + + if (unmodifiable_var_p (var)) + continue; + + not_read = not_read_b + ? bitmap_bit_p (not_read_b, DECL_UID (real_var)) + : false; + + clobber_stats.readonly_clobbers++; + + /* See if this variable is really used by this function. */ + if (!not_read) + add_virtual_operand (var, s_ann, opf_use, NULL, 0, -1, true); + else + clobber_stats.static_readonly_clobbers_avoided++; + } + + /* Add a VUSE for .GLOBAL_VAR if it has been created. See + add_referenced_var for the heuristic used to decide whether to + create .GLOBAL_VAR. */ if (gimple_global_var (cfun)) { tree var = gimple_global_var (cfun); add_virtual_operand (var, s_ann, opf_use, NULL, 0, -1, true); return; } - - not_read_b = callee ? ipa_reference_get_not_read_global (callee) : NULL; /* Add a VUSE for each call-clobbered variable. */ EXECUTE_IF_SET_IN_BITMAP (gimple_call_clobbered_vars (cfun), 0, u, bi) diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index 93b82d93ab1..80917a88525 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -1115,8 +1115,8 @@ static struct pointer_set_t *nontrap_set; static hashval_t name_to_bb_hash (const void *p) { - tree n = ((struct name_to_bb *)p)->ssa_name; - return htab_hash_pointer (n) ^ ((struct name_to_bb *)p)->store; + const_tree n = ((const struct name_to_bb *)p)->ssa_name; + return htab_hash_pointer (n) ^ ((const struct name_to_bb *)p)->store; } /* The equality function of *P1 and *P2. SSA_NAMEs are shared, so diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 052903da76b..0824b3666a8 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -294,26 +294,38 @@ get_varinfo_fc (unsigned int n) return v; } +/* Static IDs for the special variables. */ +enum { nothing_id = 0, anything_id = 1, readonly_id = 2, + escaped_id = 3, nonlocal_id = 4, callused_id = 5, integer_id = 6 }; + /* Variable that represents the unknown pointer. */ static varinfo_t var_anything; static tree anything_tree; -static unsigned int anything_id; /* Variable that represents the NULL pointer. */ static varinfo_t var_nothing; static tree nothing_tree; -static unsigned int nothing_id; /* Variable that represents read only memory. */ static varinfo_t var_readonly; static tree readonly_tree; -static unsigned int readonly_id; + +/* Variable that represents escaped memory. */ +static varinfo_t var_escaped; +static tree escaped_tree; + +/* Variable that represents nonlocal memory. */ +static varinfo_t var_nonlocal; +static tree nonlocal_tree; + +/* Variable that represents call-used memory. */ +static varinfo_t var_callused; +static tree callused_tree; /* Variable that represents integers. This is used for when people do things like &0->a.b. */ static varinfo_t var_integer; static tree integer_tree; -static unsigned int integer_id; /* Lookup a heap var for FROM, and return it if we find one. */ @@ -1399,6 +1411,7 @@ do_sd_constraint (constraint_graph_t graph, constraint_t c, bitmap_set_bit (sol, anything_id); goto done; } + /* For each variable j in delta (Sol(y)), add an edge in the graph from j to x, and union Sol(j) into Sol(x). */ EXECUTE_IF_SET_IN_BITMAP (delta, 0, j, bi) @@ -1417,8 +1430,18 @@ do_sd_constraint (constraint_graph_t graph, constraint_t c, /* Adding edges from the special vars is pointless. They don't have sets that can change. */ - if (get_varinfo (t) ->is_special_var) + if (get_varinfo (t)->is_special_var) flag |= bitmap_ior_into (sol, get_varinfo (t)->solution); + /* Merging the solution from ESCAPED needlessly increases + the set. Use ESCAPED as representative instead. + Same for CALLUSED. */ + else if ((get_varinfo (t)->id == escaped_id + || get_varinfo (t)->id == callused_id) + && !bitmap_bit_p (sol, get_varinfo (t)->id)) + { + bitmap_set_bit (sol, get_varinfo (t)->id); + flag = true; + } else if (add_graph_edge (graph, lhs, t)) flag |= bitmap_ior_into (sol, get_varinfo (t)->solution); } @@ -2351,7 +2374,10 @@ solve_graph (constraint_graph_t graph) solution_empty = bitmap_empty_p (solution); - if (!solution_empty) + if (!solution_empty + /* Do not propagate the ESCAPED/CALLUSED solutions. */ + && i != escaped_id + && i != callused_id) { bitmap_iterator bi; @@ -2500,13 +2526,11 @@ get_constraint_exp_from_ssa_var (tree t) return cexpr; } -/* Process a completed constraint T, and add it to the constraint - list. FROM_CALL is true if this is a constraint coming from a - call, which means any DEREFs we see are "may-deref's", not - "must-deref"'s. */ +/* Process constraint T, performing various simplifications and then + adding it to our list of overall constraints. */ static void -process_constraint_1 (constraint_t t, bool from_call) +process_constraint (constraint_t t) { struct constraint_expr rhs = t->rhs; struct constraint_expr lhs = t->lhs; @@ -2530,7 +2554,7 @@ process_constraint_1 (constraint_t t, bool from_call) rhs = t->lhs; t->lhs = t->rhs; t->rhs = rhs; - process_constraint_1 (t, from_call); + process_constraint (t); } /* This can happen in our IR with things like n->a = *p */ else if (rhs.type == DEREF && lhs.type == DEREF && rhs.var != anything_id) @@ -2548,8 +2572,8 @@ process_constraint_1 (constraint_t t, bool from_call) gcc_assert (!AGGREGATE_TYPE_P (pointedtotype) || get_varinfo (rhs.var)->is_unknown_size_var); - process_constraint_1 (new_constraint (tmplhs, rhs), from_call); - process_constraint_1 (new_constraint (lhs, tmplhs), from_call); + process_constraint (new_constraint (tmplhs, rhs)); + process_constraint (new_constraint (lhs, tmplhs)); } else if (rhs.type == ADDRESSOF && lhs.type == DEREF) { @@ -2559,8 +2583,8 @@ process_constraint_1 (constraint_t t, bool from_call) tree tmpvar = create_tmp_var_raw (pointertype, "derefaddrtmp"); struct constraint_expr tmplhs = get_constraint_exp_from_ssa_var (tmpvar); - process_constraint_1 (new_constraint (tmplhs, rhs), from_call); - process_constraint_1 (new_constraint (lhs, tmplhs), from_call); + process_constraint (new_constraint (tmplhs, rhs)); + process_constraint (new_constraint (lhs, tmplhs)); } else { @@ -2569,16 +2593,6 @@ process_constraint_1 (constraint_t t, bool from_call) } } - -/* Process constraint T, performing various simplifications and then - adding it to our list of overall constraints. */ - -static void -process_constraint (constraint_t t) -{ - process_constraint_1 (t, false); -} - /* Return true if T is a variable of a type that could contain pointers. */ @@ -3241,265 +3255,6 @@ do_structure_copy (tree lhsop, tree rhsop) } -/* Update related alias information kept in AI. This is used when - building name tags, alias sets and deciding grouping heuristics. - STMT is the statement to process. This function also updates - ADDRESSABLE_VARS. */ - -static void -update_alias_info (tree stmt, struct alias_info *ai) -{ - bitmap addr_taken; - use_operand_p use_p; - ssa_op_iter iter; - bool stmt_dereferences_ptr_p; - enum escape_type stmt_escape_type = is_escape_site (stmt); - struct mem_ref_stats_d *mem_ref_stats = gimple_mem_ref_stats (cfun); - - stmt_dereferences_ptr_p = false; - - if (stmt_escape_type == ESCAPE_TO_CALL - || stmt_escape_type == ESCAPE_TO_PURE_CONST) - { - mem_ref_stats->num_call_sites++; - if (stmt_escape_type == ESCAPE_TO_PURE_CONST) - mem_ref_stats->num_pure_const_call_sites++; - } - else if (stmt_escape_type == ESCAPE_TO_ASM) - mem_ref_stats->num_asm_sites++; - - /* Mark all the variables whose address are taken by the statement. */ - addr_taken = addresses_taken (stmt); - if (addr_taken) - { - bitmap_ior_into (gimple_addressable_vars (cfun), addr_taken); - - /* If STMT is an escape point, all the addresses taken by it are - call-clobbered. */ - if (stmt_escape_type != NO_ESCAPE) - { - bitmap_iterator bi; - unsigned i; - - EXECUTE_IF_SET_IN_BITMAP (addr_taken, 0, i, bi) - { - tree rvar = referenced_var (i); - if (!unmodifiable_var_p (rvar)) - mark_call_clobbered (rvar, stmt_escape_type); - } - } - } - - /* Process each operand use. For pointers, determine whether they - are dereferenced by the statement, or whether their value - escapes, etc. */ - FOR_EACH_PHI_OR_STMT_USE (use_p, stmt, iter, SSA_OP_USE) - { - tree op, var; - var_ann_t v_ann; - struct ptr_info_def *pi; - unsigned num_uses, num_loads, num_stores; - - op = USE_FROM_PTR (use_p); - - /* If STMT is a PHI node, OP may be an ADDR_EXPR. If so, add it - to the set of addressable variables. */ - if (TREE_CODE (op) == ADDR_EXPR) - { - bitmap addressable_vars = gimple_addressable_vars (cfun); - - gcc_assert (TREE_CODE (stmt) == PHI_NODE); - gcc_assert (addressable_vars); - - /* PHI nodes don't have annotations for pinning the set - of addresses taken, so we collect them here. - - FIXME, should we allow PHI nodes to have annotations - so that they can be treated like regular statements? - Currently, they are treated as second-class - statements. */ - add_to_addressable_set (TREE_OPERAND (op, 0), &addressable_vars); - continue; - } - - /* Ignore constants (they may occur in PHI node arguments). */ - if (TREE_CODE (op) != SSA_NAME) - continue; - - var = SSA_NAME_VAR (op); - v_ann = var_ann (var); - - /* The base variable of an SSA name must be a GIMPLE register, and thus - it cannot be aliased. */ - gcc_assert (!may_be_aliased (var)); - - /* We are only interested in pointers. */ - if (!POINTER_TYPE_P (TREE_TYPE (op))) - continue; - - pi = get_ptr_info (op); - - /* Add OP to AI->PROCESSED_PTRS, if it's not there already. */ - if (!TEST_BIT (ai->ssa_names_visited, SSA_NAME_VERSION (op))) - { - SET_BIT (ai->ssa_names_visited, SSA_NAME_VERSION (op)); - VEC_safe_push (tree, heap, ai->processed_ptrs, op); - } - - /* If STMT is a PHI node, then it will not have pointer - dereferences and it will not be an escape point. */ - if (TREE_CODE (stmt) == PHI_NODE) - continue; - - /* Determine whether OP is a dereferenced pointer, and if STMT - is an escape point, whether OP escapes. */ - count_uses_and_derefs (op, stmt, &num_uses, &num_loads, &num_stores); - - /* For directly dereferenced pointers we can apply - TBAA-pruning to their points-to set. We may not count the - implicit dereferences &PTR->FLD here. */ - if (num_loads + num_stores > 0) - pi->is_dereferenced = 1; - - /* Handle a corner case involving address expressions of the - form '&PTR->FLD'. The problem with these expressions is that - they do not represent a dereference of PTR. However, if some - other transformation propagates them into an INDIRECT_REF - expression, we end up with '*(&PTR->FLD)' which is folded - into 'PTR->FLD'. - - So, if the original code had no other dereferences of PTR, - the aliaser will not create memory tags for it, and when - &PTR->FLD gets propagated to INDIRECT_REF expressions, the - memory operations will receive no VDEF/VUSE operands. - - One solution would be to have count_uses_and_derefs consider - &PTR->FLD a dereference of PTR. But that is wrong, since it - is not really a dereference but an offset calculation. - - What we do here is to recognize these special ADDR_EXPR - nodes. Since these expressions are never GIMPLE values (they - are not GIMPLE invariants), they can only appear on the RHS - of an assignment and their base address is always an - INDIRECT_REF expression. */ - if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT - && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == ADDR_EXPR - && !is_gimple_val (GIMPLE_STMT_OPERAND (stmt, 1))) - { - /* If the RHS if of the form &PTR->FLD and PTR == OP, then - this represents a potential dereference of PTR. */ - tree rhs = GIMPLE_STMT_OPERAND (stmt, 1); - tree base = get_base_address (TREE_OPERAND (rhs, 0)); - if (TREE_CODE (base) == INDIRECT_REF - && TREE_OPERAND (base, 0) == op) - num_loads++; - } - - if (num_loads + num_stores > 0) - { - /* Mark OP as dereferenced. In a subsequent pass, - dereferenced pointers that point to a set of - variables will be assigned a name tag to alias - all the variables OP points to. */ - pi->memory_tag_needed = 1; - - /* ??? For always executed direct dereferences we can - apply TBAA-pruning to their escape set. */ - - /* If this is a store operation, mark OP as being - dereferenced to store, otherwise mark it as being - dereferenced to load. */ - if (num_stores > 0) - pointer_set_insert (ai->dereferenced_ptrs_store, var); - else - pointer_set_insert (ai->dereferenced_ptrs_load, var); - - /* Update the frequency estimate for all the dereferences of - pointer OP. */ - update_mem_sym_stats_from_stmt (op, stmt, num_loads, num_stores); - - /* Indicate that STMT contains pointer dereferences. */ - stmt_dereferences_ptr_p = true; - } - - if (stmt_escape_type != NO_ESCAPE && num_loads + num_stores < num_uses) - { - /* If STMT is an escape point and STMT contains at - least one direct use of OP, then the value of OP - escapes and so the pointed-to variables need to - be marked call-clobbered. */ - pi->value_escapes_p = 1; - pi->escape_mask |= stmt_escape_type; - - /* If the statement makes a function call, assume - that pointer OP will be dereferenced in a store - operation inside the called function. */ - if (get_call_expr_in (stmt) - || stmt_escape_type == ESCAPE_STORED_IN_GLOBAL) - { - pointer_set_insert (ai->dereferenced_ptrs_store, var); - pi->memory_tag_needed = 1; - } - } - } - - if (TREE_CODE (stmt) == PHI_NODE) - return; - - /* Mark stored variables in STMT as being written to and update the - memory reference stats for all memory symbols referenced by STMT. */ - if (stmt_references_memory_p (stmt)) - { - unsigned i; - bitmap_iterator bi; - - mem_ref_stats->num_mem_stmts++; - - /* Notice that we only update memory reference stats for symbols - loaded and stored by the statement if the statement does not - contain pointer dereferences and it is not a call/asm site. - This is to avoid double accounting problems when creating - memory partitions. After computing points-to information, - pointer dereference statistics are used to update the - reference stats of the pointed-to variables, so here we - should only update direct references to symbols. - - Indirect references are not updated here for two reasons: (1) - The first time we compute alias information, the sets - LOADED/STORED are empty for pointer dereferences, (2) After - partitioning, LOADED/STORED may have references to - partitions, not the original pointed-to variables. So, if we - always counted LOADED/STORED here and during partitioning, we - would count many symbols more than once. - - This does cause some imprecision when a statement has a - combination of direct symbol references and pointer - dereferences (e.g., MEMORY_VAR = *PTR) or if a call site has - memory symbols in its argument list, but these cases do not - occur so frequently as to constitute a serious problem. */ - if (STORED_SYMS (stmt)) - EXECUTE_IF_SET_IN_BITMAP (STORED_SYMS (stmt), 0, i, bi) - { - tree sym = referenced_var (i); - pointer_set_insert (ai->written_vars, sym); - if (!stmt_dereferences_ptr_p - && stmt_escape_type != ESCAPE_TO_CALL - && stmt_escape_type != ESCAPE_TO_PURE_CONST - && stmt_escape_type != ESCAPE_TO_ASM) - update_mem_sym_stats_from_stmt (sym, stmt, 0, 1); - } - - if (!stmt_dereferences_ptr_p - && LOADED_SYMS (stmt) - && stmt_escape_type != ESCAPE_TO_CALL - && stmt_escape_type != ESCAPE_TO_PURE_CONST - && stmt_escape_type != ESCAPE_TO_ASM) - EXECUTE_IF_SET_IN_BITMAP (LOADED_SYMS (stmt), 0, i, bi) - update_mem_sym_stats_from_stmt (referenced_var (i), stmt, 1, 0); - } -} - - /* Handle pointer arithmetic EXPR when creating aliasing constraints. Expressions of the type PTR + CST can be handled in two ways: @@ -3573,6 +3328,34 @@ handle_ptr_arith (VEC (ce_s, heap) *lhsc, tree expr) return true; } +/* Create a constraint ID = OP. */ + +static void +make_constraint_to (unsigned id, tree op) +{ + VEC(ce_s, heap) *rhsc = NULL; + struct constraint_expr *c; + struct constraint_expr includes; + unsigned int j; + + includes.var = id; + includes.offset = 0; + includes.type = SCALAR; + + get_constraint_for (op, &rhsc); + for (j = 0; VEC_iterate (ce_s, rhsc, j, c); j++) + process_constraint (new_constraint (includes, *c)); + VEC_free (ce_s, heap, rhsc); +} + +/* Make constraints necessary to make OP escape. */ + +static void +make_escape_constraint (tree op) +{ + make_constraint_to (escaped_id, op); +} + /* For non-IPA mode, generate constraints necessary for a call on the RHS. */ @@ -3581,53 +3364,175 @@ handle_rhs_call (tree rhs) { tree arg; call_expr_arg_iterator iter; + + FOR_EACH_CALL_EXPR_ARG (arg, iter, rhs) + /* Find those pointers being passed, and make sure they end up + pointing to anything. */ + if (could_have_pointers (arg)) + make_escape_constraint (arg); + + /* The static chain escapes as well. */ + if (CALL_EXPR_STATIC_CHAIN (rhs)) + make_escape_constraint (CALL_EXPR_STATIC_CHAIN (rhs)); +} + +/* For non-IPA mode, generate constraints necessary for a call + that returns a pointer and assigns it to LHS. This simply makes + the LHS point to global and escaped variables. */ + +static void +handle_lhs_call (tree lhs, int flags) +{ + VEC(ce_s, heap) *lhsc = NULL; struct constraint_expr rhsc; + unsigned int j; + struct constraint_expr *lhsp; - rhsc.var = anything_id; - rhsc.offset = 0; - rhsc.type = ADDRESSOF; + get_constraint_for (lhs, &lhsc); - FOR_EACH_CALL_EXPR_ARG (arg, iter, rhs) + if (flags & ECF_MALLOC) { - VEC(ce_s, heap) *lhsc = NULL; + tree heapvar = heapvar_lookup (lhs); + varinfo_t vi; - /* Find those pointers being passed, and make sure they end up - pointing to anything. */ - if (POINTER_TYPE_P (TREE_TYPE (arg))) + if (heapvar == NULL) { - unsigned int j; - struct constraint_expr *lhsp; - - get_constraint_for (arg, &lhsc); - do_deref (&lhsc); - for (j = 0; VEC_iterate (ce_s, lhsc, j, lhsp); j++) - process_constraint_1 (new_constraint (*lhsp, rhsc), true); - VEC_free (ce_s, heap, lhsc); + heapvar = create_tmp_var_raw (ptr_type_node, "HEAP"); + DECL_EXTERNAL (heapvar) = 1; + get_var_ann (heapvar)->is_heapvar = 1; + if (gimple_referenced_vars (cfun)) + add_referenced_var (heapvar); + heapvar_insert (lhs, heapvar); } + + rhsc.var = create_variable_info_for (heapvar, + alias_get_name (heapvar)); + vi = get_varinfo (rhsc.var); + vi->is_artificial_var = 1; + vi->is_heap_var = 1; + rhsc.type = ADDRESSOF; + rhsc.offset = 0; } + else + { + rhsc.var = escaped_id; + rhsc.offset = 0; + rhsc.type = ADDRESSOF; + } + for (j = 0; VEC_iterate (ce_s, lhsc, j, lhsp); j++) + process_constraint (new_constraint (*lhsp, rhsc)); + VEC_free (ce_s, heap, lhsc); } -/* For non-IPA mode, generate constraints necessary for a call - that returns a pointer and assigns it to LHS. This simply makes - the LHS point to anything. */ +/* For non-IPA mode, generate constraints necessary for a call of a + const function that returns a pointer in the statement STMT. */ static void -handle_lhs_call (tree lhs) +handle_const_call (tree stmt) { + tree lhs = GIMPLE_STMT_OPERAND (stmt, 0); + tree call = get_call_expr_in (stmt); VEC(ce_s, heap) *lhsc = NULL; struct constraint_expr rhsc; unsigned int j; struct constraint_expr *lhsp; + tree arg; + call_expr_arg_iterator iter; + + get_constraint_for (lhs, &lhsc); - rhsc.var = anything_id; + /* If this is a nested function then it can return anything. */ + if (CALL_EXPR_STATIC_CHAIN (call)) + { + rhsc.var = anything_id; + rhsc.offset = 0; + rhsc.type = ADDRESSOF; + for (j = 0; VEC_iterate (ce_s, lhsc, j, lhsp); j++) + process_constraint (new_constraint (*lhsp, rhsc)); + VEC_free (ce_s, heap, lhsc); + return; + } + + /* May return addresses of globals. */ + rhsc.var = nonlocal_id; rhsc.offset = 0; rhsc.type = ADDRESSOF; - get_constraint_for (lhs, &lhsc); for (j = 0; VEC_iterate (ce_s, lhsc, j, lhsp); j++) - process_constraint_1 (new_constraint (*lhsp, rhsc), true); + process_constraint (new_constraint (*lhsp, rhsc)); + + /* May return arguments. */ + FOR_EACH_CALL_EXPR_ARG (arg, iter, call) + if (could_have_pointers (arg)) + { + VEC(ce_s, heap) *argc = NULL; + struct constraint_expr *argp; + int i; + get_constraint_for (arg, &argc); + for (i = 0; VEC_iterate (ce_s, argc, i, argp); i++) + for (j = 0; VEC_iterate (ce_s, lhsc, j, lhsp); j++) + process_constraint (new_constraint (*lhsp, *argp)); + VEC_free (ce_s, heap, argc); + } + VEC_free (ce_s, heap, lhsc); } +/* For non-IPA mode, generate constraints necessary for a call to a + pure function in statement STMT. */ + +static void +handle_pure_call (tree stmt) +{ + tree call = get_call_expr_in (stmt); + tree arg; + call_expr_arg_iterator iter; + + /* Memory reached from pointer arguments is call-used. */ + FOR_EACH_CALL_EXPR_ARG (arg, iter, call) + if (could_have_pointers (arg)) + make_constraint_to (callused_id, arg); + + /* The static chain is used as well. */ + if (CALL_EXPR_STATIC_CHAIN (call)) + make_constraint_to (callused_id, CALL_EXPR_STATIC_CHAIN (call)); + + /* If the call returns a pointer it may point to reachable memory + from the arguments. Not so for malloc functions though. */ + if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT + && could_have_pointers (GIMPLE_STMT_OPERAND (stmt, 0)) + && !(call_expr_flags (call) & ECF_MALLOC)) + { + tree lhs = GIMPLE_STMT_OPERAND (stmt, 0); + VEC(ce_s, heap) *lhsc = NULL; + struct constraint_expr rhsc; + struct constraint_expr *lhsp; + unsigned j; + + get_constraint_for (lhs, &lhsc); + + /* If this is a nested function then it can return anything. */ + if (CALL_EXPR_STATIC_CHAIN (call)) + { + rhsc.var = anything_id; + rhsc.offset = 0; + rhsc.type = ADDRESSOF; + for (j = 0; VEC_iterate (ce_s, lhsc, j, lhsp); j++) + process_constraint (new_constraint (*lhsp, rhsc)); + VEC_free (ce_s, heap, lhsc); + return; + } + + /* Else just add the call-used memory here. Escaped variables + and globals will be dealt with in handle_lhs_call. */ + rhsc.var = callused_id; + rhsc.offset = 0; + rhsc.type = ADDRESSOF; + for (j = 0; VEC_iterate (ce_s, lhsc, j, lhsp); j++) + process_constraint (new_constraint (*lhsp, rhsc)); + VEC_free (ce_s, heap, lhsc); + } +} + /* Walk statement T setting up aliasing constraints according to the references found in T. This function is the main part of the constraint builder. AI points to auxiliary alias information used @@ -3636,10 +3541,11 @@ handle_lhs_call (tree lhs) static void find_func_aliases (tree origt) { - tree t = origt; + tree call, t = origt; VEC(ce_s, heap) *lhsc = NULL; VEC(ce_s, heap) *rhsc = NULL; struct constraint_expr *c; + enum escape_type stmt_escape_type; if (TREE_CODE (t) == RETURN_EXPR && TREE_OPERAND (t, 0)) t = TREE_OPERAND (t, 0); @@ -3688,21 +3594,36 @@ find_func_aliases (tree origt) In non-ipa mode, we need to generate constraints for each pointer passed by address. */ - else if (((TREE_CODE (t) == GIMPLE_MODIFY_STMT - && TREE_CODE (GIMPLE_STMT_OPERAND (t, 1)) == CALL_EXPR - && !(call_expr_flags (GIMPLE_STMT_OPERAND (t, 1)) - & (ECF_MALLOC | ECF_MAY_BE_ALLOCA))) - || (TREE_CODE (t) == CALL_EXPR - && !(call_expr_flags (t) - & (ECF_MALLOC | ECF_MAY_BE_ALLOCA))))) + else if ((call = get_call_expr_in (t)) != NULL_TREE) { + int flags = call_expr_flags (call); if (!in_ipa_mode) { - if (TREE_CODE (t) == GIMPLE_MODIFY_STMT) + /* Const functions can return their arguments and addresses + of global memory but not of escaped memory. */ + if (flags & ECF_CONST) + { + if (TREE_CODE (t) == GIMPLE_MODIFY_STMT + && could_have_pointers (GIMPLE_STMT_OPERAND (t, 1))) + handle_const_call (t); + } + else if (flags & ECF_PURE) + { + handle_pure_call (t); + if (TREE_CODE (t) == GIMPLE_MODIFY_STMT + && could_have_pointers (GIMPLE_STMT_OPERAND (t, 1))) + handle_lhs_call (GIMPLE_STMT_OPERAND (t, 0), flags); + } + /* Pure functions can return addresses in and of memory + reachable from their arguments, but they are not an escape + point for reachable memory of their arguments. But as we + do not compute call-used memory separately we cannot do + something special here. */ + else if (TREE_CODE (t) == GIMPLE_MODIFY_STMT) { handle_rhs_call (GIMPLE_STMT_OPERAND (t, 1)); if (could_have_pointers (GIMPLE_STMT_OPERAND (t, 1))) - handle_lhs_call (GIMPLE_STMT_OPERAND (t, 0)); + handle_lhs_call (GIMPLE_STMT_OPERAND (t, 0), flags); } else handle_rhs_call (t); @@ -3803,10 +3724,8 @@ find_func_aliases (tree origt) tree rhsop = GIMPLE_STMT_OPERAND (t, 1); int i; - if ((AGGREGATE_TYPE_P (TREE_TYPE (lhsop)) - || TREE_CODE (TREE_TYPE (lhsop)) == COMPLEX_TYPE) - && (AGGREGATE_TYPE_P (TREE_TYPE (rhsop)) - || TREE_CODE (TREE_TYPE (lhsop)) == COMPLEX_TYPE)) + if (AGGREGATE_TYPE_P (TREE_TYPE (lhsop)) + && AGGREGATE_TYPE_P (TREE_TYPE (rhsop))) { do_structure_copy (lhsop, rhsop); } @@ -3893,11 +3812,63 @@ find_func_aliases (tree origt) get_varinfo (c->var)->no_tbaa_pruning = true; } + stmt_escape_type = is_escape_site (t); + if (stmt_escape_type == ESCAPE_STORED_IN_GLOBAL) + { + tree rhs; + gcc_assert (TREE_CODE (t) == GIMPLE_MODIFY_STMT); + rhs = GIMPLE_STMT_OPERAND (t, 1); + if (TREE_CODE (rhs) == ADDR_EXPR) + { + tree base = get_base_address (TREE_OPERAND (rhs, 0)); + if (base + && (!DECL_P (base) + || !is_global_var (base))) + make_escape_constraint (rhs); + } + else if (TREE_CODE (rhs) == SSA_NAME + && POINTER_TYPE_P (TREE_TYPE (rhs))) + make_escape_constraint (rhs); + else if (could_have_pointers (rhs)) + make_escape_constraint (rhs); + } + else if (stmt_escape_type == ESCAPE_BAD_CAST) + { + tree rhs; + gcc_assert (TREE_CODE (t) == GIMPLE_MODIFY_STMT); + rhs = GIMPLE_STMT_OPERAND (t, 1); + gcc_assert (CONVERT_EXPR_P (rhs) + || TREE_CODE (rhs) == VIEW_CONVERT_EXPR); + rhs = TREE_OPERAND (rhs, 0); + make_escape_constraint (rhs); + } + else if (stmt_escape_type == ESCAPE_TO_ASM) + { + tree link; + int i; + for (i = 0, link = ASM_OUTPUTS (t); link; i++, link = TREE_CHAIN (link)) + { + tree op = TREE_VALUE (link); + if (op && could_have_pointers (op)) + /* Strictly we'd only need the constraints from ESCAPED and + NONLOCAL. */ + make_escape_constraint (op); + } + for (i = 0, link = ASM_INPUTS (t); link; i++, link = TREE_CHAIN (link)) + { + tree op = TREE_VALUE (link); + if (op && could_have_pointers (op)) + /* Strictly we'd only need the constraint to ESCAPED. */ + make_escape_constraint (op); + } + } + /* After promoting variables and computing aliasing we will need to re-scan most statements. FIXME: Try to minimize the number of statements re-scanned. It's not really necessary to re-scan *all* statements. */ - mark_stmt_modified (origt); + if (!in_ipa_mode) + mark_stmt_modified (origt); VEC_free (ce_s, heap, rhsc); VEC_free (ce_s, heap, lhsc); } @@ -4117,9 +4088,10 @@ push_fields_onto_fieldstack (tree type, VEC(fieldoff_s,heap) **fieldstack, return count; } -/* Create a constraint from ANYTHING variable to VI. */ +/* Create a constraint ID = &FROM. */ + static void -make_constraint_from_anything (varinfo_t vi) +make_constraint_from (varinfo_t vi, int from) { struct constraint_expr lhs, rhs; @@ -4127,7 +4099,7 @@ make_constraint_from_anything (varinfo_t vi) lhs.offset = 0; lhs.type = SCALAR; - rhs.var = anything_id; + rhs.var = from; rhs.offset = 0; rhs.type = ADDRESSOF; process_constraint (new_constraint (lhs, rhs)); @@ -4338,8 +4310,9 @@ create_variable_info_for (tree decl, const char *name) insert_vi_for_tree (vi->decl, vi); VEC_safe_push (varinfo_t, heap, varmap, vi); - if (is_global && (!flag_whole_program || !in_ipa_mode)) - make_constraint_from_anything (vi); + if (is_global && (!flag_whole_program || !in_ipa_mode) + && could_have_pointers (decl)) + make_constraint_from (vi, escaped_id); stats.total_vars++; if (use_field_sensitive @@ -4419,8 +4392,9 @@ create_variable_info_for (tree decl, const char *name) newvi->fullsize = vi->fullsize; insert_into_field_list (vi, newvi); VEC_safe_push (varinfo_t, heap, varmap, newvi); - if (is_global && (!flag_whole_program || !in_ipa_mode)) - make_constraint_from_anything (newvi); + if (is_global && (!flag_whole_program || !in_ipa_mode) + && (!fo->decl || could_have_pointers (fo->decl))) + make_constraint_from (newvi, escaped_id); stats.total_vars++; } @@ -4477,7 +4451,7 @@ intra_create_variable_infos (void) struct constraint_expr lhs, rhs; /* For each incoming pointer argument arg, create the constraint ARG - = ANYTHING or a dummy variable if flag_argument_noalias is set. */ + = NONLOCAL or a dummy variable if flag_argument_noalias is set. */ for (t = DECL_ARGUMENTS (current_function_decl); t; t = TREE_CHAIN (t)) { varinfo_t p; @@ -4538,7 +4512,7 @@ intra_create_variable_infos (void) varinfo_t arg_vi = get_vi_for_tree (t); for (p = arg_vi; p; p = p->next) - make_constraint_from_anything (p); + make_constraint_from (p, nonlocal_id); } } } @@ -4793,7 +4767,10 @@ find_what_p_points_to (tree p) aliases. */ if (vi->id == nothing_id) pi->pt_null = 1; - else if (vi->id == anything_id) + else if (vi->id == anything_id + || vi->id == nonlocal_id + || vi->id == escaped_id + || vi->id == callused_id) was_pt_anything = 1; else if (vi->id == readonly_id) was_pt_anything = 1; @@ -4842,42 +4819,32 @@ find_what_p_points_to (tree p) return false; } -/* Mark everything that p points to as call clobbered. Returns true - if everything is done and false if all addressable variables need to - be clobbered because p points to anything. */ +/* Mark the ESCAPED solution as call clobbered. Returns false if + pt_anything escaped which needs all locals that have their address + taken marked call clobbered as well. */ bool -clobber_what_p_points_to (tree p) +clobber_what_escaped (void) { - tree lookup_p = p; varinfo_t vi; - struct ptr_info_def *pi; unsigned int i; bitmap_iterator bi; if (!have_alias_info) return false; - /* For parameters, get at the points-to set for the actual parm - decl. */ - if (TREE_CODE (p) == SSA_NAME - && TREE_CODE (SSA_NAME_VAR (p)) == PARM_DECL - && SSA_NAME_IS_DEFAULT_DEF (p)) - lookup_p = SSA_NAME_VAR (p); - - vi = lookup_vi_for_tree (lookup_p); - if (!vi) - return false; - - /* We are asking for the points-to solution of pointers. */ - gcc_assert (!vi->is_artificial_var - && vi->size == vi->fullsize); - - pi = get_ptr_info (p); - /* This variable may have been collapsed, let's get the real - variable. */ - vi = get_varinfo (find (vi->id)); + variable for escaped_id. */ + vi = get_varinfo (find (escaped_id)); + + /* If call-used memory escapes we need to include it in the + set of escaped variables. This can happen if a pure + function returns a pointer and this pointer escapes. */ + if (bitmap_bit_p (vi->solution, callused_id)) + { + varinfo_t cu_vi = get_varinfo (find (callused_id)); + bitmap_ior_into (vi->solution, cu_vi->solution); + } /* Mark variables in the solution call-clobbered. */ EXECUTE_IF_SET_IN_BITMAP (vi->solution, 0, i, bi) @@ -4902,12 +4869,61 @@ clobber_what_p_points_to (tree p) || TREE_CODE (vi->decl) == PARM_DECL || TREE_CODE (vi->decl) == RESULT_DECL) && !unmodifiable_var_p (vi->decl)) - mark_call_clobbered (vi->decl, pi->escape_mask); + mark_call_clobbered (vi->decl, ESCAPE_TO_CALL); } return true; } +/* Compute the call-used variables. */ + +void +compute_call_used_vars (void) +{ + varinfo_t vi; + unsigned int i; + bitmap_iterator bi; + bool has_anything_id = false; + + if (!have_alias_info) + return; + + /* This variable may have been collapsed, let's get the real + variable for escaped_id. */ + vi = get_varinfo (find (callused_id)); + + /* Mark variables in the solution call-clobbered. */ + EXECUTE_IF_SET_IN_BITMAP (vi->solution, 0, i, bi) + { + varinfo_t vi = get_varinfo (i); + + if (vi->is_artificial_var) + { + /* For anything_id and integer_id we need to make + all local addressable vars call-used. */ + if (vi->id == anything_id + || vi->id == integer_id) + has_anything_id = true; + } + + /* Only artificial heap-vars are further interesting. */ + if (vi->is_artificial_var && !vi->is_heap_var) + continue; + + if ((TREE_CODE (vi->decl) == VAR_DECL + || TREE_CODE (vi->decl) == PARM_DECL + || TREE_CODE (vi->decl) == RESULT_DECL) + && !unmodifiable_var_p (vi->decl)) + bitmap_set_bit (gimple_call_used_vars (cfun), DECL_UID (vi->decl)); + } + + /* If anything is call-used, add all addressable locals to the set. */ + if (has_anything_id) + bitmap_ior_into (gimple_call_used_vars (cfun), + gimple_addressable_vars (cfun)); +} + + /* Dump points-to information to OUTFILE. */ void @@ -4958,20 +4974,19 @@ init_base_vars (void) /* Create the NULL variable, used to represent that a variable points to NULL. */ nothing_tree = create_tmp_var_raw (void_type_node, "NULL"); - var_nothing = new_var_info (nothing_tree, 0, "NULL"); + var_nothing = new_var_info (nothing_tree, nothing_id, "NULL"); insert_vi_for_tree (nothing_tree, var_nothing); var_nothing->is_artificial_var = 1; var_nothing->offset = 0; var_nothing->size = ~0; var_nothing->fullsize = ~0; var_nothing->is_special_var = 1; - nothing_id = 0; VEC_safe_push (varinfo_t, heap, varmap, var_nothing); /* Create the ANYTHING variable, used to represent that a variable points to some unknown piece of memory. */ anything_tree = create_tmp_var_raw (void_type_node, "ANYTHING"); - var_anything = new_var_info (anything_tree, 1, "ANYTHING"); + var_anything = new_var_info (anything_tree, anything_id, "ANYTHING"); insert_vi_for_tree (anything_tree, var_anything); var_anything->is_artificial_var = 1; var_anything->size = ~0; @@ -4979,7 +4994,6 @@ init_base_vars (void) var_anything->next = NULL; var_anything->fullsize = ~0; var_anything->is_special_var = 1; - anything_id = 1; /* Anything points to anything. This makes deref constraints just work in the presence of linked list and other p = *p type loops, @@ -5000,7 +5014,7 @@ init_base_vars (void) /* Create the READONLY variable, used to represent that a variable points to readonly memory. */ readonly_tree = create_tmp_var_raw (void_type_node, "READONLY"); - var_readonly = new_var_info (readonly_tree, 2, "READONLY"); + var_readonly = new_var_info (readonly_tree, readonly_id, "READONLY"); var_readonly->is_artificial_var = 1; var_readonly->offset = 0; var_readonly->size = ~0; @@ -5008,7 +5022,6 @@ init_base_vars (void) var_readonly->next = NULL; var_readonly->is_special_var = 1; insert_vi_for_tree (readonly_tree, var_readonly); - readonly_id = 2; VEC_safe_push (varinfo_t, heap, varmap, var_readonly); /* readonly memory points to anything, in order to make deref @@ -5019,15 +5032,79 @@ init_base_vars (void) lhs.var = readonly_id; lhs.offset = 0; rhs.type = ADDRESSOF; - rhs.var = anything_id; + rhs.var = readonly_id; /* FIXME */ rhs.offset = 0; + process_constraint (new_constraint (lhs, rhs)); + + /* Create the ESCAPED variable, used to represent the set of escaped + memory. */ + escaped_tree = create_tmp_var_raw (void_type_node, "ESCAPED"); + var_escaped = new_var_info (escaped_tree, escaped_id, "ESCAPED"); + insert_vi_for_tree (escaped_tree, var_escaped); + var_escaped->is_artificial_var = 1; + var_escaped->offset = 0; + var_escaped->size = ~0; + var_escaped->fullsize = ~0; + var_escaped->is_special_var = 0; + VEC_safe_push (varinfo_t, heap, varmap, var_escaped); + gcc_assert (VEC_index (varinfo_t, varmap, 3) == var_escaped); + + /* ESCAPED = *ESCAPED, because escaped is may-deref'd at calls, etc. */ + lhs.type = SCALAR; + lhs.var = escaped_id; + lhs.offset = 0; + rhs.type = DEREF; + rhs.var = escaped_id; + rhs.offset = 0; + process_constraint (new_constraint (lhs, rhs)); + /* Create the NONLOCAL variable, used to represent the set of nonlocal + memory. */ + nonlocal_tree = create_tmp_var_raw (void_type_node, "NONLOCAL"); + var_nonlocal = new_var_info (nonlocal_tree, nonlocal_id, "NONLOCAL"); + insert_vi_for_tree (nonlocal_tree, var_nonlocal); + var_nonlocal->is_artificial_var = 1; + var_nonlocal->offset = 0; + var_nonlocal->size = ~0; + var_nonlocal->fullsize = ~0; + var_nonlocal->is_special_var = 1; + VEC_safe_push (varinfo_t, heap, varmap, var_nonlocal); + + /* Nonlocal memory points to escaped (which includes nonlocal), + in order to make deref easier. */ + lhs.type = SCALAR; + lhs.var = nonlocal_id; + lhs.offset = 0; + rhs.type = ADDRESSOF; + rhs.var = escaped_id; + rhs.offset = 0; + process_constraint (new_constraint (lhs, rhs)); + + /* Create the CALLUSED variable, used to represent the set of call-used + memory. */ + callused_tree = create_tmp_var_raw (void_type_node, "CALLUSED"); + var_callused = new_var_info (callused_tree, callused_id, "CALLUSED"); + insert_vi_for_tree (callused_tree, var_callused); + var_callused->is_artificial_var = 1; + var_callused->offset = 0; + var_callused->size = ~0; + var_callused->fullsize = ~0; + var_callused->is_special_var = 0; + VEC_safe_push (varinfo_t, heap, varmap, var_callused); + + /* CALLUSED = *CALLUSED, because call-used is may-deref'd at calls, etc. */ + lhs.type = SCALAR; + lhs.var = callused_id; + lhs.offset = 0; + rhs.type = DEREF; + rhs.var = callused_id; + rhs.offset = 0; process_constraint (new_constraint (lhs, rhs)); /* Create the INTEGER variable, used to represent that a variable points to an INTEGER. */ integer_tree = create_tmp_var_raw (void_type_node, "INTEGER"); - var_integer = new_var_info (integer_tree, 3, "INTEGER"); + var_integer = new_var_info (integer_tree, integer_id, "INTEGER"); insert_vi_for_tree (integer_tree, var_integer); var_integer->is_artificial_var = 1; var_integer->size = ~0; @@ -5035,7 +5112,6 @@ init_base_vars (void) var_integer->offset = 0; var_integer->next = NULL; var_integer->is_special_var = 1; - integer_id = 3; VEC_safe_push (varinfo_t, heap, varmap, var_integer); /* INTEGER = ANYTHING, because we don't know where a dereference of @@ -5047,6 +5123,26 @@ init_base_vars (void) rhs.var = anything_id; rhs.offset = 0; process_constraint (new_constraint (lhs, rhs)); + + /* *ESCAPED = &ESCAPED. This is true because we have to assume + everything pointed to by escaped can also point to escaped. */ + lhs.type = DEREF; + lhs.var = escaped_id; + lhs.offset = 0; + rhs.type = ADDRESSOF; + rhs.var = escaped_id; + rhs.offset = 0; + process_constraint (new_constraint (lhs, rhs)); + + /* *ESCAPED = &NONLOCAL. This is true because we have to assume + everything pointed to by escaped can also point to nonlocal. */ + lhs.type = DEREF; + lhs.var = escaped_id; + lhs.offset = 0; + rhs.type = ADDRESSOF; + rhs.var = nonlocal_id; + rhs.offset = 0; + process_constraint (new_constraint (lhs, rhs)); } /* Initialize things necessary to perform PTA */ @@ -5245,7 +5341,7 @@ compute_tbaa_pruning (void) at the start of the file for an algorithmic overview. */ void -compute_points_to_sets (struct alias_info *ai) +compute_points_to_sets (void) { struct scc_info *si; basic_block bb; @@ -5264,18 +5360,8 @@ compute_points_to_sets (struct alias_info *ai) tree phi; for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) - { - if (is_gimple_reg (PHI_RESULT (phi))) - { - find_func_aliases (phi); - - /* Update various related attributes like escaped - addresses, pointer dereferences for loads and stores. - This is used when creating name tags and alias - sets. */ - update_alias_info (phi, ai); - } - } + if (is_gimple_reg (PHI_RESULT (phi))) + find_func_aliases (phi); for (bsi = bsi_start (bb); !bsi_end_p (bsi); ) { @@ -5283,12 +5369,6 @@ compute_points_to_sets (struct alias_info *ai) find_func_aliases (stmt); - /* Update various related attributes like escaped - addresses, pointer dereferences for loads and stores. - This is used when creating name tags and alias - sets. */ - update_alias_info (stmt, ai); - /* The information in CHANGE_DYNAMIC_TYPE_EXPR nodes has now been captured, and we can remove them. */ if (TREE_CODE (stmt) == CHANGE_DYNAMIC_TYPE_EXPR) @@ -5425,7 +5505,7 @@ ipa_pta_execute (void) { varinfo_t fi = get_varinfo (varid); for (; fi; fi = fi->next) - make_constraint_from_anything (fi); + make_constraint_from (fi, anything_id); } } } diff --git a/gcc/tree-ssa-structalias.h b/gcc/tree-ssa-structalias.h index 737135bdc87..7d468b42f91 100644 --- a/gcc/tree-ssa-structalias.h +++ b/gcc/tree-ssa-structalias.h @@ -24,44 +24,12 @@ struct constraint; typedef struct constraint *constraint_t; -/* Alias information used by compute_may_aliases and its helpers. */ -struct alias_info -{ - /* SSA names visited while collecting points-to information. If bit I - is set, it means that SSA variable with version I has already been - visited. */ - sbitmap ssa_names_visited; - - /* Array of SSA_NAME pointers processed by the points-to collector. */ - VEC(tree,heap) *processed_ptrs; - - /* ADDRESSABLE_VARS contains all the global variables and locals that - have had their address taken. */ - struct alias_map_d **addressable_vars; - size_t num_addressable_vars; - - /* POINTERS contains all the _DECL pointers with unique memory tags - that have been referenced in the program. */ - struct alias_map_d **pointers; - size_t num_pointers; - - /* Variables that have been written to directly (i.e., not through a - pointer dereference). */ - struct pointer_set_t *written_vars; - - /* Pointers that have been used in an indirect store operation. */ - struct pointer_set_t *dereferenced_ptrs_store; - - /* Pointers that have been used in an indirect load operation. */ - struct pointer_set_t *dereferenced_ptrs_load; -}; - /* In tree-ssa-alias.c. */ enum escape_type is_escape_site (tree); void update_mem_sym_stats_from_stmt (tree, tree, long, long); /* In tree-ssa-structalias.c. */ -extern void compute_points_to_sets (struct alias_info *); +extern void compute_points_to_sets (void); extern void delete_points_to_sets (void); extern void dump_constraint (FILE *, constraint_t); extern void dump_constraints (FILE *); diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 5a744648271..7f567b57a2e 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -937,6 +937,7 @@ init_tree_ssa (struct function *fn) fn->gimple_df->default_defs = htab_create_ggc (20, uid_ssaname_map_hash, uid_ssaname_map_eq, NULL); fn->gimple_df->call_clobbered_vars = BITMAP_GGC_ALLOC (); + fn->gimple_df->call_used_vars = BITMAP_GGC_ALLOC (); fn->gimple_df->addressable_vars = BITMAP_GGC_ALLOC (); init_ssanames (fn, 0); init_phinodes (); @@ -1009,6 +1010,7 @@ delete_tree_ssa (void) htab_delete (cfun->gimple_df->default_defs); cfun->gimple_df->default_defs = NULL; cfun->gimple_df->call_clobbered_vars = NULL; + cfun->gimple_df->call_used_vars = NULL; cfun->gimple_df->addressable_vars = NULL; cfun->gimple_df->modified_noreturn_calls = NULL; if (gimple_aliases_computed_p (cfun)) diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c index 4110b335d74..1fa786da0b9 100644 --- a/gcc/tree-vect-transform.c +++ b/gcc/tree-vect-transform.c @@ -6725,16 +6725,14 @@ vect_do_peeling_for_loop_bound (loop_vec_info loop_vinfo, tree *ratio) Else, compute address misalignment in bytes: addr_mis = addr & (vectype_size - 1) - prolog_niters = min ( LOOP_NITERS , (VF - addr_mis/elem_size)&(VF-1) ) - - (elem_size = element type size; an element is the scalar element - whose type is the inner type of the vectype) + prolog_niters = min (LOOP_NITERS, ((VF - addr_mis/elem_size)&(VF-1))/step) - For interleaving, + (elem_size = element type size; an element is the scalar element whose type + is the inner type of the vectype) - prolog_niters = min ( LOOP_NITERS , - (VF/group_size - addr_mis/elem_size)&(VF/group_size-1) ) - where group_size is the size of the interleaved group. + When the step of the data-ref in the loop is not 1 (as in interleaved data + and SLP), the number of iterations of the prolog must be divided by the step + (which is equal to the size of interleaved group). The above formulas assume that VF == number of elements in the vector. This may not hold when there are multiple-types in the loop. @@ -6756,18 +6754,12 @@ vect_gen_niters_for_prolog_loop (loop_vec_info loop_vinfo, tree loop_niters) tree vectype = STMT_VINFO_VECTYPE (stmt_info); int vectype_align = TYPE_ALIGN (vectype) / BITS_PER_UNIT; tree niters_type = TREE_TYPE (loop_niters); - int group_size = 1; + int step = 1; int element_size = GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (DR_REF (dr)))); int nelements = TYPE_VECTOR_SUBPARTS (vectype); if (STMT_VINFO_STRIDED_ACCESS (stmt_info)) - { - /* For interleaved access element size must be multiplied by the size of - the interleaved group. */ - group_size = DR_GROUP_SIZE (vinfo_for_stmt ( - DR_GROUP_FIRST_DR (stmt_info))); - element_size *= group_size; - } + step = DR_GROUP_SIZE (vinfo_for_stmt (DR_GROUP_FIRST_DR (stmt_info))); pe = loop_preheader_edge (loop); @@ -6778,8 +6770,9 @@ vect_gen_niters_for_prolog_loop (loop_vec_info loop_vinfo, tree loop_niters) if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "known alignment = %d.", byte_misalign); - iters = build_int_cst (niters_type, - (nelements - elem_misalign)&(nelements/group_size-1)); + + iters = build_int_cst (niters_type, + (((nelements - elem_misalign) & (nelements - 1)) / step)); } else { diff --git a/gcc/tree.c b/gcc/tree.c index 91b2ec5c0a4..d9e4e7f18db 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -5862,23 +5862,26 @@ build_function_type (tree value_type, tree arg_types) } /* Build a function type. The RETURN_TYPE is the type returned by the - function. If additional arguments are provided, they are - additional argument types. The list of argument types must always - be terminated by NULL_TREE. */ + function. If VAARGS is set, no void_type_node is appended to the + the list. ARGP muse be alway be terminated be a NULL_TREE. */ -tree -build_function_type_list (tree return_type, ...) +static tree +build_function_type_list_1 (bool vaargs, tree return_type, va_list argp) { tree t, args, last; - va_list p; - - va_start (p, return_type); - t = va_arg (p, tree); - for (args = NULL_TREE; t != NULL_TREE; t = va_arg (p, tree)) + t = va_arg (argp, tree); + for (args = NULL_TREE; t != NULL_TREE; t = va_arg (argp, tree)) args = tree_cons (NULL_TREE, t, args); - if (args == NULL_TREE) + if (vaargs) + { + last = args; + if (args != NULL_TREE) + args = nreverse (args); + gcc_assert (args != NULL_TREE && last != void_list_node); + } + else if (args == NULL_TREE) args = void_list_node; else { @@ -5888,7 +5891,41 @@ build_function_type_list (tree return_type, ...) } args = build_function_type (return_type, args); + return args; +} + +/* Build a function type. The RETURN_TYPE is the type returned by the + function. If additional arguments are provided, they are + additional argument types. The list of argument types must always + be terminated by NULL_TREE. */ + +tree +build_function_type_list (tree return_type, ...) +{ + tree args; + va_list p; + + va_start (p, return_type); + args = build_function_type_list_1 (false, return_type, p); + va_end (p); + return args; +} + +/* Build a variable argument function type. The RETURN_TYPE is the + type returned by the function. If additional arguments are provided, + they are additional argument types. The list of argument types must + always be terminated by NULL_TREE. */ + +tree +build_varargs_function_type_list (tree return_type, ...) +{ + tree args; + va_list p; + + va_start (p, return_type); + args = build_function_type_list_1 (true, return_type, p); va_end (p); + return args; } diff --git a/gcc/tree.h b/gcc/tree.h index 9c7fff97cea..c00ad54cf05 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -4084,6 +4084,7 @@ extern tree build_index_2_type (tree, tree); extern tree build_array_type (tree, tree); extern tree build_function_type (tree, tree); extern tree build_function_type_list (tree, ...); +extern tree build_varargs_function_type_list (tree, ...); extern tree build_method_type_directly (tree, tree, tree); extern tree build_method_type (tree, tree); extern tree build_offset_type (tree, tree); diff --git a/gcc/varasm.c b/gcc/varasm.c index f8390a43bc8..d8c611444d3 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -518,7 +518,7 @@ get_unnamed_section (unsigned int flags, void (*callback) (const void *), { section *sect; - sect = ggc_alloc (sizeof (struct unnamed_section)); + sect = GGC_NEW (section); sect->unnamed.common.flags = flags | SECTION_UNNAMED; sect->unnamed.callback = callback; sect->unnamed.data = data; @@ -535,7 +535,7 @@ get_noswitch_section (unsigned int flags, noswitch_section_callback callback) { section *sect; - sect = ggc_alloc (sizeof (struct unnamed_section)); + sect = GGC_NEW (section); sect->noswitch.common.flags = flags | SECTION_NOSWITCH; sect->noswitch.callback = callback; @@ -556,7 +556,7 @@ get_section (const char *name, unsigned int flags, tree decl) flags |= SECTION_NAMED; if (*slot == NULL) { - sect = ggc_alloc (sizeof (struct named_section)); + sect = GGC_NEW (section); sect->named.common.flags = flags; sect->named.name = ggc_strdup (name); sect->named.decl = decl; diff --git a/gcc/xcoffout.c b/gcc/xcoffout.c index fb99903b76d..3c63e81a1de 100644 --- a/gcc/xcoffout.c +++ b/gcc/xcoffout.c @@ -413,7 +413,7 @@ xcoffout_declare_function (FILE *file, tree decl, const char *name) len = strlen (name); if (name[len - 1] == ']') { - char *n = alloca (len - 3); + char *n = XALLOCAVEC (char, len - 3); memcpy (n, name, len - 4); n[len - 4] = '\0'; name = n; |
