PR82045: Avoid passing machine modes through "..."
authorRichard Sandiford <richard.sandiford@linaro.org>
Mon, 4 Sep 2017 07:30:53 +0000 (07:30 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Mon, 4 Sep 2017 07:30:53 +0000 (07:30 +0000)
commitdb69559bac8ab03ccddfe3a42be630e65c277812
tree2cf080b045129f4dea972ab956100f6ec25bddbc
parent77701e2346bee936056ff33e1a94b214e359b4d2
PR82045: Avoid passing machine modes through "..."

PR82045 is about a bootstrap failure on sparc-sun-solaris2.11.
The problem was that we were passing the new machine_mode wrapper
classes through "..."  to emit_library_call(_value), which then
read them back as ints instead.

The simplest fix seemed to be replace "..." with an array of
rtx_mode_ts, then provide wrappers for the common cases.  This
bulks out rtl.h a bit, but it does make things a bit more typesafe.

2017-09-04  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
PR bootstrap/82045
* rtl.h (emit_library_call_value_1): Declare.
(emit_library_call): Replace declaration with a series of overloads.
Remove the parameter count argument.
(emit_library_call_value): Likewise.
* calls.c (emit_library_call_value_1): Make global.  Replace varargs
with an "rtx_mode_t *".
(emit_library_call_value): Delete.
(emit_library_call): Likewise.
* asan.c (asan_emit_stack_protection): Update calls accordingly.
(asan_emit_allocas_unpoison): Likewise.
* builtins.c (expand_builtin_powi): Likewise.
(expand_asan_emit_allocas_unpoison): Likewise.
* cfgexpand.c (expand_main_function): Likewise.
* config/aarch64/aarch64.c (aarch64_trampoline_init): Likewise.
* config/aarch64/aarch64.h (PROFILE_HOOK): Likewise.
* config/alpha/alpha.c (alpha_trampoline_init): Likewise.
* config/arm/arm.c (arm_trampoline_init): Likewise.
(arm_call_tls_get_addr): Likewise.
(arm_expand_divmod_libfunc): Likewise.
* config/bfin/bfin.md (umulsi3_highpart): Likewise.
(smulsi3_highpart): Likewise.
* config/c6x/c6x.c (c6x_initialize_trampoline): Likewise.
(c6x_expand_compare): Likewise.
(c6x_expand_movmem): Likewise.
* config/frv/frv.c (frv_trampoline_init): Likewise.
* config/i386/i386.c (ix86_trampoline_init): Likewise.
(ix86_expand_divmod_libfunc): Likewise.
* config/ia64/ia64.c (ia64_expand_tls_address): Likewise.
(ia64_expand_compare): Likewise.
(ia64_profile_hook): Likewise.
* config/ia64/ia64.md (save_stack_nonlocal): Likewise.
(nonlocal_goto): Likewise.
(restore_stack_nonlocal): Likewise.
* config/m32r/m32r.c (block_move_call): Likewise.
(m32r_trampoline_init): Likewise.
* config/m68k/linux.h (FINALIZE_TRAMPOLINE): Likewise.
* config/m68k/m68k.c (m68k_call_tls_get_addr): Likewise.
(m68k_call_m68k_read_tp): Likewise.
* config/microblaze/microblaze.c (microblaze_call_tls_get_addr)
(microblaze_expand_divide): Likewise.
* config/mips/mips.h (mips_args): Likewise.
* config/mips/sdemtk.h (mips_sync_icache): Likewise.
(MIPS_ICACHE_SYNC): Likewise.
* config/nios2/nios2.c (nios2_emit_expensive_div): Likewise.
(nios2_trampoline_init): Likewise.
* config/pa/pa.c (hppa_tls_call): Likewise.
(pa_trampoline_init): Likewise.
* config/pa/pa.md (canonicalize_funcptr_for_compare): Likewise.
* config/powerpcspe/powerpcspe.c (rs6000_legitimize_tls_address)
(expand_strn_compare): Likewise.
(rs6000_generate_compare): Likewise.
(rs6000_expand_float128_convert): Likewise.
(output_profile_hook): Likewise.
(rs6000_trampoline_init): Likewise.
* config/powerpcspe/powerpcspe.md (neg<mode>2): Likewise.
* config/riscv/riscv.h (PROFILE_HOOK): Likewise.
* config/rs6000/rs6000-string.c (expand_strn_compare): Likewise.
* config/rs6000/rs6000.c (rs6000_legitimize_tls_address): Likewise.
(rs6000_generate_compare): Likewise.
(rs6000_expand_float128_convert): Likewise.
(output_profile_hook): Likewise.
(rs6000_trampoline_init): Likewise.
* config/rs6000/rs6000.md (neg<mode>2): Likewise.
* config/sh/sh.c (sh_trampoline_init): Likewise.
* config/sparc/sparc.c (emit_soft_tfmode_libcall): Likewise.
(sparc_emit_float_lib_cmp): Likewise.
(sparc32_initialize_trampoline): Likewise.
(sparc64_initialize_trampoline): Likewise.
(sparc_profile_hook): Likewise.
* config/spu/spu.c (ea_load_store): Likewise.
* config/spu/spu.md (floatunssidf2): Likewise.
* config/tilegx/tilegx.c (tilegx_trampoline_init): Likewise.
* config/tilepro/tilepro.c (tilepro_trampoline_init): Likewise.
* config/visium/visium.c (expand_block_move_4): Likewise.
(expand_block_move_2): Likewise.
(expand_block_move_1): Likewise.
(expand_block_set_4): Likewise.
(expand_block_set_2): Likewise.
(expand_block_set_1): Likewise.
(visium_trampoline_init): Likewise.
(visium_profile_hook): Likewise.
* config/xtensa/xtensa.c (xtensa_expand_nonlocal_goto): Likewise.
(xtensa_setup_frame_addresses): Likewise.
(xtensa_trampoline_init): Likewise.
* except.c (sjlj_emit_function_enter): Likewise.
(sjlj_emit_function_exit): Likewise.
* explow.c (allocate_dynamic_stack_space): Likewise.
(probe_stack_range): Likewise.
* expr.c (convert_mode_scalar): Likewise.
* optabs.c (expand_binop): Likewise.
(expand_twoval_binop_libfunc): Likewise.
(expand_unop): Likewise.
(prepare_cmp_insn): Likewise.
(prepare_float_lib_cmp): Likewise.
(expand_float): Likewise.
(expand_fix): Likewise.
(expand_fixed_convert): Likewise.
(maybe_emit_sync_lock_test_and_set): Likewise.
(expand_atomic_compare_and_swap): Likewise.
(expand_mem_thread_fence): Likewise.
(expand_atomic_fetch_op): Likewise.

From-SVN: r251637
43 files changed:
gcc/ChangeLog
gcc/asan.c
gcc/builtins.c
gcc/calls.c
gcc/cfgexpand.c
gcc/config/aarch64/aarch64.c
gcc/config/aarch64/aarch64.h
gcc/config/alpha/alpha.c
gcc/config/arm/arm.c
gcc/config/bfin/bfin.md
gcc/config/c6x/c6x.c
gcc/config/frv/frv.c
gcc/config/i386/i386.c
gcc/config/ia64/ia64.c
gcc/config/ia64/ia64.md
gcc/config/m32r/m32r.c
gcc/config/m68k/linux.h
gcc/config/m68k/m68k.c
gcc/config/microblaze/microblaze.c
gcc/config/mips/mips.h
gcc/config/mips/sdemtk.h
gcc/config/nios2/nios2.c
gcc/config/pa/pa.c
gcc/config/pa/pa.md
gcc/config/powerpcspe/powerpcspe.c
gcc/config/powerpcspe/powerpcspe.md
gcc/config/riscv/riscv.h
gcc/config/rs6000/rs6000-string.c
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/rs6000.md
gcc/config/sh/sh.c
gcc/config/sparc/sparc.c
gcc/config/spu/spu.c
gcc/config/spu/spu.md
gcc/config/tilegx/tilegx.c
gcc/config/tilepro/tilepro.c
gcc/config/visium/visium.c
gcc/config/xtensa/xtensa.c
gcc/except.c
gcc/explow.c
gcc/expr.c
gcc/optabs.c
gcc/rtl.h