diff options
88 files changed, 1173 insertions, 659 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 64139976679..16a34f4d6bc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,249 @@ +2009-04-20 Ian Lance Taylor <iant@google.com> + + Fix enum conversions which are invalid in C++: + * auto-inc-dec.c (attempt_change): Change 0 to SET in function + call. + * calls.c (store_one_arg): Change 0 to EXPAND_NORMAL in function + call. + * cse.c (hash_rtx_cb): Change 0 to VOIDmode in function call. + * dbgcnt.c (dbg_cnt_set_limit_by_name): Add cast to enum type. + * dbxout.c (dbxout_symbol): Change 0 to VOIDmode in function + call. + (dbxout_parms): Likewise. + * df-core.c (df_set_flags): Change changeable_flags parameter to + int. + (df_clear_flags): Likewise. + * df-problems.c (df_rd_bb_local_compute_process_def): Change + top_flag parameter to int. + (df_chain_create_bb_process_use): Likewise. + (df_chain_add_problem): Change chain_flags parameter to unsigned + int. Remove cast. + * df-scan.c (df_ref_create): Change ref_flags parameter to int. + (df_ref_create_structure, df_def_record_1): Likewise. + (df_defs_record, df_uses_record, df_get_call_refs): Likewise. + (df_notes_rescan): Change 0 to VOIDmode in function call. + (df_get_call_refs, df_insn_refs_collect): Likewise. + (df_bb_regs_collect): Likewise. + (df_entry_block_defs_collect): Likewise. + (df_exit_block_uses_collect): Likewise. + * df.h: Update declarations. + * double-int.c (double_int_divmod): Add cast to enum type. + * dse.c (replace_inc_dec): Reverse parameters to gen_int_mode. + * dwarf2out.c (new_reg_loc_descr): Add casts to enum type. + (based_loc_descr): Likewise. + (loc_descriptor_from_tree_1): Change first_op and second_op to + enum dwarf_location_atom. Add cast to enum type. + * expmed.c (init_expmed): Change 0 to SET in function call. + * expr.c (init_expr_target): Change 0 to VOIDmode in function + call. + (expand_expr_real_1): Change 0 to EXPAND_NORMAL in function call. + (do_store_flag): Likewise. + * fixed-value.h (struct fixed_value): Change mode to enum + machine_mode. + * function.c (assign_parms): Change 0 to VOIDmode in function + call. + * genautomata.c (insert_automaton_decl): Change 1 to INSERT in + function call. + (insert_insn_decl, insert_decl, insert_state): Likewise. + (automata_list_finish): Likewise. + * genrecog.c (process_define_predicate): Add cast to enum type. + * gensupport.c (init_predicate_table): Add cast to enum type. + * gimple.c (gimple_build_return): Change 0 to ERROR_MARK in + function call. + (gimple_build_call_1, gimple_build_label): Likewise. + (gimple_build_goto, gimple_build_asm_1): Likewise. + (gimple_build_switch_1, gimple_build_cdt): Likewise. + * gimple.h (GIMPLE_CHECK): Change 0 to ERROR_MARK in function + call. + (enum fallback): Rename from enum fallback_t. + (fallback_t): Typedef as int. + * gimple-low.c (lower_builtin_setjmp): Change TSI_SAME_STMT to + GSI_SAME_STMT in function call. + * ira.c (setup_class_subset_and_memory_move_costs): Add casts to + enum type. + (setup_reg_class_relations): Likewise. + (setup_reg_class_nregs): Change cl to int. Add casts to enum + type. + (setup_prohibited_class_mode_regs): Add cast to enum type. + (setup_prohibited_mode_move_regs): Likewise. + * ira-costs.c (record_reg_classes): Change rclass to enum + reg_class. + (record_address_regs): Change i to enum reg_class. + * lists.c (alloc_EXPR_LIST): Add cast to enum type. + * machmode.h (GET_MODE_CLASS): Cast value to enum mode_class. + (GET_MODE_WIDER_MODE): Cast value to enum machine_mode. + (GET_MODE_2XWIDER_MODE): Likewise. + (GET_CLASS_NARROWEST_MODE): Likewise. + * omp-low.c (expand_omp_for): Add cast to enum type. + * optabs.c (debug_optab_libfuncs): Add casts to enum type. + * opts.c (enable_warning_as_error): Change kind to diagostic_t. + * postreload.c (reload_cse_simplify_operands): Change rclass local + to enum reg_class. + * predict.c (combine_predictions_for_insn): Change best_predictor + and predictor to enum br_predictor. + (combine_predictions_for_bb): Likewise. + (build_predict_expr): Change assignment to PREDICT_EXPR_OUTCOME to + use SET_PREDICT_EXPR_OUTCOME. + * real.c (real_arithmetic): Change icode to code in function + call. + * reginfo.c (init_move_cost): Add casts to enum type. + (init_reg_sets_1, init_fake_stack_mems): Likewise. + * regmove.c (regclass_compatible_p): Change class0 and class1 to + enum reg_class. + * reload.c (find_valid_class): Add casts to enum type. + (push_reload): Change 0 to NO_REGS in function call. + (find_reloads): Change this_alternative to array of enum + reg_class. Remove some now-unnecessary casts. + (make_memloc): Change 0 to VOIDmode in function call. + * reload1.c (reload): Change 0 to VOIDmode in function call. + (eliminate_regs_1, elimination_effects): Likewise. + (eliminate_regs_in_insn): Likewise. + (emit_input_reload_insns): Add cast to enum type. + (delete_output_reload): Change 0 to VOIDmode in function call. + * reorg.c (insn_sets_resource_p): Convert include_delayed_effects + to enum type in function call. + * tree.h (PREDICT_EXPR_OUTCOME): Add cast to enum type. + (SET_PREDICT_EXPR_OUTCOME): Define. + * tree-dump.c (get_dump_file_info): Change phase parameter to + int. + (get_dump_file_name, dump_begin, dump_enabled_p): Likewise. + (dump_initialized_p, dump_flag_name, dump_end): Likewise. + (dump_function): Likewise. + * tree-dump.h: Update declarations. + * tree-pass.h: Update declarations. + * varasm.c (assemble_integer): Change mclass to enum mode_class. + * config/arm/arm.c (thumb_legitimize_reload_address): Add cast to + enum type. + (arm_rtx_costs_1): Correct parenthesization. + (arm_rtx_costs): Add casts to enum type. + (adjacent_mem_locations): Reverse arguments to const_ok_for_op. + (vfp_emit_fstmd): Use add_rg_note. + (emit_multi_reg_push, emit_sfm): Likewise. + (thumb_set_frame_pointer): Likewise. + (arm_expand_prologue): Likewise. + (arm_regno_class): Change return type to enum reg_class. + (thumb1_expand_prologue): Use add_reg_note. + * config/arm/arm-protos.h (arm_regno_class): Update declaration. + * config/arm/arm.h (INITIALIZE_TRAMPOLINE): Change 0 to LCT_NORMAL + in function call. + * config/arm/gentune.sh: Add cast to enum type. + * config/arm/arm-tune.md: Rebuild. + * config/i386/i386.c (ix86_expand_prologue): Use add_reg_note. + (ix86_split_fp_branch, predict_jump): Likewise. + (ix86_expand_multi_arg_builtin): Change sub_code from enum + insn_code to enum rtx_code. + (ix86_builtin_vectorized_function): Add cast to enum type. + * config/i386/i386.md (truncdfsf2): Change slot to enum + ix86_stack_slot. + (truncxf<mode>2, isinf<mode>2): Likewise. + * config/i386/i386-c.c (ix86_pragma_target_parse): Add cast to + enum type. + * config/ia64/ia64.c (ia64_split_tmode_move): Use add_reg_note. + (spill_restore_mem, do_spill, ia64_expand_prologue): Likewise. + (insert_bundle_state): Change 1 to INSERT in function call. + (ia64_add_bundle_selector_before): Likewise. + * config/ia64/ia64.md (cpu attr): Add cast to enum type. + (save_stack_nonlocal): Change 0 to LCT_NORMAL in function call. + (restore_stack_nonlocal): Likewise. + * config/mips/mips.h (MIPS_ICACHE_SYNC): Change 0 to LCT_NORMAL in + function call. + * config/mips/mips.c (mips_binary_cost): Change 0 to SET in + function call. + (mips_rtx_costs): Likewise. + (mips_override_options): Add casts to enum type. + * config/mips/sdemtk.h (MIPS_ICACHE_SYNC): Change 0 to LCT_NORMAL + in function call. + * config/pa/pa.c (legitimize_pic_address): Use add_reg_note. + (store_reg, set_reg_plus_d): Likewise. + (hppa_expand_prologue, hppa_profile_hook): Likewise. + * config/rs6000/rs6000.c (rs6000_init_hard_regno_mode_ok): Add + cast to enum type. + (altivec_expand_vec_set_builtin): Change 0 to EXPAND_NORMAL in + function call. + (emit_unlikely_jump): Use add_reg_note. + (rs6000_emit_allocate_stack): Likewise. + (rs6000_frame_related, rs6000_emit_prologue): Likewise. + (output_toc): Change 1 to INSERT in function call. + (output_profile_hook): Change 0 to LCT_NORMAL in function call. + (rs6000_initialize_trampoline): Likewise. + (rs6000_init_dwarf_reg_sizes_extra): Change 0 to EXPAND_NORMAL in + function call. + * config/s390/s390.c (s390_rtx_costs): Add cast to enum type. + (s390_expand_movmem): Change 0 to OPTAB_DIRECT in function call. + (s390_expand_setmem, s390_expand_cmpmem): Likewise. + (save_gprs): Use add_reg_note. + (s390_emit_prologue): Likewise. + (s390_expand_builtin): Change 0 to EXPAND_NORMAL in function + call. + * config/sparc/sparc.c (sparc_expand_prologue): Use add_reg_note. + (sparc_fold_builtin): Add cast to enum type. + * config/spu/spu.c (spu_emit_branch_or_set): Change ior_code to + enum insn_code. + (spu_expand_prologue): Use add_reg_note. + (expand_builtin_args): Change 0 to EXPAND_NORMAL in function + call. + +2009-04-20 Ian Lance Taylor <iant@google.com> + + * c-parser.c (c_parser_attributes): Change VEC back to tree list. + (c_parser_postfix_expression_after_primary): Get VEC for list of + arguments. Get original types of arguments. Call + build_function_call_vec. + (cached_expr_list_1, cached_expr_list_2): New static variables. + (c_parser_expr_list): Change return type to VEC *. Add + p_orig_types parameter. Change all callers. + (c_parser_release_expr): New static function. + (c_parser_vec_to_tree_list): New static function. + * c-typeck.c (build_function_call): Rewrite to build a VEC and + call build_function_call_vec. + (build_function_call_vec): New function, based on old + build_function_call. + (convert_arguments): Remove nargs and argarray parameters. Change + values to a VEC. Add origtypes parameter. + (build_modify_expr): Add rhs_origtype parameter. Change all + callers. + (convert_for_assignment): Add origtype parameter. Change all + callers. If warn_cxx_compat, check for conversion to an enum + type when calling a function. + (store_init_value): Add origtype parameter. Change all callers. + (digest_init): Likewise. + (struct init_node): Add origtype field. + (add_pending_init): Add origtype parameter. Change all callers. + (output_init_element): Likewise. + (output_pending_init_elements): Pass origtype from init_node to + output_init_element. + (process_init_elemnt): Pass origtype from c_expr to + output_init_element. + (c_finish_return): Add origtype parameter. Change all callers. + * c-common.c (sync_resolve_size): Change params to VEC *. Change + caller. + (sync_resolve_params): Likewise. + (sync_resolve_return): Change params to first_param. Change + caller. + (resolve_overloaded_builtins): Change params to VEC *. Change + callers. Save first parameter around call to + build_function_call_vec. + * c-decl.c (finish_decl): Add origtype parameter. Change all + callers. Call build_function_call_vec rather than + build_function_call for cleanup. + * c-tree.h: Update declarations. + * c-common.h: Update declarations. + * stub-objc.c (objc_rewrite_function_call): Change parameter from + params to first_param. + * target.h (struct gcc_target): Change resolve_overloaded_builtin + params parameter from tree to void *. + * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): + Change arglist parameter to have type void *, and to be a pointer + to a VEC. + * config/rs6000/rs6000-protos.h + (altivec_resolve_overloaded_builtin): Update declaration. + * config/spu/spu-c.c (spu_resolved_overloaded_builtin): Change + fnargs parameter to have type void *, and to be a pointer to a + VEC. Call build_function_call_vec instead of + build_function_call. + * config/spu/spu-protos.h (spu_expand_builtin): Update + declaration. + 2009-04-20 Joey Ye <joey.ye@intel.com> Xuepeng Guo <xuepeng.guo@intel.com> H.J. Lu <hongjiu.lu@intel.com> diff --git a/gcc/auto-inc-dec.c b/gcc/auto-inc-dec.c index 86b5a2c6f8d..c871baa8aad 100644 --- a/gcc/auto-inc-dec.c +++ b/gcc/auto-inc-dec.c @@ -520,10 +520,10 @@ attempt_change (rtx new_addr, rtx inc_reg) PUT_MODE (mem_tmp, mode); XEXP (mem_tmp, 0) = new_addr; - old_cost = rtx_cost (mem, 0, speed) - + rtx_cost (PATTERN (inc_insn.insn), 0, speed); - new_cost = rtx_cost (mem_tmp, 0, speed); - + old_cost = (rtx_cost (mem, SET, speed) + + rtx_cost (PATTERN (inc_insn.insn), SET, speed)); + new_cost = rtx_cost (mem_tmp, SET, speed); + /* The first item of business is to see if this is profitable. */ if (old_cost < new_cost) { @@ -1559,4 +1559,3 @@ struct rtl_opt_pass pass_inc_dec = TODO_df_finish, /* todo_flags_finish */ } }; - diff --git a/gcc/c-common.c b/gcc/c-common.c index 735c8e0b5c4..7e62258e468 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -8649,18 +8649,18 @@ builtin_type_for_size (int size, bool unsignedp) Returns 0 if an error is encountered. */ static int -sync_resolve_size (tree function, tree params) +sync_resolve_size (tree function, VEC(tree,gc) *params) { tree type; int size; - if (params == NULL) + if (VEC_empty (tree, params)) { error ("too few arguments to function %qE", function); return 0; } - type = TREE_TYPE (TREE_VALUE (params)); + type = TREE_TYPE (VEC_index (tree, params, 0)); if (TREE_CODE (type) != POINTER_TYPE) goto incompatible; @@ -8683,27 +8683,29 @@ sync_resolve_size (tree function, tree params) was encountered; true on success. */ static bool -sync_resolve_params (tree orig_function, tree function, tree params) +sync_resolve_params (tree orig_function, tree function, VEC(tree, gc) *params) { tree arg_types = TYPE_ARG_TYPES (TREE_TYPE (function)); tree ptype; int number; + unsigned int parmnum; /* We've declared the implementation functions to use "volatile void *" as the pointer parameter, so we shouldn't get any complaints from the call to check_function_arguments what ever type the user used. */ arg_types = TREE_CHAIN (arg_types); - ptype = TREE_TYPE (TREE_TYPE (TREE_VALUE (params))); + ptype = TREE_TYPE (TREE_TYPE (VEC_index (tree, params, 0))); number = 2; /* For the rest of the values, we need to cast these to FTYPE, so that we don't get warnings for passing pointer types, etc. */ + parmnum = 0; while (arg_types != void_list_node) { tree val; - params = TREE_CHAIN (params); - if (params == NULL) + ++parmnum; + if (VEC_length (tree, params) <= parmnum) { error ("too few arguments to function %qE", orig_function); return false; @@ -8712,10 +8714,10 @@ sync_resolve_params (tree orig_function, tree function, tree params) /* ??? Ideally for the first conversion we'd use convert_for_assignment so that we get warnings for anything that doesn't match the pointer type. This isn't portable across the C and C++ front ends atm. */ - val = TREE_VALUE (params); + val = VEC_index (tree, params, parmnum); val = convert (ptype, val); val = convert (TREE_VALUE (arg_types), val); - TREE_VALUE (params) = val; + VEC_replace (tree, params, parmnum, val); arg_types = TREE_CHAIN (arg_types); number++; @@ -8725,7 +8727,7 @@ sync_resolve_params (tree orig_function, tree function, tree params) being "an optional list of variables protected by the memory barrier". No clue what that's supposed to mean, precisely, but we consider all call-clobbered variables to be protected so we're safe. */ - TREE_CHAIN (params) = NULL; + VEC_truncate (tree, params, parmnum + 1); return true; } @@ -8735,9 +8737,9 @@ sync_resolve_params (tree orig_function, tree function, tree params) PARAMS. */ static tree -sync_resolve_return (tree params, tree result) +sync_resolve_return (tree first_param, tree result) { - tree ptype = TREE_TYPE (TREE_TYPE (TREE_VALUE (params))); + tree ptype = TREE_TYPE (TREE_TYPE (first_param)); ptype = TYPE_MAIN_VARIANT (ptype); return convert (ptype, result); } @@ -8752,7 +8754,7 @@ sync_resolve_return (tree params, tree result) continue. */ tree -resolve_overloaded_builtin (tree function, tree params) +resolve_overloaded_builtin (tree function, VEC(tree,gc) *params) { enum built_in_function orig_code = DECL_FUNCTION_CODE (function); switch (DECL_BUILT_IN_CLASS (function)) @@ -8789,7 +8791,7 @@ resolve_overloaded_builtin (tree function, tree params) case BUILT_IN_LOCK_RELEASE_N: { int n = sync_resolve_size (function, params); - tree new_function, result; + tree new_function, first_param, result; if (n == 0) return error_mark_node; @@ -8798,10 +8800,11 @@ resolve_overloaded_builtin (tree function, tree params) if (!sync_resolve_params (function, new_function, params)) return error_mark_node; - result = build_function_call (new_function, params); + first_param = VEC_index (tree, params, 0); + result = build_function_call_vec (new_function, params, NULL); if (orig_code != BUILT_IN_BOOL_COMPARE_AND_SWAP_N && orig_code != BUILT_IN_LOCK_RELEASE_N) - result = sync_resolve_return (params, result); + result = sync_resolve_return (first_param, result); return result; } diff --git a/gcc/c-common.h b/gcc/c-common.h index 723f8b5ef18..dcadbdd45ad 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -415,7 +415,7 @@ extern tree add_stmt (tree); extern void push_cleanup (tree, tree, bool); extern tree pushdecl_top_level (tree); extern tree pushdecl (tree); -extern tree build_modify_expr (location_t, tree, enum tree_code, tree); +extern tree build_modify_expr (location_t, tree, enum tree_code, tree, tree); extern tree build_indirect_ref (location_t, tree, const char *); extern int c_expand_decl (tree); @@ -922,7 +922,9 @@ extern void c_do_switch_warnings (splay_tree, location_t, tree, tree); extern tree build_function_call (tree, tree); -extern tree resolve_overloaded_builtin (tree, tree); +extern tree build_function_call_vec (tree, VEC(tree,gc) *, VEC(tree,gc) *); + +extern tree resolve_overloaded_builtin (tree, VEC(tree,gc) *); extern tree finish_label_address_expr (tree, location_t); diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 796f1eaadf3..6dc2a6ac41e 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -2791,7 +2791,7 @@ c_make_fname_decl (tree id, int type_dep) /*invisible=*/false, /*nested=*/false, UNKNOWN_LOCATION); } - finish_decl (decl, init, NULL_TREE); + finish_decl (decl, init, NULL_TREE, NULL_TREE); return decl; } @@ -3364,11 +3364,12 @@ c_maybe_initialize_eh (void) /* Finish processing of a declaration; install its initial value. + If ORIGTYPE is not NULL_TREE, it is the original type of INIT. If the length of an array type is not known before, it must be determined now, from the initial value, or it is an error. */ void -finish_decl (tree decl, tree init, tree asmspec_tree) +finish_decl (tree decl, tree init, tree origtype, tree asmspec_tree) { tree type; int was_incomplete = (DECL_SIZE (decl) == 0); @@ -3390,7 +3391,7 @@ finish_decl (tree decl, tree init, tree asmspec_tree) init = 0; if (init) - store_init_value (decl, init); + store_init_value (decl, init, origtype); if (c_dialect_objc () && (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == FUNCTION_DECL @@ -3643,11 +3644,14 @@ finish_decl (tree decl, tree init, tree asmspec_tree) tree cleanup_id = TREE_VALUE (TREE_VALUE (attr)); tree cleanup_decl = lookup_name (cleanup_id); tree cleanup; + VEC(tree,gc) *vec; /* Build "cleanup(&decl)" for the destructor. */ cleanup = build_unary_op (input_location, ADDR_EXPR, decl, 0); - cleanup = build_tree_list (NULL_TREE, cleanup); - cleanup = build_function_call (cleanup_decl, cleanup); + vec = VEC_alloc (tree, gc, 1); + VEC_quick_push (tree, vec, cleanup); + cleanup = build_function_call_vec (cleanup_decl, vec, NULL); + VEC_free (tree, gc, vec); /* Don't warn about decl unused; the cleanup uses it. */ TREE_USED (decl) = 1; @@ -3690,7 +3694,7 @@ push_parm_decl (const struct c_parm *parm) decl = pushdecl (decl); - finish_decl (decl, NULL_TREE, NULL_TREE); + finish_decl (decl, NULL_TREE, NULL_TREE, NULL_TREE); } /* Mark all the parameter declarations to date as forward decls. @@ -3740,7 +3744,7 @@ build_compound_literal (tree type, tree init, bool non_const) TREE_USED (decl) = 1; TREE_TYPE (decl) = type; TREE_READONLY (decl) = TYPE_READONLY (type); - store_init_value (decl, init); + store_init_value (decl, init, NULL_TREE); if (TREE_CODE (type) == ARRAY_TYPE && !COMPLETE_TYPE_P (type)) { @@ -4678,7 +4682,7 @@ grokdeclarator (const struct c_declarator *declarator, tree decl = build_decl (TYPE_DECL, NULL_TREE, type); DECL_ARTIFICIAL (decl) = 1; pushdecl (decl); - finish_decl (decl, NULL_TREE, NULL_TREE); + finish_decl (decl, NULL_TREE, NULL_TREE, NULL_TREE); TYPE_NAME (type) = decl; } @@ -5527,7 +5531,7 @@ grokfield (location_t loc, width ? &width : NULL, decl_attrs, NULL, NULL, DEPRECATED_NORMAL); - finish_decl (value, NULL_TREE, NULL_TREE); + finish_decl (value, NULL_TREE, NULL_TREE, NULL_TREE); DECL_INITIAL (value) = width; return value; @@ -6814,7 +6818,7 @@ finish_function (void) && TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (fndecl))) == integer_type_node && flag_isoc99) { - tree stmt = c_finish_return (integer_zero_node); + tree stmt = c_finish_return (integer_zero_node, NULL_TREE); /* Hack. We don't want the middle-end to warn that this return is unreachable, so we mark its location as special. Using UNKNOWN_LOCATION has the problem that it gets clobbered in diff --git a/gcc/c-omp.c b/gcc/c-omp.c index 33f0a83e1a8..b574559d928 100644 --- a/gcc/c-omp.c +++ b/gcc/c-omp.c @@ -142,7 +142,7 @@ c_finish_omp_atomic (enum tree_code code, tree lhs, tree rhs) /* There are lots of warnings, errors, and conversions that need to happen in the course of interpreting a statement. Use the normal mechanisms to do this, and then take it apart again. */ - x = build_modify_expr (input_location, lhs, code, rhs); + x = build_modify_expr (input_location, lhs, code, rhs, NULL_TREE); if (x == error_mark_node) return error_mark_node; gcc_assert (TREE_CODE (x) == MODIFY_EXPR); @@ -260,7 +260,7 @@ c_finish_omp_for (location_t locus, tree declv, tree initv, tree condv, fail = true; } - init = build_modify_expr (elocus, decl, NOP_EXPR, init); + init = build_modify_expr (elocus, decl, NOP_EXPR, init, NULL_TREE); } gcc_assert (TREE_CODE (init) == MODIFY_EXPR); gcc_assert (TREE_OPERAND (init, 0) == decl); diff --git a/gcc/c-parser.c b/gcc/c-parser.c index 9b3ace515a9..e5129dce7e8 100644 --- a/gcc/c-parser.c +++ b/gcc/c-parser.c @@ -916,7 +916,10 @@ static struct c_expr c_parser_postfix_expression_after_primary (c_parser *, struct c_expr); static struct c_expr c_parser_expression (c_parser *); static struct c_expr c_parser_expression_conv (c_parser *); -static tree c_parser_expr_list (c_parser *, bool, bool); +static VEC(tree,gc) *c_parser_expr_list (c_parser *, bool, bool, + VEC(tree,gc) **); +static void c_parser_release_expr_list (VEC(tree,gc) *); +static tree c_parser_vec_to_tree_list (VEC(tree,gc) *); static void c_parser_omp_construct (c_parser *); static void c_parser_omp_threadprivate (c_parser *); static void c_parser_omp_barrier (c_parser *); @@ -1230,7 +1233,7 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok, bool empty_ok, if (d != error_mark_node) { maybe_warn_string_init (TREE_TYPE (d), init); - finish_decl (d, init.value, asm_name); + finish_decl (d, init.value, init.original_type, asm_name); } } else @@ -1239,7 +1242,7 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok, bool empty_ok, chainon (postfix_attrs, all_prefix_attrs)); if (d) - finish_decl (d, NULL_TREE, asm_name); + finish_decl (d, NULL_TREE, NULL_TREE, asm_name); } if (c_parser_next_token_is (parser, CPP_COMMA)) { @@ -2786,6 +2789,7 @@ c_parser_attributes (c_parser *parser) || c_parser_next_token_is (parser, CPP_KEYWORD)) { tree attr, attr_name, attr_args; + VEC(tree,gc) *expr_list; if (c_parser_next_token_is (parser, CPP_COMMA)) { c_parser_consume_token (parser); @@ -2864,10 +2868,12 @@ c_parser_attributes (c_parser *parser) attr_args = build_tree_list (NULL_TREE, arg1); else { + tree tree_list; c_parser_consume_token (parser); - attr_args = tree_cons (NULL_TREE, arg1, - c_parser_expr_list (parser, false, - true)); + expr_list = c_parser_expr_list (parser, false, true, NULL); + tree_list = c_parser_vec_to_tree_list (expr_list); + attr_args = tree_cons (NULL_TREE, arg1, tree_list); + c_parser_release_expr_list (expr_list); } } else @@ -2875,7 +2881,11 @@ c_parser_attributes (c_parser *parser) if (c_parser_next_token_is (parser, CPP_CLOSE_PAREN)) attr_args = NULL_TREE; else - attr_args = c_parser_expr_list (parser, false, true); + { + expr_list = c_parser_expr_list (parser, false, true, NULL); + attr_args = c_parser_vec_to_tree_list (expr_list); + c_parser_release_expr_list (expr_list); + } } attr = build_tree_list (attr_name, attr_args); if (c_parser_next_token_is (parser, CPP_CLOSE_PAREN)) @@ -3739,12 +3749,13 @@ c_parser_statement_after_labels (c_parser *parser) c_parser_consume_token (parser); if (c_parser_next_token_is (parser, CPP_SEMICOLON)) { - stmt = c_finish_return (NULL_TREE); + stmt = c_finish_return (NULL_TREE, NULL_TREE); c_parser_consume_token (parser); } else { - stmt = c_finish_return (c_parser_expression_conv (parser).value); + struct c_expr expr = c_parser_expression_conv (parser); + stmt = c_finish_return (expr.value, expr.original_type); goto expect_semicolon; } break; @@ -4434,7 +4445,8 @@ c_parser_expr_no_commas (c_parser *parser, struct c_expr *after) c_parser_consume_token (parser); rhs = c_parser_expr_no_commas (parser, NULL); rhs = default_function_array_conversion (rhs); - ret.value = build_modify_expr (op_location, lhs.value, code, rhs.value); + ret.value = build_modify_expr (op_location, lhs.value, code, rhs.value, + rhs.original_type); if (code == NOP_EXPR) ret.original_code = MODIFY_EXPR; else @@ -5622,7 +5634,9 @@ c_parser_postfix_expression_after_primary (c_parser *parser, struct c_expr expr) { struct c_expr orig_expr; - tree ident, idx, exprlist; + tree ident, idx; + VEC(tree,gc) *exprlist; + VEC(tree,gc) *origtypes; location_t loc = c_parser_peek_token (parser)->location; while (true) { @@ -5643,13 +5657,14 @@ c_parser_postfix_expression_after_primary (c_parser *parser, /* Function call. */ c_parser_consume_token (parser); if (c_parser_next_token_is (parser, CPP_CLOSE_PAREN)) - exprlist = NULL_TREE; + exprlist = NULL; else - exprlist = c_parser_expr_list (parser, true, false); + exprlist = c_parser_expr_list (parser, true, false, &origtypes); c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>"); orig_expr = expr; - expr.value = build_function_call (expr.value, exprlist); + expr.value = build_function_call_vec (expr.value, exprlist, + origtypes); expr.original_code = ERROR_MARK; if (TREE_CODE (expr.value) == INTEGER_CST && TREE_CODE (orig_expr.value) == FUNCTION_DECL @@ -5657,6 +5672,11 @@ c_parser_postfix_expression_after_primary (c_parser *parser, && DECL_FUNCTION_CODE (orig_expr.value) == BUILT_IN_CONSTANT_P) expr.original_code = C_MAYBE_CONST_EXPR; expr.original_type = NULL; + if (exprlist != NULL) + { + c_parser_release_expr_list (exprlist); + c_parser_release_expr_list (origtypes); + } break; case CPP_DOT: /* Structure element reference. */ @@ -5788,17 +5808,55 @@ c_parser_expression_conv (c_parser *parser) nonempty-expr-list , assignment-expression */ -static tree -c_parser_expr_list (c_parser *parser, bool convert_p, bool fold_p) +/* We cache two vectors, to save most allocation and deallocation. */ +static GTY((deletable)) VEC(tree,gc) *cached_expr_list_1; +static GTY((deletable)) VEC(tree,gc) *cached_expr_list_2; + +static VEC(tree,gc) * +c_parser_expr_list (c_parser *parser, bool convert_p, bool fold_p, + VEC(tree,gc) **p_orig_types) { + VEC(tree,gc) *ret; + VEC(tree,gc) *orig_types; struct c_expr expr; - tree ret, cur; + + if (cached_expr_list_1 != NULL) + { + ret = cached_expr_list_1; + cached_expr_list_1 = NULL; + VEC_truncate (tree, ret, 0); + } + else if (cached_expr_list_2 != NULL) + { + ret = cached_expr_list_2; + cached_expr_list_2 = NULL; + VEC_truncate (tree, ret, 0); + } + else + ret = VEC_alloc (tree, gc, 16); + + if (p_orig_types == NULL) + orig_types = NULL; + else + { + if (cached_expr_list_2 != NULL) + { + orig_types = cached_expr_list_2; + cached_expr_list_2 = NULL; + VEC_truncate (tree, orig_types, 0); + } + else + orig_types = VEC_alloc (tree, gc, 16); + } + expr = c_parser_expr_no_commas (parser, NULL); if (convert_p) expr = default_function_array_conversion (expr); if (fold_p) expr.value = c_fully_fold (expr.value, false, NULL); - ret = cur = build_tree_list (NULL_TREE, expr.value); + VEC_quick_push (tree, ret, expr.value); + if (orig_types != NULL) + VEC_quick_push (tree, orig_types, expr.original_type); while (c_parser_next_token_is (parser, CPP_COMMA)) { c_parser_consume_token (parser); @@ -5807,11 +5865,45 @@ c_parser_expr_list (c_parser *parser, bool convert_p, bool fold_p) expr = default_function_array_conversion (expr); if (fold_p) expr.value = c_fully_fold (expr.value, false, NULL); - cur = TREE_CHAIN (cur) = build_tree_list (NULL_TREE, expr.value); + VEC_safe_push (tree, gc, ret, expr.value); + if (orig_types != NULL) + VEC_safe_push (tree, gc, orig_types, expr.original_type); } + if (orig_types != NULL) + *p_orig_types = orig_types; return ret; } +/* Release a vector returned by c_parser_expr_list. */ + +static void +c_parser_release_expr_list (VEC(tree,gc) *vec) +{ + if (cached_expr_list_1 == NULL) + cached_expr_list_1 = vec; + else if (cached_expr_list_2 == NULL) + cached_expr_list_2 = vec; + else + VEC_free (tree, gc, vec); +} + +/* Convert a vector, as returned by c_parser_expr_list, to a + tree_list. */ + +static tree +c_parser_vec_to_tree_list (VEC(tree,gc) *vec) +{ + tree ret = NULL_TREE; + tree *pp = &ret; + unsigned int i; + tree t; + for (i = 0; VEC_iterate (tree, vec, i, t); ++i) + { + *pp = build_tree_list (NULL, t); + pp = &TREE_CHAIN (*pp); + } + return ret; +} /* Parse Objective-C-specific constructs. */ @@ -6682,18 +6774,21 @@ c_parser_objc_message_args (c_parser *parser) static tree c_parser_objc_keywordexpr (c_parser *parser) { - tree list = c_parser_expr_list (parser, true, true); - if (TREE_CHAIN (list) == NULL_TREE) + tree ret; + VEC(tree,gc) *expr_list = c_parser_expr_list (parser, true, true, NULL); + if (VEC_length (tree, expr_list) == 1) { /* Just return the expression, remove a level of indirection. */ - return TREE_VALUE (list); + ret = VEC_index (tree, expr_list, 0); } else { /* We have a comma expression, we will collapse later. */ - return list; + ret = c_parser_vec_to_tree_list (expr_list); } + c_parser_release_expr_list (expr_list); + return ret; } @@ -7738,7 +7833,8 @@ c_parser_omp_for_loop (c_parser *parser, tree clauses, tree *par_clauses) init_exp = c_parser_expr_no_commas (parser, NULL); init_exp = default_function_array_conversion (init_exp); init = build_modify_expr (init_loc, - decl, NOP_EXPR, init_exp.value); + decl, NOP_EXPR, init_exp.value, + init_exp.original_type); init = c_process_expr_stmt (init); c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>"); diff --git a/gcc/c-tree.h b/gcc/c-tree.h index 6b9fcc798ca..f4a2e71bf0f 100644 --- a/gcc/c-tree.h +++ b/gcc/c-tree.h @@ -500,7 +500,7 @@ extern void undeclared_variable (tree, location_t); extern tree declare_label (tree); extern tree define_label (location_t, tree); extern void c_maybe_initialize_eh (void); -extern void finish_decl (tree, tree, tree); +extern void finish_decl (tree, tree, tree, tree); extern tree finish_enum (tree, tree, tree); extern void finish_function (void); extern tree finish_struct (tree, tree, tree); @@ -595,7 +595,7 @@ extern tree build_conditional_expr (tree, bool, tree, tree); extern tree build_compound_expr (tree, tree); extern tree c_cast_expr (struct c_type_name *, tree); extern tree build_c_cast (tree, tree); -extern void store_init_value (tree, tree); +extern void store_init_value (tree, tree, tree); extern void error_init (const char *); extern void pedwarn_init (location_t, int opt, const char *); extern void maybe_warn_string_init (tree, struct c_expr); @@ -621,7 +621,7 @@ extern tree c_begin_stmt_expr (void); extern tree c_finish_stmt_expr (tree); extern tree c_process_expr_stmt (tree); extern tree c_finish_expr_stmt (tree); -extern tree c_finish_return (tree); +extern tree c_finish_return (tree, tree); extern tree c_finish_bc_stmt (tree *, bool); extern tree c_finish_goto_label (tree); extern tree c_finish_goto_ptr (tree); diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 96b1a5da599..7fc55e230e4 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -87,9 +87,10 @@ static int comp_target_types (tree, tree); static int function_types_compatible_p (const_tree, const_tree); static int type_lists_compatible_p (const_tree, const_tree); static tree lookup_field (tree, tree); -static int convert_arguments (int, tree *, tree, tree, tree, tree); +static int convert_arguments (tree, VEC(tree,gc) *, VEC(tree,gc) *, tree, + tree); static tree pointer_diff (tree, tree); -static tree convert_for_assignment (tree, tree, enum impl_conv, bool, +static tree convert_for_assignment (tree, tree, tree, enum impl_conv, bool, tree, tree, int); static tree valid_compound_expr_initializer (tree, tree); static void push_string (const char *); @@ -97,12 +98,12 @@ static void push_member_name (tree); static int spelling_length (void); static char *print_spelling (char *); static void warning_init (int, const char *); -static tree digest_init (tree, tree, bool, bool, int); -static void output_init_element (tree, bool, tree, tree, int, bool); +static tree digest_init (tree, tree, tree, bool, bool, int); +static void output_init_element (tree, tree, bool, tree, tree, int, bool); static void output_pending_init_elements (int); static int set_designator (int); static void push_range_stack (tree); -static void add_pending_init (tree, tree, bool); +static void add_pending_init (tree, tree, tree, bool); static void set_nonincremental_init (void); static void set_nonincremental_init_from_string (tree); static tree find_init_member (tree); @@ -2410,6 +2411,29 @@ c_expr_sizeof_type (struct c_type_name *t) tree build_function_call (tree function, tree params) { + VEC(tree,gc) *vec; + tree ret; + + vec = VEC_alloc (tree, gc, list_length (params)); + for (; params; params = TREE_CHAIN (params)) + VEC_quick_push (tree, vec, TREE_VALUE (params)); + ret = build_function_call_vec (function, vec, NULL); + VEC_free (tree, gc, vec); + return ret; +} + +/* Build a function call to function FUNCTION with parameters PARAMS. + ORIGTYPES, if not NULL, is a vector of types; each element is + either NULL or the original type of the corresponding element in + PARAMS. The original type may differ from TREE_TYPE of the + parameter for enums. FUNCTION's data type may be a function type + or pointer-to-function. This function changes the elements of + PARAMS. */ + +tree +build_function_call_vec (tree function, VEC(tree,gc) *params, + VEC(tree,gc) *origtypes) +{ tree fntype, fundecl = 0; tree name = NULL_TREE, result; tree tem; @@ -2439,7 +2463,9 @@ build_function_call (tree function, tree params) /* For Objective-C, convert any calls via a cast to OBJC_TYPE_REF expressions, like those used for ObjC messenger dispatches. */ - function = objc_rewrite_function_call (function, params); + if (!VEC_empty (tree, params)) + function = objc_rewrite_function_call (function, + VEC_index (tree, params, 0)); function = c_fully_fold (function, false, NULL); @@ -2464,10 +2490,8 @@ build_function_call (tree function, tree params) /* Convert the parameters to the types declared in the function prototype, or apply default promotions. */ - nargs = list_length (params); - argarray = (tree *) alloca (nargs * sizeof (tree)); - nargs = convert_arguments (nargs, argarray, TYPE_ARG_TYPES (fntype), - params, function, fundecl); + nargs = convert_arguments (TYPE_ARG_TYPES (fntype), params, origtypes, + function, fundecl); if (nargs < 0) return error_mark_node; @@ -2496,7 +2520,8 @@ build_function_call (tree function, tree params) /* Before the abort, allow the function arguments to exit or call longjmp. */ for (i = 0; i < nargs; i++) - trap = build2 (COMPOUND_EXPR, void_type_node, argarray[i], trap); + trap = build2 (COMPOUND_EXPR, void_type_node, + VEC_index (tree, params, i), trap); if (VOID_TYPE_P (return_type)) { @@ -2521,6 +2546,8 @@ build_function_call (tree function, tree params) } } + argarray = VEC_address (tree, params); + /* Check that arguments to builtin functions match the expectations. */ if (fundecl && DECL_BUILT_IN (fundecl) @@ -2559,34 +2586,31 @@ build_function_call (tree function, tree params) return require_complete_type (result); } -/* Convert the argument expressions in the list VALUES - to the types in the list TYPELIST. The resulting arguments are - stored in the array ARGARRAY which has size NARGS. +/* Convert the argument expressions in the vector VALUES + to the types in the list TYPELIST. If TYPELIST is exhausted, or when an element has NULL as its type, perform the default conversions. - PARMLIST is the chain of parm decls for the function being called. - It may be 0, if that info is not available. - It is used only for generating error messages. + ORIGTYPES is the original types of the expressions in VALUES. This + holds the type of enum values which have been converted to integral + types. It may be NULL. FUNCTION is a tree for the called function. It is used only for error messages, where it is formatted with %qE. This is also where warnings about wrong number of args are generated. - VALUES is a chain of TREE_LIST nodes with the elements of the list - in the TREE_VALUE slots of those nodes. - Returns the actual number of arguments processed (which may be less - than NARGS in some error situations), or -1 on failure. */ + than the length of VALUES in some error situations), or -1 on + failure. */ static int -convert_arguments (int nargs, tree *argarray, - tree typelist, tree values, tree function, tree fundecl) +convert_arguments (tree typelist, VEC(tree,gc) *values, + VEC(tree,gc) *origtypes, tree function, tree fundecl) { - tree typetail, valtail; - int parmnum; + tree typetail, val; + unsigned int parmnum; const bool type_generic = fundecl && lookup_attribute ("type generic", TYPE_ATTRIBUTES(TREE_TYPE (fundecl))); bool type_generic_remove_excess_precision = false; @@ -2626,20 +2650,20 @@ convert_arguments (int nargs, tree *argarray, } /* Scan the given expressions and types, producing individual - converted arguments and storing them in ARGARRAY. */ + converted arguments. */ - for (valtail = values, typetail = typelist, parmnum = 0; - valtail; - valtail = TREE_CHAIN (valtail), parmnum++) + for (typetail = typelist, parmnum = 0; + VEC_iterate (tree, values, parmnum, val); + ++parmnum) { tree type = typetail ? TREE_VALUE (typetail) : 0; - tree val = TREE_VALUE (valtail); tree valtype = TREE_TYPE (val); tree rname = function; int argnum = parmnum + 1; const char *invalid_func_diag; bool excess_precision = false; bool npc; + tree parmval; if (type == void_type_node) { @@ -2675,7 +2699,6 @@ convert_arguments (int nargs, tree *argarray, if (type != 0) { /* Formal parm type is specified by a function prototype. */ - tree parmval; if (type == error_mark_node || !COMPLETE_TYPE_P (type)) { @@ -2684,6 +2707,8 @@ convert_arguments (int nargs, tree *argarray, } else { + tree origtype; + /* Optionally warn about conversions that differ from the default conversions. */ if (warn_traditional_conversion || warn_traditional) @@ -2812,7 +2837,11 @@ convert_arguments (int nargs, tree *argarray, sake of better warnings from convert_and_check. */ if (excess_precision) val = build1 (EXCESS_PRECISION_EXPR, valtype, val); - parmval = convert_for_assignment (type, val, ic_argpass, npc, + origtype = (origtypes == NULL + ? NULL_TREE + : VEC_index (tree, origtypes, parmnum)); + parmval = convert_for_assignment (type, val, origtype, + ic_argpass, npc, fundecl, function, parmnum + 1); @@ -2821,7 +2850,6 @@ convert_arguments (int nargs, tree *argarray, && (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))) parmval = default_conversion (parmval); } - argarray[parmnum] = parmval; } else if (TREE_CODE (valtype) == REAL_TYPE && (TYPE_PRECISION (valtype) @@ -2829,15 +2857,15 @@ convert_arguments (int nargs, tree *argarray, && !DECIMAL_FLOAT_MODE_P (TYPE_MODE (valtype))) { if (type_generic) - argarray[parmnum] = val; + parmval = val; else /* Convert `float' to `double'. */ - argarray[parmnum] = convert (double_type_node, val); + parmval = convert (double_type_node, val); } else if (excess_precision && !type_generic) /* A "double" argument with excess precision being passed without a prototype or in variable arguments. */ - argarray[parmnum] = convert (valtype, val); + parmval = convert (valtype, val); else if ((invalid_func_diag = targetm.calls.invalid_arg_for_unprototyped_fn (typelist, fundecl, val))) { @@ -2846,13 +2874,15 @@ convert_arguments (int nargs, tree *argarray, } else /* Convert `short' and `char' to full-size `int'. */ - argarray[parmnum] = default_conversion (val); + parmval = default_conversion (val); + + VEC_replace (tree, values, parmnum, parmval); if (typetail) typetail = TREE_CHAIN (typetail); } - gcc_assert (parmnum == nargs); + gcc_assert (parmnum == VEC_length (tree, values)); if (typetail != 0 && TREE_VALUE (typetail) != void_type_node) { @@ -4069,7 +4099,7 @@ build_c_cast (tree type, tree expr) "ISO C forbids casts to union type"); t = digest_init (type, build_constructor_single (type, field, value), - false, true, 0); + NULL_TREE, false, true, 0); TREE_CONSTANT (t) = TREE_CONSTANT (value); return t; } @@ -4263,12 +4293,15 @@ c_cast_expr (struct c_type_name *type_name, tree expr) MODIFYCODE is the code for a binary operator that we use to combine the old value of LHS with RHS to get the new value. Or else MODIFYCODE is NOP_EXPR meaning do a simple assignment. + If RHS_ORIGTYPE is not NULL_TREE, it is the original type of RHS, + which may differ from TREE_TYPE (RHS) for an enum value. LOCATION is the location of the MODIFYCODE operator. */ tree build_modify_expr (location_t location, - tree lhs, enum tree_code modifycode, tree rhs) + tree lhs, enum tree_code modifycode, tree rhs, + tree rhs_origtype) { tree result; tree newrhs; @@ -4298,7 +4331,7 @@ build_modify_expr (location_t location, if (TREE_CODE (lhs) == C_MAYBE_CONST_EXPR) { tree inner = build_modify_expr (location, C_MAYBE_CONST_EXPR_EXPR (lhs), - modifycode, rhs); + modifycode, rhs, rhs_origtype); if (inner == error_mark_node) return error_mark_node; result = build2 (C_MAYBE_CONST_EXPR, TREE_TYPE (inner), @@ -4318,6 +4351,10 @@ build_modify_expr (location_t location, lhs = stabilize_reference (lhs); newrhs = build_binary_op (location, modifycode, lhs, rhs, 1); + + /* The original type of the right hand side is no longer + meaningful. */ + rhs_origtype = NULL_TREE; } /* Give an error for storing in something that is 'const'. */ @@ -4362,8 +4399,8 @@ build_modify_expr (location_t location, newrhs = c_fully_fold (newrhs, false, NULL); if (rhs_semantic_type) newrhs = build1 (EXCESS_PRECISION_EXPR, rhs_semantic_type, newrhs); - newrhs = convert_for_assignment (lhstype, newrhs, ic_assign, npc, - NULL_TREE, NULL_TREE, 0); + newrhs = convert_for_assignment (lhstype, newrhs, rhs_origtype, ic_assign, + npc, NULL_TREE, NULL_TREE, 0); if (TREE_CODE (newrhs) == ERROR_MARK) return error_mark_node; @@ -4392,15 +4429,17 @@ build_modify_expr (location_t location, if (olhstype == TREE_TYPE (result)) return result; - result = convert_for_assignment (olhstype, result, ic_assign, false, - NULL_TREE, NULL_TREE, 0); + result = convert_for_assignment (olhstype, result, rhs_origtype, ic_assign, + false, NULL_TREE, NULL_TREE, 0); protected_set_expr_location (result, location); return result; } -/* Convert value RHS to type TYPE as preparation for an assignment - to an lvalue of type TYPE. NULL_POINTER_CONSTANT says whether RHS - was a null pointer constant before any folding. +/* Convert value RHS to type TYPE as preparation for an assignment to + an lvalue of type TYPE. If ORIGTYPE is not NULL_TREE, it is the + original type of RHS; this differs from TREE_TYPE (RHS) for enum + types. NULL_POINTER_CONSTANT says whether RHS was a null pointer + constant before any folding. The real work of conversion is done by `convert'. The purpose of this function is to generate error messages for assignments that are not allowed in C. @@ -4411,8 +4450,8 @@ build_modify_expr (location_t location, PARMNUM is the number of the argument, for printing in error messages. */ static tree -convert_for_assignment (tree type, tree rhs, enum impl_conv errtype, - bool null_pointer_constant, +convert_for_assignment (tree type, tree rhs, tree origtype, + enum impl_conv errtype, bool null_pointer_constant, tree fundecl, tree function, int parmnum) { enum tree_code codel = TREE_CODE (type); @@ -4504,6 +4543,31 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype, objc_ok = objc_compare_types (type, rhstype, parmno, rname); } + if (warn_cxx_compat) + { + tree checktype = origtype != NULL_TREE ? origtype : rhstype; + if (checktype != error_mark_node + && TREE_CODE (type) == ENUMERAL_TYPE + && TYPE_MAIN_VARIANT (checktype) != TYPE_MAIN_VARIANT (type)) + { + /* FIXME: Until the gcc source code is converted, we only + warn about parameter passing. We will add the other + cases when bootstrap succeeds with them. */ + if (errtype == ic_argpass) + { + WARN_FOR_ASSIGNMENT (input_location, OPT_Wc___compat, + G_("enum conversion when passing argument " + "%d of %qE is invalid in C++"), + G_("enum conversion in assignment is " + "invalid in C++"), + G_("enum conversion in initialization is " + "invalid in C++"), + G_("enum conversion in return is " + "invalid in C++")); + } + } + } + if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (rhstype)) return rhs; @@ -4945,10 +5009,11 @@ valid_compound_expr_initializer (tree value, tree endtype) /* Perform appropriate conversions on the initial value of a variable, store it in the declaration DECL, and print any error messages that are appropriate. + If ORIGTYPE is not NULL_TREE, it is the original type of INIT. If the init is invalid, store an ERROR_MARK. */ void -store_init_value (tree decl, tree init) +store_init_value (tree decl, tree init, tree origtype) { tree value, type; bool npc = false; @@ -4963,7 +5028,7 @@ store_init_value (tree decl, tree init) if (init) npc = null_pointer_constant_p (init); - value = digest_init (type, init, npc, true, TREE_STATIC (decl)); + value = digest_init (type, init, origtype, npc, true, TREE_STATIC (decl)); /* Store the expression if valid; else report error. */ @@ -5194,6 +5259,8 @@ maybe_warn_string_init (tree type, struct c_expr expr) /* Digest the parser output INIT as an initializer for type TYPE. Return a C expression of type TYPE to represent the initial value. + If ORIGTYPE is not NULL_TREE, it is the original type of INIT. + NULL_POINTER_CONSTANT is true if INIT is a null pointer constant. If INIT is a string constant, STRICT_STRING is true if it is @@ -5204,7 +5271,7 @@ maybe_warn_string_init (tree type, struct c_expr expr) elements are seen. */ static tree -digest_init (tree type, tree init, bool null_pointer_constant, +digest_init (tree type, tree init, tree origtype, bool null_pointer_constant, bool strict_string, int require_constant) { enum tree_code code = TREE_CODE (type); @@ -5431,8 +5498,8 @@ digest_init (tree type, tree init, bool null_pointer_constant, /* Added to enable additional -Wmissing-format-attribute warnings. */ if (TREE_CODE (TREE_TYPE (inside_init)) == POINTER_TYPE) - inside_init = convert_for_assignment (type, inside_init, ic_init, - null_pointer_constant, + inside_init = convert_for_assignment (type, inside_init, origtype, + ic_init, null_pointer_constant, NULL_TREE, NULL_TREE, 0); return inside_init; } @@ -5451,7 +5518,7 @@ digest_init (tree type, tree init, bool null_pointer_constant, inside_init = build1 (EXCESS_PRECISION_EXPR, semantic_type, inside_init); inside_init - = convert_for_assignment (type, inside_init, ic_init, + = convert_for_assignment (type, inside_init, origtype, ic_init, null_pointer_constant, NULL_TREE, NULL_TREE, 0); @@ -5549,6 +5616,7 @@ struct init_node int balance; tree purpose; tree value; + tree origtype; }; /* Tree of pending elements at this constructor level. @@ -6418,7 +6486,8 @@ set_init_label (tree fieldname) /* Add a new initializer to the tree of pending initializers. PURPOSE identifies the initializer, either array index or field in a structure. - VALUE is the value of that index or field. + VALUE is the value of that index or field. If ORIGTYPE is not + NULL_TREE, it is the original type of VALUE. IMPLICIT is true if value comes from pop_init_level (1), the new initializer has been merged with the existing one @@ -6426,7 +6495,7 @@ set_init_label (tree fieldname) existing initializer. */ static void -add_pending_init (tree purpose, tree value, bool implicit) +add_pending_init (tree purpose, tree value, tree origtype, bool implicit) { struct init_node *p, **q, *r; @@ -6452,6 +6521,7 @@ add_pending_init (tree purpose, tree value, bool implicit) warning_init (OPT_Woverride_init, "initialized field overwritten"); } p->value = value; + p->origtype = origtype; return; } } @@ -6478,6 +6548,7 @@ add_pending_init (tree purpose, tree value, bool implicit) warning_init (OPT_Woverride_init, "initialized field overwritten"); } p->value = value; + p->origtype = origtype; return; } } @@ -6486,6 +6557,7 @@ add_pending_init (tree purpose, tree value, bool implicit) r = GGC_NEW (struct init_node); r->purpose = purpose; r->value = value; + r->origtype = origtype; *q = r; r->parent = p; @@ -6661,7 +6733,7 @@ set_nonincremental_init (void) return; FOR_EACH_CONSTRUCTOR_ELT (constructor_elements, ix, index, value) - add_pending_init (index, value, false); + add_pending_init (index, value, NULL_TREE, false); constructor_elements = 0; if (TREE_CODE (constructor_type) == RECORD_TYPE) { @@ -6751,7 +6823,7 @@ set_nonincremental_init_from_string (tree str) } value = build_int_cst_wide (type, val[1], val[0]); - add_pending_init (purpose, value, false); + add_pending_init (purpose, value, NULL_TREE, false); } constructor_incremental = 0; @@ -6816,6 +6888,7 @@ find_init_member (tree field) /* "Output" the next constructor element. At top level, really output it to assembler code now. Otherwise, collect it in a list from which we will make a CONSTRUCTOR. + If ORIGTYPE is not NULL_TREE, it is the original type of VALUE. TYPE is the data type that the containing data type wants here. FIELD is the field (a FIELD_DECL) or the index that this element fills. If VALUE is a string constant, STRICT_STRING is true if it is @@ -6832,8 +6905,8 @@ find_init_member (tree field) existing initializer. */ static void -output_init_element (tree value, bool strict_string, tree type, tree field, - int pending, bool implicit) +output_init_element (tree value, tree origtype, bool strict_string, tree type, + tree field, int pending, bool implicit) { tree semantic_type = NULL_TREE; constructor_elt *celt; @@ -6914,7 +6987,7 @@ output_init_element (tree value, bool strict_string, tree type, tree field, if (semantic_type) value = build1 (EXCESS_PRECISION_EXPR, semantic_type, value); - value = digest_init (type, value, npc, strict_string, + value = digest_init (type, value, origtype, npc, strict_string, require_constant_value); if (value == error_mark_node) { @@ -6934,7 +7007,7 @@ output_init_element (tree value, bool strict_string, tree type, tree field, && tree_int_cst_lt (field, constructor_unfilled_index)) set_nonincremental_init (); - add_pending_init (field, value, implicit); + add_pending_init (field, value, origtype, implicit); return; } else if (TREE_CODE (constructor_type) == RECORD_TYPE @@ -6960,7 +7033,7 @@ output_init_element (tree value, bool strict_string, tree type, tree field, } } - add_pending_init (field, value, implicit); + add_pending_init (field, value, origtype, implicit); return; } else if (TREE_CODE (constructor_type) == UNION_TYPE @@ -7043,7 +7116,7 @@ output_pending_init_elements (int all) { if (tree_int_cst_equal (elt->purpose, constructor_unfilled_index)) - output_init_element (elt->value, true, + output_init_element (elt->value, elt->origtype, true, TREE_TYPE (constructor_type), constructor_unfilled_index, 0, false); else if (tree_int_cst_lt (constructor_unfilled_index, @@ -7097,7 +7170,8 @@ output_pending_init_elements (int all) if (tree_int_cst_equal (elt_bitpos, ctor_unfilled_bitpos)) { constructor_unfilled_fields = elt->purpose; - output_init_element (elt->value, true, TREE_TYPE (elt->purpose), + output_init_element (elt->value, elt->origtype, true, + TREE_TYPE (elt->purpose), elt->purpose, 0, false); } else if (tree_int_cst_lt (ctor_unfilled_bitpos, elt_bitpos)) @@ -7292,8 +7366,9 @@ process_init_element (struct c_expr value, bool implicit) if (value.value) { push_member_name (constructor_fields); - output_init_element (value.value, strict_string, - fieldtype, constructor_fields, 1, implicit); + output_init_element (value.value, value.original_type, + strict_string, fieldtype, + constructor_fields, 1, implicit); RESTORE_SPELLING_DEPTH (constructor_depth); } else @@ -7382,8 +7457,9 @@ process_init_element (struct c_expr value, bool implicit) if (value.value) { push_member_name (constructor_fields); - output_init_element (value.value, strict_string, - fieldtype, constructor_fields, 1, implicit); + output_init_element (value.value, value.original_type, + strict_string, fieldtype, + constructor_fields, 1, implicit); RESTORE_SPELLING_DEPTH (constructor_depth); } else @@ -7432,8 +7508,9 @@ process_init_element (struct c_expr value, bool implicit) if (value.value) { push_array_bounds (tree_low_cst (constructor_index, 1)); - output_init_element (value.value, strict_string, - elttype, constructor_index, 1, implicit); + output_init_element (value.value, value.original_type, + strict_string, elttype, + constructor_index, 1, implicit); RESTORE_SPELLING_DEPTH (constructor_depth); } @@ -7461,8 +7538,9 @@ process_init_element (struct c_expr value, bool implicit) /* Now output the actual element. */ if (value.value) - output_init_element (value.value, strict_string, - elttype, constructor_index, 1, implicit); + output_init_element (value.value, value.original_type, + strict_string, elttype, + constructor_index, 1, implicit); constructor_index = size_binop (PLUS_EXPR, constructor_index, bitsize_one_node); @@ -7486,8 +7564,9 @@ process_init_element (struct c_expr value, bool implicit) else { if (value.value) - output_init_element (value.value, strict_string, - constructor_type, NULL_TREE, 1, implicit); + output_init_element (value.value, value.original_type, + strict_string, constructor_type, + NULL_TREE, 1, implicit); constructor_fields = 0; } @@ -7718,10 +7797,11 @@ c_finish_goto_ptr (tree expr) } /* Generate a C `return' statement. RETVAL is the expression for what - to return, or a null pointer for `return;' with no value. */ + to return, or a null pointer for `return;' with no value. If + ORIGTYPE is not NULL_TREE, it is the original type of RETVAL. */ tree -c_finish_return (tree retval) +c_finish_return (tree retval, tree origtype) { tree valtype = TREE_TYPE (TREE_TYPE (current_function_decl)), ret_stmt; bool no_warning = false; @@ -7768,8 +7848,8 @@ c_finish_return (tree retval) } else { - tree t = convert_for_assignment (valtype, retval, ic_return, npc, - NULL_TREE, NULL_TREE, 0); + tree t = convert_for_assignment (valtype, retval, origtype, ic_return, + npc, NULL_TREE, NULL_TREE, 0); tree res = DECL_RESULT (current_function_decl); tree inner; diff --git a/gcc/calls.c b/gcc/calls.c index b2d3bfa5145..c05c2880c7c 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -4233,7 +4233,8 @@ store_one_arg (struct arg_data *arg, rtx argblock, int flags, - int_size_in_bytes (TREE_TYPE (pval)) + partial); size_rtx = expand_expr (size_in_bytes (TREE_TYPE (pval)), - NULL_RTX, TYPE_MODE (sizetype), 0); + NULL_RTX, TYPE_MODE (sizetype), + EXPAND_NORMAL); } parm_align = arg->locate.boundary; diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index 8d03141e44b..6019dc697df 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -1,6 +1,6 @@ /* Prototypes for exported functions defined in arm.c and pe.c - Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 - Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, + 2009 Free Software Foundation, Inc. Contributed by Richard Earnshaw (rearnsha@arm.com) Minor hacks by Nick Clifton (nickc@cygnus.com) @@ -26,7 +26,7 @@ extern void arm_override_options (void); extern void arm_optimization_options (int, int); extern int use_return_insn (int, rtx); -extern int arm_regno_class (int); +extern enum reg_class arm_regno_class (int); extern void arm_load_pic_register (unsigned long); extern int arm_volatile_func (void); extern const char *arm_output_epilogue (rtx); diff --git a/gcc/config/arm/arm-tune.md b/gcc/config/arm/arm-tune.md index ea728dcb67c..4d8ae2f11bc 100644 --- a/gcc/config/arm/arm-tune.md +++ b/gcc/config/arm/arm-tune.md @@ -2,4 +2,4 @@ ;; Generated automatically by gentune.sh from arm-cores.def (define_attr "tune" "arm2,arm250,arm3,arm6,arm60,arm600,arm610,arm620,arm7,arm7d,arm7di,arm70,arm700,arm700i,arm710,arm720,arm710c,arm7100,arm7500,arm7500fe,arm7m,arm7dm,arm7dmi,arm8,arm810,strongarm,strongarm110,strongarm1100,strongarm1110,arm7tdmi,arm7tdmis,arm710t,arm720t,arm740t,arm9,arm9tdmi,arm920,arm920t,arm922t,arm940t,ep9312,arm10tdmi,arm1020t,arm9e,arm946es,arm966es,arm968es,arm10e,arm1020e,arm1022e,xscale,iwmmxt,iwmmxt2,arm926ejs,arm1026ejs,arm1136js,arm1136jfs,arm1176jzs,arm1176jzfs,mpcorenovfp,mpcore,arm1156t2s,cortexa8,cortexa9,cortexr4,cortexr4f,cortexm3,cortexm1" - (const (symbol_ref "arm_tune"))) + (const (symbol_ref "((enum attr_tune) arm_tune)"))) diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 9bd9624eb2e..80d12676ca0 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -4784,7 +4784,7 @@ thumb_legitimize_reload_address (rtx *x_p, x = copy_rtx (x); push_reload (orig_x, NULL_RTX, x_p, NULL, MODE_BASE_REG_CLASS (mode), - Pmode, VOIDmode, 0, 0, opnum, type); + Pmode, VOIDmode, 0, 0, opnum, (enum reload_type) type); return x; } @@ -4801,7 +4801,7 @@ thumb_legitimize_reload_address (rtx *x_p, x = copy_rtx (x); push_reload (orig_x, NULL_RTX, x_p, NULL, MODE_BASE_REG_CLASS (mode), - Pmode, VOIDmode, 0, 0, opnum, type); + Pmode, VOIDmode, 0, 0, opnum, (enum reload_type) type); return x; } @@ -5465,7 +5465,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed) return true; case ABS: - if (GET_MODE_CLASS (mode == MODE_FLOAT)) + if (GET_MODE_CLASS (mode) == MODE_FLOAT) { if (TARGET_HARD_FLOAT && (mode == SFmode || mode == DFmode)) { @@ -5821,10 +5821,12 @@ arm_rtx_costs (rtx x, int code, int outer_code, int *total, bool speed) { if (!speed) - return arm_size_rtx_costs (x, code, outer_code, total); + return arm_size_rtx_costs (x, (enum rtx_code) code, + (enum rtx_code) outer_code, total); else - return all_cores[(int)arm_tune].rtx_costs (x, code, outer_code, total, - speed); + return all_cores[(int)arm_tune].rtx_costs (x, (enum rtx_code) code, + (enum rtx_code) outer_code, + total, speed); } /* RTX costs for cores with a slow MUL implementation. Thumb-2 is not @@ -7408,7 +7410,7 @@ adjacent_mem_locations (rtx a, rtx b) /* Don't accept any offset that will require multiple instructions to handle, since this would cause the arith_adjacentmem pattern to output an overlong sequence. */ - if (!const_ok_for_op (PLUS, val0) || !const_ok_for_op (PLUS, val1)) + if (!const_ok_for_op (val0, PLUS) || !const_ok_for_op (val1, PLUS)) return 0; /* Don't allow an eliminable register: register elimination can make @@ -10214,8 +10216,7 @@ vfp_emit_fstmd (int base_reg, int count) } par = emit_insn (par); - REG_NOTES (par) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, dwarf, - REG_NOTES (par)); + add_reg_note (par, REG_FRAME_RELATED_EXPR, dwarf); RTX_FRAME_RELATED_P (par) = 1; return count * 8; @@ -12498,8 +12499,8 @@ emit_multi_reg_push (unsigned long mask) RTX_FRAME_RELATED_P (tmp) = 1; XVECEXP (dwarf, 0, 0) = tmp; - REG_NOTES (par) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, dwarf, - REG_NOTES (par)); + add_reg_note (par, REG_FRAME_RELATED_EXPR, dwarf); + return par; } @@ -12565,8 +12566,8 @@ emit_sfm (int base_reg, int count) XVECEXP (dwarf, 0, 0) = tmp; par = emit_insn (par); - REG_NOTES (par) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, dwarf, - REG_NOTES (par)); + add_reg_note (par, REG_FRAME_RELATED_EXPR, dwarf); + return par; } @@ -12985,8 +12986,7 @@ thumb_set_frame_pointer (arm_stack_offsets *offsets) dwarf = gen_rtx_SET (VOIDmode, hard_frame_pointer_rtx, plus_constant (stack_pointer_rtx, amount)); RTX_FRAME_RELATED_P (dwarf) = 1; - REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, dwarf, - REG_NOTES (insn)); + add_reg_note (insn, REG_FRAME_RELATED_EXPR, dwarf); } RTX_FRAME_RELATED_P (insn) = 1; @@ -13049,8 +13049,7 @@ arm_expand_prologue (void) dwarf = gen_rtx_SET (VOIDmode, r0, dwarf); insn = gen_movsi (r0, stack_pointer_rtx); RTX_FRAME_RELATED_P (insn) = 1; - REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, - dwarf, REG_NOTES (insn)); + add_reg_note (insn, REG_FRAME_RELATED_EXPR, dwarf); emit_insn (insn); emit_insn (gen_andsi3 (r1, r0, GEN_INT (~(HOST_WIDE_INT)7))); emit_insn (gen_movsi (stack_pointer_rtx, r1)); @@ -13117,8 +13116,7 @@ arm_expand_prologue (void) plus_constant (stack_pointer_rtx, -fp_offset)); RTX_FRAME_RELATED_P (insn) = 1; - REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, - dwarf, REG_NOTES (insn)); + add_reg_note (insn, REG_FRAME_RELATED_EXPR, dwarf); } else { @@ -14670,7 +14668,8 @@ arm_hard_regno_mode_ok (unsigned int regno, enum machine_mode mode) /* For efficiency and historical reasons LO_REGS, HI_REGS and CC_REGS are not used in arm mode. */ -int + +enum reg_class arm_regno_class (int regno) { if (TARGET_THUMB1) @@ -17631,9 +17630,7 @@ thumb1_expand_prologue (void) plus_constant (stack_pointer_rtx, -amount)); RTX_FRAME_RELATED_P (dwarf) = 1; - REG_NOTES (insn) - = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, dwarf, - REG_NOTES (insn)); + add_reg_note (insn, REG_FRAME_RELATED_EXPR, dwarf); } } diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index a44b40388d7..b55c65cf16d 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -1915,7 +1915,7 @@ typedef struct TARGET_32BIT ? 12 : 16)), \ FNADDR); \ emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_cache"), \ - 0, VOIDmode, 2, TRAMP, Pmode, \ + LCT_NORMAL, VOIDmode, 2, TRAMP, Pmode, \ plus_constant (TRAMP, TRAMPOLINE_SIZE), Pmode); \ } #endif diff --git a/gcc/config/arm/gentune.sh b/gcc/config/arm/gentune.sh index 40c05411052..7c309c75f55 100755 --- a/gcc/config/arm/gentune.sh +++ b/gcc/config/arm/gentune.sh @@ -9,4 +9,4 @@ allcores=`awk -F'[(, ]+' '/^ARM_CORE/ { cores = cores$3"," } END { print cores echo "(define_attr \"tune\"" echo " \"$allcores\"" | sed -e 's/,"$/"/' -echo " (const (symbol_ref \"arm_tune\")))" +echo " (const (symbol_ref \"((enum attr_tune) arm_tune)\")))" diff --git a/gcc/config/i386/i386-c.c b/gcc/config/i386/i386-c.c index 0c59b2fef6c..d35ea7626a7 100644 --- a/gcc/config/i386/i386-c.c +++ b/gcc/config/i386/i386-c.c @@ -1,5 +1,5 @@ /* Subroutines used for macro/preprocessor support on the ia-32. - Copyright (C) 2008 + Copyright (C) 2008, 2009 Free Software Foundation, Inc. This file is part of GCC. @@ -297,14 +297,14 @@ ix86_pragma_target_parse (tree args, tree pop_target) ix86_target_macros_internal (prev_isa & diff_isa, prev_arch, prev_tune, - prev_opt->fpmath, + (enum fpmath_unit) prev_opt->fpmath, cpp_undef); /* Define all of the macros for new options that were just turned on. */ ix86_target_macros_internal (cur_isa & diff_isa, cur_arch, cur_tune, - cur_opt->fpmath, + (enum fpmath_unit) cur_opt->fpmath, cpp_define); return true; diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 5af19514f90..6e60fb7e70b 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -8333,8 +8333,7 @@ ix86_expand_prologue (void) RTX_FRAME_RELATED_P (insn) = 1; t = gen_rtx_PLUS (Pmode, stack_pointer_rtx, GEN_INT (-allocate)); t = gen_rtx_SET (VOIDmode, stack_pointer_rtx, t); - REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, - t, REG_NOTES (insn)); + add_reg_note (insn, REG_FRAME_RELATED_EXPR, t); if (eax_live) { @@ -14886,20 +14885,14 @@ ix86_split_fp_branch (enum rtx_code code, rtx op1, rtx op2, label), pc_rtx))); if (bypass_probability >= 0) - REG_NOTES (i) - = gen_rtx_EXPR_LIST (REG_BR_PROB, - GEN_INT (bypass_probability), - REG_NOTES (i)); + add_reg_note (i, REG_BR_PROB, GEN_INT (bypass_probability)); } i = emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, gen_rtx_IF_THEN_ELSE (VOIDmode, condition, target1, target2))); if (probability >= 0) - REG_NOTES (i) - = gen_rtx_EXPR_LIST (REG_BR_PROB, - GEN_INT (probability), - REG_NOTES (i)); + add_reg_note (i, REG_BR_PROB, GEN_INT (probability)); if (second != NULL_RTX) { i = emit_jump_insn (gen_rtx_SET @@ -14907,10 +14900,7 @@ ix86_split_fp_branch (enum rtx_code code, rtx op1, rtx op2, gen_rtx_IF_THEN_ELSE (VOIDmode, second, target1, target2))); if (second_probability >= 0) - REG_NOTES (i) - = gen_rtx_EXPR_LIST (REG_BR_PROB, - GEN_INT (second_probability), - REG_NOTES (i)); + add_reg_note (i, REG_BR_PROB, GEN_INT (second_probability)); } if (label != NULL_RTX) emit_label (label); @@ -17108,10 +17098,7 @@ predict_jump (int prob) { rtx insn = get_last_insn (); gcc_assert (JUMP_P (insn)); - REG_NOTES (insn) - = gen_rtx_EXPR_LIST (REG_BR_PROB, - GEN_INT (prob), - REG_NOTES (insn)); + add_reg_note (insn, REG_BR_PROB, GEN_INT (prob)); } /* Helper function for the string operations below. Dest VARIABLE whether @@ -23914,7 +23901,7 @@ ix86_expand_binop_builtin (enum insn_code icode, tree exp, rtx target) static rtx ix86_expand_multi_arg_builtin (enum insn_code icode, tree exp, rtx target, enum multi_arg_type m_type, - enum insn_code sub_code) + enum rtx_code sub_code) { rtx pat; int i; @@ -25401,7 +25388,8 @@ ix86_builtin_vectorized_function (unsigned int fn, tree type_out, /* Dispatch to a handler for a vectorization library. */ if (ix86_veclib_handler) - return (*ix86_veclib_handler)(fn, type_out, type_in); + return (*ix86_veclib_handler) ((enum built_in_function) fn, type_out, + type_in); return NULL_TREE; } diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 679d38a8a89..777a72cb9a6 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -4375,7 +4375,9 @@ ; else { - int slot = virtuals_instantiated ? SLOT_TEMP : SLOT_VIRTUAL; + enum ix86_stack_slot slot = (virtuals_instantiated + ? SLOT_TEMP + : SLOT_VIRTUAL); rtx temp = assign_386_stack_local (SFmode, slot); emit_insn (gen_truncdfsf2_with_temp (operands[0], operands[1], temp)); DONE; @@ -4560,7 +4562,9 @@ } else { - int slot = virtuals_instantiated ? SLOT_TEMP : SLOT_VIRTUAL; + enum ix86_stack_slot slot = (virtuals_instantiated + ? SLOT_TEMP + : SLOT_VIRTUAL); operands[2] = assign_386_stack_local (<MODE>mode, slot); } }) @@ -5730,7 +5734,9 @@ } else { - int slot = virtuals_instantiated ? SLOT_TEMP : SLOT_VIRTUAL; + enum ix86_stack_slot slot = (virtuals_instantiated + ? SLOT_TEMP + : SLOT_VIRTUAL); operands[2] = assign_386_stack_local (DImode, slot); } }) @@ -18984,7 +18990,9 @@ emit_insn (gen_fxam<mode>2_i387_with_temp (scratch, operands[1])); else { - int slot = virtuals_instantiated ? SLOT_TEMP : SLOT_VIRTUAL; + enum ix86_stack_slot slot = (virtuals_instantiated + ? SLOT_TEMP + : SLOT_VIRTUAL); rtx temp = assign_386_stack_local (<MODE>mode, slot); emit_move_insn (temp, operands[1]); diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 66ef5a84e07..7cccb6be2cc 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -1311,9 +1311,7 @@ ia64_split_tmode_move (rtx operands[]) && (GET_CODE (XEXP (EXP, 0)) == POST_MODIFY \ || GET_CODE (XEXP (EXP, 0)) == POST_INC \ || GET_CODE (XEXP (EXP, 0)) == POST_DEC)) \ - REG_NOTES (INSN) = gen_rtx_EXPR_LIST (REG_INC, \ - XEXP (XEXP (EXP, 0), 0), \ - REG_NOTES (INSN)) + add_reg_note (insn, REG_INC, XEXP (XEXP (EXP, 0), 0)) insn = emit_insn (gen_rtx_SET (VOIDmode, out[0], in[0])); MAYBE_ADD_REG_INC_NOTE (insn, in[0]); @@ -2770,9 +2768,8 @@ spill_restore_mem (rtx reg, HOST_WIDE_INT cfa_off) gen_rtx_PLUS (DImode, spill_fill_data.iter_reg[iter], disp_rtx)); - REG_NOTES (spill_fill_data.prev_insn[iter]) - = gen_rtx_EXPR_LIST (REG_INC, spill_fill_data.iter_reg[iter], - REG_NOTES (spill_fill_data.prev_insn[iter])); + add_reg_note (spill_fill_data.prev_insn[iter], + REG_INC, spill_fill_data.iter_reg[iter]); } else { @@ -2889,13 +2886,11 @@ do_spill (rtx (*move_fn) (rtx, rtx, rtx), rtx reg, HOST_WIDE_INT cfa_off, off = current_frame_info.total_size - cfa_off; } - REG_NOTES (insn) - = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, - gen_rtx_SET (VOIDmode, - gen_rtx_MEM (GET_MODE (reg), - plus_constant (base, off)), - frame_reg), - REG_NOTES (insn)); + add_reg_note (insn, REG_FRAME_RELATED_EXPR, + gen_rtx_SET (VOIDmode, + gen_rtx_MEM (GET_MODE (reg), + plus_constant (base, off)), + frame_reg)); } } @@ -3095,16 +3090,12 @@ ia64_expand_prologue (void) { RTX_FRAME_RELATED_P (insn) = 1; if (GET_CODE (offset) != CONST_INT) - { - REG_NOTES (insn) - = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, - gen_rtx_SET (VOIDmode, - stack_pointer_rtx, - gen_rtx_PLUS (DImode, - stack_pointer_rtx, - frame_size_rtx)), - REG_NOTES (insn)); - } + add_reg_note (insn, REG_FRAME_RELATED_EXPR, + gen_rtx_SET (VOIDmode, + stack_pointer_rtx, + gen_rtx_PLUS (DImode, + stack_pointer_rtx, + frame_size_rtx))); } /* ??? At this point we must generate a magic insn that appears to @@ -3171,10 +3162,8 @@ ia64_expand_prologue (void) /* ??? Denote pr spill/fill by a DImode move that modifies all 64 hard registers. */ RTX_FRAME_RELATED_P (insn) = 1; - REG_NOTES (insn) - = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, - gen_rtx_SET (VOIDmode, alt_reg, reg), - REG_NOTES (insn)); + add_reg_note (insn, REG_FRAME_RELATED_EXPR, + gen_rtx_SET (VOIDmode, alt_reg, reg)); /* Even if we're not going to generate an epilogue, we still need to save the register so that EH works. */ @@ -3533,16 +3522,12 @@ ia64_expand_epilogue (int sibcall_p) RTX_FRAME_RELATED_P (insn) = 1; if (GET_CODE (offset) != CONST_INT) - { - REG_NOTES (insn) - = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, - gen_rtx_SET (VOIDmode, - stack_pointer_rtx, - gen_rtx_PLUS (DImode, - stack_pointer_rtx, - frame_size_rtx)), - REG_NOTES (insn)); - } + add_reg_note (insn, REG_FRAME_RELATED_EXPR, + gen_rtx_SET (VOIDmode, + stack_pointer_rtx, + gen_rtx_PLUS (DImode, + stack_pointer_rtx, + frame_size_rtx))); } if (cfun->machine->ia64_eh_epilogue_bsp) @@ -7931,7 +7916,7 @@ insert_bundle_state (struct bundle_state *bundle_state) { void **entry_ptr; - entry_ptr = htab_find_slot (bundle_state_table, bundle_state, 1); + entry_ptr = htab_find_slot (bundle_state_table, bundle_state, INSERT); if (*entry_ptr == NULL) { bundle_state->next = index_to_bundle_states [bundle_state->insn_num]; @@ -8295,9 +8280,7 @@ ia64_add_bundle_selector_before (int template0, rtx insn) if (find_reg_note (insn, REG_EH_REGION, NULL_RTX)) note = NULL_RTX; else - REG_NOTES (insn) - = gen_rtx_EXPR_LIST (REG_EH_REGION, XEXP (note, 0), - REG_NOTES (insn)); + add_reg_note (insn, REG_EH_REGION, XEXP (note, 0)); } } } diff --git a/gcc/config/ia64/ia64.md b/gcc/config/ia64/ia64.md index 7c09236d045..51a01e4e15e 100644 --- a/gcc/config/ia64/ia64.md +++ b/gcc/config/ia64/ia64.md @@ -1,6 +1,6 @@ ;; IA-64 Machine description template -;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 -;; Free Software Foundation, Inc. +;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, +;; 2009 Free Software Foundation, Inc. ;; Contributed by James E. Wilson <wilson@cygnus.com> and ;; David Mosberger <davidm@hpl.hp.com>. @@ -116,7 +116,8 @@ ;; Processor type. This attribute must exactly match the processor_type ;; enumeration in ia64.h. -(define_attr "cpu" "itanium,itanium2" (const (symbol_ref "ia64_tune"))) +(define_attr "cpu" "itanium,itanium2" + (const (symbol_ref "((enum attr_cpu) ia64_tune)"))) ;; Instruction type. This primarily determines how instructions can be ;; packed in bundles, and secondarily affects scheduling to function units. @@ -6076,7 +6077,7 @@ { emit_library_call (gen_rtx_SYMBOL_REF (Pmode, \"__ia64_save_stack_nonlocal\"), - 0, VOIDmode, 2, XEXP (operands[0], 0), Pmode, + LCT_NORMAL, VOIDmode, 2, XEXP (operands[0], 0), Pmode, operands[1], Pmode); DONE; }) @@ -6154,7 +6155,7 @@ { emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__ia64_restore_stack_nonlocal"), - 0, VOIDmode, 1, + LCT_NORMAL, VOIDmode, 1, copy_to_reg (XEXP (operands[1], 0)), Pmode); DONE; }) diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index ca727ad12e5..8e3cdcfa6d8 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -3312,7 +3312,7 @@ mips_binary_cost (rtx x, int single_cost, int double_cost) else cost = single_cost; return (cost - + rtx_cost (XEXP (x, 0), 0, !optimize_size) + + rtx_cost (XEXP (x, 0), SET, !optimize_size) + rtx_cost (XEXP (x, 1), GET_CODE (x), !optimize_size)); } @@ -3531,7 +3531,7 @@ mips_rtx_costs (rtx x, int code, int outer_code, int *total, && UINTVAL (XEXP (x, 1)) == 0xffffffff) { *total = (mips_zero_extend_cost (mode, XEXP (x, 0)) - + rtx_cost (XEXP (x, 0), 0, speed)); + + rtx_cost (XEXP (x, 0), SET, speed)); return true; } /* Fall through. */ @@ -3563,7 +3563,7 @@ mips_rtx_costs (rtx x, int code, int outer_code, int *total, case LO_SUM: /* Low-part immediates need an extended MIPS16 instruction. */ *total = (COSTS_N_INSNS (TARGET_MIPS16 ? 2 : 1) - + rtx_cost (XEXP (x, 0), 0, speed)); + + rtx_cost (XEXP (x, 0), SET, speed)); return true; case LT: @@ -3603,17 +3603,17 @@ mips_rtx_costs (rtx x, int code, int outer_code, int *total, if (GET_CODE (op0) == MULT && GET_CODE (XEXP (op0, 0)) == NEG) { *total = (mips_fp_mult_cost (mode) - + rtx_cost (XEXP (XEXP (op0, 0), 0), 0, speed) - + rtx_cost (XEXP (op0, 1), 0, speed) - + rtx_cost (op1, 0, speed)); + + rtx_cost (XEXP (XEXP (op0, 0), 0), SET, speed) + + rtx_cost (XEXP (op0, 1), SET, speed) + + rtx_cost (op1, SET, speed)); return true; } if (GET_CODE (op1) == MULT) { *total = (mips_fp_mult_cost (mode) - + rtx_cost (op0, 0, speed) - + rtx_cost (XEXP (op1, 0), 0, speed) - + rtx_cost (XEXP (op1, 1), 0, speed)); + + rtx_cost (op0, SET, speed) + + rtx_cost (XEXP (op1, 0), SET, speed) + + rtx_cost (XEXP (op1, 1), SET, speed)); return true; } } @@ -3654,9 +3654,9 @@ mips_rtx_costs (rtx x, int code, int outer_code, int *total, && GET_CODE (XEXP (op, 0)) == MULT) { *total = (mips_fp_mult_cost (mode) - + rtx_cost (XEXP (XEXP (op, 0), 0), 0, speed) - + rtx_cost (XEXP (XEXP (op, 0), 1), 0, speed) - + rtx_cost (XEXP (op, 1), 0, speed)); + + rtx_cost (XEXP (XEXP (op, 0), 0), SET, speed) + + rtx_cost (XEXP (XEXP (op, 0), 1), SET, speed) + + rtx_cost (XEXP (op, 1), SET, speed)); return true; } } @@ -3694,9 +3694,10 @@ mips_rtx_costs (rtx x, int code, int outer_code, int *total, if (outer_code == SQRT || GET_CODE (XEXP (x, 1)) == SQRT) /* An rsqrt<mode>a or rsqrt<mode>b pattern. Count the division as being free. */ - *total = rtx_cost (XEXP (x, 1), 0, speed); + *total = rtx_cost (XEXP (x, 1), SET, speed); else - *total = mips_fp_div_cost (mode) + rtx_cost (XEXP (x, 1), 0, speed); + *total = (mips_fp_div_cost (mode) + + rtx_cost (XEXP (x, 1), SET, speed)); return true; } /* Fall through. */ @@ -3724,7 +3725,7 @@ mips_rtx_costs (rtx x, int code, int outer_code, int *total, && CONST_INT_P (XEXP (x, 1)) && exact_log2 (INTVAL (XEXP (x, 1))) >= 0) { - *total = COSTS_N_INSNS (2) + rtx_cost (XEXP (x, 0), 0, speed); + *total = COSTS_N_INSNS (2) + rtx_cost (XEXP (x, 0), SET, speed); return true; } *total = COSTS_N_INSNS (mips_idiv_insns ()); @@ -14465,8 +14466,8 @@ mips_override_options (void) /* Set up mips_hard_regno_mode_ok. */ for (mode = 0; mode < MAX_MACHINE_MODE; mode++) for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) - mips_hard_regno_mode_ok[(int)mode][regno] - = mips_hard_regno_mode_ok_p (regno, mode); + mips_hard_regno_mode_ok[mode][regno] + = mips_hard_regno_mode_ok_p (regno, (enum machine_mode) mode); /* Function to allocate machine-dependent function status. */ init_machine_status = &mips_init_machine_status; diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index cd6f1e5d220..30faa196a52 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -2441,7 +2441,7 @@ typedef struct mips_args { /* Flush both caches. We need to flush the data cache in case \ the system has a write-back cache. */ \ emit_library_call (gen_rtx_SYMBOL_REF (Pmode, mips_cache_flush_func), \ - 0, VOIDmode, 3, ADDR, Pmode, SIZE, Pmode, \ + LCT_NORMAL, VOIDmode, 3, ADDR, Pmode, SIZE, Pmode, \ GEN_INT (3), TYPE_MODE (integer_type_node)) /* A C statement to initialize the variable parts of a trampoline. diff --git a/gcc/config/mips/sdemtk.h b/gcc/config/mips/sdemtk.h index 3e4e58fdd4f..adaaa25e6cd 100644 --- a/gcc/config/mips/sdemtk.h +++ b/gcc/config/mips/sdemtk.h @@ -1,6 +1,6 @@ /* Definitions of target machine for GNU compiler. MIPS SDE version, for use with the SDE C library rather than newlib. - Copyright (C) 2007, 2008 + Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GCC. @@ -86,7 +86,7 @@ extern void mips_sync_icache (void *beg, unsigned long len); #undef MIPS_ICACHE_SYNC #define MIPS_ICACHE_SYNC(ADDR, SIZE) \ emit_library_call (gen_rtx_SYMBOL_REF (Pmode, mips_cache_flush_func), \ - 0, VOIDmode, 2, ADDR, Pmode, \ + LCT_NORMAL, VOIDmode, 2, ADDR, Pmode, \ SIZE, TYPE_MODE (sizetype)) /* This version of _mcount does not pop 2 words from the stack. */ diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 5d080658864..0f42d6bd98c 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -684,7 +684,7 @@ legitimize_pic_address (rtx orig, enum machine_mode mode, rtx reg) insn = emit_insn (gen_rtx_SET (VOIDmode, reg, orig)); /* Put a REG_EQUAL note on this insn, so that it can be optimized. */ - REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, orig, REG_NOTES (insn)); + add_reg_note (insn, REG_EQUAL, orig); /* During and after reload, we need to generate a REG_LABEL_OPERAND note and update LABEL_NUSES because this is not done automatically. */ @@ -3395,11 +3395,9 @@ store_reg (int reg, HOST_WIDE_INT disp, int base) insn = emit_move_insn (tmpreg, gen_rtx_PLUS (Pmode, tmpreg, basereg)); if (DO_FRAME_NOTES) { - REG_NOTES (insn) - = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, - gen_rtx_SET (VOIDmode, tmpreg, - gen_rtx_PLUS (Pmode, basereg, delta)), - REG_NOTES (insn)); + add_reg_note (insn, REG_FRAME_RELATED_EXPR, + gen_rtx_SET (VOIDmode, tmpreg, + gen_rtx_PLUS (Pmode, basereg, delta))); RTX_FRAME_RELATED_P (insn) = 1; } dest = gen_rtx_MEM (word_mode, tmpreg); @@ -3415,16 +3413,13 @@ store_reg (int reg, HOST_WIDE_INT disp, int base) dest = gen_rtx_MEM (word_mode, gen_rtx_LO_SUM (Pmode, tmpreg, delta)); insn = emit_move_insn (dest, src); if (DO_FRAME_NOTES) - { - REG_NOTES (insn) - = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, - gen_rtx_SET (VOIDmode, - gen_rtx_MEM (word_mode, - gen_rtx_PLUS (word_mode, basereg, - delta)), - src), - REG_NOTES (insn)); - } + add_reg_note (insn, REG_FRAME_RELATED_EXPR, + gen_rtx_SET (VOIDmode, + gen_rtx_MEM (word_mode, + gen_rtx_PLUS (word_mode, + basereg, + delta)), + src)); } if (DO_FRAME_NOTES) @@ -3484,11 +3479,9 @@ set_reg_plus_d (int reg, int base, HOST_WIDE_INT disp, int note) insn = emit_move_insn (gen_rtx_REG (Pmode, reg), gen_rtx_PLUS (Pmode, tmpreg, basereg)); if (DO_FRAME_NOTES) - REG_NOTES (insn) - = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, - gen_rtx_SET (VOIDmode, tmpreg, - gen_rtx_PLUS (Pmode, basereg, delta)), - REG_NOTES (insn)); + add_reg_note (insn, REG_FRAME_RELATED_EXPR, + gen_rtx_SET (VOIDmode, tmpreg, + gen_rtx_PLUS (Pmode, basereg, delta))); } else { @@ -3912,10 +3905,8 @@ hppa_expand_prologue (void) { rtx mem = gen_rtx_MEM (DFmode, plus_constant (base, offset)); - REG_NOTES (insn) - = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, - gen_rtx_SET (VOIDmode, mem, reg), - REG_NOTES (insn)); + add_reg_note (insn, REG_FRAME_RELATED_EXPR, + gen_rtx_SET (VOIDmode, mem, reg)); } else { @@ -3932,10 +3923,8 @@ hppa_expand_prologue (void) RTX_FRAME_RELATED_P (setl) = 1; RTX_FRAME_RELATED_P (setr) = 1; vec = gen_rtvec (2, setl, setr); - REG_NOTES (insn) - = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, - gen_rtx_SEQUENCE (VOIDmode, vec), - REG_NOTES (insn)); + add_reg_note (insn, REG_FRAME_RELATED_EXPR, + gen_rtx_SEQUENCE (VOIDmode, vec)); } } offset += GET_MODE_SIZE (DFmode); @@ -4353,8 +4342,7 @@ hppa_profile_hook (int label_no) /* Indicate the _mcount call cannot throw, nor will it execute a non-local goto. */ - REG_NOTES (call_insn) - = gen_rtx_EXPR_LIST (REG_EH_REGION, constm1_rtx, REG_NOTES (call_insn)); + add_reg_note (call_insn, REG_EH_REGION, constm1_rtx); } /* Fetch the return address for the frame COUNT steps up from diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c index 79c96ac5efd..ebcb11116aa 100644 --- a/gcc/config/rs6000/rs6000-c.c +++ b/gcc/config/rs6000/rs6000-c.c @@ -1,5 +1,5 @@ /* Subroutines for the C front end on the POWER and PowerPC architectures. - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. Contributed by Zack Weinberg <zack@codesourcery.com> @@ -2993,13 +2993,15 @@ altivec_build_resolved_builtin (tree *args, int n, support Altivec's overloaded builtins. */ tree -altivec_resolve_overloaded_builtin (tree fndecl, tree arglist) +altivec_resolve_overloaded_builtin (tree fndecl, void *passed_arglist) { + VEC(tree,gc) *arglist = (VEC(tree,gc) *) passed_arglist; + unsigned int nargs = VEC_length (tree, arglist); unsigned int fcode = DECL_FUNCTION_CODE (fndecl); tree fnargs = TYPE_ARG_TYPES (TREE_TYPE (fndecl)); tree types[3], args[3]; const struct altivec_builtin_types *desc; - int n; + unsigned int n; if (fcode < ALTIVEC_BUILTIN_OVERLOADED_FIRST || fcode > ALTIVEC_BUILTIN_OVERLOADED_LAST) @@ -3016,33 +3018,27 @@ altivec_resolve_overloaded_builtin (tree fndecl, tree arglist) VEC(constructor_elt,gc) *vec; const char *name = fcode == ALTIVEC_BUILTIN_VEC_SPLATS ? "vec_splats": "vec_promote"; - if (!arglist) + if (nargs == 0) { error ("%s only accepts %d arguments", name, (fcode == ALTIVEC_BUILTIN_VEC_PROMOTE)+1 ); return error_mark_node; } - if (fcode == ALTIVEC_BUILTIN_VEC_SPLATS && TREE_CHAIN (arglist)) + if (fcode == ALTIVEC_BUILTIN_VEC_SPLATS && nargs != 1) { error ("%s only accepts 1 argument", name); return error_mark_node; } - if (fcode == ALTIVEC_BUILTIN_VEC_PROMOTE && !TREE_CHAIN (arglist)) + if (fcode == ALTIVEC_BUILTIN_VEC_PROMOTE && nargs != 2) { error ("%s only accepts 2 arguments", name); return error_mark_node; } /* Ignore promote's element argument. */ if (fcode == ALTIVEC_BUILTIN_VEC_PROMOTE - && TREE_CHAIN (TREE_CHAIN (arglist))) - { - error ("%s only accepts 2 arguments", name); - return error_mark_node; - } - if (fcode == ALTIVEC_BUILTIN_VEC_PROMOTE - && !INTEGRAL_TYPE_P (TREE_TYPE (TREE_VALUE (TREE_CHAIN (arglist))))) + && !INTEGRAL_TYPE_P (TREE_TYPE (VEC_index (tree, arglist, 1)))) goto bad; - arg = TREE_VALUE (arglist); + arg = VEC_index (tree, arglist, 0); type = TREE_TYPE (arg); if (!SCALAR_FLOAT_TYPE_P (type) && !INTEGRAL_TYPE_P (type)) @@ -3093,15 +3089,14 @@ altivec_resolve_overloaded_builtin (tree fndecl, tree arglist) tree innerptrtype; /* No second argument. */ - if (!arglist || !TREE_CHAIN (arglist) - || TREE_CHAIN (TREE_CHAIN (arglist))) + if (nargs != 2) { error ("vec_extract only accepts 2 arguments"); return error_mark_node; } - arg2 = TREE_VALUE (TREE_CHAIN (arglist)); - arg1 = TREE_VALUE (arglist); + arg2 = VEC_index (tree, arglist, 1); + arg1 = VEC_index (tree, arglist, 0); arg1_type = TREE_TYPE (arg1); if (TREE_CODE (arg1_type) != VECTOR_TYPE) @@ -3149,18 +3144,16 @@ altivec_resolve_overloaded_builtin (tree fndecl, tree arglist) tree innerptrtype; /* No second or third arguments. */ - if (!arglist || !TREE_CHAIN (arglist) - || !TREE_CHAIN (TREE_CHAIN (arglist)) - || TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (arglist)))) + if (nargs != 3) { error ("vec_insert only accepts 3 arguments"); return error_mark_node; } - arg0 = TREE_VALUE (arglist); - arg1 = TREE_VALUE (TREE_CHAIN (arglist)); + arg0 = VEC_index (tree, arglist, 0); + arg1 = VEC_index (tree, arglist, 1); arg1_type = TREE_TYPE (arg1); - arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))); + arg2 = VEC_index (tree, arglist, 2); if (TREE_CODE (arg1_type) != VECTOR_TYPE) goto bad; @@ -3198,11 +3191,11 @@ altivec_resolve_overloaded_builtin (tree fndecl, tree arglist) } for (n = 0; - !VOID_TYPE_P (TREE_VALUE (fnargs)) && arglist; - fnargs = TREE_CHAIN (fnargs), arglist = TREE_CHAIN (arglist), n++) + !VOID_TYPE_P (TREE_VALUE (fnargs)) && n < nargs; + fnargs = TREE_CHAIN (fnargs), n++) { tree decl_type = TREE_VALUE (fnargs); - tree arg = TREE_VALUE (arglist); + tree arg = VEC_index (tree, arglist, n); tree type; if (arg == error_mark_node) @@ -3248,7 +3241,7 @@ altivec_resolve_overloaded_builtin (tree fndecl, tree arglist) /* If the number of arguments did not match the prototype, return NULL and the generic code will issue the appropriate error message. */ - if (!VOID_TYPE_P (TREE_VALUE (fnargs)) || arglist) + if (!VOID_TYPE_P (TREE_VALUE (fnargs)) || nargs > 0) return NULL; if (n == 0) @@ -3281,4 +3274,3 @@ altivec_resolve_overloaded_builtin (tree fndecl, tree arglist) error ("invalid parameter combination for AltiVec intrinsic"); return error_mark_node; } - diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h index 9fa0e345839..c898d51e3a3 100644 --- a/gcc/config/rs6000/rs6000-protos.h +++ b/gcc/config/rs6000/rs6000-protos.h @@ -134,7 +134,7 @@ extern void function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, tree, int, int); extern int function_arg_boundary (enum machine_mode, tree); extern rtx function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int); -extern tree altivec_resolve_overloaded_builtin (tree, tree); +extern tree altivec_resolve_overloaded_builtin (tree, void *); extern rtx rs6000_function_value (const_tree, const_tree); extern rtx rs6000_libcall_value (enum machine_mode); extern rtx rs6000_va_arg (tree, tree); diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 07131b72723..69ef4d209cf 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -1346,7 +1346,7 @@ rs6000_init_hard_regno_mode_ok (void) for (r = 0; r < FIRST_PSEUDO_REGISTER; ++r) for (m = 0; m < NUM_MACHINE_MODES; ++m) - if (rs6000_hard_regno_mode_ok (r, m)) + if (rs6000_hard_regno_mode_ok (r, (enum machine_mode) m)) rs6000_hard_regno_mode_ok_p[m][r] = true; } @@ -8560,8 +8560,8 @@ altivec_expand_vec_set_builtin (tree exp) mode1 = TYPE_MODE (TREE_TYPE (TREE_TYPE (arg0))); gcc_assert (VECTOR_MODE_P (tmode)); - op0 = expand_expr (arg0, NULL_RTX, tmode, 0); - op1 = expand_expr (arg1, NULL_RTX, mode1, 0); + op0 = expand_expr (arg0, NULL_RTX, tmode, EXPAND_NORMAL); + op1 = expand_expr (arg1, NULL_RTX, mode1, EXPAND_NORMAL); elt = get_element_number (TREE_TYPE (arg0), arg2); if (GET_MODE (op1) != mode1 && GET_MODE (op1) != VOIDmode) @@ -14035,7 +14035,7 @@ emit_unlikely_jump (rtx cond, rtx label) x = gen_rtx_IF_THEN_ELSE (VOIDmode, cond, label, pc_rtx); x = emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, x)); - REG_NOTES (x) = gen_rtx_EXPR_LIST (REG_BR_PROB, very_unlikely, NULL_RTX); + add_reg_note (x, REG_BR_PROB, very_unlikely); } /* A subroutine of the atomic operation splitters. Emit a load-locked @@ -15628,12 +15628,10 @@ rs6000_emit_allocate_stack (HOST_WIDE_INT size, int copy_r12, int copy_r11) set_mem_alias_set (mem, get_frame_alias_set ()); RTX_FRAME_RELATED_P (insn) = 1; - REG_NOTES (insn) = - gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, - gen_rtx_SET (VOIDmode, stack_reg, - gen_rtx_PLUS (Pmode, stack_reg, - GEN_INT (-size))), - REG_NOTES (insn)); + add_reg_note (insn, REG_FRAME_RELATED_EXPR, + gen_rtx_SET (VOIDmode, stack_reg, + gen_rtx_PLUS (Pmode, stack_reg, + GEN_INT (-size)))); } /* Add to 'insn' a note which is PATTERN (INSN) but with REG replaced @@ -15714,9 +15712,7 @@ rs6000_frame_related (rtx insn, rtx reg, HOST_WIDE_INT val, } RTX_FRAME_RELATED_P (insn) = 1; - REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, - real, - REG_NOTES (insn)); + add_reg_note (insn, REG_FRAME_RELATED_EXPR, real); } /* Returns an insn that has a vrsave set operation with the @@ -16341,9 +16337,7 @@ rs6000_emit_prologue (void) We use CR2_REGNO (70) to be compatible with gcc-2.95 on Linux. */ set = gen_rtx_SET (VOIDmode, cr_save_rtx, gen_rtx_REG (SImode, CR2_REGNO)); - REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, - set, - REG_NOTES (insn)); + add_reg_note (insn, REG_FRAME_RELATED_EXPR, set); } /* Do any required saving of fpr's. If only one or two to save, do @@ -16599,10 +16593,7 @@ rs6000_emit_prologue (void) insn = emit_insn (gen_movesi_from_cr (cr_save_rtx)); RTX_FRAME_RELATED_P (insn) = 1; set = gen_rtx_SET (VOIDmode, cr_save_rtx, magic_eh_cr_reg); - REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, - set, - REG_NOTES (insn)); - + add_reg_note (insn, REG_FRAME_RELATED_EXPR, set); } insn = emit_move_insn (mem, cr_save_rtx); @@ -18132,7 +18123,7 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode) h->key_mode = mode; h->labelno = labelno; - found = htab_find_slot (toc_hash_table, h, 1); + found = htab_find_slot (toc_hash_table, h, INSERT); if (*found == NULL) *found = h; else /* This is indeed a duplicate. @@ -18553,7 +18544,8 @@ output_profile_hook (int labelno ATTRIBUTE_UNUSED) # define NO_PROFILE_COUNTERS 0 #endif if (NO_PROFILE_COUNTERS) - emit_library_call (init_one_libfunc (RS6000_MCOUNT), 0, VOIDmode, 0); + emit_library_call (init_one_libfunc (RS6000_MCOUNT), + LCT_NORMAL, VOIDmode, 0); else { char buf[30]; @@ -18564,8 +18556,8 @@ output_profile_hook (int labelno ATTRIBUTE_UNUSED) label_name = (*targetm.strip_name_encoding) (ggc_strdup (buf)); fun = gen_rtx_SYMBOL_REF (Pmode, label_name); - emit_library_call (init_one_libfunc (RS6000_MCOUNT), 0, VOIDmode, 1, - fun, Pmode); + emit_library_call (init_one_libfunc (RS6000_MCOUNT), + LCT_NORMAL, VOIDmode, 1, fun, Pmode); } } else if (DEFAULT_ABI == ABI_DARWIN) @@ -18584,7 +18576,7 @@ output_profile_hook (int labelno ATTRIBUTE_UNUSED) caller_addr_regno = 0; #endif emit_library_call (gen_rtx_SYMBOL_REF (Pmode, mcount_name), - 0, VOIDmode, 1, + LCT_NORMAL, VOIDmode, 1, gen_rtx_REG (Pmode, caller_addr_regno), Pmode); } } @@ -20487,7 +20479,7 @@ rs6000_initialize_trampoline (rtx addr, rtx fnaddr, rtx cxt) case ABI_DARWIN: case ABI_V4: emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__trampoline_setup"), - FALSE, VOIDmode, 4, + LCT_NORMAL, VOIDmode, 4, addr, Pmode, GEN_INT (rs6000_trampoline_size ()), SImode, fnaddr, Pmode, @@ -22730,7 +22722,7 @@ rs6000_init_dwarf_reg_sizes_extra (tree address) { int i; enum machine_mode mode = TYPE_MODE (char_type_node); - rtx addr = expand_expr (address, NULL_RTX, VOIDmode, 0); + rtx addr = expand_expr (address, NULL_RTX, VOIDmode, EXPAND_NORMAL); rtx mem = gen_rtx_MEM (BLKmode, addr); rtx value = gen_int_mode (4, mode); diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 1cf9f8eb270..5c1f1b17f2b 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -1,6 +1,6 @@ /* Subroutines used for code generation on IBM S/390 and zSeries Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008 Free Software Foundation, Inc. + 2007, 2008, 2009 Free Software Foundation, Inc. Contributed by Hartmut Penner (hpenner@de.ibm.com) and Ulrich Weigand (uweigand@de.ibm.com) and Andreas Krebbel (Andreas.Krebbel@de.ibm.com). @@ -2320,9 +2320,9 @@ s390_rtx_costs (rtx x, int code, int outer_code, int *total, *total = s390_cost->madbr; else *total = s390_cost->maebr; - *total += rtx_cost (XEXP (XEXP (x, 0), 0), MULT, speed) - + rtx_cost (XEXP (XEXP (x, 0), 1), MULT, speed) - + rtx_cost (XEXP (x, 1), code, speed); + *total += (rtx_cost (XEXP (XEXP (x, 0), 0), MULT, speed) + + rtx_cost (XEXP (XEXP (x, 0), 1), MULT, speed) + + rtx_cost (XEXP (x, 1), (enum rtx_code) code, speed)); return true; /* Do not do an additional recursive descent. */ } *total = COSTS_N_INSNS (1); @@ -3909,11 +3909,13 @@ s390_expand_movmem (rtx dst, rtx src, rtx len) dst = change_address (dst, VOIDmode, dst_addr); src = change_address (src, VOIDmode, src_addr); - temp = expand_binop (mode, add_optab, count, constm1_rtx, count, 1, 0); + temp = expand_binop (mode, add_optab, count, constm1_rtx, count, 1, + OPTAB_DIRECT); if (temp != count) emit_move_insn (count, temp); - temp = expand_binop (mode, lshr_optab, count, GEN_INT (8), blocks, 1, 0); + temp = expand_binop (mode, lshr_optab, count, GEN_INT (8), blocks, 1, + OPTAB_DIRECT); if (temp != blocks) emit_move_insn (blocks, temp); @@ -3928,7 +3930,8 @@ s390_expand_movmem (rtx dst, rtx src, rtx len) s390_load_address (src_addr, gen_rtx_PLUS (Pmode, src_addr, GEN_INT (256))); - temp = expand_binop (mode, add_optab, blocks, constm1_rtx, blocks, 1, 0); + temp = expand_binop (mode, add_optab, blocks, constm1_rtx, blocks, 1, + OPTAB_DIRECT); if (temp != blocks) emit_move_insn (blocks, temp); @@ -4011,7 +4014,8 @@ s390_expand_setmem (rtx dst, rtx len, rtx val) dst = change_address (dst, VOIDmode, dst_addr); if (val == const0_rtx) - temp = expand_binop (mode, add_optab, count, constm1_rtx, count, 1, 0); + temp = expand_binop (mode, add_optab, count, constm1_rtx, count, 1, + OPTAB_DIRECT); else { dstp1 = adjust_address (dst, VOIDmode, 1); @@ -4024,12 +4028,14 @@ s390_expand_setmem (rtx dst, rtx len, rtx val) emit_cmp_and_jump_insns (count, const1_rtx, EQ, NULL_RTX, mode, 1, end_label); - temp = expand_binop (mode, add_optab, count, GEN_INT (-2), count, 1, 0); + temp = expand_binop (mode, add_optab, count, GEN_INT (-2), count, 1, + OPTAB_DIRECT); } if (temp != count) emit_move_insn (count, temp); - temp = expand_binop (mode, lshr_optab, count, GEN_INT (8), blocks, 1, 0); + temp = expand_binop (mode, lshr_optab, count, GEN_INT (8), blocks, 1, + OPTAB_DIRECT); if (temp != blocks) emit_move_insn (blocks, temp); @@ -4045,7 +4051,8 @@ s390_expand_setmem (rtx dst, rtx len, rtx val) s390_load_address (dst_addr, gen_rtx_PLUS (Pmode, dst_addr, GEN_INT (256))); - temp = expand_binop (mode, add_optab, blocks, constm1_rtx, blocks, 1, 0); + temp = expand_binop (mode, add_optab, blocks, constm1_rtx, blocks, 1, + OPTAB_DIRECT); if (temp != blocks) emit_move_insn (blocks, temp); @@ -4117,11 +4124,13 @@ s390_expand_cmpmem (rtx target, rtx op0, rtx op1, rtx len) op0 = change_address (op0, VOIDmode, addr0); op1 = change_address (op1, VOIDmode, addr1); - temp = expand_binop (mode, add_optab, count, constm1_rtx, count, 1, 0); + temp = expand_binop (mode, add_optab, count, constm1_rtx, count, 1, + OPTAB_DIRECT); if (temp != count) emit_move_insn (count, temp); - temp = expand_binop (mode, lshr_optab, count, GEN_INT (8), blocks, 1, 0); + temp = expand_binop (mode, lshr_optab, count, GEN_INT (8), blocks, 1, + OPTAB_DIRECT); if (temp != blocks) emit_move_insn (blocks, temp); @@ -4142,7 +4151,8 @@ s390_expand_cmpmem (rtx target, rtx op0, rtx op1, rtx len) s390_load_address (addr1, gen_rtx_PLUS (Pmode, addr1, GEN_INT (256))); - temp = expand_binop (mode, add_optab, blocks, constm1_rtx, blocks, 1, 0); + temp = expand_binop (mode, add_optab, blocks, constm1_rtx, blocks, 1, + OPTAB_DIRECT); if (temp != blocks) emit_move_insn (blocks, temp); @@ -7490,9 +7500,7 @@ save_gprs (rtx base, int offset, int first, int last) GEN_INT (last - 6 + 1)); note = PATTERN (note); - REG_NOTES (insn) = - gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, - note, REG_NOTES (insn)); + add_reg_note (insn, REG_FRAME_RELATED_EXPR, note); for (i = 0; i < XVECLEN (note, 0); i++) if (GET_CODE (XVECEXP (note, 0, i)) == SET) @@ -7704,6 +7712,7 @@ s390_emit_prologue (void) if (cfun_frame_layout.frame_size > 0) { rtx frame_off = GEN_INT (-cfun_frame_layout.frame_size); + rtx real_frame_off; if (s390_stack_size) { @@ -7781,12 +7790,11 @@ s390_emit_prologue (void) } RTX_FRAME_RELATED_P (insn) = 1; - REG_NOTES (insn) = - gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, - gen_rtx_SET (VOIDmode, stack_pointer_rtx, - gen_rtx_PLUS (Pmode, stack_pointer_rtx, - GEN_INT (-cfun_frame_layout.frame_size))), - REG_NOTES (insn)); + real_frame_off = GEN_INT (-cfun_frame_layout.frame_size); + add_reg_note (insn, REG_FRAME_RELATED_EXPR, + gen_rtx_SET (VOIDmode, stack_pointer_rtx, + gen_rtx_PLUS (Pmode, stack_pointer_rtx, + real_frame_off))); /* Set backchain. */ @@ -7838,12 +7846,10 @@ s390_emit_prologue (void) insn = save_fpr (temp_reg, offset, i); offset += 8; RTX_FRAME_RELATED_P (insn) = 1; - REG_NOTES (insn) = - gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, - gen_rtx_SET (VOIDmode, - gen_rtx_MEM (DFmode, addr), - gen_rtx_REG (DFmode, i)), - REG_NOTES (insn)); + add_reg_note (insn, REG_FRAME_RELATED_EXPR, + gen_rtx_SET (VOIDmode, + gen_rtx_MEM (DFmode, addr), + gen_rtx_REG (DFmode, i))); } } @@ -8725,7 +8731,7 @@ s390_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED, insn_op = &insn_data[icode].operand[arity + nonvoid]; - op[arity] = expand_expr (arg, NULL_RTX, insn_op->mode, 0); + op[arity] = expand_expr (arg, NULL_RTX, insn_op->mode, EXPAND_NORMAL); if (!(*insn_op->predicate) (op[arity], insn_op->mode)) op[arity] = copy_to_mode_reg (insn_op->mode, op[arity]); diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 7e6a358f89b..62d025f4ceb 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -1,6 +1,6 @@ /* Subroutines for insn-output.c for SPARC. Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) 64-bit SPARC-V9 support by Michael Tiemann, Jim Wilson, and Doug Evans, @@ -4082,10 +4082,8 @@ sparc_expand_prologue (void) rtx reg = gen_rtx_REG (Pmode, 1); emit_move_insn (reg, GEN_INT (-actual_fsize)); insn = emit_insn (gen_stack_pointer_inc (reg)); - REG_NOTES (insn) = - gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, - gen_stack_pointer_inc (GEN_INT (-actual_fsize)), - REG_NOTES (insn)); + add_reg_note (insn, REG_FRAME_RELATED_EXPR, + gen_stack_pointer_inc (GEN_INT (-actual_fsize))); } RTX_FRAME_RELATED_P (insn) = 1; @@ -8255,13 +8253,14 @@ sparc_fold_builtin (tree fndecl, tree arglist, bool ignore) { tree arg0, arg1, arg2; tree rtype = TREE_TYPE (TREE_TYPE (fndecl)); + enum insn_code icode = (enum insn_code) DECL_FUNCTION_CODE (fndecl); if (ignore - && DECL_FUNCTION_CODE (fndecl) != CODE_FOR_alignaddrsi_vis - && DECL_FUNCTION_CODE (fndecl) != CODE_FOR_alignaddrdi_vis) + && icode != CODE_FOR_alignaddrsi_vis + && icode != CODE_FOR_alignaddrdi_vis) return fold_convert (rtype, integer_zero_node); - switch (DECL_FUNCTION_CODE (fndecl)) + switch (icode) { case CODE_FOR_fexpand_vis: arg0 = TREE_VALUE (arglist); @@ -8297,8 +8296,8 @@ sparc_fold_builtin (tree fndecl, tree arglist, bool ignore) tree inner_type = TREE_TYPE (rtype); tree elts0 = TREE_VECTOR_CST_ELTS (arg0); tree elts1 = TREE_VECTOR_CST_ELTS (arg1); - tree n_elts = sparc_handle_vis_mul8x16 (DECL_FUNCTION_CODE (fndecl), - inner_type, elts0, elts1); + tree n_elts = sparc_handle_vis_mul8x16 (icode, inner_type, elts0, + elts1); return build_vector (rtype, n_elts); } diff --git a/gcc/config/spu/spu-c.c b/gcc/config/spu/spu-c.c index 7db0bfb83ad..2ae57ba44c0 100644 --- a/gcc/config/spu/spu-c.c +++ b/gcc/config/spu/spu-c.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. +/* Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file 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 @@ -96,11 +96,13 @@ spu_macro_to_expand (cpp_reader *pfile, const cpp_token *tok) /* target hook for resolve_overloaded_builtin(). Returns a function call RTX if we can resolve the overloaded builtin */ tree -spu_resolve_overloaded_builtin (tree fndecl, tree fnargs) +spu_resolve_overloaded_builtin (tree fndecl, void *passed_args) { #define SCALAR_TYPE_P(t) (INTEGRAL_TYPE_P (t) \ || SCALAR_FLOAT_TYPE_P (t) \ || POINTER_TYPE_P (t)) + VEC(tree,gc) *fnargs = (VEC(tree,gc) *) passed_args; + unsigned int nargs = VEC_length (tree, fnargs); spu_function_code new_fcode, fcode = DECL_FUNCTION_CODE (fndecl) - END_BUILTINS; struct spu_builtin_description *desc; @@ -121,23 +123,23 @@ spu_resolve_overloaded_builtin (tree fndecl, tree fnargs) { tree decl = spu_builtins[new_fcode].fndecl; tree params = TYPE_ARG_TYPES (TREE_TYPE (decl)); - tree arg, param; - int p; + tree param; + unsigned int p; - for (param = params, arg = fnargs, p = 0; + for (param = params, p = 0; param != void_list_node; - param = TREE_CHAIN (param), arg = TREE_CHAIN (arg), p++) + param = TREE_CHAIN (param), p++) { tree var, arg_type, param_type = TREE_VALUE (param); - if (!arg) + if (p < nargs) { error ("insufficient arguments to overloaded function %s", desc->name); return error_mark_node; } - var = TREE_VALUE (arg); + var = VEC_index (tree, fnargs, p); if (TREE_CODE (var) == NON_LVALUE_EXPR) var = TREE_OPERAND (var, 0); @@ -165,7 +167,7 @@ spu_resolve_overloaded_builtin (tree fndecl, tree fnargs) } if (param == void_list_node) { - if (arg) + if (p != nargs) { error ("too many arguments to overloaded function %s", desc->name); @@ -184,7 +186,7 @@ spu_resolve_overloaded_builtin (tree fndecl, tree fnargs) return error_mark_node; } - return build_function_call (match, fnargs); + return build_function_call_vec (match, fnargs, NULL); #undef SCALAR_TYPE_P } diff --git a/gcc/config/spu/spu-protos.h b/gcc/config/spu/spu-protos.h index 48ec9697237..07eb654c7f3 100644 --- a/gcc/config/spu/spu-protos.h +++ b/gcc/config/spu/spu-protos.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. +/* Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file 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 @@ -90,7 +90,7 @@ extern void spu_expand_vector_init (rtx target, rtx vals); extern void spu_init_expanders (void); /* spu-c.c */ -extern tree spu_resolve_overloaded_builtin (tree fndecl, tree fnargs); +extern tree spu_resolve_overloaded_builtin (tree fndecl, void *fnargs); extern rtx spu_expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, int ignore); extern rtx spu_expand_builtin (tree, rtx, rtx, enum machine_mode, int); diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c index 8e165713df3..b0ba7ceebd2 100644 --- a/gcc/config/spu/spu.c +++ b/gcc/config/spu/spu.c @@ -786,7 +786,8 @@ spu_emit_branch_or_set (int is_set, enum rtx_code code, rtx operands[]) rtx target = operands[0]; enum machine_mode comp_mode; enum machine_mode op_mode; - enum spu_comp_code scode, eq_code, ior_code; + enum spu_comp_code scode, eq_code; + enum insn_code ior_code; int index; int eq_test = 0; @@ -1886,8 +1887,7 @@ spu_expand_prologue (void) } RTX_FRAME_RELATED_P (insn) = 1; real = gen_addsi3 (sp_reg, sp_reg, GEN_INT (-total_size)); - REG_NOTES (insn) = - gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, real, REG_NOTES (insn)); + add_reg_note (insn, REG_FRAME_RELATED_EXPR, real); if (total_size > 2000) { @@ -1904,9 +1904,7 @@ spu_expand_prologue (void) insn = frame_emit_add_imm (fp_reg, sp_reg, fp_offset, scratch_reg_0); RTX_FRAME_RELATED_P (insn) = 1; real = gen_addsi3 (fp_reg, sp_reg, GEN_INT (fp_offset)); - REG_NOTES (insn) = - gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, - real, REG_NOTES (insn)); + add_reg_note (insn, REG_FRAME_RELATED_EXPR, real); REGNO_POINTER_ALIGN (HARD_FRAME_POINTER_REGNUM) = STACK_BOUNDARY; } } @@ -5892,7 +5890,7 @@ expand_builtin_args (struct spu_builtin_description *d, tree exp, tree arg = CALL_EXPR_ARG (exp, a); if (arg == 0) abort (); - ops[i] = expand_expr (arg, NULL_RTX, VOIDmode, 0); + ops[i] = expand_expr (arg, NULL_RTX, VOIDmode, EXPAND_NORMAL); } /* The insn pattern may have additional operands (SCRATCH). @@ -6291,4 +6289,3 @@ spu_section_type_flags (tree decl, const char *name, int reloc) return SECTION_BSS; return default_section_type_flags (decl, name, reloc); } - diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index dbbea2d8bca..0d014f57a17 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,17 @@ 2009-04-20 Ian Lance Taylor <iant@google.com> + * typeck.c (build_function_call_vec): New function. + (cp_build_function_call): Only pass first parameter to + objc_rewrite_function_call. + (build_modify_expr): Add rhs_origtype parameter. Change all + callers. + * decl.c (finish_decl): Add origtype parameter. Change all + callers. + * semantics.c (finish_call_expr): Pass VEC to + resolve_overloaded_builtin. + +2009-04-20 Ian Lance Taylor <iant@google.com> + * cp-tree.h (base_access): Change typedef to int. * parser.c (cp_parser_omp_flush): Change 0 to OMP_CLAUSE_ERROR. (cp_parser_omp_threadprivate): Likewise. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 76e63981a33..a20b8c4c565 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -774,7 +774,7 @@ get_vtable_decl (tree type, int complete) if (complete) { DECL_EXTERNAL (decl) = 1; - finish_decl (decl, NULL_TREE, NULL_TREE); + finish_decl (decl, NULL_TREE, NULL_TREE, NULL_TREE); } return decl; diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index c96e5759502..e3fed778e80 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4346,7 +4346,7 @@ extern tree start_decl (const cp_declarator *, cp_decl_specifier_seq *, int, extern void start_decl_1 (tree, bool); extern bool check_array_initializer (tree, tree, tree); extern void cp_finish_decl (tree, tree, bool, tree, int); -extern void finish_decl (tree, tree, tree); +extern void finish_decl (tree, tree, tree, tree); extern int cp_complete_array_type (tree *, tree, bool); extern tree build_ptrmemfunc_type (tree); extern tree build_ptrmem_type (tree, tree); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index cd550f224cb..9aebe2af9c1 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5868,7 +5868,8 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p, /* This is here for a midend callback from c-common.c. */ void -finish_decl (tree decl, tree init, tree asmspec_tree) +finish_decl (tree decl, tree init, tree origtype ATTRIBUTE_UNUSED, + tree asmspec_tree) { cp_finish_decl (decl, init, /*init_const_expr_p=*/false, asmspec_tree, 0); } @@ -5895,7 +5896,7 @@ declare_global_var (tree name, tree type) library), then it is possible that our declaration will be merged with theirs by pushdecl. */ decl = pushdecl (decl); - finish_decl (decl, NULL_TREE, NULL_TREE); + finish_decl (decl, NULL_TREE, NULL_TREE, NULL_TREE); pop_from_top_level (); return decl; @@ -12480,7 +12481,7 @@ start_method (cp_decl_specifier_seq *declspecs, } } - finish_decl (fndecl, NULL_TREE, NULL_TREE); + finish_decl (fndecl, NULL_TREE, NULL_TREE, NULL_TREE); /* Make a place for the parms. */ begin_scope (sk_function_parms, fndecl); diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 91c707d7b69..12876adb47a 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1001,7 +1001,7 @@ grokbitfield (const cp_declarator *declarator, error ("static member %qD cannot be a bit-field", value); return NULL_TREE; } - finish_decl (value, NULL_TREE, NULL_TREE); + finish_decl (value, NULL_TREE, NULL_TREE, NULL_TREE); if (width != error_mark_node) { diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index b47c0c55fd8..d8b2e7c5e92 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -3556,7 +3556,7 @@ pushdecl_top_level_1 (tree x, tree *init, bool is_friend) push_to_top_level (); x = pushdecl_namespace_level (x, is_friend); if (init) - finish_decl (x, *init, NULL_TREE); + finish_decl (x, *init, NULL_TREE, NULL_TREE); pop_from_top_level (); POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, x); } diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 2ee3d18c39b..b58b9f1f8ef 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -10774,7 +10774,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl, init = t; } - finish_decl (decl, init, NULL_TREE); + finish_decl (decl, init, NULL_TREE, NULL_TREE); } } } @@ -15577,7 +15577,7 @@ instantiate_decl (tree d, int defer_ok, /* Enter the scope of D so that access-checking works correctly. */ push_nested_class (DECL_CONTEXT (d)); - finish_decl (d, init, NULL_TREE); + finish_decl (d, init, NULL_TREE, NULL_TREE); pop_nested_class (); } else if (TREE_CODE (d) == FUNCTION_DECL) diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 1d5da671437..68419fa8319 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -1,6 +1,6 @@ /* RunTime Type Identification Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008 + 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. Mostly written by Jason Merrill (jason@cygnus.com). @@ -1519,7 +1519,7 @@ emit_tinfo_decl (tree decl) init = get_pseudo_ti_init (type, get_pseudo_ti_index (type)); DECL_INITIAL (decl) = init; mark_used (decl); - finish_decl (decl, init, NULL_TREE); + finish_decl (decl, init, NULL_TREE, NULL_TREE); return true; } else diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 337b6373b28..0183239f359 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1987,7 +1987,15 @@ finish_call_expr (tree fn, tree args, bool disallow_virtual, bool koenig_p, if (TREE_CODE (fn) == FUNCTION_DECL && (DECL_BUILT_IN_CLASS (fn) == BUILT_IN_NORMAL || DECL_BUILT_IN_CLASS (fn) == BUILT_IN_MD)) - result = resolve_overloaded_builtin (fn, args); + { + VEC(tree,gc)* vec = VEC_alloc (tree, gc, list_length (args)); + tree p; + + for (p = args; p != NULL_TREE; p = TREE_CHAIN (p)) + VEC_quick_push (tree, vec, TREE_VALUE (p)); + result = resolve_overloaded_builtin (fn, vec); + VEC_free (tree, gc, vec); + } if (!result) /* A call to a namespace-scope function. */ @@ -4121,7 +4129,7 @@ handle_omp_for_class_iterator (int i, location_t locus, tree declv, tree initv, cond = cp_build_binary_op (elocus, TREE_CODE (cond), decl, diff, tf_warning_or_error); - incr = build_modify_expr (elocus, decl, PLUS_EXPR, incr); + incr = build_modify_expr (elocus, decl, PLUS_EXPR, incr, NULL_TREE); orig_body = *body; *body = push_stmt_list (); diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index fe791f3d707..9084b5e10e0 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -2857,6 +2857,28 @@ build_function_call (tree function, tree params) return cp_build_function_call (function, params, tf_warning_or_error); } +/* Used by the C-common bits. */ +tree +build_function_call_vec (tree function, VEC(tree,gc) *params, + VEC(tree,gc) *origtypes ATTRIBUTE_UNUSED) +{ + tree p; + tree *pp; + unsigned int i; + tree t; + + /* FIXME: Should just change cp_build_function_call to use a + VEC. */ + p = NULL_TREE; + pp = &p; + for (i = 0; VEC_iterate (tree, params, i, t); ++i) + { + *pp = build_tree_list (NULL, t); + pp = &TREE_CHAIN (*pp); + } + return cp_build_function_call (function, p, tf_warning_or_error); +} + tree cp_build_function_call (tree function, tree params, tsubst_flags_t complain) { @@ -2870,7 +2892,8 @@ cp_build_function_call (tree function, tree params, tsubst_flags_t complain) /* For Objective-C, convert any calls via a cast to OBJC_TYPE_REF expressions, like those used for ObjC messenger dispatches. */ - function = objc_rewrite_function_call (function, params); + if (params != NULL_TREE) + function = objc_rewrite_function_call (function, TREE_VALUE (params)); /* build_c_cast puts on a NOP_EXPR to make the result not an lvalue. Strip such NOP_EXPRs, since FUNCTION is used in non-lvalue context. */ @@ -5840,7 +5863,8 @@ cp_build_c_cast (tree type, tree expr, tsubst_flags_t complain) /* For use from the C common bits. */ tree build_modify_expr (location_t location ATTRIBUTE_UNUSED, - tree lhs, enum tree_code modifycode, tree rhs) + tree lhs, enum tree_code modifycode, tree rhs, + tree rhs_origtype ATTRIBUTE_UNUSED) { return cp_build_modify_expr (lhs, modifycode, rhs, tf_warning_or_error); } diff --git a/gcc/cse.c b/gcc/cse.c index 04f52fb7d77..c238efd6e4e 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -1,6 +1,6 @@ /* Common subexpression elimination for GNU compiler. Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998 - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GCC. @@ -2329,14 +2329,14 @@ hash_rtx_cb (const_rtx x, enum machine_mode mode, goto repeat; } - hash += hash_rtx_cb (XEXP (x, i), 0, do_not_record_p, + hash += hash_rtx_cb (XEXP (x, i), VOIDmode, do_not_record_p, hash_arg_in_memory_p, have_reg_qty, cb); break; case 'E': for (j = 0; j < XVECLEN (x, i); j++) - hash += hash_rtx_cb (XVECEXP (x, i, j), 0, do_not_record_p, + hash += hash_rtx_cb (XVECEXP (x, i, j), VOIDmode, do_not_record_p, hash_arg_in_memory_p, have_reg_qty, cb); break; @@ -6997,4 +6997,3 @@ struct rtl_opt_pass pass_cse2 = TODO_verify_flow /* todo_flags_finish */ } }; - diff --git a/gcc/dbgcnt.c b/gcc/dbgcnt.c index 1e004d1656c..859aabff9d9 100644 --- a/gcc/dbgcnt.c +++ b/gcc/dbgcnt.c @@ -1,5 +1,5 @@ /* Debug counter for debugging support - Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GCC. @@ -88,7 +88,7 @@ dbg_cnt_set_limit_by_name (const char *name, int len, int value) if (i < 0) return false; - dbg_cnt_set_limit_by_index (i, value); + dbg_cnt_set_limit_by_index ((enum debug_counter) i, value); return true; } diff --git a/gcc/dbxout.c b/gcc/dbxout.c index c8bf30d69d6..edad611f089 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -1,6 +1,6 @@ /* Output dbx-format symbol table information from GNU compiler. Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GCC. @@ -2811,7 +2811,7 @@ dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED) if (!decl_rtl) DBXOUT_DECR_NESTING_AND_RETURN (0); - decl_rtl = eliminate_regs (decl_rtl, 0, NULL_RTX); + decl_rtl = eliminate_regs (decl_rtl, VOIDmode, NULL_RTX); #ifdef LEAF_REG_REMAP if (current_function_uses_only_leaf_regs) leaf_renumber_regs_insn (decl_rtl); @@ -3316,8 +3316,9 @@ dbxout_parms (tree parms) /* Perform any necessary register eliminations on the parameter's rtl, so that the debugging output will be accurate. */ DECL_INCOMING_RTL (parms) - = eliminate_regs (DECL_INCOMING_RTL (parms), 0, NULL_RTX); - SET_DECL_RTL (parms, eliminate_regs (DECL_RTL (parms), 0, NULL_RTX)); + = eliminate_regs (DECL_INCOMING_RTL (parms), VOIDmode, NULL_RTX); + SET_DECL_RTL (parms, + eliminate_regs (DECL_RTL (parms), VOIDmode, NULL_RTX)); #ifdef LEAF_REG_REMAP if (current_function_uses_only_leaf_regs) { diff --git a/gcc/df-core.c b/gcc/df-core.c index 88f761b679a..e25d0e5faa3 100644 --- a/gcc/df-core.c +++ b/gcc/df-core.c @@ -475,7 +475,7 @@ df_add_problem (struct df_problem *problem) returned. If a flag is not allowed to be changed this will fail if checking is enabled. */ enum df_changeable_flags -df_set_flags (enum df_changeable_flags changeable_flags) +df_set_flags (int changeable_flags) { enum df_changeable_flags old_flags = df->changeable_flags; df->changeable_flags |= changeable_flags; @@ -487,7 +487,7 @@ df_set_flags (enum df_changeable_flags changeable_flags) returned. If a flag is not allowed to be changed this will fail if checking is enabled. */ enum df_changeable_flags -df_clear_flags (enum df_changeable_flags changeable_flags) +df_clear_flags (int changeable_flags) { enum df_changeable_flags old_flags = df->changeable_flags; df->changeable_flags &= ~changeable_flags; diff --git a/gcc/df-problems.c b/gcc/df-problems.c index c0f79d83020..a4853273214 100644 --- a/gcc/df-problems.c +++ b/gcc/df-problems.c @@ -321,7 +321,7 @@ df_rd_alloc (bitmap all_blocks) static void df_rd_bb_local_compute_process_def (struct df_rd_bb_info *bb_info, df_ref *def_rec, - enum df_ref_flags top_flag) + int top_flag) { while (*def_rec) { @@ -2025,7 +2025,7 @@ df_chain_reset (bitmap blocks_to_clear ATTRIBUTE_UNUSED) static void df_chain_create_bb_process_use (bitmap local_rd, df_ref *use_rec, - enum df_ref_flags top_flag) + int top_flag) { bitmap_iterator bi; unsigned int def_index; @@ -2325,10 +2325,10 @@ static struct df_problem problem_CHAIN = solution. */ void -df_chain_add_problem (enum df_chain_flags chain_flags) +df_chain_add_problem (unsigned int chain_flags) { df_add_problem (&problem_CHAIN); - df_chain->local_flags = (unsigned int)chain_flags; + df_chain->local_flags = chain_flags; df_chain->out_of_date_transfer_functions = BITMAP_ALLOC (NULL); } @@ -3931,5 +3931,3 @@ df_simulate_finalize_forwards (basic_block bb, bitmap live) bitmap_clear_bit (live, DF_REF_REGNO (def)); } } - - diff --git a/gcc/df-scan.c b/gcc/df-scan.c index d8ad4a06698..fe00af2d3ec 100644 --- a/gcc/df-scan.c +++ b/gcc/df-scan.c @@ -100,24 +100,24 @@ static struct df_mw_hardreg * df_null_mw_rec[1]; static void df_ref_record (enum df_ref_class, struct df_collection_rec *, rtx, rtx *, basic_block, struct df_insn_info *, - enum df_ref_type, enum df_ref_flags, + enum df_ref_type, int ref_flags, int, int, enum machine_mode); static void df_def_record_1 (struct df_collection_rec *, rtx, basic_block, struct df_insn_info *, - enum df_ref_flags); + int ref_flags); static void df_defs_record (struct df_collection_rec *, rtx, basic_block, struct df_insn_info *, - enum df_ref_flags); + int ref_flags); static void df_uses_record (enum df_ref_class, struct df_collection_rec *, rtx *, enum df_ref_type, basic_block, struct df_insn_info *, - enum df_ref_flags, + int ref_flags, int, int, enum machine_mode); static df_ref df_ref_create_structure (enum df_ref_class, struct df_collection_rec *, rtx, rtx *, basic_block, struct df_insn_info *, - enum df_ref_type, enum df_ref_flags, + enum df_ref_type, int ref_flags, int, int, enum machine_mode); static void df_insn_refs_collect (struct df_collection_rec*, @@ -708,7 +708,7 @@ df_ref df_ref_create (rtx reg, rtx *loc, rtx insn, basic_block bb, enum df_ref_type ref_type, - enum df_ref_flags ref_flags, + int ref_flags, int width, int offset, enum machine_mode mode) { df_ref ref; @@ -2146,7 +2146,7 @@ df_notes_rescan (rtx insn) case REG_EQUAL: df_uses_record (DF_REF_REGULAR, &collection_rec, &XEXP (note, 0), DF_REF_REG_USE, - bb, insn_info, DF_REF_IN_NOTE, -1, -1, 0); + bb, insn_info, DF_REF_IN_NOTE, -1, -1, VOIDmode); default: break; } @@ -2691,7 +2691,7 @@ df_ref_create_structure (enum df_ref_class cl, rtx reg, rtx *loc, basic_block bb, struct df_insn_info *info, enum df_ref_type ref_type, - enum df_ref_flags ref_flags, + int ref_flags, int width, int offset, enum machine_mode mode) { df_ref this_ref = NULL; @@ -2789,7 +2789,7 @@ df_ref_record (enum df_ref_class cl, rtx reg, rtx *loc, basic_block bb, struct df_insn_info *insn_info, enum df_ref_type ref_type, - enum df_ref_flags ref_flags, + int ref_flags, int width, int offset, enum machine_mode mode) { unsigned int regno; @@ -2878,7 +2878,7 @@ df_read_modify_subreg_p (rtx x) static void df_def_record_1 (struct df_collection_rec *collection_rec, rtx x, basic_block bb, struct df_insn_info *insn_info, - enum df_ref_flags flags) + int flags) { rtx *loc; rtx dst; @@ -2971,7 +2971,7 @@ df_def_record_1 (struct df_collection_rec *collection_rec, static void df_defs_record (struct df_collection_rec *collection_rec, rtx x, basic_block bb, struct df_insn_info *insn_info, - enum df_ref_flags flags) + int flags) { RTX_CODE code = GET_CODE (x); @@ -3009,7 +3009,7 @@ static void df_uses_record (enum df_ref_class cl, struct df_collection_rec *collection_rec, rtx *loc, enum df_ref_type ref_type, basic_block bb, struct df_insn_info *insn_info, - enum df_ref_flags flags, + int flags, int width, int offset, enum machine_mode mode) { RTX_CODE code; @@ -3322,7 +3322,7 @@ static void df_get_call_refs (struct df_collection_rec * collection_rec, basic_block bb, struct df_insn_info *insn_info, - enum df_ref_flags flags) + int flags) { rtx note; bitmap_iterator bi; @@ -3347,7 +3347,8 @@ df_get_call_refs (struct df_collection_rec * collection_rec, { if (GET_CODE (XEXP (note, 0)) == USE) df_uses_record (DF_REF_REGULAR, collection_rec, &XEXP (XEXP (note, 0), 0), - DF_REF_REG_USE, bb, insn_info, flags, -1, -1, 0); + DF_REF_REG_USE, bb, insn_info, flags, -1, -1, + VOIDmode); else if (GET_CODE (XEXP (note, 0)) == CLOBBER) { if (REG_P (XEXP (XEXP (note, 0), 0))) @@ -3359,7 +3360,8 @@ df_get_call_refs (struct df_collection_rec * collection_rec, } else df_uses_record (DF_REF_REGULAR, collection_rec, &XEXP (note, 0), - DF_REF_REG_USE, bb, insn_info, flags, -1, -1, 0); + DF_REF_REG_USE, bb, insn_info, flags, -1, -1, + VOIDmode); } } @@ -3367,7 +3369,7 @@ df_get_call_refs (struct df_collection_rec * collection_rec, df_ref_record (DF_REF_BASE, collection_rec, regno_reg_rtx[STACK_POINTER_REGNUM], NULL, bb, insn_info, DF_REF_REG_USE, DF_REF_CALL_STACK_USAGE | flags, - -1, -1, 0); + -1, -1, VOIDmode); /* Calls may also reference any of the global registers, so they are recorded as used. */ @@ -3375,9 +3377,11 @@ df_get_call_refs (struct df_collection_rec * collection_rec, if (global_regs[i]) { df_ref_record (DF_REF_BASE, collection_rec, regno_reg_rtx[i], - NULL, bb, insn_info, DF_REF_REG_USE, flags, -1, -1, 0); + NULL, bb, insn_info, DF_REF_REG_USE, flags, -1, -1, + VOIDmode); df_ref_record (DF_REF_BASE, collection_rec, regno_reg_rtx[i], - NULL, bb, insn_info, DF_REF_REG_DEF, flags, -1, -1, 0); + NULL, bb, insn_info, DF_REF_REG_DEF, flags, -1, -1, + VOIDmode); } is_sibling_call = SIBLING_CALL_P (insn_info->insn); @@ -3392,7 +3396,7 @@ df_get_call_refs (struct df_collection_rec * collection_rec, df_ref_record (DF_REF_BASE, collection_rec, regno_reg_rtx[ui], NULL, bb, insn_info, DF_REF_REG_DEF, DF_REF_MAY_CLOBBER | flags, - -1, -1, 0); + -1, -1, VOIDmode); } BITMAP_FREE (defs_generated); @@ -3430,19 +3434,19 @@ df_insn_refs_collect (struct df_collection_rec* collection_rec, case REG_EQUAL: df_uses_record (DF_REF_REGULAR, collection_rec, &XEXP (note, 0), DF_REF_REG_USE, - bb, insn_info, DF_REF_IN_NOTE, -1, -1, 0); + bb, insn_info, DF_REF_IN_NOTE, -1, -1, VOIDmode); break; case REG_NON_LOCAL_GOTO: /* The frame ptr is used by a non-local goto. */ df_ref_record (DF_REF_BASE, collection_rec, regno_reg_rtx[FRAME_POINTER_REGNUM], NULL, bb, insn_info, - DF_REF_REG_USE, 0, -1, -1, 0); + DF_REF_REG_USE, 0, -1, -1, VOIDmode); #if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM df_ref_record (DF_REF_BASE, collection_rec, regno_reg_rtx[HARD_FRAME_POINTER_REGNUM], NULL, bb, insn_info, - DF_REF_REG_USE, 0, -1, -1, 0); + DF_REF_REG_USE, 0, -1, -1, VOIDmode); #endif break; default: @@ -3457,7 +3461,7 @@ df_insn_refs_collect (struct df_collection_rec* collection_rec, /* Record the register uses. */ df_uses_record (DF_REF_REGULAR, collection_rec, &PATTERN (insn_info->insn), DF_REF_REG_USE, bb, insn_info, 0, - -1, -1, 0); + -1, -1, VOIDmode); /* DF_REF_CONDITIONAL needs corresponding USES. */ if (is_cond_exec) @@ -3540,7 +3544,8 @@ df_bb_refs_collect (struct df_collection_rec *collection_rec, basic_block bb) if (regno == INVALID_REGNUM) break; df_ref_record (DF_REF_ARTIFICIAL, collection_rec, regno_reg_rtx[regno], NULL, - bb, NULL, DF_REF_REG_DEF, DF_REF_AT_TOP, -1, -1, 0); + bb, NULL, DF_REF_REG_DEF, DF_REF_AT_TOP, -1, -1, + VOIDmode); } } #endif @@ -3549,7 +3554,7 @@ df_bb_refs_collect (struct df_collection_rec *collection_rec, basic_block bb) non-local goto. */ if (bb->flags & BB_NON_LOCAL_GOTO_TARGET) df_ref_record (DF_REF_ARTIFICIAL, collection_rec, hard_frame_pointer_rtx, NULL, - bb, NULL, DF_REF_REG_DEF, DF_REF_AT_TOP, -1, -1, 0); + bb, NULL, DF_REF_REG_DEF, DF_REF_AT_TOP, -1, -1, VOIDmode); /* Add the artificial uses. */ if (bb->index >= NUM_FIXED_BLOCKS) @@ -3563,7 +3568,7 @@ df_bb_refs_collect (struct df_collection_rec *collection_rec, basic_block bb) EXECUTE_IF_SET_IN_BITMAP (au, 0, regno, bi) { df_ref_record (DF_REF_ARTIFICIAL, collection_rec, regno_reg_rtx[regno], NULL, - bb, NULL, DF_REF_REG_USE, 0, -1, -1, 0); + bb, NULL, DF_REF_REG_USE, 0, -1, -1, VOIDmode); } } @@ -3864,7 +3869,8 @@ df_entry_block_defs_collect (struct df_collection_rec *collection_rec, EXECUTE_IF_SET_IN_BITMAP (entry_block_defs, 0, i, bi) { df_ref_record (DF_REF_ARTIFICIAL, collection_rec, regno_reg_rtx[i], NULL, - ENTRY_BLOCK_PTR, NULL, DF_REF_REG_DEF, 0, -1, -1, 0); + ENTRY_BLOCK_PTR, NULL, DF_REF_REG_DEF, 0, -1, -1, + VOIDmode); } df_canonize_collection_rec (collection_rec); @@ -4025,7 +4031,7 @@ df_exit_block_uses_collect (struct df_collection_rec *collection_rec, bitmap exi EXECUTE_IF_SET_IN_BITMAP (exit_block_uses, 0, i, bi) df_ref_record (DF_REF_ARTIFICIAL, collection_rec, regno_reg_rtx[i], NULL, - EXIT_BLOCK_PTR, NULL, DF_REF_REG_USE, 0, -1, -1, 0); + EXIT_BLOCK_PTR, NULL, DF_REF_REG_USE, 0, -1, -1, VOIDmode); #if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM /* It is deliberate that this is not put in the exit block uses but @@ -4035,7 +4041,7 @@ df_exit_block_uses_collect (struct df_collection_rec *collection_rec, bitmap exi && bb_has_eh_pred (EXIT_BLOCK_PTR) && fixed_regs[ARG_POINTER_REGNUM]) df_ref_record (DF_REF_ARTIFICIAL, collection_rec, regno_reg_rtx[ARG_POINTER_REGNUM], NULL, - EXIT_BLOCK_PTR, NULL, DF_REF_REG_USE, 0, -1, -1, 0); + EXIT_BLOCK_PTR, NULL, DF_REF_REG_USE, 0, -1, -1, VOIDmode); #endif df_canonize_collection_rec (collection_rec); @@ -879,8 +879,8 @@ extern struct df *df; /* Functions defined in df-core.c. */ extern void df_add_problem (struct df_problem *); -extern enum df_changeable_flags df_set_flags (enum df_changeable_flags); -extern enum df_changeable_flags df_clear_flags (enum df_changeable_flags); +extern enum df_changeable_flags df_set_flags (int); +extern enum df_changeable_flags df_clear_flags (int); extern void df_set_blocks (bitmap); extern void df_remove_problem (struct dataflow *); extern void df_finish_pass (bool); @@ -945,7 +945,7 @@ extern void df_lr_verify_transfer_functions (void); extern void df_live_verify_transfer_functions (void); extern void df_live_add_problem (void); extern void df_live_set_all_dirty (void); -extern void df_chain_add_problem (enum df_chain_flags); +extern void df_chain_add_problem (unsigned int); extern void df_byte_lr_add_problem (void); extern int df_byte_lr_get_regno_start (unsigned int); extern int df_byte_lr_get_regno_len (unsigned int); @@ -972,7 +972,7 @@ extern void df_grow_reg_info (void); extern void df_grow_insn_info (void); extern void df_scan_blocks (void); extern df_ref df_ref_create (rtx, rtx *, rtx,basic_block, - enum df_ref_type, enum df_ref_flags, + enum df_ref_type, int ref_flags, int, int, enum machine_mode); extern void df_ref_remove (df_ref); extern struct df_insn_info * df_insn_create_insn_record (rtx); diff --git a/gcc/double-int.c b/gcc/double-int.c index 7bcf88f2780..93c7ca45c58 100644 --- a/gcc/double-int.c +++ b/gcc/double-int.c @@ -1,5 +1,5 @@ /* Operations with long integers. - Copyright (C) 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc. This file is part of GCC. @@ -211,8 +211,9 @@ double_int_divmod (double_int a, double_int b, bool uns, unsigned code, { double_int ret; - div_and_round_double (code, uns, a.low, a.high, b.low, b.high, - &ret.low, &ret.high, &mod->low, &mod->high); + div_and_round_double ((enum tree_code) code, uns, a.low, a.high, + b.low, b.high, &ret.low, &ret.high, + &mod->low, &mod->high); return ret; } diff --git a/gcc/dse.c b/gcc/dse.c index a35f07bb113..e0e685bf0c9 100644 --- a/gcc/dse.c +++ b/gcc/dse.c @@ -826,7 +826,7 @@ replace_inc_dec (rtx *r, void *d) case POST_INC: { rtx r1 = XEXP (x, 0); - rtx c = gen_int_mode (Pmode, data->size); + rtx c = gen_int_mode (data->size, Pmode); emit_insn_before (gen_rtx_SET (Pmode, r1, gen_rtx_PLUS (Pmode, r1, c)), data->insn); @@ -837,7 +837,7 @@ replace_inc_dec (rtx *r, void *d) case POST_DEC: { rtx r1 = XEXP (x, 0); - rtx c = gen_int_mode (Pmode, -data->size); + rtx c = gen_int_mode (-data->size, Pmode); emit_insn_before (gen_rtx_SET (Pmode, r1, gen_rtx_PLUS (Pmode, r1, c)), data->insn); diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index d4799b163b5..f2da4ac1f50 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -3866,12 +3866,13 @@ new_reg_loc_descr (unsigned int reg, unsigned HOST_WIDE_INT offset) if (offset) { if (reg <= 31) - return new_loc_descr (DW_OP_breg0 + reg, offset, 0); + return new_loc_descr ((enum dwarf_location_atom) (DW_OP_breg0 + reg), + offset, 0); else return new_loc_descr (DW_OP_bregx, reg, offset); } else if (reg <= 31) - return new_loc_descr (DW_OP_reg0 + reg, 0, 0); + return new_loc_descr ((enum dwarf_location_atom) (DW_OP_reg0 + reg), 0, 0); else return new_loc_descr (DW_OP_regx, reg, 0); } @@ -9866,7 +9867,8 @@ based_loc_descr (rtx reg, HOST_WIDE_INT offset, regno = dbx_reg_number (reg); if (regno <= 31) - result = new_loc_descr (DW_OP_breg0 + regno, offset, 0); + result = new_loc_descr ((enum dwarf_location_atom) (DW_OP_breg0 + regno), + offset, 0); else result = new_loc_descr (DW_OP_bregx, regno, offset); @@ -10394,8 +10396,8 @@ loc_descriptor_from_tree_1 (tree loc, int want_address) if (DECL_THREAD_LOCAL_P (loc)) { rtx rtl; - unsigned first_op; - unsigned second_op; + enum dwarf_location_atom first_op; + enum dwarf_location_atom second_op; if (targetm.have_tls) { @@ -10409,7 +10411,7 @@ loc_descriptor_from_tree_1 (tree loc, int want_address) module. */ if (DECL_EXTERNAL (loc) && !targetm.binds_local_p (loc)) return 0; - first_op = INTERNAL_DW_OP_tls_addr; + first_op = (enum dwarf_location_atom) INTERNAL_DW_OP_tls_addr; second_op = DW_OP_GNU_push_tls_address; } else diff --git a/gcc/expmed.c b/gcc/expmed.c index 165bcaea09e..acbc09b1b87 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -208,7 +208,7 @@ init_expmed (void) for (speed = 0; speed < 2; speed++) { crtl->maybe_hot_insn_p = speed; - zero_cost[speed] = rtx_cost (const0_rtx, 0, speed); + zero_cost[speed] = rtx_cost (const0_rtx, SET, speed); for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode; diff --git a/gcc/expr.c b/gcc/expr.c index ce740d24d91..7935c67cf67 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -1,6 +1,6 @@ /* Convert tree expression to rtl instructions, for GNU compiler. Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GCC. @@ -267,7 +267,7 @@ init_expr_target (void) reg = gen_rtx_REG (VOIDmode, -1); insn = rtx_alloc (INSN); - pat = gen_rtx_SET (0, NULL_RTX, NULL_RTX); + pat = gen_rtx_SET (VOIDmode, NULL_RTX, NULL_RTX); PATTERN (insn) = pat; for (mode = VOIDmode; (int) mode < NUM_MACHINE_MODES; @@ -8453,7 +8453,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, || mode != ptr_mode) { expand_operands (TREE_OPERAND (exp, 0), TREE_OPERAND (exp, 1), - subtarget, &op0, &op1, 0); + subtarget, &op0, &op1, EXPAND_NORMAL); if (op0 == const0_rtx) return op1; if (op1 == const0_rtx) @@ -8625,11 +8625,11 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, if (TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (subexp0, 0)))) expand_operands (TREE_OPERAND (subexp0, 0), TREE_OPERAND (subexp1, 0), - NULL_RTX, &op0, &op1, 0); + NULL_RTX, &op0, &op1, EXPAND_NORMAL); else expand_operands (TREE_OPERAND (subexp0, 0), TREE_OPERAND (subexp1, 0), - NULL_RTX, &op1, &op0, 0); + NULL_RTX, &op1, &op0, EXPAND_NORMAL); goto binop3; } @@ -8706,7 +8706,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, } } expand_operands (TREE_OPERAND (exp, 0), TREE_OPERAND (exp, 1), - subtarget, &op0, &op1, 0); + subtarget, &op0, &op1, EXPAND_NORMAL); return REDUCE_BIT_FIELD (expand_mult (mode, op0, op1, target, unsignedp)); case TRUNC_DIV_EXPR: @@ -8726,7 +8726,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, then if the divisor is constant can optimize the case where some terms of the dividend have coeffs divisible by it. */ expand_operands (TREE_OPERAND (exp, 0), TREE_OPERAND (exp, 1), - subtarget, &op0, &op1, 0); + subtarget, &op0, &op1, EXPAND_NORMAL); return expand_divmod (0, code, mode, op0, op1, target, unsignedp); case RDIV_EXPR: @@ -8739,7 +8739,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, if (modifier == EXPAND_STACK_PARM) target = 0; expand_operands (TREE_OPERAND (exp, 0), TREE_OPERAND (exp, 1), - subtarget, &op0, &op1, 0); + subtarget, &op0, &op1, EXPAND_NORMAL); return expand_divmod (1, code, mode, op0, op1, target, unsignedp); case FIXED_CONVERT_EXPR: @@ -8816,7 +8816,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, && REGNO (target) < FIRST_PSEUDO_REGISTER)) target = gen_reg_rtx (mode); expand_operands (TREE_OPERAND (exp, 0), TREE_OPERAND (exp, 1), - target, &op0, &op1, 0); + target, &op0, &op1, EXPAND_NORMAL); /* First try to do it with a special MIN or MAX instruction. If that does not win, use a conditional jump to select the proper @@ -9324,7 +9324,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, tree oprnd0 = TREE_OPERAND (exp, 0); tree oprnd1 = TREE_OPERAND (exp, 1); - expand_operands (oprnd0, oprnd1, NULL_RTX, &op0, &op1, 0); + expand_operands (oprnd0, oprnd1, NULL_RTX, &op0, &op1, EXPAND_NORMAL); target = expand_widen_pattern_expr (exp, op0, NULL_RTX, op1, target, unsignedp); return target; @@ -9345,7 +9345,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, case VEC_EXTRACT_ODD_EXPR: { expand_operands (TREE_OPERAND (exp, 0), TREE_OPERAND (exp, 1), - NULL_RTX, &op0, &op1, 0); + NULL_RTX, &op0, &op1, EXPAND_NORMAL); this_optab = optab_for_tree_code (code, type, optab_default); temp = expand_binop (mode, this_optab, op0, op1, target, unsignedp, OPTAB_WIDEN); @@ -9357,7 +9357,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, case VEC_INTERLEAVE_LOW_EXPR: { expand_operands (TREE_OPERAND (exp, 0), TREE_OPERAND (exp, 1), - NULL_RTX, &op0, &op1, 0); + NULL_RTX, &op0, &op1, EXPAND_NORMAL); this_optab = optab_for_tree_code (code, type, optab_default); temp = expand_binop (mode, this_optab, op0, op1, target, unsignedp, OPTAB_WIDEN); @@ -9405,7 +9405,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, tree oprnd0 = TREE_OPERAND (exp, 0); tree oprnd1 = TREE_OPERAND (exp, 1); - expand_operands (oprnd0, oprnd1, NULL_RTX, &op0, &op1, 0); + expand_operands (oprnd0, oprnd1, NULL_RTX, &op0, &op1, EXPAND_NORMAL); target = expand_widen_pattern_expr (exp, op0, op1, NULL_RTX, target, unsignedp); gcc_assert (target); @@ -9446,7 +9446,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, /* Here to do an ordinary binary operator. */ binop: expand_operands (TREE_OPERAND (exp, 0), TREE_OPERAND (exp, 1), - subtarget, &op0, &op1, 0); + subtarget, &op0, &op1, EXPAND_NORMAL); binop2: this_optab = optab_for_tree_code (code, type, optab_default); binop3: @@ -9825,7 +9825,7 @@ do_store_flag (tree exp, rtx target, enum machine_mode mode) || GET_MODE (subtarget) != operand_mode) subtarget = 0; - expand_operands (arg0, arg1, subtarget, &op0, &op1, 0); + expand_operands (arg0, arg1, subtarget, &op0, &op1, EXPAND_NORMAL); if (target == 0) target = gen_reg_rtx (mode); diff --git a/gcc/fixed-value.h b/gcc/fixed-value.h index 69db190e8f1..d6e67794b04 100644 --- a/gcc/fixed-value.h +++ b/gcc/fixed-value.h @@ -1,5 +1,5 @@ /* Fixed-point arithmetic support. - Copyright (C) 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc. This file is part of GCC. @@ -26,8 +26,8 @@ along with GCC; see the file COPYING3. If not see struct fixed_value GTY(()) { - double_int data; /* Store data up to 2 wide integers. */ - unsigned int mode; /* Use machine mode to know IBIT and FBIT. */ + double_int data; /* Store data up to 2 wide integers. */ + enum machine_mode mode; /* Use machine mode to know IBIT and FBIT. */ }; #define FIXED_VALUE_TYPE struct fixed_value diff --git a/gcc/function.c b/gcc/function.c index 3809770a0d3..2c97597edd7 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -3249,7 +3249,7 @@ assign_parms (tree fndecl) = (all.stack_args_size.var == 0 ? GEN_INT (-all.stack_args_size.constant) : expand_expr (size_diffop (all.stack_args_size.var, size_int (-all.stack_args_size.constant)), - NULL_RTX, VOIDmode, 0)); + NULL_RTX, VOIDmode, EXPAND_NORMAL)); #else crtl->args.arg_offset_rtx = ARGS_SIZE_RTX (all.stack_args_size); #endif diff --git a/gcc/genautomata.c b/gcc/genautomata.c index 514c2e69255..0f5a4086704 100644 --- a/gcc/genautomata.c +++ b/gcc/genautomata.c @@ -1796,7 +1796,7 @@ insert_automaton_decl (decl_t automaton_decl) { void **entry_ptr; - entry_ptr = htab_find_slot (automaton_decl_table, automaton_decl, 1); + entry_ptr = htab_find_slot (automaton_decl_table, automaton_decl, INSERT); if (*entry_ptr == NULL) *entry_ptr = (void *) automaton_decl; return (decl_t) *entry_ptr; @@ -1895,7 +1895,7 @@ insert_insn_decl (decl_t insn_decl) { void **entry_ptr; - entry_ptr = htab_find_slot (insn_decl_table, insn_decl, 1); + entry_ptr = htab_find_slot (insn_decl_table, insn_decl, INSERT); if (*entry_ptr == NULL) *entry_ptr = (void *) insn_decl; return (decl_t) *entry_ptr; @@ -1996,7 +1996,7 @@ insert_decl (decl_t decl) { void **entry_ptr; - entry_ptr = htab_find_slot (decl_table, decl, 1); + entry_ptr = htab_find_slot (decl_table, decl, INSERT); if (*entry_ptr == NULL) *entry_ptr = (void *) decl; return (decl_t) *entry_ptr; @@ -3748,7 +3748,7 @@ insert_state (state_t state) { void **entry_ptr; - entry_ptr = htab_find_slot (state_table, (void *) state, 1); + entry_ptr = htab_find_slot (state_table, (void *) state, INSERT); if (*entry_ptr == NULL) *entry_ptr = (void *) state; return (state_t) *entry_ptr; @@ -4104,7 +4104,7 @@ automata_list_finish (void) if (current_automata_list == NULL) return NULL; entry_ptr = htab_find_slot (automata_list_table, - (void *) current_automata_list, 1); + (void *) current_automata_list, INSERT); if (*entry_ptr == NULL) *entry_ptr = (void *) current_automata_list; else diff --git a/gcc/genrecog.c b/gcc/genrecog.c index 01177c6de8f..004fbf82ecb 100644 --- a/gcc/genrecog.c +++ b/gcc/genrecog.c @@ -1,6 +1,6 @@ /* Generate code from machine description to recognize rtl as insns. Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GCC. @@ -378,7 +378,7 @@ process_define_predicate (rtx desc) for (i = 0; i < NUM_RTX_CODE; i++) if (codes[i] != N) - add_predicate_code (pred, i); + add_predicate_code (pred, (enum rtx_code) i); add_predicate (pred); } diff --git a/gcc/gensupport.c b/gcc/gensupport.c index 3c94863e5fd..28eb5b3f433 100644 --- a/gcc/gensupport.c +++ b/gcc/gensupport.c @@ -1,5 +1,5 @@ /* Support routines for the various generation passes. - Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GCC. @@ -1404,7 +1404,7 @@ init_predicate_table (void) if (std_preds[i].allows_const_p) for (j = 0; j < NUM_RTX_CODE; j++) if (GET_RTX_CLASS (j) == RTX_CONST_OBJ) - add_predicate_code (pred, j); + add_predicate_code (pred, (enum rtx_code) j); add_predicate (pred); } diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c index 71ab1b1e44c..d35ba8b8055 100644 --- a/gcc/gimple-low.c +++ b/gcc/gimple-low.c @@ -829,7 +829,7 @@ lower_builtin_setjmp (gimple_stmt_iterator *gsi) /* Build 'goto CONT_LABEL' and insert. */ g = gimple_build_goto (cont_label); - gsi_insert_before (gsi, g, TSI_SAME_STMT); + gsi_insert_before (gsi, g, GSI_SAME_STMT); /* Build 'NEXT_LABEL:' and insert. */ g = gimple_build_label (next_label); diff --git a/gcc/gimple.c b/gcc/gimple.c index a91e83a99d4..e499e491a07 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -1,6 +1,6 @@ /* Gimple IR support functions. - Copyright 2007, 2008 Free Software Foundation, Inc. + Copyright 2007, 2008, 2009 Free Software Foundation, Inc. Contributed by Aldy Hernandez <aldyh@redhat.com> This file is part of GCC. @@ -271,7 +271,7 @@ gimple_build_with_ops_stat (enum gimple_code code, enum tree_code subcode, gimple gimple_build_return (tree retval) { - gimple s = gimple_build_with_ops (GIMPLE_RETURN, 0, 1); + gimple s = gimple_build_with_ops (GIMPLE_RETURN, ERROR_MARK, 1); if (retval) gimple_return_set_retval (s, retval); return s; @@ -284,7 +284,7 @@ gimple_build_return (tree retval) static inline gimple gimple_build_call_1 (tree fn, unsigned nargs) { - gimple s = gimple_build_with_ops (GIMPLE_CALL, 0, nargs + 3); + gimple s = gimple_build_with_ops (GIMPLE_CALL, ERROR_MARK, nargs + 3); if (TREE_CODE (fn) == FUNCTION_DECL) fn = build_fold_addr_expr (fn); gimple_set_op (s, 1, fn); @@ -544,7 +544,7 @@ gimple_cond_set_condition_from_tree (gimple stmt, tree cond) gimple gimple_build_label (tree label) { - gimple p = gimple_build_with_ops (GIMPLE_LABEL, 0, 1); + gimple p = gimple_build_with_ops (GIMPLE_LABEL, ERROR_MARK, 1); gimple_label_set_label (p, label); return p; } @@ -554,7 +554,7 @@ gimple_build_label (tree label) gimple gimple_build_goto (tree dest) { - gimple p = gimple_build_with_ops (GIMPLE_GOTO, 0, 1); + gimple p = gimple_build_with_ops (GIMPLE_GOTO, ERROR_MARK, 1); gimple_goto_set_dest (p, dest); return p; } @@ -600,7 +600,8 @@ gimple_build_asm_1 (const char *string, unsigned ninputs, unsigned noutputs, gimple p; int size = strlen (string); - p = gimple_build_with_ops (GIMPLE_ASM, 0, ninputs + noutputs + nclobbers); + p = gimple_build_with_ops (GIMPLE_ASM, ERROR_MARK, + ninputs + noutputs + nclobbers); p->gimple_asm.ni = ninputs; p->gimple_asm.no = noutputs; @@ -776,7 +777,8 @@ static inline gimple gimple_build_switch_1 (unsigned nlabels, tree index, tree default_label) { /* nlabels + 1 default label + 1 index. */ - gimple p = gimple_build_with_ops (GIMPLE_SWITCH, 0, nlabels + 1 + 1); + gimple p = gimple_build_with_ops (GIMPLE_SWITCH, ERROR_MARK, + nlabels + 1 + 1); gimple_switch_set_index (p, index); gimple_switch_set_default_label (p, default_label); return p; @@ -1046,7 +1048,7 @@ gimple_build_omp_single (gimple_seq body, tree clauses) gimple gimple_build_cdt (tree type, tree ptr) { - gimple p = gimple_build_with_ops (GIMPLE_CHANGE_DYNAMIC_TYPE, 0, 2); + gimple p = gimple_build_with_ops (GIMPLE_CHANGE_DYNAMIC_TYPE, ERROR_MARK, 2); gimple_cdt_set_new_type (p, type); gimple_cdt_set_location (p, ptr); diff --git a/gcc/gimple.h b/gcc/gimple.h index 2d5ee0fd9b4..05c514e438e 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -69,7 +69,7 @@ extern void gimple_check_failed (const_gimple, const char *, int, \ const_gimple __gs = (GS); \ if (gimple_code (__gs) != (CODE)) \ gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \ - (CODE), 0); \ + (CODE), ERROR_MARK); \ } while (0) #else /* not ENABLE_GIMPLE_CHECKING */ #define GIMPLE_CHECK(GS, CODE) (void)0 @@ -930,7 +930,7 @@ typedef bool (*gimple_predicate)(tree); /* FIXME we should deduce this from the predicate. */ -typedef enum fallback_t { +enum fallback { fb_none = 0, /* Do not generate a temporary. */ fb_rvalue = 1, /* Generate an rvalue to hold the result of a @@ -942,7 +942,9 @@ typedef enum fallback_t { fb_mayfail = 4, /* Gimplification may fail. Error issued afterwards. */ fb_either= fb_rvalue | fb_lvalue -} fallback_t; +}; + +typedef int fallback_t; enum gimplify_status { GS_ERROR = -2, /* Something Bad Seen. */ diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c index 58700b75f14..513b1fba882 100644 --- a/gcc/ira-costs.c +++ b/gcc/ira-costs.c @@ -1,5 +1,5 @@ /* IRA hard register and memory cost calculation for allocnos. - Copyright (C) 2006, 2007, 2008 + Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc. Contributed by Vladimir Makarov <vmakarov@redhat.com>. @@ -205,7 +205,7 @@ record_reg_classes (int n_alts, int n_ops, rtx *ops, { enum reg_class classes[MAX_RECOG_OPERANDS]; int allows_mem[MAX_RECOG_OPERANDS]; - int rclass; + enum reg_class rclass; int alt_fail = 0; int alt_cost = 0, op_cost_add; @@ -672,7 +672,7 @@ record_reg_classes (int n_alts, int n_ops, rtx *ops, { unsigned int regno = REGNO (ops[!i]); enum machine_mode mode = GET_MODE (ops[!i]); - int rclass; + enum reg_class rclass; unsigned int nr; if (regno < FIRST_PSEUDO_REGISTER) @@ -886,7 +886,8 @@ record_address_regs (enum machine_mode mode, rtx x, int context, case REG: { struct costs *pp; - int i, k; + enum reg_class i; + int k; if (REGNO (x) < FIRST_PSEUDO_REGISTER) break; diff --git a/gcc/ira.c b/gcc/ira.c index 4dee400f3f8..df5e7957009 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -515,8 +515,10 @@ setup_class_subset_and_memory_move_costs (void) if (cl != (int) NO_REGS) for (mode = 0; mode < MAX_MACHINE_MODE; mode++) { - ira_memory_move_cost[mode][cl][0] = MEMORY_MOVE_COST (mode, cl, 0); - ira_memory_move_cost[mode][cl][1] = MEMORY_MOVE_COST (mode, cl, 1); + ira_memory_move_cost[mode][cl][0] = + MEMORY_MOVE_COST (mode, (enum reg_class) cl, 0); + ira_memory_move_cost[mode][cl][1] = + MEMORY_MOVE_COST (mode, (enum reg_class) cl, 1); /* Costs for NO_REGS are used in cost calculation on the 1st pass when the preferred register classes are not known yet. In this case we take the best scenario. */ @@ -981,8 +983,8 @@ setup_reg_class_relations (void) if (cl3 == LIM_REG_CLASSES) break; if (reg_class_subset_p (ira_reg_class_intersect[cl1][cl2], - cl3)) - ira_reg_class_intersect[cl1][cl2] = cl3; + (enum reg_class) cl3)) + ira_reg_class_intersect[cl1][cl2] = (enum reg_class) cl3; } ira_reg_class_union[cl1][cl2] = reg_class_subunion[cl1][cl2]; continue; @@ -1133,14 +1135,14 @@ int ira_max_nregs; static void setup_reg_class_nregs (void) { - int m; - enum reg_class cl; + int cl, m; ira_max_nregs = -1; for (cl = 0; cl < N_REG_CLASSES; cl++) for (m = 0; m < MAX_MACHINE_MODE; m++) { - ira_reg_class_nregs[cl][m] = CLASS_MAX_NREGS (cl, m); + ira_reg_class_nregs[cl][m] = CLASS_MAX_NREGS ((enum reg_class) cl, + (enum machine_mode) m); if (ira_max_nregs < ira_reg_class_nregs[cl][m]) ira_max_nregs = ira_reg_class_nregs[cl][m]; } @@ -1169,7 +1171,7 @@ setup_prohibited_class_mode_regs (void) for (k = ira_class_hard_regs_num[cl] - 1; k >= 0; k--) { hard_regno = ira_class_hard_regs[cl][k]; - if (! HARD_REGNO_MODE_OK (hard_regno, j)) + if (! HARD_REGNO_MODE_OK (hard_regno, (enum machine_mode) j)) SET_HARD_REG_BIT (prohibited_class_mode_regs[cl][j], hard_regno); } @@ -1306,7 +1308,7 @@ setup_prohibited_mode_move_regs (void) SET_HARD_REG_SET (ira_prohibited_mode_move_regs[i]); for (j = 0; j < FIRST_PSEUDO_REGISTER; j++) { - if (! HARD_REGNO_MODE_OK (j, i)) + if (! HARD_REGNO_MODE_OK (j, (enum machine_mode) i)) continue; SET_REGNO (test_reg1, j); PUT_MODE (test_reg1, i); diff --git a/gcc/lists.c b/gcc/lists.c index 0cfc8609650..99846710305 100644 --- a/gcc/lists.c +++ b/gcc/lists.c @@ -1,6 +1,7 @@ /* List management for the GCC expander. Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + 1999, 2003, 2004, 2005, 2006, 2007, 2008, 2009 + Free Software Foundation, Inc. This file is part of GCC. @@ -140,7 +141,7 @@ alloc_EXPR_LIST (int kind, rtx val, rtx next) PUT_REG_NOTE_KIND (r, kind); } else - r = gen_rtx_EXPR_LIST (kind, val, next); + r = gen_rtx_EXPR_LIST ((enum machine_mode) kind, val, next); return r; } diff --git a/gcc/machmode.h b/gcc/machmode.h index 7d50b466397..936a36e6a0d 100644 --- a/gcc/machmode.h +++ b/gcc/machmode.h @@ -1,6 +1,6 @@ /* Machine mode definitions for GCC; included by rtl.h and tree.h. Copyright (C) 1991, 1993, 1994, 1996, 1998, 1999, 2000, 2001, 2003, - 2007, 2008 Free Software Foundation, Inc. + 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GCC. @@ -41,7 +41,7 @@ enum mode_class { MODE_CLASSES, MAX_MODE_CLASS }; (integer, floating, complex, etc.) */ extern const unsigned char mode_class[NUM_MACHINE_MODES]; -#define GET_MODE_CLASS(MODE) mode_class[MODE] +#define GET_MODE_CLASS(MODE) ((enum mode_class) mode_class[MODE]) /* Nonzero if MODE is an integral mode. */ #define INTEGRAL_MODE_P(MODE) \ @@ -219,10 +219,10 @@ extern const unsigned char mode_nunits[NUM_MACHINE_MODES]; /* Get the next wider natural mode (eg, QI -> HI -> SI -> DI -> TI). */ extern const unsigned char mode_wider[NUM_MACHINE_MODES]; -#define GET_MODE_WIDER_MODE(MODE) mode_wider[MODE] +#define GET_MODE_WIDER_MODE(MODE) ((enum machine_mode) mode_wider[MODE]) extern const unsigned char mode_2xwider[NUM_MACHINE_MODES]; -#define GET_MODE_2XWIDER_MODE(MODE) mode_2xwider[MODE] +#define GET_MODE_2XWIDER_MODE(MODE) ((enum machine_mode) mode_2xwider[MODE]) /* Return the mode for data of a given size SIZE and mode class CLASS. If LIMIT is nonzero, then don't use modes bigger than MAX_FIXED_MODE_SIZE. @@ -257,7 +257,8 @@ extern unsigned get_mode_alignment (enum machine_mode); /* For each class, get the narrowest mode in that class. */ extern const unsigned char class_narrowest_mode[MAX_MODE_CLASS]; -#define GET_CLASS_NARROWEST_MODE(CLASS) class_narrowest_mode[CLASS] +#define GET_CLASS_NARROWEST_MODE(CLASS) \ + ((enum machine_mode) class_narrowest_mode[CLASS]) /* Define the integer modes whose sizes are BITS_PER_UNIT and BITS_PER_WORD and the mode whose class is Pmode and whose size is POINTER_SIZE. */ diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index 4e26aad210f..704e118429a 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,8 @@ +2009-04-20 Ian Lance Taylor <iant@google.com> + + * objc-act.c (objc_rewrite_function_call): Change parameter from + params to first_param. Change all callers. + 2009-03-30 Dominique d'Humieres <dominiq@lps.ens.fr> PR bootstrap/39583 diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 50e99d65105..a45ff27b45d 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -1482,7 +1482,7 @@ start_var_decl (tree type, const char *name) static void finish_var_decl (tree var, tree initializer) { - finish_decl (var, initializer, NULL_TREE); + finish_decl (var, initializer, NULL_TREE, NULL_TREE); /* Ensure that the variable actually gets output. */ mark_decl_referenced (var); /* Mark the decl to avoid "defined but not used" warning. */ @@ -8346,7 +8346,7 @@ objc_get_parm_info (int have_ellipsis) TREE_CHAIN (parm_info) = NULL_TREE; parm_info = pushdecl (parm_info); - finish_decl (parm_info, NULL_TREE, NULL_TREE); + finish_decl (parm_info, NULL_TREE, NULL_TREE, NULL_TREE); parm_info = next; } arg_info = get_parm_info (have_ellipsis); @@ -8737,14 +8737,15 @@ get_super_receiver (void) /* This prevents `unused variable' warnings when compiling with -Wall. */ TREE_USED (UOBJC_SUPER_decl) = 1; lang_hooks.decls.pushdecl (UOBJC_SUPER_decl); - finish_decl (UOBJC_SUPER_decl, NULL_TREE, NULL_TREE); + finish_decl (UOBJC_SUPER_decl, NULL_TREE, NULL_TREE, NULL_TREE); UOBJC_SUPER_scope = objc_get_current_scope (); } /* Set receiver to self. */ super_expr = objc_build_component_ref (UOBJC_SUPER_decl, self_id); super_expr = build_modify_expr (input_location, - super_expr, NOP_EXPR, self_decl); + super_expr, NOP_EXPR, self_decl, + NULL_TREE); super_expr_list = super_expr; /* Set class to begin searching. */ @@ -8760,7 +8761,8 @@ get_super_receiver (void) ((TREE_CODE (objc_method_context) == INSTANCE_METHOD_DECL) ? ucls_super_ref - : uucls_super_ref)); + : uucls_super_ref), + NULL_TREE); } else @@ -8810,7 +8812,8 @@ get_super_receiver (void) super_expr = build_modify_expr (input_location, super_expr, NOP_EXPR, build_c_cast (TREE_TYPE (super_expr), - super_class)); + super_class), + NULL_TREE); } super_expr_list = build_compound_expr (super_expr_list, super_expr); @@ -9508,7 +9511,7 @@ objc_lookup_ivar (tree other, tree id) needs to be done if we are calling a function through a cast. */ tree -objc_rewrite_function_call (tree function, tree params) +objc_rewrite_function_call (tree function, tree first_param) { if (TREE_CODE (function) == NOP_EXPR && TREE_CODE (TREE_OPERAND (function, 0)) == ADDR_EXPR @@ -9517,7 +9520,7 @@ objc_rewrite_function_call (tree function, tree params) { function = build3 (OBJ_TYPE_REF, TREE_TYPE (function), TREE_OPERAND (function, 0), - TREE_VALUE (params), size_zero_node); + first_param, size_zero_node); } return function; diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 3e6d91cc592..5a25e95c33a 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -4561,7 +4561,8 @@ expand_omp_for (struct omp_region *region) next_ix += BUILT_IN_GOMP_LOOP_ULL_STATIC_NEXT - BUILT_IN_GOMP_LOOP_STATIC_NEXT; } - expand_omp_for_generic (region, &fd, start_ix, next_ix); + expand_omp_for_generic (region, &fd, (enum built_in_function) start_ix, + (enum built_in_function) next_ix); } update_ssa (TODO_update_ssa_only_virtuals); diff --git a/gcc/optabs.c b/gcc/optabs.c index 058cebe33eb..74c14f1d094 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -1,6 +1,6 @@ /* Expand the basic unary and binary arithmetic operations, for GNU compiler. Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GCC. @@ -6688,7 +6688,7 @@ debug_optab_libfuncs (void) rtx l; o = &optab_table[i]; - l = optab_libfunc (o, j); + l = optab_libfunc (o, (enum machine_mode) j); if (l) { gcc_assert (GET_CODE (l) == SYMBOL_REF); @@ -6708,7 +6708,8 @@ debug_optab_libfuncs (void) rtx l; o = &convert_optab_table[i]; - l = convert_optab_libfunc (o, j, k); + l = convert_optab_libfunc (o, (enum machine_mode) j, + (enum machine_mode) k); if (l) { gcc_assert (GET_CODE (l) == SYMBOL_REF); diff --git a/gcc/opts.c b/gcc/opts.c index 785e5d019ac..f047fc3d541 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -2323,7 +2323,7 @@ enable_warning_as_error (const char *arg, int value, unsigned int lang_mask) } else { - int kind = value ? DK_ERROR : DK_WARNING; + diagnostic_t kind = value ? DK_ERROR : DK_WARNING; diagnostic_classify_diagnostic (global_dc, option_index, kind); /* -Werror=foo implies -Wfoo. */ diff --git a/gcc/postreload.c b/gcc/postreload.c index 8abc90f83d9..c87c60b6644 100644 --- a/gcc/postreload.c +++ b/gcc/postreload.c @@ -1,6 +1,6 @@ /* Perform simple optimizations to clean up the result of reload. Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, - 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 + 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GCC. @@ -519,7 +519,7 @@ reload_cse_simplify_operands (rtx insn, rtx testreg) for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) { - int rclass = (int) NO_REGS; + enum reg_class rclass = NO_REGS; if (! TEST_HARD_REG_BIT (equiv_regs[i], regno)) continue; @@ -580,7 +580,7 @@ reload_cse_simplify_operands (rtx insn, rtx testreg) op_alt_regno[i][j] = regno; } j++; - rclass = (int) NO_REGS; + rclass = NO_REGS; break; } p += CONSTRAINT_LEN (c, p); @@ -1610,4 +1610,3 @@ struct rtl_opt_pass pass_postreload_cse = TODO_dump_func /* todo_flags_finish */ } }; - diff --git a/gcc/predict.c b/gcc/predict.c index 22e71ceab8d..e3fc6cedf75 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -1,5 +1,5 @@ /* Branch prediction routines for the GNU compiler. - Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008 + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GCC. @@ -654,7 +654,7 @@ combine_predictions_for_insn (rtx insn, basic_block bb) rtx *pnote; rtx note; int best_probability = PROB_EVEN; - int best_predictor = END_PREDICTORS; + enum br_predictor best_predictor = END_PREDICTORS; int combined_probability = REG_BR_PROB_BASE / 2; int d; bool first_match = false; @@ -677,7 +677,7 @@ combine_predictions_for_insn (rtx insn, basic_block bb) for (note = REG_NOTES (insn); note; note = XEXP (note, 1)) if (REG_NOTE_KIND (note) == REG_BR_PRED) { - int predictor = INTVAL (XEXP (XEXP (note, 0), 0)); + enum br_predictor predictor = INTVAL (XEXP (XEXP (note, 0), 0)); int probability = INTVAL (XEXP (XEXP (note, 0), 1)); found = true; @@ -723,7 +723,7 @@ combine_predictions_for_insn (rtx insn, basic_block bb) { if (REG_NOTE_KIND (*pnote) == REG_BR_PRED) { - int predictor = INTVAL (XEXP (XEXP (*pnote, 0), 0)); + enum br_predictor predictor = INTVAL (XEXP (XEXP (*pnote, 0), 0)); int probability = INTVAL (XEXP (XEXP (*pnote, 0), 1)); dump_prediction (dump_file, predictor, probability, bb, @@ -765,7 +765,7 @@ static void combine_predictions_for_bb (basic_block bb) { int best_probability = PROB_EVEN; - int best_predictor = END_PREDICTORS; + enum br_predictor best_predictor = END_PREDICTORS; int combined_probability = REG_BR_PROB_BASE / 2; int d; bool first_match = false; @@ -813,7 +813,7 @@ combine_predictions_for_bb (basic_block bb) by predictor with smallest index. */ for (pred = (struct edge_prediction *) *preds; pred; pred = pred->ep_next) { - int predictor = pred->ep_predictor; + enum br_predictor predictor = pred->ep_predictor; int probability = pred->ep_probability; if (pred->ep_edge != first) @@ -888,7 +888,7 @@ combine_predictions_for_bb (basic_block bb) { for (pred = (struct edge_prediction *) *preds; pred; pred = pred->ep_next) { - int predictor = pred->ep_predictor; + enum br_predictor predictor = pred->ep_predictor; int probability = pred->ep_probability; if (pred->ep_edge != EDGE_SUCC (bb, 0)) @@ -2185,7 +2185,7 @@ build_predict_expr (enum br_predictor predictor, enum prediction taken) { tree t = build1 (PREDICT_EXPR, void_type_node, build_int_cst (NULL, predictor)); - PREDICT_EXPR_OUTCOME (t) = taken; + SET_PREDICT_EXPR_OUTCOME (t, taken); return t; } diff --git a/gcc/real.c b/gcc/real.c index 29fee8305e1..1a63ecdb140 100644 --- a/gcc/real.c +++ b/gcc/real.c @@ -1000,7 +1000,7 @@ real_arithmetic (REAL_VALUE_TYPE *r, int icode, const REAL_VALUE_TYPE *op0, enum tree_code code = icode; if (op0->decimal || (op1 && op1->decimal)) - return decimal_real_arithmetic (r, icode, op0, op1); + return decimal_real_arithmetic (r, code, op0, op1); switch (code) { diff --git a/gcc/reginfo.c b/gcc/reginfo.c index f31866602eb..5ab67ef5b00 100644 --- a/gcc/reginfo.c +++ b/gcc/reginfo.c @@ -277,7 +277,8 @@ init_move_cost (enum machine_mode m) cost = 65535; else { - cost = REGISTER_MOVE_COST (m, i, j); + cost = REGISTER_MOVE_COST (m, (enum reg_class) i, + (enum reg_class) j); gcc_assert (cost < 65535); } all_match &= (last_move_cost[i][j] == cost); @@ -327,12 +328,12 @@ init_move_cost (enum machine_mode m) gcc_assert (cost <= 65535); move_cost[m][i][j] = cost; - if (reg_class_subset_p (i, j)) + if (reg_class_subset_p ((enum reg_class) i, (enum reg_class) j)) may_move_in_cost[m][i][j] = 0; else may_move_in_cost[m][i][j] = cost; - if (reg_class_subset_p (j, i)) + if (reg_class_subset_p ((enum reg_class) j, (enum reg_class) i)) may_move_out_cost[m][i][j] = 0; else may_move_out_cost[m][i][j] = cost; @@ -589,11 +590,13 @@ init_reg_sets_1 (void) HARD_REG_SET ok_regs; CLEAR_HARD_REG_SET (ok_regs); for (j = 0; j < FIRST_PSEUDO_REGISTER; j++) - if (!fixed_regs [j] && HARD_REGNO_MODE_OK (j, m)) + if (!fixed_regs [j] && HARD_REGNO_MODE_OK (j, (enum machine_mode) m)) SET_HARD_REG_BIT (ok_regs, j); - + for (i = 0; i < N_REG_CLASSES; i++) - if ((unsigned) CLASS_MAX_NREGS (i, m) <= reg_class_size[i] + if (((unsigned) CLASS_MAX_NREGS ((enum reg_class) i, + (enum machine_mode) m) + <= reg_class_size[i]) && hard_reg_set_intersect_p (ok_regs, reg_class_contents[i])) { contains_reg_of_mode [i][m] = 1; @@ -676,9 +679,9 @@ void init_fake_stack_mems (void) { int i; - + for (i = 0; i < MAX_MACHINE_MODE; i++) - top_of_stack[i] = gen_rtx_MEM (i, stack_pointer_rtx); + top_of_stack[i] = gen_rtx_MEM ((enum machine_mode) i, stack_pointer_rtx); } diff --git a/gcc/regmove.c b/gcc/regmove.c index bdbd74722fd..53618b2193c 100644 --- a/gcc/regmove.c +++ b/gcc/regmove.c @@ -58,13 +58,12 @@ struct match { }; static int find_matches (rtx, struct match *); -static int regclass_compatible_p (int, int); static int fixup_match_2 (rtx, rtx, rtx, rtx); /* Return nonzero if registers with CLASS1 and CLASS2 can be merged without causing too much register allocation problems. */ static int -regclass_compatible_p (int class0, int class1) +regclass_compatible_p (enum reg_class class0, enum reg_class class1) { return (class0 == class1 || (reg_class_subset_p (class0, class1) @@ -1353,4 +1352,3 @@ struct rtl_opt_pass pass_regmove = TODO_ggc_collect /* todo_flags_finish */ } }; - diff --git a/gcc/reload.c b/gcc/reload.c index a7e9309f63c..6181224e747 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -685,7 +685,7 @@ find_valid_class (enum machine_mode outer ATTRIBUTE_UNUSED, if (bad || !good) continue; - cost = REGISTER_MOVE_COST (outer, rclass, dest_class); + cost = REGISTER_MOVE_COST (outer, (enum reg_class) rclass, dest_class); if ((reg_class_size[rclass] > best_size && (best_cost < 0 || best_cost >= cost)) @@ -693,7 +693,8 @@ find_valid_class (enum machine_mode outer ATTRIBUTE_UNUSED, { best_class = rclass; best_size = reg_class_size[rclass]; - best_cost = REGISTER_MOVE_COST (outer, rclass, dest_class); + best_cost = REGISTER_MOVE_COST (outer, (enum reg_class) rclass, + dest_class); } } @@ -1516,7 +1517,7 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc, value for the incoming operand (same as outgoing one). */ if (rld[i].reg_rtx == out && (REG_P (in) || CONSTANT_P (in)) - && 0 != find_equiv_reg (in, this_insn, 0, REGNO (out), + && 0 != find_equiv_reg (in, this_insn, NO_REGS, REGNO (out), static_reload_reg_p, i, inmode)) rld[i].in = out; } @@ -2565,7 +2566,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known, enum reload_usage { RELOAD_READ, RELOAD_READ_WRITE, RELOAD_WRITE } modified[MAX_RECOG_OPERANDS]; int no_input_reloads = 0, no_output_reloads = 0; int n_alternatives; - int this_alternative[MAX_RECOG_OPERANDS]; + enum reg_class this_alternative[MAX_RECOG_OPERANDS]; char this_alternative_match_win[MAX_RECOG_OPERANDS]; char this_alternative_win[MAX_RECOG_OPERANDS]; char this_alternative_offmemok[MAX_RECOG_OPERANDS]; @@ -3059,7 +3060,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known, force_reload = 1; } - this_alternative[i] = (int) NO_REGS; + this_alternative[i] = NO_REGS; this_alternative_win[i] = 0; this_alternative_match_win[i] = 0; this_alternative_offmemok[i] = 0; @@ -3146,7 +3147,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known, this combination, because we can't reload it. */ if (this_alternative_offmemok[m] && MEM_P (recog_data.operand[m]) - && this_alternative[m] == (int) NO_REGS + && this_alternative[m] == NO_REGS && ! this_alternative_win[m]) bad = 1; @@ -3162,7 +3163,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known, if (this_alternative_win[m]) losers++; this_alternative_win[m] = 0; - if (this_alternative[m] == (int) NO_REGS) + if (this_alternative[m] == NO_REGS) bad = 1; /* But count the pair only once in the total badness of this alternative, if the pair can be a dummy reload. @@ -3211,8 +3212,8 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known, case 'p': /* All necessary reloads for an address_operand were handled in find_reloads_address. */ - this_alternative[i] - = (int) base_reg_class (VOIDmode, ADDRESS, SCRATCH); + this_alternative[i] = base_reg_class (VOIDmode, ADDRESS, + SCRATCH); win = 1; badop = 0; break; @@ -3371,7 +3372,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known, case 'r': this_alternative[i] - = (int) reg_class_subunion[this_alternative[i]][(int) GENERAL_REGS]; + = reg_class_subunion[this_alternative[i]][(int) GENERAL_REGS]; goto reg; default: @@ -3417,8 +3418,9 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known, /* If we didn't already win, we can reload the address into a base register. */ - this_alternative[i] - = (int) base_reg_class (VOIDmode, ADDRESS, SCRATCH); + this_alternative[i] = base_reg_class (VOIDmode, + ADDRESS, + SCRATCH); badop = 0; break; } @@ -3430,9 +3432,9 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known, } this_alternative[i] - = (int) (reg_class_subunion - [this_alternative[i]] - [(int) REG_CLASS_FROM_CONSTRAINT (c, p)]); + = (reg_class_subunion + [this_alternative[i]] + [(int) REG_CLASS_FROM_CONSTRAINT (c, p)]); reg: if (GET_MODE (operand) == BLKmode) break; @@ -3449,7 +3451,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known, /* If this operand could be handled with a reg, and some reg is allowed, then this operand can be handled. */ - if (winreg && this_alternative[i] != (int) NO_REGS) + if (winreg && this_alternative[i] != NO_REGS) badop = 0; /* Record which operands fit this alternative. */ @@ -3468,7 +3470,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known, bad = 1; /* Alternative loses if it has no regs for a reg operand. */ if (REG_P (operand) - && this_alternative[i] == (int) NO_REGS + && this_alternative[i] == NO_REGS && this_alternative_matches[i] < 0) bad = 1; @@ -3481,14 +3483,13 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known, precisely the same as in the code below that calls force_const_mem. */ if (CONST_POOL_OK_P (operand) - && ((PREFERRED_RELOAD_CLASS (operand, - (enum reg_class) this_alternative[i]) + && ((PREFERRED_RELOAD_CLASS (operand, this_alternative[i]) == NO_REGS) || no_input_reloads) && operand_mode[i] != VOIDmode) { const_to_mem = 1; - if (this_alternative[i] != (int) NO_REGS) + if (this_alternative[i] != NO_REGS) losers++; } @@ -3508,19 +3509,17 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known, LIMIT_RELOAD_CLASS, but we don't check that here. */ - if (! CONSTANT_P (operand) - && (enum reg_class) this_alternative[i] != NO_REGS) + if (! CONSTANT_P (operand) && this_alternative[i] != NO_REGS) { - if (PREFERRED_RELOAD_CLASS - (operand, (enum reg_class) this_alternative[i]) + if (PREFERRED_RELOAD_CLASS (operand, this_alternative[i]) == NO_REGS) reject = 600; #ifdef PREFERRED_OUTPUT_RELOAD_CLASS if (operand_type[i] == RELOAD_FOR_OUTPUT - && PREFERRED_OUTPUT_RELOAD_CLASS - (operand, (enum reg_class) this_alternative[i]) - == NO_REGS) + && (PREFERRED_OUTPUT_RELOAD_CLASS (operand, + this_alternative[i]) + == NO_REGS)) reject = 600; #endif } @@ -3568,7 +3567,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known, because we might otherwise exhaust the class. */ if (! win && ! did_match - && this_alternative[i] != (int) NO_REGS + && this_alternative[i] != NO_REGS && GET_MODE_SIZE (operand_mode[i]) <= UNITS_PER_WORD && reg_class_size [(int) preferred_class[i]] > 0 && ! SMALL_REGISTER_CLASS_P (preferred_class[i])) @@ -3582,7 +3581,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known, common case anyway. */ if (reg_class_subset_p (preferred_class[i], this_alternative[i])) - this_alternative[i] = (int) preferred_class[i]; + this_alternative[i] = preferred_class[i]; else reject += (2 + 2 * pref_or_nothing[i]); } @@ -4767,7 +4766,8 @@ make_memloc (rtx ad, int regno) /* We must rerun eliminate_regs, in case the elimination offsets have changed. */ rtx tem - = XEXP (eliminate_regs (reg_equiv_memory_loc[regno], 0, NULL_RTX), 0); + = XEXP (eliminate_regs (reg_equiv_memory_loc[regno], VOIDmode, NULL_RTX), + 0); /* If TEM might contain a pseudo, we must copy it to avoid modifying it when we do the substitution for the reload. */ diff --git a/gcc/reload1.c b/gcc/reload1.c index bb5a3a2bcd3..d31578d96ab 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -997,7 +997,8 @@ reload (rtx first, int global) for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++) if (reg_renumber[i] < 0 && reg_equiv_memory_loc[i]) { - rtx x = eliminate_regs (reg_equiv_memory_loc[i], 0, NULL_RTX); + rtx x = eliminate_regs (reg_equiv_memory_loc[i], VOIDmode, + NULL_RTX); if (strict_memory_address_p (GET_MODE (regno_reg_rtx[i]), XEXP (x, 0))) @@ -2809,7 +2810,7 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn, case USE: /* Handle insn_list USE that a call to a pure function may generate. */ - new_rtx = eliminate_regs_1 (XEXP (x, 0), 0, insn, false); + new_rtx = eliminate_regs_1 (XEXP (x, 0), VOIDmode, insn, false); if (new_rtx != XEXP (x, 0)) return gen_rtx_USE (GET_MODE (x), new_rtx); return x; @@ -3050,8 +3051,8 @@ elimination_effects (rtx x, enum machine_mode mem_mode) } } - elimination_effects (SET_DEST (x), 0); - elimination_effects (SET_SRC (x), 0); + elimination_effects (SET_DEST (x), VOIDmode); + elimination_effects (SET_SRC (x), VOIDmode); return; case MEM: @@ -3349,7 +3350,7 @@ eliminate_regs_in_insn (rtx insn, int replace) } /* Determine the effects of this insn on elimination offsets. */ - elimination_effects (old_body, 0); + elimination_effects (old_body, VOIDmode); /* Eliminate all eliminable registers occurring in operands that can be handled by reload. */ @@ -3390,7 +3391,7 @@ eliminate_regs_in_insn (rtx insn, int replace) in_plus = true; substed_operand[i] - = eliminate_regs_1 (recog_data.operand[i], 0, + = eliminate_regs_1 (recog_data.operand[i], VOIDmode, replace ? insn : NULL_RTX, is_set_src || in_plus); if (substed_operand[i] != orig_operand[i]) @@ -3520,7 +3521,7 @@ eliminate_regs_in_insn (rtx insn, int replace) the pre-passes. */ if (val && REG_NOTES (insn) != 0) REG_NOTES (insn) - = eliminate_regs_1 (REG_NOTES (insn), 0, REG_NOTES (insn), true); + = eliminate_regs_1 (REG_NOTES (insn), VOIDmode, REG_NOTES (insn), true); return val; } @@ -7087,7 +7088,8 @@ emit_input_reload_insns (struct insn_chain *chain, struct reload *rl, else if (new_class == NO_REGS) { if (reload_adjust_reg_for_icode (&second_reload_reg, - third_reload_reg, sri.icode)) + third_reload_reg, + (enum insn_code) sri.icode)) icode = sri.icode, third_reload_reg = 0; else oldequiv = old, real_oldequiv = real_old; @@ -7117,7 +7119,8 @@ emit_input_reload_insns (struct insn_chain *chain, struct reload *rl, if (reload_adjust_reg_for_temp (&intermediate, NULL, new_class, mode) && reload_adjust_reg_for_icode (&third_reload_reg, NULL, - sri2.icode)) + ((enum insn_code) + sri2.icode))) { second_reload_reg = intermediate; tertiary_icode = sri2.icode; @@ -8414,7 +8417,7 @@ delete_output_reload (rtx insn, int j, int last_reload_reg, rtx new_reload_reg) reg, 0); if (substed) n_occurrences += count_occurrences (PATTERN (insn), - eliminate_regs (substed, 0, + eliminate_regs (substed, VOIDmode, NULL_RTX), 0); for (i1 = reg_equiv_alt_mem_list[REGNO (reg)]; i1; i1 = XEXP (i1, 1)) { diff --git a/gcc/reorg.c b/gcc/reorg.c index 0bbe031f8c1..059bf755e79 100644 --- a/gcc/reorg.c +++ b/gcc/reorg.c @@ -318,7 +318,10 @@ insn_sets_resource_p (rtx insn, struct resources *res, struct resources insn_sets; CLEAR_RESOURCE (&insn_sets); - mark_set_resources (insn, &insn_sets, 0, include_delayed_effects); + mark_set_resources (insn, &insn_sets, 0, + (include_delayed_effects + ? MARK_SRC_DEST_CALL + : MARK_SRC_DEST)); return resource_conflicts_p (&insn_sets, res); } diff --git a/gcc/stub-objc.c b/gcc/stub-objc.c index 2b79566e343..a907d51d684 100644 --- a/gcc/stub-objc.c +++ b/gcc/stub-objc.c @@ -2,7 +2,7 @@ that are called from within the C and C++ front-ends, respectively. Copyright (C) 1991, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, - 2004, 2005, 2007 Free Software Foundation, Inc. + 2004, 2005, 2007, 2009 Free Software Foundation, Inc. This file is part of GCC. @@ -81,7 +81,7 @@ objc_type_quals_match (tree ARG_UNUSED (ltyp), tree ARG_UNUSED (rtyp)) } tree -objc_rewrite_function_call (tree function, tree ARG_UNUSED (params)) +objc_rewrite_function_call (tree function, tree ARG_UNUSED (first_param)) { return function; } diff --git a/gcc/target.h b/gcc/target.h index 608910a3ec4..f3d3361e233 100644 --- a/gcc/target.h +++ b/gcc/target.h @@ -553,10 +553,12 @@ struct gcc_target enum machine_mode mode, int ignore); /* Select a replacement for a target-specific builtin. This is done - *before* regular type checking, and so allows the target to implement - a crude form of function overloading. The result is a complete - expression that implements the operation. */ - tree (*resolve_overloaded_builtin) (tree decl, tree params); + *before* regular type checking, and so allows the target to + implement a crude form of function overloading. The result is a + complete expression that implements the operation. PARAMS really + has type VEC(tree,gc)*, but we don't want to include tree.h + here. */ + tree (*resolve_overloaded_builtin) (tree decl, void *params); /* Fold a target-specific builtin. */ tree (* fold_builtin) (tree fndecl, tree arglist, bool ignore); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8f0516dbdc5..aba13101c69 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2009-04-20 Ian Lance Taylor <iant@google.com> + + * gcc.dg/Wcxx-compat-3.c: New testcase. + 2009-04-20 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/pack13.ad[sb]: New test. diff --git a/gcc/testsuite/gcc.dg/Wcxx-compat-3.c b/gcc/testsuite/gcc.dg/Wcxx-compat-3.c new file mode 100644 index 00000000000..306167314e8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wcxx-compat-3.c @@ -0,0 +1,46 @@ +/* { dg-do compile } */ +/* { dg-options "-Wc++-compat" } */ +enum E1 { A, B, C }; +enum E2 { D, E, F }; +extern void f2 (enum E1); + +void +f1 () +{ + int a = A; + enum E1 e1; + enum E2 e2; + + f2 (0); /* { dg-warning "invalid in C\[+\]\[+\]" } */ + f2 (A); + f2 (D); /* { dg-warning "invalid in C\[+\]\[+\]" } */ + f2 (a); /* { dg-warning "invalid in C\[+\]\[+\]" } */ + f2 (e1); + f2 (e2); /* { dg-warning "invalid in C\[+\]\[+\]" } */ + f2 ((A)); + f2 (a ? A : B); + f2 ((enum E1) 0); + f2 ((enum E1) D); + f2 ((enum E1) a); + f2 ((enum E1) e2); +} + +struct s1 { enum E1 e1 : 3; }; +struct s2 { enum E2 e2 : 3; }; + +void +f3 (struct s1 sv1, struct s2 sv2) +{ + f2 (sv1.e1); + f2 (sv2.e2); /* { dg-warning "invalid in C\[+\]\[+\]" } */ +} + +void +f4 (struct s1 *pv1, struct s2 *pv2) +{ + f2 (pv1->e1); + f2 (pv2->e2); /* { dg-warning "invalid in C\[+\]\[+\]" } */ +} + +/* Match all extra informative notes. */ +/* { dg-message "note: expected '\[^\n'\]*' but argument is of type '\[^\n'\]*'" "note: expected" { target *-*-* } 0 } */ diff --git a/gcc/tree-dump.c b/gcc/tree-dump.c index c4a643e3d4a..893da7ab104 100644 --- a/gcc/tree-dump.c +++ b/gcc/tree-dump.c @@ -1,5 +1,5 @@ /* Tree-dumping functionality for intermediate representation. - Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008 + Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. Written by Mark Mitchell <mark@codesourcery.com> @@ -855,11 +855,11 @@ dump_register (const char *suffix, const char *swtch, const char *glob, /* Return the dump_file_info for the given phase. */ struct dump_file_info * -get_dump_file_info (enum tree_dump_index phase) +get_dump_file_info (int phase) { if (phase < TDI_end) return &dump_files[phase]; - else if (phase - TDI_end >= extra_dump_files_in_use) + else if ((size_t) (phase - TDI_end) >= extra_dump_files_in_use) return NULL; else return extra_dump_files + (phase - TDI_end); @@ -870,7 +870,7 @@ get_dump_file_info (enum tree_dump_index phase) If the dump is not enabled, returns NULL. */ char * -get_dump_file_name (enum tree_dump_index phase) +get_dump_file_name (int phase) { char dump_id[10]; struct dump_file_info *dfi; @@ -907,7 +907,7 @@ get_dump_file_name (enum tree_dump_index phase) Multiple calls will reopen and append to the dump file. */ FILE * -dump_begin (enum tree_dump_index phase, int *flag_ptr) +dump_begin (int phase, int *flag_ptr) { char *name; struct dump_file_info *dfi; @@ -935,7 +935,7 @@ dump_begin (enum tree_dump_index phase, int *flag_ptr) TDI_tree_all, return nonzero if any dump is enabled. */ int -dump_enabled_p (enum tree_dump_index phase) +dump_enabled_p (int phase) { if (phase == TDI_tree_all) { @@ -958,7 +958,7 @@ dump_enabled_p (enum tree_dump_index phase) /* Returns nonzero if tree dump PHASE has been initialized. */ int -dump_initialized_p (enum tree_dump_index phase) +dump_initialized_p (int phase) { struct dump_file_info *dfi = get_dump_file_info (phase); return dfi->state > 0; @@ -967,7 +967,7 @@ dump_initialized_p (enum tree_dump_index phase) /* Returns the switch name of PHASE. */ const char * -dump_flag_name (enum tree_dump_index phase) +dump_flag_name (int phase) { struct dump_file_info *dfi = get_dump_file_info (phase); return dfi->swtch; @@ -977,7 +977,7 @@ dump_flag_name (enum tree_dump_index phase) dump_begin. */ void -dump_end (enum tree_dump_index phase ATTRIBUTE_UNUSED, FILE *stream) +dump_end (int phase ATTRIBUTE_UNUSED, FILE *stream) { fclose (stream); } @@ -1098,7 +1098,7 @@ dump_switch_p (const char *arg) /* Dump FUNCTION_DECL FN as tree dump PHASE. */ void -dump_function (enum tree_dump_index phase, tree fn) +dump_function (int phase, tree fn) { FILE *stream; int flags; @@ -1116,5 +1116,3 @@ enable_rtl_dump_file (void) { return dump_enable_all (TDF_RTL | TDF_DETAILS | TDF_BLOCKS) > 0; } - - diff --git a/gcc/tree-dump.h b/gcc/tree-dump.h index ba1b4a4ca26..558e1c1c952 100644 --- a/gcc/tree-dump.h +++ b/gcc/tree-dump.h @@ -1,5 +1,5 @@ /* Tree-dumping functionality for intermediate representation. - Copyright (C) 1999, 2000, 2003, 2004, 2005, 2007, 2008 + Copyright (C) 1999, 2000, 2003, 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc. Written by Mark Mitchell <mark@codesourcery.com> @@ -89,7 +89,7 @@ extern void dump_string_field (dump_info_p, const char *, const char *); extern void dump_stmt (dump_info_p, const_tree); extern void queue_and_dump_index (dump_info_p, const char *, const_tree, int); extern void queue_and_dump_type (dump_info_p, const_tree); -extern void dump_function (enum tree_dump_index, tree); +extern void dump_function (int, tree); extern void dump_function_to_file (tree, FILE *, int); extern void debug_function (tree, int); extern int dump_flag (dump_info_p, int, const_tree); diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h index c74ed1b654c..cb95fe61a9a 100644 --- a/gcc/tree-pass.h +++ b/gcc/tree-pass.h @@ -77,14 +77,14 @@ enum tree_dump_index a gimple stmt. */ /* In tree-dump.c */ -extern char *get_dump_file_name (enum tree_dump_index); -extern int dump_enabled_p (enum tree_dump_index); -extern int dump_initialized_p (enum tree_dump_index); -extern FILE *dump_begin (enum tree_dump_index, int *); -extern void dump_end (enum tree_dump_index, FILE *); +extern char *get_dump_file_name (int); +extern int dump_enabled_p (int); +extern int dump_initialized_p (int); +extern FILE *dump_begin (int, int *); +extern void dump_end (int, FILE *); extern void dump_node (const_tree, int, FILE *); extern int dump_switch_p (const char *); -extern const char *dump_flag_name (enum tree_dump_index); +extern const char *dump_flag_name (int); /* Global variables used to communicate with passes. */ extern FILE *dump_file; @@ -92,7 +92,7 @@ extern int dump_flags; extern const char *dump_file_name; /* Return the dump_file_info for the given phase. */ -extern struct dump_file_info *get_dump_file_info (enum tree_dump_index); +extern struct dump_file_info *get_dump_file_info (int); /* Describe one pass; this is the common part shared across different pass types. */ diff --git a/gcc/tree.h b/gcc/tree.h index 8902b43254d..5e2ee38e4ef 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -1124,7 +1124,9 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int, (CASE_LABEL_EXPR_CHECK (NODE)->base.addressable_flag) #define PREDICT_EXPR_OUTCOME(NODE) \ - (PREDICT_EXPR_CHECK(NODE)->base.addressable_flag) + ((enum prediction) (PREDICT_EXPR_CHECK(NODE)->base.addressable_flag)) +#define SET_PREDICT_EXPR_OUTCOME(NODE, OUTCOME) \ + (PREDICT_EXPR_CHECK(NODE)->base.addressable_flag = (int) OUTCOME) #define PREDICT_EXPR_PREDICTOR(NODE) \ ((enum br_predictor)tree_low_cst (TREE_OPERAND (PREDICT_EXPR_CHECK (NODE), 0), 0)) diff --git a/gcc/varasm.c b/gcc/varasm.c index 4e414442e54..9a611e0164f 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -2637,7 +2637,7 @@ assemble_integer (rtx x, unsigned int size, unsigned int align, int force) enum machine_mode omode, imode; unsigned int subalign; unsigned int subsize, i; - unsigned char mclass; + enum mode_class mclass; subsize = size > UNITS_PER_WORD? UNITS_PER_WORD : 1; subalign = MIN (align, subsize * BITS_PER_UNIT); |