2009-05-11 J"orn Rennecke * genmodes.c (drop_mode): handle !old_contained. * genmodes.c (find_mode): Set target field for to-be searched mode. (eq_mode): Also consider target. (drop_mode): New function. (fixup_target_modes): Implement commoning of equivalent modes. Mangle mode names for other-target modes. (make_complex_modes): When processing target-specific input, don't make modes for other targets. (make_complex_modes, make_vector_modes): Tag new modes with the same target field as the modes that they are made from. (make_partial_integer_mode): Make error message clearer. (emit_insn_modes_h): Remove mangling of mode name. * Makefile.in (extra-modes.h): Use *-extra-modes.h instead of extra_modes_blurb. (extra_modes_blurb): Remove rule. [!TA] (%-extra-modes.h): New rule. * config/rs6000/t-rs6000 (rs6000-c.o): Use CXXX. * config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Add casts to enum rs6000_builtins. 2009-05-08 J"orn Rennecke * doc/extend.texi (target_arch): Document new attribute. * targhooks.c (STRINGIFY1, STRINGIFY): Delete. (default_override_options): Use this_targetm.name for error message. * flags.h (multi-target.h): Include. (flag_ira_algorithm): Mark as target specific. * multi-target.h (EXTRA_TARGETS_EXPAND_COMMA): Add trailing comma. * tree.h (expand_function_end): Mark as target specific. (expand_function_start, stack_protect_prologue): Likewise. (stack_protect_epilogue): Likewise. (allocate_struct_function): Mark as not target specific. * target.h (struct gcc_target): Add new member name. * toplev.c (targetm_array): Add zero delimiter. (asm_out_file): Don't define for EXTRA_TARGET. (process_options): Always initialize debug_hooks. * regs.h (regstat_n_sets_and_refs): Mark as target specific. (REG_N_REFS, REG_N_SETS, regstat_init_n_sets_and_refs): Likewise. (regstat_free_n_sets_and_refs, regstat_compute_ri): Likewise. (regstat_free_ri, regstat_get_setjmp_crosses): LIkewise. (regstat_compute_calls_crossed, regstat_free_calls_crossed): Likewise. (reg_renumber, have_regs_of_mode, reg_raw_mode): Likewise. * opts.c: Include multi-target.h. Add START_TARGET_SPECIFIC and END_TARGET_SPECIFC markers. Add #ifndef EXTRA_TARGET / #endif directives. (decode_options): Use this_targetm for target-specific processing. Do an EXTRA_TARGETS_CALL of self. * function.c (allocate_struct_function_1): New function, broken out of: (allocate_struct_function). (set_cfun): Update target_pnt. [!EXTRA_TARGET] (allocate_struct_function_1_array): New const array. [EXTRA_TARGET] (allocate_struct_function): Don't define. (allocate_struct_function): Initialize cfun->target_arch and set targetm_pnt. * varasm.c (last_arch): New variable. (assemble_start_function): Emit .arch directive when targetm changed since the last function was emitted, and update last_arch. * ira.c (setup_cover_and_important_classes): Use this_targetm. * ira.h (ira_init_once, ira_init): Mark as target specific. (ira_finish_once, ira_eliminate_regs): Likewise. (ira_sort_regnos_for_alter_reg, ira_mark_allocation_change): Likewise. (ira_mark_memory_move_deletion, ira_reuse_stack_slot): Likewise. (ira_mark_new_stack_slot, ira_better_spill_reload_regno_p: Likewise. * target-def.h (TARGET_INITIALIZER): Add TARGET_NAME. * rtl.h (insn_locators_alloc): Mark as target specific. (insn_locators_free, insn_locators_finalize): Likewise. (set_curr_insn_source_location, set_curr_insn_block): Likewise. (curr_insn_locator): Likewise. * output.h (asm_out_file): Don't mark as target specific. * c-common.c (handle_target_arch_attribute): New function. (c_common_attribute_table): Add target_arch attribute entry. * Makefile.in (OBJS-common): Move opts.o from here... (OBJS-rtl): ... to here. ($(out_object_file)): Add -DTARGET_NAME=\"$(target_noncanonical)\" to rule. * passes.c (execute_one_pass): Move dispatch code from here... (execute_pass_list): ... to here. 2009-05-06 J"orn Rennecke * targhooks.c (default_override_options): New function. (STRINGIFY1, STRINGIFY): New macros. * targhooks.h (default_override_options): Declare. * tree-pass.h: Include multi-target.h. Mark rtl passes and pass_rest_of_compilation as target specific. * target.h: Include multi-target.h. (struct target_option_hooks): Add override member. (targetm): change into a #define. (targetm_pnt, targetm_array): Declare. (this_targetm): Declare. * toplev.c [EXTRA_TARGET] (general_init, do_compile): Don't declare. (process_options): No longer static. [!EXTRA_TARGET] (targetm_array, targetm_pnt): Define and inititialize. (general_init): Add ATTRIBUTE_UNUSED to argv0. (process_options): Guard general code with #ifndef EXTRA_TARGET. Use this_targetm.target_option.override instead of OVERRIDE_OPTIONS. (do_compile): Do an EXTRA_TARGETS_CALL of process_options. (opth-gen.awk): Also make variables target specific that are for options named AllTarget. * common.opt (align_functions, align_jumps): Mark with AllTarget. (align_loops, flag_data_sections, flag_delayed_branch): Likewise. (flag_no_function_cse, flag_function_sections): Likewise. (flag_leading_underscore, flag_omit_frame_pointer): Likewise. (flag_rename_registers, flag_schedule_insns): Likewise. (flag_schedule_insns_after_reload): Likewise. * target-def.h [!TARGET_OVERRIDE_OPTIONS] (TARGET_OVERRIDE_OPTIONS): Define. (TARGET_OPTION_HOOKS): Include TARGET_OVERRIDE_OPTIONS. * reg-stack.c: Include multi-target.h and mark code as target specific. * reginfo.c (init_reg_sets): Make EXTRA_TARGETS_CALL of self. * Makefile.in ($(out_object_file)): Add -Dtargetm=this_targetm. * passes.c (gate_rest_of_compilation): Make target specific. (pass_rest_of_compilation): Likewise. * config/sh/sh.h (OVERRIDE_OPTIONS): Delete, moved contents to: * config/sh/sh.c (sh_override_options): New function. Make manipulation of global flags dependent on main_target. (TARGET_OVERRIDE_OPTIONS): Redefine. * config/arc/arc-protos.h (arc_init): Don't declare. * config/arc/arc.c (arc_override_options): New function. (TARGET_OVERRIDE_OPTIONS): Redefine. * config/arc/arc.h (OVERRIDE_OPTIONS): Don't define. 2009-05-01 J"orn Rennecke * regrename.c: Include "multi-target.h" and add START_TARGET_SPECIFIC and END_TARGET_SPECIFC markers. * loop-unswitch.c, sched-ebb.c, fwprop.c, dwarf2asm.c: Likewise. * dwarf2asm.h, ira-conflicts.c, targhooks.c, targhooks.h: Likewise. * regstat.c, see.c, machmode.h, rtlhooks.c, optabs.c: Likewise. * postreload-gcse.c, optabs.h, postreload.c, reload.c: Likewise. * tree.h, reload.h, rtlanal.c, ddg.c, final.c, builtins.c: Likewise. * cfghooks.c, cfghooks.h, cfgloopanal.c, cfg.c: Likewise. * auto-inc-dec.c, toplev.c, toplev.h, reorg.c, regs.h: Likewise. * df-scan.c, haifa-sched.c, dojump.c, dbxout.c, df-core.c: Likewise. * mode-switching.c, modulo-sched.c, caller-save.ci, graph.c: Likewise. * ira-int.h, cse.c, web.c, ira-color.c, sel-sched.c: Likewise. * loop-init.c, cfganal.c, ifcvt.c, jump.c, dwarf2out.c: Likewise. * expr.c, cfgbuild.c, hard-reg-set.h, predict.c, predict.h: Likewise. * recog.c, recog.h, dse.c, sel-sched-ir.c, sel-sched-ir.h: Likewise. * ira-lives.c, regmove.c, sel-sched-dump.c: Likewise. * sel-sched-dump.h, function.c, function.h, print-rtl.c: Likewise. * df.h, sdbout.c, stor-layout.c, rtlhooks-def.h, ira-emit.c: Likewise. * df-byte-scan.c, gcse.c, alias.c, alias.h, init-regs.c: Likewise. * ira-build.c, loop-unroll.c, ggc.h, insn-addr.h, calls.c: Likewise. * loop-doloop.c, rtl-factoring.c, lower-subreg.c, expmed.c: Likewise. * bt-load.c, except.c, except.h, emit-rtl.c, cfgexpand.c: Likewise. * cselib.c, cfgcleanup.c, simplify-rtx.c, explow.c: Likewise. * loop-invariant.c, loop-iv.c, cfglayout.c, varasm.c, ira.c: Likewise. * sched-deps.c, ira.h, rtl.c, ira-costs.c, rtl.h: Likewise. * integrate.c, sched-int.h, output.h, combine.c: Likewise. * fixed-value.h, addresses.h, bb-reorder.c, stack-ptr-mod.c: Likewise. * resource.c, var-tracking.c, resource.h, cfgloop.h: Likewise. * df-problems.c, reginfo.c, sched-rgn.c, basic-block.h: Likewise. * sched-vis.c, passes.c, config/sh/sh-protos.h: Likewise. * config/sh/sh.c, config/sh/sh.h, config/arc/arc.c: Likewise. * config/arc/arc.h, combine-stack-adj.c, cfgrtl.c, stmt.c: Likewise. * dce.c, reload1.c: Likewise. * targhooks.c: Add #ifndef EXTRA_TARGET / #endif directives. * cfghooks.c, toplev.c, expr.c, calls.c, emit-rtl.c: Likewise. * explow.c, passes.c: Likewise. * targhooks.h: (default_branch_target_register_class): Return int instead of enum reg_class. (default_secondary_reload): Likewise. * config/sh/sh-protos.h (sh_secondary_reload): Likewise. * config/sh/sh.c (sh_secondary_reload): Likewise. * targhooks.h: (default_ira_cover_classes): Return const int * instead of const enum reg_class *. * targhooks.c (default_ira_cover_classes): Likewise. * genrecog.c (write_header, main): Make generated file include "multi-target.h" and have START_TARGET_SPECIFIC and END_TARGET_SPECIFC markers. * genopinit.c (main): Likewise. * genoutput.c (output_prologue, main): Likewise. * genextract.c (print_header, main): Likewise. * genautomata.c (main): Likewise. * genemit.c (main): Likewise. * genpeep.c (main): Likewise. * genattrtab.c (main): Likewise. * genattr.c (gen_attr, main): Likewise. * optc-gen.awk: Likewise. * genmodes.c (emit_insn_modes_c_header, emit_insn_modes_c): Likewise. (emit_min_insn_modes_c_header, emit_min_insn_modes_c): Likewise. * genflags.c (main): Likewise. * genpreds.c (write_tm_constrs_h, write_insn_preds_c): Likewise. * opth-gen.awk: Likewise. * gengtype.c (open_base_files): Make generated file include "multi-target.h" and have START_TARGET_SPECIFIC markers. (write_func_for_structure, write_roots): FIXME: effectively comment for EXTRA_TARGET out except for creating the files. (main): Emit END_TARGET_SPECIFIC markers. * multi-target.h: New file. * mkconfig.sh: Support function-like DEFINES. In /-protos.h, wrap header files after multi-target.h up to but excluding tm-preds.h in START_TARGET_SPECIFIC / END_TARGET_SPECIFIC. * tree.h (strip_float_extensions): Delete duplicate declaration. * reload.c (push_secondary_reload): Cast arguments / return value of targetm.secondary_reload from / to enum reg_class.` (secondary_reload_class): Likewise. * ira-costs.c (copy_cost): Likewise. * reload1.c (emit_input_reload_insns): Likewise. * tree-pass.h (rtl_dispatch_pass): New struct. (TODO_arch_dispatch): New macro. (pass_expand): Now has type rtl_dispatch_pass. * tree-scalar-evolution.h (block_before_loop): Don't define for EXTRA_TARGET. (instantiate_parameters, get_chrec_loop): Likewise. * target.h (struct gcc_target): Change branch_target_register_class and ira_cover_classes to avoid the target-specific enum reg_class. * bt-load.c (branch_target_register_class): Likewise. * ddg.h, dbxout.h: Enclose declarations in namespace EXTRA_TARGET. * expr.h, cselib.h, cfglayout.h, gimple.h: Likewise * toplev.c (init_random_seed): No longer static. (lang_dependent_init_target): Likewise. (backend_init): No longer static. Do an EXTRA_TARGETS_CALL of self. (lang_dependent_init): Likewise. (target_reinit): Do an EXTRA_TARGETS_CALL of self. * toplev.h (init_random_seed): Declare, * machmode.def: Include "extra-modes.h" instead of EXTRA_MODES_FILE. * configure.ac (with_extra_target_list): Add AC_SUBST statement. * configure: Regenerate. * function.c (cfun): Don't define for EXTRA_TARGET. (init_function_start): Do an EXTRA_TARGETS_CALL of self. * function.h (struct function): Add new member target_arch. * genmodes.c (struct mode_date): New member target. (blank_mode): Add initializer for target member. (target): New variable. (new_mode): Initialize target member. (fixup_target_modes): New function. (calc_wider_mode): Skip (other-)target modes. (print_maybe_const_decl): Add declaration for const definition. Don't expect %s in type anymore. Changed all users. (emit_insn_modes_h): Prefix target modes names with the target name. Don't include target modes in search for MIN_/MAX_ modes. (emit_mode_wider): Skip target modes. (emit_real_format_for_mode): Likewise. (main): Call fixup_target_modes. * emit-rtl.c (const_int_htab, const_double_htab): No longer static * cfgexpand.c (pass_expand): Change type to struct rtl_dispatch_pass. Set TODO_arch_dispatch in todo_flags_finish. Initialize target_variants. * ira.c (setup_cover_and_important_classes): Change type of cover_classes to int *. * README-multi-target: New file. * rtl.h (struct function): Remove forward declaration. (delete_insn): Move declaration to correct block. TDEP-SOURCES: New file. * Makefile.in: Use $(TA) prefix for taget-specific files that are (compiled to be ) included in libbackend.a. (gcc_config_arguments, TA, TARGET_NUM, CXXX, OBJS-rtl): Set. (EXTRA_TARGETS, NUM_TARGETS, empty, space): Likewise. (EXTRA_TARGET_RULES, enumerate): Likewise. (out_object_file) [EXTRA_TARGET]: Set to $(TA)xout.o. (OBJS-common): Use $(OBJS-rtl), and add EXTRA_TARGETS files. (cs-tm.h): Add definitions to indicate total number of targets, the ordinary number of current extra target, and a macro to call all the extra targets to DEFINES. (cs-tm_p.h): Add multi-target.h to HEADERS. ($(out_object_file)): Use CXXX. (build/%.o) [EXTRA_TARGET]: Add -DEXTRA_TARGET=$(EXTRA_TARGET). (build/genmodes.o): Add output_target defintion to BUILD_CPPFLAGS. Depend on extra-modes.h instead of on $(extra_modes_file). (extra-modes.h, extra_modes_blurb, COMMON_ABI): New rules. (intl/config.intl, make-OBJS-rtl): Likewise. [EXTRA_TARGET]: Evaluate EXTRA_TARGET_RULES for each target in EXTRA_TARGETS with substitutions. * basic-block.h: Fix location of declarations to properly indicate where the functions are defined. * passes.c (init_optimization_passes) [!EXTRA_TARGET]: Do an EXTRA_TARGETS_CALL of self. (init_optimization_passes) [EXTRA_TARGET]: Initialize pass_expand.target_variants array member for current target. (execute_one_pass): Handle TODO_arch_dispatch flag. * config/sh/sh.c (struct save_entry_s): Change type of mode to int. * config/m32r/m32r-protos.h (m32r_compute_function_type): Make this depend on RTX_CODE being defined instead of on TREE_CODE being defined.