diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-09-04 07:30:53 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-09-04 07:30:53 +0000 |
commit | db69559bac8ab03ccddfe3a42be630e65c277812 (patch) | |
tree | 2cf080b045129f4dea972ab956100f6ec25bddbc /gcc/config/rs6000 | |
parent | 77701e2346bee936056ff33e1a94b214e359b4d2 (diff) | |
download | gcc-db69559bac8ab03ccddfe3a42be630e65c277812.zip gcc-db69559bac8ab03ccddfe3a42be630e65c277812.tar.gz gcc-db69559bac8ab03ccddfe3a42be630e65c277812.tar.bz2 |
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
Diffstat (limited to 'gcc/config/rs6000')
-rw-r--r-- | gcc/config/rs6000/rs6000-string.c | 8 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 24 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.md | 2 |
3 files changed, 16 insertions, 18 deletions
diff --git a/gcc/config/rs6000/rs6000-string.c b/gcc/config/rs6000/rs6000-string.c index b71a4a3..fb57ab3 100644 --- a/gcc/config/rs6000/rs6000-string.c +++ b/gcc/config/rs6000/rs6000-string.c @@ -843,7 +843,7 @@ expand_strn_compare (rtx operands[], int no_length) { tree fun = builtin_decl_explicit (BUILT_IN_STRCMP); emit_library_call_value (XEXP (DECL_RTL (fun), 0), - target, LCT_NORMAL, GET_MODE (target), 2, + target, LCT_NORMAL, GET_MODE (target), force_reg (Pmode, XEXP (src1, 0)), Pmode, force_reg (Pmode, XEXP (src2, 0)), Pmode); } @@ -862,7 +862,7 @@ expand_strn_compare (rtx operands[], int no_length) tree fun = builtin_decl_explicit (BUILT_IN_STRNCMP); emit_library_call_value (XEXP (DECL_RTL (fun), 0), - target, LCT_NORMAL, GET_MODE (target), 3, + target, LCT_NORMAL, GET_MODE (target), force_reg (Pmode, XEXP (src1, 0)), Pmode, force_reg (Pmode, XEXP (src2, 0)), Pmode, len_rtx, GET_MODE (len_rtx)); @@ -1109,7 +1109,7 @@ expand_strn_compare (rtx operands[], int no_length) { tree fun = builtin_decl_explicit (BUILT_IN_STRCMP); emit_library_call_value (XEXP (DECL_RTL (fun), 0), - target, LCT_NORMAL, GET_MODE (target), 2, + target, LCT_NORMAL, GET_MODE (target), force_reg (Pmode, XEXP (src1, 0)), Pmode, force_reg (Pmode, XEXP (src2, 0)), Pmode); } @@ -1124,7 +1124,7 @@ expand_strn_compare (rtx operands[], int no_length) emit_move_insn (len_rtx, GEN_INT (bytes - compare_length)); tree fun = builtin_decl_explicit (BUILT_IN_STRNCMP); emit_library_call_value (XEXP (DECL_RTL (fun), 0), - target, LCT_NORMAL, GET_MODE (target), 3, + target, LCT_NORMAL, GET_MODE (target), force_reg (Pmode, XEXP (src1, 0)), Pmode, force_reg (Pmode, XEXP (src2, 0)), Pmode, len_rtx, GET_MODE (len_rtx)); diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index cf744d8..a787a29 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -9233,7 +9233,7 @@ rs6000_legitimize_tls_address (rtx addr, enum tls_model model) { tga = rs6000_tls_get_addr (); emit_library_call_value (tga, dest, LCT_CONST, Pmode, - 1, const0_rtx, Pmode); + const0_rtx, Pmode); r3 = gen_rtx_REG (Pmode, 3); if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) @@ -9258,7 +9258,7 @@ rs6000_legitimize_tls_address (rtx addr, enum tls_model model) tga = rs6000_tls_get_addr (); tmp1 = gen_reg_rtx (Pmode); emit_library_call_value (tga, tmp1, LCT_CONST, Pmode, - 1, const0_rtx, Pmode); + const0_rtx, Pmode); r3 = gen_rtx_REG (Pmode, 3); if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) @@ -21887,7 +21887,7 @@ rs6000_generate_compare (rtx cmp, machine_mode mode) if (!check_nan) dest = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST, - SImode, 2, op0, mode, op1, mode); + SImode, op0, mode, op1, mode); /* The library signals an exception for signalling NaNs, so we need to handle isgreater, etc. by first checking isordered. */ @@ -21903,8 +21903,7 @@ rs6000_generate_compare (rtx cmp, machine_mode mode) /* Test for either value being a NaN. */ gcc_assert (unord_func); unord_dest = emit_library_call_value (unord_func, NULL_RTX, LCT_CONST, - SImode, 2, op0, mode, op1, - mode); + SImode, op0, mode, op1, mode); /* Set value (0) if either value is a NaN, and jump to the join label. */ @@ -21923,8 +21922,7 @@ rs6000_generate_compare (rtx cmp, machine_mode mode) /* Do the normal comparison, knowing that the values are not NaNs. */ normal_dest = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST, - SImode, 2, op0, mode, op1, - mode); + SImode, op0, mode, op1, mode); emit_insn (gen_cstoresi4 (dest, gen_rtx_fmt_ee (code, SImode, normal_dest, @@ -22287,8 +22285,8 @@ rs6000_expand_float128_convert (rtx dest, rtx src, bool unsigned_p) libfunc = convert_optab_libfunc (cvt, dest_mode, src_mode); gcc_assert (libfunc != NULL_RTX); - dest2 = emit_library_call_value (libfunc, dest, LCT_CONST, dest_mode, 1, src, - src_mode); + dest2 = emit_library_call_value (libfunc, dest, LCT_CONST, dest_mode, + src, src_mode); gcc_assert (dest2 != NULL_RTX); if (!rtx_equal_p (dest, dest2)) @@ -29928,7 +29926,7 @@ output_profile_hook (int labelno ATTRIBUTE_UNUSED) #endif if (NO_PROFILE_COUNTERS) emit_library_call (init_one_libfunc (RS6000_MCOUNT), - LCT_NORMAL, VOIDmode, 0); + LCT_NORMAL, VOIDmode); else { char buf[30]; @@ -29940,7 +29938,7 @@ output_profile_hook (int labelno ATTRIBUTE_UNUSED) fun = gen_rtx_SYMBOL_REF (Pmode, label_name); emit_library_call (init_one_libfunc (RS6000_MCOUNT), - LCT_NORMAL, VOIDmode, 1, fun, Pmode); + LCT_NORMAL, VOIDmode, fun, Pmode); } } else if (DEFAULT_ABI == ABI_DARWIN) @@ -29959,7 +29957,7 @@ output_profile_hook (int labelno ATTRIBUTE_UNUSED) caller_addr_regno = 0; #endif emit_library_call (gen_rtx_SYMBOL_REF (Pmode, mcount_name), - LCT_NORMAL, VOIDmode, 1, + LCT_NORMAL, VOIDmode, gen_rtx_REG (Pmode, caller_addr_regno), Pmode); } } @@ -32309,7 +32307,7 @@ rs6000_trampoline_init (rtx m_tramp, tree fndecl, rtx cxt) case ABI_DARWIN: case ABI_V4: emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__trampoline_setup"), - LCT_NORMAL, VOIDmode, 4, + LCT_NORMAL, VOIDmode, addr, Pmode, GEN_INT (rs6000_trampoline_size ()), SImode, fnaddr, Pmode, diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index f67e949..10ce014 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -7886,7 +7886,7 @@ { rtx libfunc = optab_libfunc (neg_optab, <MODE>mode); rtx target = emit_library_call_value (libfunc, operands[0], LCT_CONST, - <MODE>mode, 1, + <MODE>mode, operands[1], <MODE>mode); if (target && !rtx_equal_p (target, operands[0])) |