1. 05 Sep, 2017 21 commits
    • Make more use of int_mode_for_mode · 636bfdfa
      This patch converts more places that could use int_mode_for_mode
      instead of mode_for_size.  This is in preparation for an upcoming
      patch that makes mode_for_size itself return an opt_mode.
      
      The reason for using required () in exp2_immediate_p is that
      we go on to do:
      
          trunc_int_for_mode (..., int_mode)
      
      which would be invalid for (and have failed for) BLKmode.
      
      The reason for using required () in spu_convert_move and
      resolve_simple_move is that we go on to use registers of
      the returned mode in non-call rtl instructions, which would
      be invalid for BLKmode.
      
      2017-09-05  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* config/spu/spu.c (exp2_immediate_p): Use int_mode_for_mode.
      	(spu_convert_move): Likewise.
      	* lower-subreg.c (resolve_simple_move): Likewise.
      
      From-SVN: r251725
      Richard Sandiford committed
    • class.c (unreverse_member_declarations): Remove extraneous if. · 36560e9e
      	* class.c (unreverse_member_declarations): Remove extraneous if.
      	* pt.c (push_template_decl_real): Use string concatenation, not
      	\<newline>.  Add %<..%>.
      
      From-SVN: r251724
      Nathan Sidwell committed
    • re PR target/81833 (PowerPC: VSX: Miscompiles ffmpeg's scalarproduct_int16_vsx at -O1) · 55b2ce1c
      [gcc]
      
      2017-09-05  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
      
      	PR target/81833
      	* config/rs6000/altivec.md (altivec_vsum2sws): Convert from a
      	define_insn to a define_expand.
      	(altivec_vsum2sws_direct): New define_insn.
      	(altivec_vsumsws): Convert from a define_insn to a define_expand.
      
      [gcc/testsuite]
      
      2017-09-05  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
      
      	PR target/81833
      	* gcc.target/powerpc/pr81833-1.c: New file.
      	* gcc.target/powerpc/pr81833-2.c: New file.
      
      From-SVN: r251723
      Bill Schmidt committed
    • Improve max_insns_skipped logic · e5fc06a3
      Improve the logic when setting max_insns_skipped.  Limit the maximum size of IT
      to MAX_INSN_PER_IT_BLOCK as otherwise multiple IT instructions are needed,
      increasing codesize.  Given 4 works well for Thumb-2, use the same limit for ARM
      for consistency.
      
          gcc/
      	* config/arm/arm.c (arm_option_params_internal): Improve setting of
      	max_insns_skipped.
      
      From-SVN: r251720
      Wilco Dijkstra committed
    • i386: Avoid stack realignment if possible · f174328e
      ix86_finalize_stack_frame_flags has been extended to eliminate frame
      pointer when the new stack frame isn't needed with and without
      -maccumulate-outgoing-args as well as -fomit-frame-pointer.  Since stack
      access with larger alignment may be optimized out, to decide if stack
      realignment is needed, we need to not only check for stack frame access,
      but also verify the alignment of stack frame access.  Since alignment of
      memory access via arg_pointer is set up by caller, not by callee, we
      should find the maximum stack alignment from the stack frame access
      instructions via stack pointer and frame pointrer to avoid stack
      realignment when stack alignment needed is less than incoming stack
      boundary.
      
      gcc/
      
      	PR target/59501
      	PR target/81624
      	PR target/81769
      	* config/i386/i386.c (ix86_finalize_stack_frame_flags): Don't
      	realign stack if stack alignment needed is less than incoming
      	stack boundary.
      
      gcc/testsuite/
      
      	PR target/59501
      	PR target/81624
      	PR target/81769
      	* gcc.target/i386/pr59501-4a.c: Remove xfail.
      	* gcc.target/i386/pr81769-1a.c: New test.
      	* gcc.target/i386/pr81769-1b.c: Likewise.
      	* gcc.target/i386/pr81769-2.c: Likewise.
      
      From-SVN: r251718
      H.J. Lu committed
    • re PR sanitizer/82072 (sanitizer does not detect an overflow from LLONG_MIN) · c253525e
      	PR sanitizer/82072
      	* convert.c (convert_to_integer_1) <case NEGATE_EXPR>: Move the ubsan
      	check earlier.
      
      	* c-c++-common/ubsan/pr82072-2.c: New test.
      
      From-SVN: r251717
      Marek Polacek committed
    • re PR c++/81942 (ICE on empty constexpr constructor with C++14) · d49318d9
      /cp
      2017-09-05  Paolo Carlini  <paolo.carlini@oracle.com>
      
      	PR c++/81942
      	* cp-tree.h (LABEL_DECL_CDTOR): Add and document.
      	* decl.c (start_preparsed_function): Set LABEL_DECL_CDTOR when
      	creating cdtor_label.
      	* constexpr.c (returns): Add the case of a constructor/destructor
      	returning via a LABEL_DECL_CDTOR label.
      	(cxx_eval_constant_expression, case [GOTO_EXPR]): Likewise.
      
      /testsuite
      2017-09-05  Paolo Carlini  <paolo.carlini@oracle.com>
      
      	PR c++/81942
      	* g++.dg/cpp1y/constexpr-return3.C: New.
      
      From-SVN: r251714
      Paolo Carlini committed
    • Improve alloca alignment · ae85ad3a
      This patch improves alloca alignment.  Currently alloca reserves
      too much space as it aligns twice, and generates unnecessary stack
      alignment code.
      
      When the requested alignment is lower than the stack alignment, no
      extra alignment is needed.  If the requested alignment is higher,
      we need to increase the size by the difference of the requested 
      alignment and the stack alignment.  As a result, the alloca alignment
      is exactly as expected:
      
      alloca (16):
      	sub	sp, sp, #16
      	mov	x1, sp
      
      alloca (x):
      	add	x0, x0, 15
      	and	x0, x0, -16
      	sub	sp, sp, x0
      	mov	x0, sp
      
      __builtin_alloca_with_align (x, 512):
      	add	x0, x0, 63
      	and	x0, x0, -16
      	sub	sp, sp, x0
      	add	x0, sp, 63
      	and	x0, x0, -64
      
          gcc/
      	* explow.c (get_dynamic_stack_size): Improve dynamic alignment.
      
      From-SVN: r251713
      Wilco Dijkstra committed
    • re PR c++/82084 (ICE: constructing wstring with -O3) · 54c43004
      2017-09-05  Richard Biener  <rguenther@suse.de>
      
      	PR tree-optimization/82084
      	* fold-const.c (can_native_encode_string_p): Handle wide characters.
      
      From-SVN: r251711
      Richard Biener committed
    • re PR ada/62235 (segmentation fault on Ada 2012 code) · d3b080bc
      	PR ada/62235
      	* gcc-interface/decl.c (gnat_to_gnu_entity): Skip regular processing
      	for Itypes that are E_Record_Subtype with a cloned subtype.
      	<E_Record_Subtype>: Use the DECL of the cloned type directly, if any.
      
      From-SVN: r251706
      Eric Botcazou committed
    • trans.c (convert_with_check): Use a custom base type if the base type of the… · a4f7374e
      trans.c (convert_with_check): Use a custom base type if the base type of the expression has a different...
      
      	* gcc-interface/trans.c (convert_with_check): Use a custom base type
      	if the base type of the expression has a different machine mode.
      	Rename a couple of parameters and local variable.
      
      From-SVN: r251705
      Eric Botcazou committed
    • trans.c (Attribute_to_gnu): Do not strip conversions around prefixes that are not references. · 3fd9ae96
      	* gcc-interface/trans.c (Attribute_to_gnu) <Attr_Address>: Do not strip
      	conversions around prefixes that are not references.
      
      From-SVN: r251704
      Eric Botcazou committed
    • utils.c (unchecked_convert): When the result type is a non-biased integral type with size 0... · 1f073c92
      	* gcc-interface/utils.c (unchecked_convert): When the result type is a
      	non-biased integral type with size 0, set the result to 0 directly.
      
      From-SVN: r251701
      Eric Botcazou committed
    • gigi.h (renaming_from_generic_instantiation_p): Turn to · 7ed9919d
      	* gcc-interface/gigi.h (renaming_from_generic_instantiation_p): Turn to
      	(renaming_from_instantiation_p): ...this.
      	* gcc-interface/decl.c (gnat_to_gnu_entity): Use inline predicate
      	instead of explicit tests on kind of entities.  Adjust for renaming.
      	(gnat_to_gnu_profile_type): Likewise.
      	(gnat_to_gnu_subprog_type): Likewise.
      	* gcc-interface/trans.c (Identifier_to_gnu): Likewise.
      	(Case_Statement_to_gnu): Likewise.
      	(gnat_to_gnu): Likewise.
      	(process_freeze_entity): Likewise.
      	(process_type): Likewise.
      	(add_stmt_with_node): Adjust for renaming.
      	* gcc-interface/utils.c (gnat_pushdecl): Adjust for renaming.
      	(renaming_from_generic_instantiation_p): Rename to...
      	(renaming_from_instantiation_p): ...this.  Use inline predicate.
      	(pad_type_hasher::keep_cache_entry): Fold.
      
      From-SVN: r251700
      Eric Botcazou committed
    • trans.c (adjust_for_implicit_deref): New function. · 806fcf71
      	* gcc-interface/trans.c (adjust_for_implicit_deref): New function.
      	(gnat_to_gnu) <N_Explicit_Dereference>: Translate result type first.
      	(N_Indexed_Component): Invoke adjust_for_implicit_deref on the prefix.
      	(N_Slice): Likewise.
      	(N_Selected_Component): Likewise.  Do not try again to translate it.
      	(N_Free_Statement): Invoke adjust_for_implicit_deref on the expression.
      
      From-SVN: r251699
      Eric Botcazou committed
    • repinfo.ads: Document new treatment of dynamic values. · e45f84a5
      	* repinfo.ads: Document new treatment of dynamic values.
      	(TCode): Bump upper bound to 29.
      	(Dynamic_Val): New constant set to 29.
      	* repinfo.adb (Print_Expr) <Dynamic_Val>: New case.
      	(Rep_Value)  <Dynamic_Val>: Likewise.
      	* repinfo.h (Dynamic_Val): New macro.
      	* gcc-interface/decl.c (annotate_value): Tidy up and cache result for
      	DECL_P nodes too.
      	<INTEGER_CST>: Set TCODE instead of recursing.
      	<COMPONENT_REF>: Set TCODE instead of calling Create_Node manually.
      	<VAR_DECL>: New case.
      	<MULT_EXPR, PLUS_EXPR>: Fold conversions into inner operations.
      	<BIT_AND_EXPR>: Adjust.
      	<CALL_EXPR>: Do not fall through.
      
      From-SVN: r251698
      Eric Botcazou committed
    • trans.c (Call_to_gnu): If this is a function call and there is no target... · 6a9db54c
      	* gcc-interface/trans.c (Call_to_gnu): If this is a function call and
      	there is no target, do not create a temporary for the return value for
      	an allocator either.
      
      From-SVN: r251695
      Eric Botcazou committed
    • re PR tree-optimization/82102 (ICE: Segmentation fault in… · a0f8cad6
      re PR tree-optimization/82102 (ICE: Segmentation fault in /home/arnd/git/gcc/gcc/tree-ssa-pre.c:4863)
      
      2017-09-05  Richard Biener  <rguenther@suse.de>
      
      	PR tree-optimization/82102
      	* tree-ssa-pre.c (fini_eliminate): Check if lhs is NULL.
      
      	* gcc.dg/torture/pr82102.c: New testcase.
      
      From-SVN: r251692
      Richard Biener committed
    • trans.c (pos_to_constructor): Skip conversions to an unconstrained array type. · babf697a
      	* gcc-interface/trans.c (pos_to_constructor): Skip conversions to an
      	unconstrained array type.
      
      From-SVN: r251691
      Eric Botcazou committed
    • Learn CFG cleanup to transform single case switches to gcond. · 02e637d8
      2017-09-05  Martin Liska  <mliska@suse.cz>
      
      	PR tree-optimization/82032
      	* tree-cfg.c (generate_range_test): New function.
      	* tree-cfg.h (generate_range_test): Declared here.
      	* tree-cfgcleanup.c (convert_single_case_switch): New function.
      	(cleanup_control_expr_graph): Use it.
      	* tree-switch-conversion.c (try_switch_expansion): Remove
      	assert.
      	(emit_case_nodes): Use generate_range_test.
      2017-09-05  Martin Liska  <mliska@suse.cz>
      
      	PR tree-optimization/82032
      	* g++.dg/other/pr82032.C: New test.
      	* gcc.dg/tree-ssa/pr68198.c: Update scanned pattern.
      	* gcc.dg/tree-ssa/vrp34.c: Likewise.
      	* gcc.dg/switch-10.c: Likewise.
      
      From-SVN: r251690
      Martin Liska committed
    • Daily bump. · b471c5c6
      From-SVN: r251689
      GCC Administrator committed
  2. 04 Sep, 2017 19 commits
    • mpx-os-support.h: New file. · bc394e5a
      	* gcc.target/i386/mpx/mpx-os-support.h: New file.
      	* gcc.target/i386/mpx/mpx-check.h: Include mpx-os-support.h.
      
      From-SVN: r251683
      Uros Bizjak committed
    • re PR target/82098 (internal compiler error: in elimination_costs_in_insn, at… · fc3664b1
      re PR target/82098 (internal compiler error: in elimination_costs_in_insn, at reload1.c:3616, -march=i686)
      
      	PR target/82098
      	* config/i386/i386.md (*<btsc><mode>_mask): Add
      	TARGET_USE_BT to insn constraint.
      	(*btr<mode>_mask): Ditto.
      
      From-SVN: r251682
      Uros Bizjak committed
    • Fix ldrd offsets · c9244494
      Fix the ldrd offsets of Thumb-2 - for TARGET_LDRD the range is +-1020,
      without -252..4096.  This reduces the number of addressing instructions
      when using DI mode operations (such as in PR77308).
      
          gcc/
      	* config/arm/arm.c (arm_legitimate_index_p): Add comment.
      	(thumb2_legitimate_index_p): Use correct range for DI/DF mode.
      
      From-SVN: r251681
      Wilco Dijkstra committed
    • PR libstdc++/79162 implement LWG 2946 and LWG 2758 · df66af3b
      2017-09-04  Daniel Kruegler  <daniel.kruegler@gmail.com>
      
      	PR libstdc++/79162
      	Implement LWG 2946, LWG 2758's resolution missed further corrections
      	* include/bits/basic_string.h (basic_string::compare): Add missing
      	required noexcept specifications.
      	(basic_string): Introduce internal _S_to_string_view and __sv_wrapper
      	for implicit string_view conversion.
      	(basic_string::basic_string): Fix explicit string_view conversion by
      	implicit conversion using _S_to_string_view and __sv_wrapper.
      	(basic_string): Introduce internal basic_string(__sv_wrapper, Alloc)
      	constructor.
      	(basic_string): Fix operator=(T) template by operator=(const T&)
      	template for uncopyable types (PR 79162).
      	(basic_string::operator+=, basic_string::append, basic_string::assign)
      	(basic_string::insert, basic_string::replace, basic_string::find)
      	(basic_string::rfind, basic_string::find_first_of)
      	(basic_string::find_last_of, basic_string::find_first_not_of)
      	(basic_string::find_last_not_of, basic_string::compare): Replace
      	__sv_type argument by template const T& (LWG 2946) and correct
      	documentation describing __sv_type argument.
      	(basic_string::find, basic_string::rfind, basic_string::find_first_of)
      	(basic_string::find_last_of, basic_string::find_first_not_of)
      	(basic_string::find_last_not_of, basic_string::compare): Replace
      	unconditional noexcept specification by conditional noexcept
      	specification to partially balance the removal of noexcept by LWG 2946.
      	* testsuite/21_strings/basic_string/79162.cc: New.
      	* testsuite/21_strings/basic_string/lwg2946.cc: New.
      
      From-SVN: r251664
      Daniel Kruegler committed
    • re PR target/77308 (surprisingly large stack usage for sha512 on arm) · 9afacf39
      2017-09-04  Bernd Edlinger  <bernd.edlinger@hotmail.de>
      
              PR target/77308
              * config/arm/arm.md (*arm_adddi3, *arm_subdi3): Split early except for
              TARGET_NEON and TARGET_IWMMXT.
              (anddi3, iordi3, xordi3, one_cmpldi2): Split while expanding except for
              TARGET_NEON and TARGET_IWMMXT.
              (*one_cmpldi2_insn): Moved the body of one_cmpldi2 here.
      
      testsuite:
      2017-09-04  Bernd Edlinger  <bernd.edlinger@hotmail.de>
      
              PR target/77308
              * gcc.target/arm/pr77308-1.c: New test.
      
      From-SVN: r251663
      Bernd Edlinger committed
    • * config/i386/i386-protos.h (ix86_tls_address_pattern_p) New prototype. · f3648f7d
      	(ix86_rewrite_tls_address): Ditto.
      	* config/i386/i386.c (ix86_tls_address_pattern_p) New function.
      	(ix86_rewrite_tls_address_1): Ditto.
      	(ix86_rewrite_tls_address): Ditto.
      	* config/i386/predicates.md (tls_address_pattern): New predicate.
      	* config/i386/i386.md (TLS address splitter): New splitter.
      
      From-SVN: r251662
      Uros Bizjak committed
    • re PR c++/82084 (ICE: constructing wstring with -O3) · 11a82e25
      2017-09-04  Richard Biener  <rguenther@suse.de>
      
      	PR tree-optimization/82084
      	* fold-const.h (can_native_encode_string_p): Declare.
      	* fold-const.c (can_native_encode_string_p): Factor out from ...
      	(native_encode_string): ... here.
      	* tree-vect-stmts.c (vectorizable_store): Call it to avoid
      	vectorizing stores from constants we later cannot handle.
      
      	* g++.dg/torture/pr82084.C: New testcase.
      
      From-SVN: r251661
      Richard Biener committed
    • re PR c/81783 (-Wtautological-compare could do better) · bc7fe952
      	PR c/81783
      	* c-warn.c (warn_tautological_bitwise_comparison): New function.
      	(warn_tautological_cmp): Call it.
      
      	* doc/invoke.texi: Update -Wtautological-compare documentation.
      
      	* c-c++-common/Wtautological-compare-5.c: New test.
      
      From-SVN: r251660
      Marek Polacek committed
    • re PR tree-optimization/64910 (tree reassociation results in poor code) · 8713d0f1
      2017-09-03  Jeff Law  <law@redhat.com>
      
      	PR tree-optimization/64910
      	* tree-ssa-reassoc.c (reassociate_bb): For bitwise binary ops,
      	swap the first and last operand if the last is a constant.
      
      	PR tree-optimization/64910
      	* gcc.dg/tree-ssa/pr64910-2.c: New test.
      
      From-SVN: r251659
      Jeff Law committed
    • re PR sanitizer/82072 (sanitizer does not detect an overflow from LLONG_MIN) · 8d2b48ae
      	PR sanitizer/82072
      	* convert.c (do_narrow): When sanitizing signed integer overflows,
      	bail out for signed types.
      	(convert_to_integer_1) <case NEGATE_EXPR>: Likewise.
      
      	* c-c++-common/ubsan/pr82072.c: New test.
      
      From-SVN: r251651
      Marek Polacek committed
    • re PR tree-optimization/82060 (ICE in refs_may_alias_p_1 with devirtualization enabled) · e910a9b1
      2017-09-04  Richard Biener  <rguenther@suse.de>
      
      	PR tree-optimization/82060
      	* tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
      	Move devirtualization after stmt folding and before EH/AB/noreturn
      	cleanup to get the stmt refs canonicalized.  Use a bool instead
      	of gimple_modified_p since that doesn't work for NOPs.  Schedule
      	NOPs generated by folding for removal.
      
      	* g++.dg/torture/pr82060.C: New testcase.
      
      From-SVN: r251650
      Richard Biener committed
    • Turn FUNCTION_ARG_PADDING into a target hook · 76b0cbf8
      This involved renaming the rather general-sounding "enum direction" to
      "enum pad_direction" to avoid a conflict with the Fortran frontend.
      
      2017-09-04  Richard Sandiford  <richard.sandiford@linaro.org>
      	    Alan Hayward  <alan.hayward@arm.com>
      	    David Sherwood  <david.sherwood@arm.com>
      
      gcc/
      	* coretypes.h (pad_direction): New enum.
      	* defaults.h (DEFAULT_FUNCTION_ARG_PADDING): Delete.
      	(FUNCTION_ARG_PADDING): Likewise.
      	* target.def (function_arg_padding): New hook.
      	* targhooks.h (default_function_arg_padding): Declare.
      	* targhooks.c (default_function_arg_padding): New function.
      	* doc/tm.texi.in (FUNCTION_ARG_PADDING): Replace with...
      	(TARGET_FUNCTION_ARG_PADDING): ...this.
      	* doc/tm.texi: Regenerate.
      	* calls.c (store_unaligned_arguments_into_pseudos): Use pad_direction
      	instead of direction.
      	(compute_argument_addresses): Likewise.
      	(load_register_parameters): Likewise.
      	(emit_library_call_value_1): Likewise.
      	(store_one_arg): Use targetm.calls.function_arg_padding instead
      	of FUNCTION_ARG_PADDING.
      	(must_pass_in_stack_var_size_or_pad): Likewise.
      	* expr.c (emit_group_load_1): Use pad_direction instead of direction.
      	(emit_group_store): Likewise.
      	(emit_single_push_insn_1): Use targetm.calls.function_arg_padding
      	instead of FUNCTION_ARG_PADDING.
      	(emit_push_insn): Likewise, and propagate enum change throughout
      	function.
      	* function.h (direction): Delete.
      	(locate_and_pad_arg_data::where_pad): Use pad_direction instead
      	of direction.
      	* function.c (assign_parm_find_stack_rtl): Likewise.
      	(assign_parm_setup_block_p): Likewise.
      	(assign_parm_setup_block): Likewise.
      	(gimplify_parameters): Likewise.
      	(locate_and_pad_parm): Use targetm.calls.function_arg_padding
      	instead of FUNCTION_ARG_PADDING, and propagate enum change throughout
      	function.
      	* config/aarch64/aarch64.h (FUNCTION_ARG_PADDING): Delete.
      	(BLOCK_REG_PADDING): Use pad_direction instead of direction.
      	* config/aarch64/aarch64-protos.h (aarch64_pad_arg_upward): Delete.
      	* config/aarch64/aarch64.c (aarch64_pad_arg_upward): Replace with...
      	(aarch64_function_arg_padding): ...this new function.
      	(aarch64_gimplify_va_arg_expr): Use pad_direction instead of direction.
      	(TARGET_FUNCTION_ARG_PADDING): Redefine.
      	* config/arm/arm.h (FUNCTION_ARG_PADDING): Delete.
      	(BLOCK_REG_PADDING): Use pad_direction instead of direction.
      	* config/arm/arm-protos.h (arm_pad_arg_upward): Delete.
      	* config/arm/arm.c (TARGET_FUNCTION_ARG_PADDING): Redefine.
      	(arm_pad_arg_upward): Replace with...
      	(arm_function_arg_padding): ...this new function.
      	* config/c6x/c6x.h (BLOCK_REG_PADDING): Use pad_direction instead
      	of direction.
      	* config/ia64/hpux.h (FUNCTION_ARG_PADDING): Delete.
      	* config/ia64/ia64-protos.h (ia64_hpux_function_arg_padding): Delete.
      	* config/ia64/ia64.c (TARGET_FUNCTION_ARG_PADDING): Redefine.
      	(ia64_hpux_function_arg_padding): Replace with...
      	(ia64_function_arg_padding): ...this new function.  Use pad_direction
      	instead of direction.  Check for TARGET_HPUX.
      	* config/iq2000/iq2000.h (FUNCTION_ARG_PADDING): Delete.
      	* config/iq2000/iq2000.c (TARGET_FUNCTION_ARG_PADDING): Redefine.
      	(iq2000_function_arg_padding): New function.
      	* config/mips/mips-protos.h (mips_pad_arg_upward): Delete.
      	* config/mips/mips.c (mips_pad_arg_upward): Replace with...
      	(mips_function_arg_padding): ...this new function.
      	(mips_pad_reg_upward): Update accordingly.
      	(TARGET_FUNCTION_ARG_PADDING): Redefine.
      	* config/mips/mips.h (PAD_VARARGS_DOWN): Use
      	targetm.calls.function_arg_padding.
      	(FUNCTION_ARG_PADDING): Delete.
      	(BLOCK_REG_PADDING): Use pad_direction instead of direction.
      	* config/nios2/nios2.h (FUNCTION_ARG_PADDING): Delete.
      	(PAD_VARARGS_DOWN): Use targetm.calls.function_arg_padding.
      	* config/nios2/nios2-protos.h (nios2_function_arg_padding): Delete.
      	(nios2_block_reg_padding): Return pad_direction instead of direction.
      	* config/nios2/nios2.c (nios2_block_reg_padding): Return pad_direction
      	instead of direction.
      	(nios2_function_arg_padding): Likewise.  Make static.
      	(TARGET_FUNCTION_ARG_PADDING): Redefine.
      	* config/pa/pa.h (FUNCTION_ARG_PADDING): Delete.
      	(BLOCK_REG_PADDING): Use targetm.calls.function_arg_padding.
      	* config/pa/pa-protos.h (pa_function_arg_padding): Delete.
      	* config/pa/pa.c (TARGET_FUNCTION_ARG_PADDING): Redefine.
      	(pa_function_arg_padding): Make static.  Return pad_direction instead
      	of direction.
      	* config/powerpcspe/powerpcspe.h (FUNCTION_ARG_PADDING): Delete.
      	(PAD_VARARGS_DOWN): Use targetm.calls.function_arg_padding.
      	* config/powerpcspe/aix.h (BLOCK_REG_PADDING): Use pad_direction
      	instead of direction.  Use targetm.calls.function_arg_padding.
      	* config/powerpcspe/darwin.h (BLOCK_REG_PADDING): Likewise.
      	* config/powerpcspe/freebsd64.h (BLOCK_REG_PADDING): Likewise.
      	* config/powerpcspe/linux64.h (BLOCK_REG_PADDING): Likewise.
      	* config/powerpcspe/powerpcspe-protos.h (function_arg_padding): Delete.
      	* config/powerpcspe/powerpcspe.c (TARGET_FUNCTION_ARG_PADDING):
      	Redefine.
      	(function_arg_padding): Rename to...
      	(rs6000_function_arg_padding): ...this.  Make static.  Return
      	pad_direction instead of direction.
      	(rs6000_return_in_msb): Use rs6000_function_arg_padding.
      	* config/rs6000/rs6000.h (FUNCTION_ARG_PADDING): Delete.
      	(PAD_VARARGS_DOWN): Use targetm.calls.function_arg_padding.
      	* config/rs6000/aix.h (BLOCK_REG_PADDING): Use pad_direction
      	instead of direction.  Use targetm.calls.function_arg_padding.
      	* config/rs6000/darwin.h (BLOCK_REG_PADDING): Likewise.
      	* config/rs6000/freebsd64.h (BLOCK_REG_PADDING): Likewise.
      	* config/rs6000/linux64.h (BLOCK_REG_PADDING): Likewise.
      	* config/rs6000/rs6000-protos.h (function_arg_padding): Delete.
      	* config/rs6000/rs6000.c (TARGET_FUNCTION_ARG_PADDING): Redefine.
      	(function_arg_padding): Rename to...
      	(rs6000_function_arg_padding): ...this.  Make static.  Return
      	pad_direction instead of direction.
      	(rs6000_return_in_msb): Use rs6000_function_arg_padding.
      	* config/s390/s390.h (FUNCTION_ARG_PADDING): Delete.
      	* config/s390/s390.c (s390_function_arg_padding): New function.
      	(TARGET_FUNCTION_ARG_PADDING): Redefine.
      	* config/sparc/sparc.h (FUNCTION_ARG_PADDING): Delete.
      	* config/sparc/sparc-protos.h (function_arg_padding): Delete.
      	* config/sparc/sparc.c (TARGET_FUNCTION_ARG_PADDING): Redefine.
      	(function_arg_padding): Rename to...
      	(sparc_function_arg_padding): ...this.  Make static.  Return
      	pad_direction instead of direction.
      	* config/spu/spu.h (FUNCTION_ARG_PADDING): Delete.
      	* config/spu/spu.c (spu_function_arg_padding): New function.
      	(TARGET_FUNCTION_ARG_PADDING): Redefine.
      	* system.h (FUNCTION_ARG_PADDING): Poison.
      
      Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
      Co-Authored-By: David Sherwood <david.sherwood@arm.com>
      
      From-SVN: r251648
      Richard Sandiford committed
    • Turn MODES_TIEABLE_P into a target hook · 99e1629f
      2017-09-04  Richard Sandiford  <richard.sandiford@linaro.org>
      	    Alan Hayward  <alan.hayward@arm.com>
      	    David Sherwood  <david.sherwood@arm.com>
      
      gcc/
      	* target.def (modes_tieable_p): New hook.
      	* doc/tm.texi (MODES_TIEABLE_P): Replace with...
      	(TARGET_MODES_TIEABLE_P): ...this.
      	* doc/tm.texi.in: Regenerate.
      	* hooks.h (hook_bool_mode_mode_true): Declare.
      	* hooks.c (hook_bool_mode_mode_true): New function.
      	* combine.c (subst): Use targetm.modes_tieable_p instead of
      	MODES_TIEABLE_P.
      	* dse.c (find_shift_sequence): Likewise.
      	* expmed.c (extract_low_bits): Likewise.
      	* lower-subreg.c: Include target.h.
      	(find_decomposable_subregs): Use targetm.modes_tieable_p instead of
      	MODES_TIEABLE_P.
      	* rtlanal.c (rtx_cost): Likewise.
      	* config/aarch64/aarch64.h (MODES_TIEABLE_P): Delete.
      	* config/aarch64/aarch64-protos.h (aarch64_modes_tieable_p): Delete.
      	* config/aarch64/aarch64.c (aarch64_modes_tieable_p): Make static.
      	(TARGET_MODES_TIEABLE_P): Redefine.
      	* config/alpha/alpha.h (MODES_TIEABLE_P): Delete.
      	* config/alpha/alpha.c (alpha_modes_tieable_p): New function.
      	(TARGET_MODES_TIEABLE_P): Redefine.
      	* config/arc/arc.h (MODES_TIEABLE_P): Delete.
      	* config/arc/arc.c (TARGET_MODES_TIEABLE_P): Redefine.
      	(arc_modes_tieable_p): New function.
      	* config/arm/arm.h (MODES_TIEABLE_P): Delete.
      	* config/arm/arm-protos.h (arm_modes_tieable_p): Delete.
      	* config/arm/arm.c (TARGET_MODES_TIEABLE_P): Redefine.
      	(arm_modes_tieable_p): Make static.
      	* config/avr/avr.h (MODES_TIEABLE_P): Delete.
      	* config/bfin/bfin.h (MODES_TIEABLE_P): Delete.
      	* config/bfin/bfin.c (bfin_modes_tieable_p): New function.
      	(TARGET_MODES_TIEABLE_P): Redefine.
      	* config/c6x/c6x.h (MODES_TIEABLE_P): Delete.
      	* config/c6x/c6x.c (c6x_modes_tieable_p): New function.
      	(TARGET_MODES_TIEABLE_P): Redefine.
      	* config/cr16/cr16.h (MODES_TIEABLE_P): Delete.
      	* config/cr16/cr16.c (TARGET_MODES_TIEABLE_P): Redefine.
      	(cr16_modes_tieable_p): New function.
      	* config/cris/cris.h (MODES_TIEABLE_P): Delete.
      	* config/epiphany/epiphany.h (MODES_TIEABLE_P): Delete.
      	* config/fr30/fr30.h (MODES_TIEABLE_P): Delete.
      	(TRULY_NOOP_TRUNCATION): Update comment.
      	* config/frv/frv.h (MODES_TIEABLE_P): Delete.
      	(TRULY_NOOP_TRUNCATION): Update comment.
      	* config/frv/frv.c (TARGET_MODES_TIEABLE_P): Redefine.
      	(frv_modes_tieable_p): New function.
      	* config/ft32/ft32.h (MODES_TIEABLE_P): Delete.
      	* config/h8300/h8300.h (MODES_TIEABLE_P): Delete.
      	* config/h8300/h8300.c (h8300_modes_tieable_p): New function.
      	(TARGET_MODES_TIEABLE_P): Redefine.
      	* config/i386/i386.h (MODES_TIEABLE_P): Delete.
      	* config/i386/i386-protos.h (ix86_modes_tieable_p): Delete.
      	* config/i386/i386.c (ix86_modes_tieable_p): Make static.
      	(TARGET_MODES_TIEABLE_P): Redefine.
      	* config/ia64/ia64.h (MODES_TIEABLE_P): Delete.
      	* config/ia64/ia64.c (TARGET_MODES_TIEABLE_P): Redefine.
      	(ia64_modes_tieable_p): New function.
      	* config/iq2000/iq2000.h (MODES_TIEABLE_P): Delete.
      	* config/iq2000/iq2000.c (TARGET_MODES_TIEABLE_P): Redefine.
      	(iq2000_modes_tieable_p): New function.
      	* config/lm32/lm32.h (MODES_TIEABLE_P): Delete.
      	* config/lm32/lm32.c (TARGET_MODES_TIEABLE_P): Redefine.
      	(lm32_modes_tieable_p): New function.
      	* config/m32c/m32c.h (MODES_TIEABLE_P): Delete.
      	* config/m32c/m32c-protos.h (m32c_modes_tieable_p): Delete.
      	* config/m32c/m32c.c (m32c_modes_tieable_p): Make static.
      	(TARGET_MODES_TIEABLE_P): Redefine.
      	* config/m32r/m32r.h (MODES_TIEABLE_P): Delete.
      	* config/m32r/m32r.c (TARGET_MODES_TIEABLE_P): Redefine.
      	(m32r_modes_tieable_p): New function.
      	* config/m68k/m68k.h (MODES_TIEABLE_P): Delete.
      	* config/m68k/m68k.c (TARGET_MODES_TIEABLE_P): Redefine.
      	(m68k_modes_tieable_p): New function.
      	* config/mcore/mcore.h (MODES_TIEABLE_P): Delete.
      	* config/mcore/mcore.c (TARGET_MODES_TIEABLE_P): Redefine.
      	(mcore_modes_tieable_p): New function.
      	* config/microblaze/microblaze.h (MODES_TIEABLE_P): Delete.
      	* config/microblaze/microblaze.c (microblaze_modes_tieable_p): New
      	function.
      	(TARGET_MODES_TIEABLE_P): Redefine.
      	* config/mips/mips.h (MODES_TIEABLE_P): Delete.
      	* config/mips/mips-protos.h (mips_modes_tieable_p): Delete.
      	* config/mips/mips.c (mips_modes_tieable_p): Make static.
      	(TARGET_MODES_TIEABLE_P): Redefine.
      	* config/mmix/mmix.h (MODES_TIEABLE_P): Delete.
      	* config/mn10300/mn10300.h (MODES_TIEABLE_P): Delete.
      	* config/mn10300/mn10300-protos.h (mn10300_modes_tieable): Delete.
      	* config/mn10300/mn10300.c (mn10300_modes_tieable): Rename to...
      	(mn10300_modes_tieable_p): ...this and make static.
      	(TARGET_MODES_TIEABLE_P): Redefine.
      	* config/moxie/moxie.h (MODES_TIEABLE_P): Delete.
      	* config/msp430/msp430.h (MODES_TIEABLE_P): Delete.
      	* config/msp430/msp430-protos.h (msp430_modes_tieable_p): Delete.
      	* config/msp430/msp430.c (TARGET_MODES_TIEABLE_P): Redefine.
      	(msp430_modes_tieable_p): Make static.
      	* config/nds32/nds32.h (MODES_TIEABLE_P): Delete.
      	* config/nds32/nds32.c (nds32_modes_tieable_p): New function.
      	(TARGET_MODES_TIEABLE_P): Redefine.
      	* config/nios2/nios2.h (MODES_TIEABLE_P): Delete.
      	* config/nvptx/nvptx.h (MODES_TIEABLE_P): Delete.
      	* config/nvptx/nvptx.c (nvptx_modes_tieable_p): New function.
      	(TARGET_MODES_TIEABLE_P): Redefine.
      	* config/pa/pa.h (MODES_TIEABLE_P): Delete.
      	* config/pa/pa-protos.h (pa_modes_tieable_p): Delete.
      	* config/pa/pa.c (pa_modes_tieable_p): Make static.
      	(TARGET_MODES_TIEABLE_P): Redefine.
      	* config/pdp11/pdp11.h (MODES_TIEABLE_P): Delete.
      	* config/pdp11/pdp11.c (TARGET_MODES_TIEABLE_P): Redefine.
      	(pdp11_modes_tieable_p): New function.
      	* config/powerpcspe/powerpcspe.h (MODES_TIEABLE_P): Delete.
      	* config/powerpcspe/powerpcspe.c (TARGET_MODES_TIEABLE_P): Redefine.
      	(rs6000_modes_tieable_p): New function.
      	(rs6000_debug_reg_global): Use it instead of MODES_TIEABLE_P.
      	* config/powerpcspe/powerpcspe.md: Update comment.
      	* config/riscv/riscv.h (MODES_TIEABLE_P): Delete.
      	* config/riscv/riscv.c (riscv_modes_tieable_p): New function.
      	(TARGET_MODES_TIEABLE_P): Redefine.
      	* config/rl78/rl78.h (MODES_TIEABLE_P): Delete.
      	* config/rl78/rl78.c (TARGET_MODES_TIEABLE_P): Redefine.
      	(rl78_modes_tieable_p): New function.
      	* config/rs6000/rs6000.h (MODES_TIEABLE_P): Delete.
      	* config/rs6000/rs6000.c (TARGET_MODES_TIEABLE_P): Redefine.
      	(rs6000_modes_tieable_p): New function.
      	(rs6000_debug_reg_global): Use it instead of MODES_TIEABLE_P.
      	* config/rs6000/rs6000.md: Update comment.
      	* config/rx/rx.h (MODES_TIEABLE_P): Delete.
      	* config/rx/rx.c (rx_modes_tieable_p): New function.
      	(TARGET_MODES_TIEABLE_P): Redefine.
      	* config/s390/s390.h (MODES_TIEABLE_P): Delete.
      	* config/s390/s390.c (s390_modes_tieable_p): New function.
      	(TARGET_MODES_TIEABLE_P): Redefine.
      	* config/sh/sh.h (MODES_TIEABLE_P): Delete.
      	* config/sh/sh.c (TARGET_MODES_TIEABLE_P): Redefine.
      	(sh_modes_tieable_p): New function.
      	* config/sparc/sparc.h (MODES_TIEABLE_P): Delete.
      	* config/sparc/sparc-protos.h (sparc_modes_tieable_p): Delete.
      	* config/sparc/sparc.c (TARGET_MODES_TIEABLE_P): Redefine.
      	(sparc_modes_tieable_p): Make static.
      	* config/spu/spu.h (MODES_TIEABLE_P): Delete.
      	* config/spu/spu.c (spu_modes_tieable_p): New function.
      	(TARGET_MODES_TIEABLE_P): Redefine.
      	* config/stormy16/stormy16.h (MODES_TIEABLE_P): Delete.
      	* config/stormy16/stormy16.c (xstormy16_modes_tieable_p): New function.
      	(TARGET_MODES_TIEABLE_P): Redefine.
      	* config/tilegx/tilegx.h (MODES_TIEABLE_P): Delete.
      	* config/tilepro/tilepro.h (MODES_TIEABLE_P): Delete.
      	* config/v850/v850.h (MODES_TIEABLE_P): Delete.
      	* config/v850/v850.c (v850_modes_tieable_p): New function.
      	(TARGET_MODES_TIEABLE_P): Redefine.
      	* config/vax/vax.h (MODES_TIEABLE_P): Delete.
      	* config/visium/visium.h (MODES_TIEABLE_P): Delete.
      	* config/visium/visium.c (TARGET_MODES_TIEABLE_P): Redefine.
      	(visium_modes_tieable_p): New function.
      	* config/xtensa/xtensa.h (MODES_TIEABLE_P): Delete.
      	* config/xtensa/xtensa.c (TARGET_MODES_TIEABLE_P): Redefine.
      	(xtensa_modes_tieable_p): New function.
      	* system.h (MODES_TIEABLE_P): Poison.
      
      Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
      Co-Authored-By: David Sherwood <david.sherwood@arm.com>
      
      From-SVN: r251647
      Richard Sandiford committed
    • Turn HARD_REGNO_MODE_OK into a target hook · f939c3e6
      2017-09-04  Richard Sandiford  <richard.sandiford@linaro.org>
      	    Alan Hayward  <alan.hayward@arm.com>
      	    David Sherwood  <david.sherwood@arm.com>
      
      gcc/
      	* target.def (hard_regno_mode_ok): New hook.
      	* doc/tm.texi (HARD_REGNO_MODE_OK): Replace with...
      	(TARGET_HARD_REGNO_MODE_OK): ...this.
      	* doc/tm.texi.in: Regenerate.
      	* hooks.h (hook_bool_uint_mode_true): Declare.
      	* hooks.c (hook_bool_uint_mode_true): New function.
      	* doc/md.texi: Refer to targetm.hard_regno_mode_ok instead of
      	HARD_REGNO_MODE_OK.
      	* genpreds.c (write_insn_preds_c): Add an include of target.h.
      	* alias.c (init_alias_target): Use targetm.hard_regno_mode_ok
      	instead of HARD_REGNO_MODE_OK.
      	* caller-save.c: Include target.h.
      	(reg_save_code): Use targetm.hard_regno_mode_ok instead of
      	HARD_REGNO_MODE_OK.
      	* combine.c (can_combine_p): Likewise.
      	(combinable_i3pat): Likewise.
      	(can_change_dest_mode): Likewise.
      	* expr.c (init_expr_target): Likewise.
      	(convert_move): Likewise.
      	(convert_modes): Likewise.
      	* ira.c (setup_prohibited_class_mode_regs): Likewise.
      	(setup_prohibited_mode_move_regs): Likewise.
      	* ira.h (target_ira): Likewise.
      	* lra-assigns.c (find_hard_regno_for_1): Likewise.
      	* lra-constraints.c (process_alt_operands): Likewise.
      	(split_reg): Likewise.
      	* recog.c (peep2_find_free_register): Likewise.
      	* ree.c (combine_reaching_defs): Likewise.
      	* regcprop.c (maybe_mode_change): Likewise.
      	* reginfo.c (init_reg_sets_1): Likewise.
      	(choose_hard_reg_mode): Likewise.
      	(simplifiable_subregs): Likewise.
      	* regrename.c (check_new_reg_p): Likewise.
      	* reload.c (find_valid_class): Likewise.
      	(find_valid_class_1): Likewise.
      	(reload_inner_reg_of_subreg): Likewise.
      	(push_reload): Likewise.
      	(combine_reloads): Likewise.
      	(find_dummy_reload): Likewise.
      	(find_reloads): Likewise.
      	* reload1.c (find_reg): Likewise.
      	(set_reload_reg): Likewise.
      	(allocate_reload_reg): Likewise.
      	(choose_reload_regs): Likewise.
      	(reload_adjust_reg_for_temp): Likewise.
      	* rtlanal.c (subreg_size_offset_from_lsb): Likewise.
      	(simplify_subreg_regno): Likewise.
      	* sel-sched.c (init_regs_for_mode): Likewise.
      	* varasm.c (make_decl_rtl): Likewise.
      	* config/aarch64/aarch64.h (HARD_REGNO_MODE_OK): Delete.
      	(MODES_TIEABLE_P): Use targetm.hard_regno_mode_ok instead of
      	HARD_REGNO_MODE_OK.
      	* config/aarch64/aarch64-protos.h (aarch64_hard_regno_mode_ok): Delete.
      	* config/aarch64/aarch64.c (aarch64_hard_regno_mode_ok): Make static.
      	(TARGET_HARD_REGNO_MODE_OK): Redefine.
      	* config/alpha/alpha.h (HARD_REGNO_MODE_OK): Delete.
      	* config/alpha/alpha.c (alpha_hard_regno_mode_ok): New function.
      	(TARGET_HARD_REGNO_MODE_OK): Redefine.
      	* config/arc/arc.h (arc_hard_regno_mode_ok): Delete.
      	(arc_mode_class): Delete.
      	(HARD_REGNO_MODE_OK): Delete.
      	* config/arc/arc.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
      	(arc_hard_regno_mode_ok): Rename old array to...
      	(arc_hard_regno_mode_ok_modes): ...this.
      	(arc_conditional_register_usage): Update accordingly.
      	(arc_mode_class): Make static.
      	(arc_hard_regno_mode_ok): New function.
      	* config/arm/arm.h (HARD_REGNO_MODE_OK): Delete.
      	* config/arm/arm-protos.h (arm_hard_regno_mode_ok): Delete.
      	* config/arm/arm.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
      	(arm_hard_regno_mode_ok): Make static.
      	* config/arm/arm.md (movdi): Use targetm.hard_regno_mode_ok instead of
      	HARD_REGNO_MODE_OK.
      	* config/avr/avr-protos.h (avr_hard_regno_mode_ok): Delete.
      	* config/avr/avr.h (HARD_REGNO_MODE_OK): Delete.
      	* config/avr/avr.c (avr_hard_regno_mode_ok): Make static and
      	return a bool.
      	(TARGET_HARD_REGNO_MODE_OK): Redefine.
      	* config/bfin/bfin-protos.h (hard_regno_mode_ok): Delete.
      	* config/bfin/bfin.h (HARD_REGNO_MODE_OK): Delete.
      	* config/bfin/bfin.c (hard_regno_mode_ok): Rename to...
      	(bfin_hard_regno_mode_ok): ...this.  Make static and return a bool.
      	(TARGET_HARD_REGNO_MODE_OK): Redefine.
      	* config/bfin/predicates.md (valid_reg_operand): Use
      	targetm.hard_regno_mode_ok instead of HARD_REGNO_MODE_OK.
      	* config/c6x/c6x.h (HARD_REGNO_MODE_OK): Delete.
      	* config/c6x/c6x.c (c6x_hard_regno_mode_ok): New function.
      	(TARGET_HARD_REGNO_MODE_OK): Redefine.
      	* config/cr16/cr16.h (HARD_REGNO_MODE_OK): Delete.
      	* config/cr16/cr16-protos.h (cr16_hard_regno_mode_ok): Delete.
      	* config/cr16/cr16.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
      	(cr16_hard_regno_mode_ok): Make static and return a bool.
      	* config/cris/cris.h (HARD_REGNO_MODE_OK): Delete.
      	* config/cris/cris.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
      	(cris_hard_regno_mode_ok): New function.
      	* config/epiphany/epiphany.h (epiphany_hard_regno_mode_ok): Delete.
      	(epiphany_mode_class): Delete.
      	(HARD_REGNO_MODE_OK): Delete.
      	* config/epiphany/epiphany-protos.h (hard_regno_mode_ok): Delete.
      	* config/epiphany/epiphany.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
      	(hard_regno_mode_ok): Rename to...
      	(epiphany_hard_regno_mode_ok): ...this.  Make static and return a bool.
      	* config/fr30/fr30.h (HARD_REGNO_MODE_OK): Delete.
      	* config/fr30/fr30.md: Refer to targetm.hard_regno_mode_ok instead of
      	HARD_REGNO_MODE_OK.
      	* config/frv/frv.h (HARD_REGNO_MODE_OK): Delete.
      	* config/frv/frv-protos.h (frv_hard_regno_mode_ok): Delete.
      	* config/frv/frv.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
      	(frv_hard_regno_mode_ok): Make static and return a bool.
      	* config/frv/frv.md: Refer to targetm.hard_regno_mode_ok instead of
      	HARD_REGNO_MODE_OK.
      	* config/ft32/ft32.h (HARD_REGNO_MODE_OK): Delete.
      	* config/h8300/h8300.h (HARD_REGNO_MODE_OK): Delete.
      	* config/h8300/h8300-protos.h (h8300_hard_regno_mode_ok): Delete.
      	* config/h8300/h8300.c (h8300_hard_regno_mode_ok): Make static
      	and return a bool.
      	(TARGET_HARD_REGNO_MODE_OK): Redefine.
      	* config/i386/i386.h (HARD_REGNO_MODE_OK): Delete.
      	* config/i386/i386-protos.h (ix86_hard_regno_mode_ok): Delete.
      	* config/i386/i386.c (ix86_hard_regno_mode_ok): Make static and
      	return a bool.
      	(TARGET_HARD_REGNO_MODE_OK): Redefine.
      	* config/ia64/ia64.h (HARD_REGNO_MODE_OK): Delete.
      	* config/ia64/ia64.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
      	(ia64_hard_regno_mode_ok): New function.
      	* config/iq2000/iq2000.h (HARD_REGNO_MODE_OK): Delete.
      	* config/iq2000/iq2000.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
      	(iq2000_hard_regno_mode_ok): New function.
      	* config/lm32/lm32.h (HARD_REGNO_MODE_OK): Delete.
      	* config/lm32/lm32.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
      	(lm32_hard_regno_mode_ok): New function.
      	* config/m32c/m32c.h (HARD_REGNO_MODE_OK): Delete.
      	* config/m32c/m32c-protos.h (m32c_hard_regno_ok): Delete.
      	* config/m32c/m32c.c (class_can_hold_mode): Use m32c_hard_regno_mode_ok
      	instead of HARD_REGNO_MODE_OK.
      	(m32c_hard_regno_ok): Rename to...
      	(m32c_hard_regno_mode_ok): ...this.  Make static and return a bool.
      	(m32c_cannot_change_mode_class): Update accordingly.
      	(TARGET_HARD_REGNO_MODE_OK): Redefine.
      	* config/m32r/m32r.h (m32r_hard_regno_mode_ok): Delete.
      	(m32r_mode_class): Delete.
      	(HARD_REGNO_MODE_OK): Delete.
      	* config/m32r/m32r.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
      	(m32r_hard_regno_mode_ok): Rename to...
      	(m32r_hard_regno_modes): ...this.
      	(m32r_mode_class): Make static.
      	(m32r_hard_regno_mode_ok): New function.
      	* config/m68k/m68k.h (HARD_REGNO_MODE_OK): Delete.
      	* config/m68k/m68k-protos.h (m68k_regno_mode_ok): Delete.
      	* config/m68k/m68k.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
      	(m68k_hard_regno_mode_ok): Make static.
      	* config/mcore/mcore.h (HARD_REGNO_MODE_OK): Delete.
      	* config/mcore/mcore.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
      	(mcore_hard_regno_mode_ok): New function.
      	* config/microblaze/microblaze.h (microblaze_hard_regno_mode_ok)
      	(HARD_REGNO_MODE_OK): Delete.
      	* config/microblaze/microblaze.c (microblaze_hard_regno_mode_ok):
      	Rename to...
      	(microblaze_hard_regno_mode_ok_p): ...this and make static.
      	(microblaze_hard_regno_mode_ok): New function.
      	(TARGET_HARD_REGNO_MODE_OK): Redefine.
      	* config/mips/mips.h (HARD_REGNO_MODE_OK): Delete.
      	(mips_hard_regno_mode_ok): Delete.
      	* config/mips/mips.c (mips_hard_regno_mode_ok): Rename to...
      	(mips_hard_regno_mode_ok_p): ...this and make static.
      	(mips_hard_regno_mode_ok_p): Rename to...
      	(mips_hard_regno_mode_ok_uncached): ...this.
      	(mips_hard_regno_mode_ok): New function.
      	(mips_class_max_nregs): Use mips_hard_regno_mode_ok instead
      	of HARD_REGNO_MODE_OK.
      	(mips_option_override): Update after above name changes.
      	(TARGET_HARD_REGNO_MODE_OK): Redefine.
      	* config/mmix/mmix.h (HARD_REGNO_MODE_OK): Delete.
      	* config/mn10300/mn10300.h (HARD_REGNO_MODE_OK): Delete.
      	* config/mn10300/mn10300-protos.h (mn10300_hard_regno_mode_ok): Delete.
      	* config/mn10300/mn10300.c (mn10300_hard_regno_mode_ok): Make static.
      	(TARGET_HARD_REGNO_MODE_OK): Redefine.
      	* config/moxie/moxie.h (HARD_REGNO_MODE_OK): Delete.
      	* config/msp430/msp430.h (HARD_REGNO_MODE_OK): Delete.
      	* config/msp430/msp430-protos.h (msp430_hard_regno_mode_ok): Delete.
      	* config/msp430/msp430.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
      	(msp430_hard_regno_mode_ok): Make static and return a bool.
      	* config/nds32/nds32.h (HARD_REGNO_MODE_OK): Delete.
      	* config/nds32/nds32-protos.h (nds32_hard_regno_mode_ok): Delete.
      	* config/nds32/nds32.c (nds32_hard_regno_mode_ok): Make static
      	and return a bool.
      	(TARGET_HARD_REGNO_MODE_OK): Redefine.
      	* config/nios2/nios2.h (HARD_REGNO_MODE_OK): Delete.
      	* config/nvptx/nvptx.h (HARD_REGNO_MODE_OK): Delete.
      	* config/pa/pa.h (MODES_TIEABLE_P): Update commentary.
      	* config/pa/pa32-regs.h (HARD_REGNO_MODE_OK): Rename to...
      	(PA_HARD_REGNO_MODE_OK): ...this
      	* config/pa/pa64-regs.h (HARD_REGNO_MODE_OK): Rename to...
      	(PA_HARD_REGNO_MODE_OK): ...this.
      	* config/pa/pa.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
      	(pa_hard_regno_mode_ok): New function.
      	* config/pdp11/pdp11.h (HARD_REGNO_MODE_OK): Delete.
      	* config/pdp11/pdp11.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
      	(pdp11_hard_regno_mode_ok): New function.
      	* config/powerpcspe/powerpcspe.h (HARD_REGNO_MODE_OK): Delete.
      	* config/powerpcspe/powerpcspe-protos.h (rs6000_hard_regno_mode_ok_p):
      	Delete.
      	* config/powerpcspe/powerpcspe.c (rs6000_hard_regno_mode_ok_p):
      	Make static.
      	(TARGET_HARD_REGNO_MODE_OK): Redefine.
      	(rs6000_hard_regno_mode_ok): Rename to...
      	(rs6000_hard_regno_mode_ok_uncached): ...this.
      	(rs6000_init_hard_regno_mode_ok): Update accordingly.
      	(rs6000_hard_regno_mode_ok): New function.
      	* config/riscv/riscv.h (HARD_REGNO_MODE_OK): Delete.
      	* config/riscv/riscv-protos.h (riscv_hard_regno_mode_ok_p): Delete.
      	* config/riscv/riscv.c (riscv_hard_regno_mode_ok_p): Rename to...
      	(riscv_hard_regno_mode_ok): ...this and make static.
      	(TARGET_HARD_REGNO_MODE_OK): Redefine.
      	* config/rl78/rl78.h (HARD_REGNO_MODE_OK): Delete.
      	* config/rl78/rl78-protos.h (rl78_hard_regno_mode_ok): Delete.
      	* config/rl78/rl78.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
      	(rl78_hard_regno_mode_ok): Make static and return bool.
      	* config/rs6000/rs6000.h (HARD_REGNO_MODE_OK): Delete.
      	* config/rs6000/rs6000-protos.h (rs6000_hard_regno_mode_ok_p):
      	Delete.
      	* config/rs6000/rs6000.c (rs6000_hard_regno_mode_ok_p): Make static.
      	(TARGET_HARD_REGNO_MODE_OK): Redefine.
      	(rs6000_hard_regno_mode_ok): Rename to...
      	(rs6000_hard_regno_mode_ok_uncached): ...this.
      	(rs6000_init_hard_regno_mode_ok): Update accordingly.
      	(rs6000_hard_regno_mode_ok): New function.
      	* config/rx/rx.h (HARD_REGNO_MODE_OK): Delete.
      	* config/rx/rx.c (rx_hard_regno_mode_ok): New function.
      	(TARGET_HARD_REGNO_MODE_OK): Redefine.
      	* config/s390/s390.h (HARD_REGNO_MODE_OK): Delete.
      	* config/s390/s390-protos.h (s390_hard_regno_mode_ok): Delete.
      	* config/s390/s390.c (s390_hard_regno_mode_ok): Make static.
      	(TARGET_HARD_REGNO_MODE_OK): Redefine.
      	* config/sh/sh.h (HARD_REGNO_MODE_OK): Delete.
      	* config/sh/sh-protos.h (sh_hard_regno_mode_ok): Delete.
      	* config/sh/sh.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
      	(sh_hard_regno_mode_ok): Make static.
      	* config/sparc/constraints.md: Refer to targetm.hard_regno_mode_ok
      	instead of HARD_REGNO_MODE_OK.
      	* config/sparc/sparc.h (hard_regno_mode_classes): Delete.
      	(sparc_mode_class): Delete.
      	(HARD_REGNO_MODE_OK): Delete.
      	* config/sparc/sparc.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
      	(hard_regno_mode_classes): Make static.
      	(sparc_mode_class): Likewise.
      	(sparc_hard_regno_mode_ok): New function.
      	* config/spu/spu.h (HARD_REGNO_MODE_OK): Delete.
      	* config/stormy16/stormy16.h (HARD_REGNO_MODE_OK): Delete.
      	* config/stormy16/stormy16.c (xstormy16_hard_regno_mode_ok): New
      	function.
      	(TARGET_HARD_REGNO_MODE_OK): Redefine.
      	* config/tilegx/tilegx.h (HARD_REGNO_MODE_OK): Delete.
      	* config/tilepro/tilepro.h (HARD_REGNO_MODE_OK): Delete.
      	* config/v850/v850.h (HARD_REGNO_MODE_OK): Delete.
      	* config/v850/v850.c (v850_hard_regno_mode_ok): New function.
      	(TARGET_HARD_REGNO_MODE_OK): Redefine.
      	* config/vax/vax.h (HARD_REGNO_MODE_OK): Delete.
      	* config/visium/visium.h (HARD_REGNO_MODE_OK): Delete.
      	* config/visium/visium.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
      	(visium_hard_regno_mode_ok): New function.
      	* config/visium/visium.md: Refer to targetm.hard_regno_mode_ok
      	instead of HARD_REGNO_MODE_OK.
      	* config/xtensa/xtensa.h (xtensa_hard_regno_mode_ok): Delete.
      	(HARD_REGNO_MODE_OK): Delete.
      	* config/xtensa/xtensa.c (xtensa_hard_regno_mode_ok): Rename to...
      	(xtensa_hard_regno_mode_ok_p): ...this and make static.
      	(xtensa_option_override): Update accordingly.
      	(TARGET_HARD_REGNO_MODE_OK): Redefine.
      	(xtensa_hard_regno_mode_ok): New function.
      	* system.h (HARD_REGNO_MODE_OK): Poison.
      
      Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
      Co-Authored-By: David Sherwood <david.sherwood@arm.com>
      
      From-SVN: r251646
      Richard Sandiford committed
    • Turn HARD_REGNO_CALL_PART_CLOBBERED into a target hook · 80ec73f4
      The SVE patches change the size of a machine_mode from a compile-time
      constant to a runtime invariant.  However, target-specific code can
      continue to treat the modes as constant-sized if the target only has
      constant-sized modes.
      
      The main snag with this approach is that target-independent code still
      uses macros from the target .h file.  This patch is one of several that
      converts a target macro to a hook.
      
      2017-09-04  Richard Sandiford  <richard.sandiford@linaro.org>
      	    Alan Hayward  <alan.hayward@arm.com>
      	    David Sherwood  <david.sherwood@arm.com>
      
      gcc/
      	* target.def (hard_regno_call_part_clobbered): New hook.
      	* doc/tm.texi.in (HARD_REGNO_CALL_PART_CLOBBERED): Replace with...
      	(TARGET_HARD_REGNO_CALL_PART_CLOBBERED): ...this hook.
      	* doc/tm.texi: Regenerate.
      	* hooks.h (hook_bool_uint_mode_false): Declare.
      	* hooks.c (hook_bool_uint_mode_false): New function.
      	* regs.h (HARD_REGNO_CALL_PART_CLOBBERED): Delete.
      	* cselib.c (cselib_process_insn): Use
      	targetm.hard_regno_call_part_clobbered instead of
      	HARD_REGNO_CALL_PART_CLOBBERED.
      	* ira-conflicts.c (ira_build_conflicts): Likewise.
      	* ira-costs.c (ira_tune_allocno_costs): Likewise.
      	* lra-constraints.c (need_for_call_save_p): Likewise.
      	* lra-lives.c: Include target.h.
      	(check_pseudos_live_through_calls): Use
      	targetm.hard_regno_call_part_clobbered instead of
      	HARD_REGNO_CALL_PART_CLOBBERED.
      	* regcprop.c: Include target.h.
      	(copyprop_hardreg_forward_1): Use
      	targetm.hard_regno_call_part_clobbered instead of
      	HARD_REGNO_CALL_PART_CLOBBERED.
      	* reginfo.c (choose_hard_reg_mode): Likewise.
      	* regrename.c (check_new_reg_p): Likewise.
      	* reload.c (find_equiv_reg): Likewise.
      	* reload1.c (emit_reload_insns): Likewise.
      	* sched-deps.c (deps_analyze_insn): Likewise.
      	* sel-sched.c (init_regs_for_mode): Likewise.
      	(mark_unavailable_hard_regs): Likewise.
      	* targhooks.c (default_dwarf_frame_reg_mode): Likewise.
      	* config/aarch64/aarch64.h (HARD_REGNO_CALL_PART_CLOBBERED): Delete.
      	* config/aarch64/aarch64.c (aarch64_hard_regno_call_part_clobbered):
      	New function.
      	(TARGET_HARD_REGNO_CALL_PART_CLOBBERED): Redefine.
      	* config/avr/avr.h (HARD_REGNO_CALL_PART_CLOBBERED): Delete.
      	* config/avr/avr-protos.h (avr_hard_regno_call_part_clobbered):
      	Delete.
      	* config/avr/avr.c (avr_hard_regno_call_part_clobbered): Make static
      	and return a bool.
      	(TARGET_HARD_REGNO_CALL_PART_CLOBBERED): Redefine.
      	* config/i386/i386.h (HARD_REGNO_CALL_PART_CLOBBERED): Delete.
      	* config/i386/i386.c (ix86_hard_regno_call_part_clobbered): New
      	function.
      	(TARGET_HARD_REGNO_CALL_PART_CLOBBERED): Redefine.
      	* config/mips/mips.h (HARD_REGNO_CALL_PART_CLOBBERED): Delete.
      	* config/mips/mips.c (mips_hard_regno_call_part_clobbered): New
      	function.
      	(TARGET_HARD_REGNO_CALL_PART_CLOBBERED): Redefine.
      	* config/powerpcspe/powerpcspe.h (HARD_REGNO_CALL_PART_CLOBBERED):
      	Delete.
      	* config/powerpcspe/powerpcspe.c
      	(rs6000_hard_regno_call_part_clobbered): New function.
      	(TARGET_HARD_REGNO_CALL_PART_CLOBBERED): Redefine.
      	* config/rs6000/rs6000.h (HARD_REGNO_CALL_PART_CLOBBERED): Delete.
      	* config/rs6000/rs6000.c (rs6000_hard_regno_call_part_clobbered):
      	New function.
      	(TARGET_HARD_REGNO_CALL_PART_CLOBBERED): Redefine.
      	* config/s390/s390.h (HARD_REGNO_CALL_PART_CLOBBERED): Delete.
      	* config/s390/s390.c (s390_hard_regno_call_part_clobbered): New
      	function.
      	(TARGET_HARD_REGNO_CALL_PART_CLOBBERED): Redefine.
      	* config/sh/sh.h (HARD_REGNO_CALL_PART_CLOBBERED): Delete.
      	* system.h (HARD_REGNO_CALL_PART_CLOBBERED): Poison.
      
      Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
      Co-Authored-By: David Sherwood <david.sherwood@arm.com>
      
      From-SVN: r251645
      Richard Sandiford committed
    • Add subreg_memory_offset helper functions · 3d09ba95
      This patch adds routines for converting a SUBREG_BYTE offset into a
      memory address offset.  The two only differ for paradoxical subregs,
      where SUBREG_BYTE is always 0 but the memory address offset can be
      negative.
      
      2017-09-04  Richard Sandiford  <richard.sandiford@linaro.org>
      	    Alan Hayward  <alan.hayward@arm.com>
      	    David Sherwood  <david.sherwood@arm.com>
      
      gcc/
      	* rtl.h (subreg_memory_offset): Declare.
      	* emit-rtl.c (subreg_memory_offset): New function.
      	* expmed.c (store_bit_field_1): Use it.
      	* expr.c (undefined_operand_subword_p): Likewise.
      	* simplify-rtx.c (simplify_subreg): Likewise.
      
      Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
      Co-Authored-By: David Sherwood <david.sherwood@arm.com>
      
      From-SVN: r251644
      Richard Sandiford committed
    • optabs: ensure atomic_load/stores have compiler barriers · d8c40eff
      	PR rtl-optimization/57448
      	PR target/67458
      	PR target/81316
      	* optabs.c (expand_atomic_load): Place compiler memory barriers if
      	using atomic_load pattern.
      	(expand_atomic_store): Likewise.
      testsuite/
      	* gcc.dg/atomic/pr80640-2.c: New testcase.
      	* gcc.dg/atomic/pr81316.c: New testcase.
      
      From-SVN: r251643
      Alexander Monakov committed
    • Fix call arguments mismatch in gcc.c-torture/compile/pr82052.c · 1fda57cb
      2017-09-04  Tom de Vries  <tom@codesourcery.com>
      
      	PR tree-optimization/82052
      	* gcc.c-torture/compile/pr82052.c (fn2): Add parameters corresponding to
      	call in fn11.
      
      From-SVN: r251642
      Tom de Vries committed
    • re PR sanitizer/81981 (-fsanitize=undefined makes a -Wmaybe-uninitialized warning disappear) · ca1150f0
      	PR sanitizer/81981
      	* gimple-fold.c (gimple_fold_call): Optimize away useless UBSAN_PTR
      	and UBSAN_BOUNDS internal calls.  Clean up IFN_UBSAN_OBJECT_SIZE
      	handling.  Use replace_call_with_value with NULL instead of
      	gsi_replace, unlink_stmt_vdef and release_defs.
      
      	* gcc.dg/ubsan/pr81981.c: New test.
      
      From-SVN: r251641
      Jakub Jelinek committed