diff mbox series

PR82045: Avoid passing machine modes through "..."

Message ID 87efrq1q2v.fsf@linaro.org
State Accepted
Commit db69559bac8ab03ccddfe3a42be630e65c277812
Headers show
Series PR82045: Avoid passing machine modes through "..." | expand

Commit Message

Richard Sandiford Sept. 1, 2017, 1:55 p.m. UTC
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.

AFAICT this is the only place where we passed machine_modes this way.

Tested so far on aarch64-linux-gnu, powerpc64le-linux-gnu and
x86_64-linux-gnu.  Rainer also tested an earlier version on
sparc-sun-solaris2.11 (thanks).  Some multi-target testing is
still in progress.  OK to install if the remaining tests pass?

Richard


2017-09-01  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.

Comments

Jeff Law Sept. 4, 2017, 4:54 a.m. UTC | #1
On 09/01/2017 07:55 AM, Richard Sandiford wrote:
> 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.

> 

> AFAICT this is the only place where we passed machine_modes this way.

> 

> Tested so far on aarch64-linux-gnu, powerpc64le-linux-gnu and

> x86_64-linux-gnu.  Rainer also tested an earlier version on

> sparc-sun-solaris2.11 (thanks).  Some multi-target testing is

> still in progress.  OK to install if the remaining tests pass?

> 

> Richard

> 

> 

> 2017-09-01  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.

OK.
jeff
diff mbox series

Patch

Index: gcc/rtl.h
===================================================================
--- gcc/rtl.h	2017-08-30 16:28:10.775001395 +0100
+++ gcc/rtl.h	2017-09-01 14:49:15.762637329 +0100
@@ -3773,10 +3773,138 @@  enum libcall_type
   LCT_RETURNS_TWICE = 5
 };
 
-extern void emit_library_call (rtx, enum libcall_type, machine_mode, int,
-			       ...);
-extern rtx emit_library_call_value (rtx, rtx, enum libcall_type,
-				    machine_mode, int, ...);
+extern rtx emit_library_call_value_1 (int, rtx, rtx, enum libcall_type,
+				      machine_mode, int, rtx_mode_t *);
+
+/* Output a library call and discard the returned value.  FUN is the
+   address of the function, as a SYMBOL_REF rtx, and OUTMODE is the mode
+   of the (discarded) return value.  FN_TYPE is LCT_NORMAL for `normal'
+   calls, LCT_CONST for `const' calls, LCT_PURE for `pure' calls, or
+   another LCT_ value for other types of library calls.
+
+   There are different overloads of this function for different numbers
+   of arguments.  In each case the argument value is followed by its mode.  */
+
+inline void
+emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode)
+{
+  emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 0, NULL);
+}
+
+inline void
+emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode,
+		   rtx arg1, machine_mode arg1_mode)
+{
+  rtx_mode_t args[] = { rtx_mode_t (arg1, arg1_mode) };
+  emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 1, args);
+}
+
+inline void
+emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode,
+		   rtx arg1, machine_mode arg1_mode,
+		   rtx arg2, machine_mode arg2_mode)
+{
+  rtx_mode_t args[] = {
+    rtx_mode_t (arg1, arg1_mode),
+    rtx_mode_t (arg2, arg2_mode)
+  };
+  emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 2, args);
+}
+
+inline void
+emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode,
+		   rtx arg1, machine_mode arg1_mode,
+		   rtx arg2, machine_mode arg2_mode,
+		   rtx arg3, machine_mode arg3_mode)
+{
+  rtx_mode_t args[] = {
+    rtx_mode_t (arg1, arg1_mode),
+    rtx_mode_t (arg2, arg2_mode),
+    rtx_mode_t (arg3, arg3_mode)
+  };
+  emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 3, args);
+}
+
+inline void
+emit_library_call (rtx fun, libcall_type fn_type, machine_mode outmode,
+		   rtx arg1, machine_mode arg1_mode,
+		   rtx arg2, machine_mode arg2_mode,
+		   rtx arg3, machine_mode arg3_mode,
+		   rtx arg4, machine_mode arg4_mode)
+{
+  rtx_mode_t args[] = {
+    rtx_mode_t (arg1, arg1_mode),
+    rtx_mode_t (arg2, arg2_mode),
+    rtx_mode_t (arg3, arg3_mode),
+    rtx_mode_t (arg4, arg4_mode)
+  };
+  emit_library_call_value_1 (0, fun, NULL_RTX, fn_type, outmode, 4, args);
+}
+
+/* Like emit_library_call, but return the value produced by the call.
+   Use VALUE to store the result if it is nonnull, otherwise pick a
+   convenient location.  */
+
+inline rtx
+emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
+			 machine_mode outmode)
+{
+  return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 0, NULL);
+}
+
+inline rtx
+emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
+			 machine_mode outmode,
+			 rtx arg1, machine_mode arg1_mode)
+{
+  rtx_mode_t args[] = { rtx_mode_t (arg1, arg1_mode) };
+  return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 1, args);
+}
+
+inline rtx
+emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
+			 machine_mode outmode,
+			 rtx arg1, machine_mode arg1_mode,
+			 rtx arg2, machine_mode arg2_mode)
+{
+  rtx_mode_t args[] = {
+    rtx_mode_t (arg1, arg1_mode),
+    rtx_mode_t (arg2, arg2_mode)
+  };
+  return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 2, args);
+}
+
+inline rtx
+emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
+			 machine_mode outmode,
+			 rtx arg1, machine_mode arg1_mode,
+			 rtx arg2, machine_mode arg2_mode,
+			 rtx arg3, machine_mode arg3_mode)
+{
+  rtx_mode_t args[] = {
+    rtx_mode_t (arg1, arg1_mode),
+    rtx_mode_t (arg2, arg2_mode),
+    rtx_mode_t (arg3, arg3_mode)
+  };
+  return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 3, args);
+}
+
+inline rtx
+emit_library_call_value (rtx fun, rtx value, libcall_type fn_type,
+			 machine_mode outmode,
+			 rtx arg1, machine_mode arg1_mode,
+			 rtx arg2, machine_mode arg2_mode,
+			 rtx arg3, machine_mode arg3_mode,
+			 rtx arg4, machine_mode arg4_mode)
+{
+  rtx_mode_t args[] = {
+    rtx_mode_t (arg1, arg1_mode),
+    rtx_mode_t (arg2, arg2_mode),
+    rtx_mode_t (arg3, arg3_mode),
+    rtx_mode_t (arg4, arg4_mode)
+  };
+  return emit_library_call_value_1 (1, fun, value, fn_type, outmode, 4, args);
+}
 
 /* In varasm.c */
 extern void init_varasm_once (void);
Index: gcc/calls.c
===================================================================
--- gcc/calls.c	2017-08-30 16:26:42.813124082 +0100
+++ gcc/calls.c	2017-09-01 14:49:15.663681251 +0100
@@ -164,8 +164,6 @@  static void compute_argument_addresses (
 static rtx rtx_for_function_call (tree, tree);
 static void load_register_parameters (struct arg_data *, int, rtx *, int,
 				      int, int *);
-static rtx emit_library_call_value_1 (int, rtx, rtx, enum libcall_type,
-				      machine_mode, int, va_list);
 static int special_function_p (const_tree, int);
 static int check_sibcall_argument_overlap_1 (rtx);
 static int check_sibcall_argument_overlap (rtx_insn *, struct arg_data *, int);
@@ -4364,14 +4362,21 @@  split_complex_types (tree types)
   return types;
 }
 
-/* Output a library call to function FUN (a SYMBOL_REF rtx).
-   The RETVAL parameter specifies whether return value needs to be saved, other
-   parameters are documented in the emit_library_call function below.  */
+/* Output a library call to function ORGFUN (a SYMBOL_REF rtx)
+   for a value of mode OUTMODE,
+   with NARGS different arguments, passed as ARGS.
+   Store the return value if RETVAL is nonzero: store it in VALUE if
+   VALUE is nonnull, otherwise pick a convenient location.  In either
+   case return the location of the stored value.
 
-static rtx
+   FN_TYPE should be LCT_NORMAL for `normal' calls, LCT_CONST for
+   `const' calls, LCT_PURE for `pure' calls, or another LCT_ value for
+   other types of library calls.  */
+
+rtx
 emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
 			   enum libcall_type fn_type,
-			   machine_mode outmode, int nargs, va_list p)
+			   machine_mode outmode, int nargs, rtx_mode_t *args)
 {
   /* Total size in bytes of all the stack-parms scanned so far.  */
   struct args_size args_size;
@@ -4553,10 +4558,10 @@  emit_library_call_value_1 (int retval, r
       count++;
     }
 
-  for (; count < nargs; count++)
+  for (unsigned int i = 0; count < nargs; i++, count++)
     {
-      rtx val = va_arg (p, rtx);
-      machine_mode mode = (machine_mode) va_arg (p, int);
+      rtx val = args[i].first;
+      machine_mode mode = args[i].second;
       int unsigned_p = 0;
 
       /* We cannot convert the arg value to the mode the library wants here;
@@ -5128,51 +5133,6 @@  emit_library_call_value_1 (int retval, r
 
 }
 
-/* Output a library call to function FUN (a SYMBOL_REF rtx)
-   (emitting the queue unless NO_QUEUE is nonzero),
-   for a value of mode OUTMODE,
-   with NARGS different arguments, passed as alternating rtx values
-   and machine_modes to convert them to.
-
-   FN_TYPE should be LCT_NORMAL for `normal' calls, LCT_CONST for
-   `const' calls, LCT_PURE for `pure' calls, or other LCT_ value for
-   other types of library calls.  */
-
-void
-emit_library_call (rtx orgfun, enum libcall_type fn_type,
-		   machine_mode outmode, int nargs, ...)
-{
-  va_list p;
-
-  va_start (p, nargs);
-  emit_library_call_value_1 (0, orgfun, NULL_RTX, fn_type, outmode, nargs, p);
-  va_end (p);
-}
-
-/* Like emit_library_call except that an extra argument, VALUE,
-   comes second and says where to store the result.
-   (If VALUE is zero, this function chooses a convenient way
-   to return the value.
-
-   This function returns an rtx for where the value is to be found.
-   If VALUE is nonzero, VALUE is returned.  */
-
-rtx
-emit_library_call_value (rtx orgfun, rtx value,
-			 enum libcall_type fn_type,
-			 machine_mode outmode, int nargs, ...)
-{
-  rtx result;
-  va_list p;
-
-  va_start (p, nargs);
-  result = emit_library_call_value_1 (1, orgfun, value, fn_type, outmode,
-				      nargs, p);
-  va_end (p);
-
-  return result;
-}
-
 
 /* Store pointer bounds argument ARG  into Bounds Table entry
    associated with PARM.  */
Index: gcc/asan.c
===================================================================
--- gcc/asan.c	2017-08-16 08:50:32.602449576 +0100
+++ gcc/asan.c	2017-09-01 14:49:15.661796373 +0100
@@ -1347,7 +1347,7 @@  asan_emit_stack_protection (rtx base, rt
       snprintf (buf, sizeof buf, "__asan_stack_malloc_%d",
 		use_after_return_class);
       ret = init_one_libfunc (buf);
-      ret = emit_library_call_value (ret, NULL_RTX, LCT_NORMAL, ptr_mode, 1,
+      ret = emit_library_call_value (ret, NULL_RTX, LCT_NORMAL, ptr_mode,
 				     GEN_INT (asan_frame_size
 					      + base_align_bias),
 				     TYPE_MODE (pointer_sized_int_node));
@@ -1477,7 +1477,7 @@  asan_emit_stack_protection (rtx base, rt
 	  ret = init_one_libfunc (buf);
 	  rtx addr = convert_memory_address (ptr_mode, base);
 	  rtx orig_addr = convert_memory_address (ptr_mode, orig_base);
-	  emit_library_call (ret, LCT_NORMAL, ptr_mode, 3, addr, ptr_mode,
+	  emit_library_call (ret, LCT_NORMAL, ptr_mode, addr, ptr_mode,
 			     GEN_INT (asan_frame_size + base_align_bias),
 			     TYPE_MODE (pointer_sized_int_node),
 			     orig_addr, ptr_mode);
@@ -1573,8 +1573,8 @@  asan_emit_allocas_unpoison (rtx top, rtx
   rtx ret = init_one_libfunc ("__asan_allocas_unpoison");
   top = convert_memory_address (ptr_mode, top);
   bot = convert_memory_address (ptr_mode, bot);
-  ret = emit_library_call_value (ret, NULL_RTX, LCT_NORMAL, ptr_mode, 2, top,
-				 ptr_mode, bot, ptr_mode);
+  ret = emit_library_call_value (ret, NULL_RTX, LCT_NORMAL, ptr_mode,
+				 top, ptr_mode, bot, ptr_mode);
 
   do_pending_stack_adjust ();
   rtx_insn *insns = get_insns ();
Index: gcc/builtins.c
===================================================================
--- gcc/builtins.c	2017-08-30 12:18:46.601840959 +0100
+++ gcc/builtins.c	2017-09-01 14:49:15.663681251 +0100
@@ -2768,7 +2768,7 @@  expand_builtin_powi (tree exp, rtx targe
     op1 = convert_to_mode (mode2, op1, 0);
 
   target = emit_library_call_value (optab_libfunc (powi_optab, mode),
-				    target, LCT_CONST, mode, 2,
+				    target, LCT_CONST, mode,
 				    op0, mode, op1, mode2);
 
   return target;
@@ -4909,8 +4909,8 @@  expand_asan_emit_allocas_unpoison (tree
   rtx top = expand_expr (arg0, NULL_RTX, ptr_mode, EXPAND_NORMAL);
   rtx bot = convert_memory_address (ptr_mode, virtual_stack_dynamic_rtx);
   rtx ret = init_one_libfunc ("__asan_allocas_unpoison");
-  ret = emit_library_call_value (ret, NULL_RTX, LCT_NORMAL, ptr_mode, 2, top,
-				 ptr_mode, bot, ptr_mode);
+  ret = emit_library_call_value (ret, NULL_RTX, LCT_NORMAL, ptr_mode,
+				 top, ptr_mode, bot, ptr_mode);
   return ret;
 }
 
Index: gcc/cfgexpand.c
===================================================================
--- gcc/cfgexpand.c	2017-08-30 12:19:09.845221513 +0100
+++ gcc/cfgexpand.c	2017-09-01 14:49:15.664623690 +0100
@@ -6079,7 +6079,7 @@  expand_main_function (void)
      || (!defined(HAS_INIT_SECTION)			\
 	 && !defined(INIT_SECTION_ASM_OP)		\
 	 && !defined(INIT_ARRAY_SECTION_ASM_OP)))
-  emit_library_call (init_one_libfunc (NAME__MAIN), LCT_NORMAL, VOIDmode, 0);
+  emit_library_call (init_one_libfunc (NAME__MAIN), LCT_NORMAL, VOIDmode);
 #endif
 }
 
Index: gcc/config/aarch64/aarch64.c
===================================================================
--- gcc/config/aarch64/aarch64.c	2017-08-31 11:11:34.189935493 +0100
+++ gcc/config/aarch64/aarch64.c	2017-09-01 14:49:15.670278323 +0100
@@ -5977,7 +5977,7 @@  aarch64_trampoline_init (rtx m_tramp, tr
      gen_clear_cache().  */
   a_tramp = XEXP (m_tramp, 0);
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_cache"),
-		     LCT_NORMAL, VOIDmode, 2, a_tramp, ptr_mode,
+		     LCT_NORMAL, VOIDmode, a_tramp, ptr_mode,
 		     plus_constant (ptr_mode, a_tramp, TRAMPOLINE_SIZE),
 		     ptr_mode);
 }
Index: gcc/config/aarch64/aarch64.h
===================================================================
--- gcc/config/aarch64/aarch64.h	2017-08-29 20:01:08.275372151 +0100
+++ gcc/config/aarch64/aarch64.h	2017-09-01 14:49:15.670278323 +0100
@@ -857,7 +857,7 @@  #define PROFILE_HOOK(LABEL)						\
     rtx fun, lr;							\
     lr = get_hard_reg_initial_val (Pmode, LR_REGNUM);			\
     fun = gen_rtx_SYMBOL_REF (Pmode, MCOUNT_NAME);			\
-    emit_library_call (fun, LCT_NORMAL, VOIDmode, 1, lr, Pmode);	\
+    emit_library_call (fun, LCT_NORMAL, VOIDmode, lr, Pmode);		\
   }
 
 /* All the work done in PROFILE_HOOK, but still required.  */
Index: gcc/config/alpha/alpha.c
===================================================================
--- gcc/config/alpha/alpha.c	2017-08-30 12:20:21.796623888 +0100
+++ gcc/config/alpha/alpha.c	2017-09-01 14:49:15.671220762 +0100
@@ -5562,7 +5562,7 @@  alpha_trampoline_init (rtx m_tramp, tree
       emit_insn (gen_imb ());
 #ifdef HAVE_ENABLE_EXECUTE_STACK
       emit_library_call (init_one_libfunc ("__enable_execute_stack"),
-			 LCT_NORMAL, VOIDmode, 1, XEXP (m_tramp, 0), Pmode);
+			 LCT_NORMAL, VOIDmode, XEXP (m_tramp, 0), Pmode);
 #endif
     }
 }
Index: gcc/config/arm/arm.c
===================================================================
--- gcc/config/arm/arm.c	2017-08-30 12:20:31.685622402 +0100
+++ gcc/config/arm/arm.c	2017-09-01 14:49:15.682530028 +0100
@@ -3888,7 +3888,7 @@  arm_trampoline_init (rtx m_tramp, tree f
 
   a_tramp = XEXP (m_tramp, 0);
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_cache"),
-		     LCT_NORMAL, VOIDmode, 2, a_tramp, Pmode,
+		     LCT_NORMAL, VOIDmode, a_tramp, Pmode,
 		     plus_constant (Pmode, a_tramp, TRAMPOLINE_SIZE), Pmode);
 }
 
@@ -8364,7 +8364,7 @@  arm_call_tls_get_addr (rtx x, rtx reg, r
 
   *valuep = emit_library_call_value (get_tls_get_addr (), NULL_RTX,
 				     LCT_PURE, /* LCT_CONST?  */
-				     Pmode, 1, reg, Pmode);
+				     Pmode, reg, Pmode);
 
   rtx_insn *insns = get_insns ();
   end_sequence ();
@@ -31101,7 +31101,7 @@  arm_expand_divmod_libfunc (rtx libfunc,
     = smallest_int_mode_for_size (2 * GET_MODE_BITSIZE (mode));
 
   rtx libval = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST,
-					libval_mode, 2,
+					libval_mode,
 					op0, GET_MODE (op0),
 					op1, GET_MODE (op1));
 
Index: gcc/config/bfin/bfin.md
===================================================================
--- gcc/config/bfin/bfin.md	2017-02-23 19:54:26.000000000 +0000
+++ gcc/config/bfin/bfin.md	2017-09-01 14:49:15.682530028 +0100
@@ -1578,7 +1578,7 @@  (define_expand "umulsi3_highpart"
 
       emit_library_call_value (umulsi3_highpart_libfunc,
 			       operands[0], LCT_NORMAL, SImode,
-			       2, operands[1], SImode, operands[2], SImode);
+			       operands[1], SImode, operands[2], SImode);
     }
   DONE;
 })
@@ -1628,7 +1628,7 @@  (define_expand "smulsi3_highpart"
 
       emit_library_call_value (smulsi3_highpart_libfunc,
 			       operands[0], LCT_NORMAL, SImode,
-			       2, operands[1], SImode, operands[2], SImode);
+			       operands[1], SImode, operands[2], SImode);
     }
   DONE;
 })
Index: gcc/config/c6x/c6x.c
===================================================================
--- gcc/config/c6x/c6x.c	2017-08-30 12:20:31.686622402 +0100
+++ gcc/config/c6x/c6x.c	2017-09-01 14:49:15.683472467 +0100
@@ -739,9 +739,8 @@  c6x_initialize_trampoline (rtx tramp, tr
 #ifdef CLEAR_INSN_CACHE
   tramp = XEXP (tramp, 0);
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__gnu_clear_cache"),
-		     LCT_NORMAL, VOIDmode, 2, tramp, Pmode,
-		     plus_constant (Pmode, tramp, TRAMPOLINE_SIZE),
-		     Pmode);
+		     LCT_NORMAL, VOIDmode, tramp, Pmode,
+		     plus_constant (Pmode, tramp, TRAMPOLINE_SIZE), Pmode);
 #endif
 }
 
@@ -1592,7 +1591,7 @@  c6x_expand_compare (rtx comparison, mach
 	    }
 	  start_sequence ();
 
-	  cmp = emit_library_call_value (libfunc, 0, LCT_CONST, SImode, 2,
+	  cmp = emit_library_call_value (libfunc, 0, LCT_CONST, SImode,
 					 op0, op_mode, op1, op_mode);
 	  insns = get_insns ();
 	  end_sequence ();
@@ -1728,7 +1727,7 @@  c6x_expand_movmem (rtx dst, rtx src, rtx
 	mark_addressable (src_expr);
       if (dst_expr)
 	mark_addressable (dst_expr);
-      emit_library_call (fn, LCT_NORMAL, VOIDmode, 3,
+      emit_library_call (fn, LCT_NORMAL, VOIDmode,
 			 dstreg, Pmode, srcreg, Pmode, count_exp, SImode);
       return true;
     }
Index: gcc/config/frv/frv.c
===================================================================
--- gcc/config/frv/frv.c	2017-08-30 12:08:15.979691213 +0100
+++ gcc/config/frv/frv.c	2017-09-01 14:49:15.684414906 +0100
@@ -6241,7 +6241,7 @@  frv_trampoline_init (rtx m_tramp, tree f
   rtx sc_reg = force_reg (Pmode, static_chain);
 
   emit_library_call (gen_rtx_SYMBOL_REF (SImode, "__trampoline_setup"),
-		     LCT_NORMAL, VOIDmode, 4,
+		     LCT_NORMAL, VOIDmode,
 		     addr, Pmode,
 		     GEN_INT (frv_trampoline_size ()), SImode,
 		     fnaddr, Pmode,
Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c	2017-08-30 12:20:31.690622401 +0100
+++ gcc/config/i386/i386.c	2017-09-01 14:49:15.701378805 +0100
@@ -31806,7 +31806,7 @@  ix86_trampoline_init (rtx m_tramp, tree
   if (CHECK_EXECUTE_STACK_ENABLED)
 #endif
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__enable_execute_stack"),
-		     LCT_NORMAL, VOIDmode, 1, XEXP (m_tramp, 0), Pmode);
+		     LCT_NORMAL, VOIDmode, XEXP (m_tramp, 0), Pmode);
 #endif
 }
 
@@ -52414,10 +52414,10 @@  ix86_expand_divmod_libfunc (rtx libfunc,
   rtx rem = assign_386_stack_local (mode, SLOT_TEMP);
 
   rtx quot = emit_library_call_value (libfunc, NULL_RTX, LCT_NORMAL,
-				    mode, 3,
-				    op0, GET_MODE (op0),
-				    op1, GET_MODE (op1),
-				    XEXP (rem, 0), Pmode);
+				      mode,
+				      op0, GET_MODE (op0),
+				      op1, GET_MODE (op1),
+				      XEXP (rem, 0), Pmode);
   *quot_p = quot;
   *rem_p = rem;
 }
Index: gcc/config/ia64/ia64.c
===================================================================
--- gcc/config/ia64/ia64.c	2017-08-30 12:20:21.805623886 +0100
+++ gcc/config/ia64/ia64.c	2017-09-01 14:49:15.702321244 +0100
@@ -1202,8 +1202,8 @@  ia64_expand_tls_address (enum tls_model
       emit_insn (gen_load_dtprel (tga_op2, op1));
 
       tga_ret = emit_library_call_value (gen_tls_get_addr (), NULL_RTX,
-					 LCT_CONST, Pmode, 2, tga_op1,
-					 Pmode, tga_op2, Pmode);
+					 LCT_CONST, Pmode,
+					 tga_op1, Pmode, tga_op2, Pmode);
 
       insns = get_insns ();
       end_sequence ();
@@ -1226,8 +1226,8 @@  ia64_expand_tls_address (enum tls_model
       tga_op2 = const0_rtx;
 
       tga_ret = emit_library_call_value (gen_tls_get_addr (), NULL_RTX,
-					 LCT_CONST, Pmode, 2, tga_op1,
-					 Pmode, tga_op2, Pmode);
+					 LCT_CONST, Pmode,
+					 tga_op1, Pmode, tga_op2, Pmode);
 
       insns = get_insns ();
       end_sequence ();
@@ -1836,7 +1836,7 @@  ia64_expand_compare (rtx *expr, rtx *op0
 
       start_sequence ();
 
-      ret = emit_library_call_value (cmptf_libfunc, 0, LCT_CONST, DImode, 3,
+      ret = emit_library_call_value (cmptf_libfunc, 0, LCT_CONST, DImode,
 				     *op0, TFmode, *op1, TFmode,
 				     GEN_INT (magic), DImode);
       cmp = gen_reg_rtx (BImode);
@@ -11101,7 +11101,7 @@  ia64_profile_hook (int labelno)
   ip = gen_reg_rtx (Pmode);
   emit_insn (gen_ip_value (ip));
   emit_library_call (gen_mcount_func_rtx (), LCT_NORMAL,
-                     VOIDmode, 3,
+                     VOIDmode,
 		     gen_rtx_REG (Pmode, BR_REG (0)), Pmode,
 		     ip, Pmode,
 		     label, Pmode);
Index: gcc/config/ia64/ia64.md
===================================================================
--- gcc/config/ia64/ia64.md	2017-02-23 19:54:23.000000000 +0000
+++ gcc/config/ia64/ia64.md	2017-09-01 14:49:15.703263682 +0100
@@ -5056,7 +5056,7 @@  (define_expand "save_stack_nonlocal"
 {
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode,
 					 \"__ia64_save_stack_nonlocal\"),
-		     LCT_NORMAL, VOIDmode, 2, XEXP (operands[0], 0), Pmode,
+		     LCT_NORMAL, VOIDmode, XEXP (operands[0], 0), Pmode,
 		     operands[1], Pmode);
   DONE;
 })
@@ -5069,7 +5069,7 @@  (define_expand "nonlocal_goto"
   ""
 {
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, \"__ia64_nonlocal_goto\"),
-		     LCT_NORETURN, VOIDmode, 3,
+		     LCT_NORETURN, VOIDmode,
 		     operands[1], Pmode,
 		     copy_to_reg (XEXP (operands[2], 0)), Pmode,
 		     operands[3], Pmode);
@@ -5134,7 +5134,7 @@  (define_expand "restore_stack_nonlocal"
 {
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode,
 					 "__ia64_restore_stack_nonlocal"),
-		     LCT_NORMAL, VOIDmode, 1,
+		     LCT_NORMAL, VOIDmode,
 		     copy_to_reg (XEXP (operands[1], 0)), Pmode);
   DONE;
 })
Index: gcc/config/m32r/m32r.c
===================================================================
--- gcc/config/m32r/m32r.c	2017-08-29 20:01:08.126372143 +0100
+++ gcc/config/m32r/m32r.c	2017-09-01 14:49:15.703263682 +0100
@@ -2493,7 +2493,7 @@  block_move_call (rtx dest_reg, rtx src_r
     bytes_rtx = convert_to_mode (Pmode, bytes_rtx, 1);
 
   emit_library_call (m32r_function_symbol ("memcpy"), LCT_NORMAL,
-		     VOIDmode, 3, dest_reg, Pmode, src_reg, Pmode,
+		     VOIDmode, dest_reg, Pmode, src_reg, Pmode,
 		     convert_to_mode (TYPE_MODE (sizetype), bytes_rtx,
 				      TYPE_UNSIGNED (sizetype)),
 		     TYPE_MODE (sizetype));
@@ -2796,7 +2796,7 @@  m32r_trampoline_init (rtx m_tramp, tree
 		gen_int_mode (m32r_cache_flush_trap, SImode)));
   else if (m32r_cache_flush_func && m32r_cache_flush_func[0])
     emit_library_call (m32r_function_symbol (m32r_cache_flush_func),
-		       LCT_NORMAL, VOIDmode, 3, XEXP (m_tramp, 0), Pmode,
+		       LCT_NORMAL, VOIDmode, XEXP (m_tramp, 0), Pmode,
 		       gen_int_mode (TRAMPOLINE_SIZE, SImode), SImode,
 		       GEN_INT (3), SImode);
 }
Index: gcc/config/m68k/linux.h
===================================================================
--- gcc/config/m68k/linux.h	2017-02-23 19:54:23.000000000 +0000
+++ gcc/config/m68k/linux.h	2017-09-01 14:49:15.704206121 +0100
@@ -192,8 +192,8 @@  #define DEFAULT_PCC_STRUCT_RETURN 0
 #undef FINALIZE_TRAMPOLINE
 #define FINALIZE_TRAMPOLINE(TRAMP)					\
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_cache"),	\
-		     LCT_NORMAL, VOIDmode, 2, TRAMP, Pmode,		\
-		     plus_constant (Pmode, TRAMP, TRAMPOLINE_SIZE), \
+		     LCT_NORMAL, VOIDmode, TRAMP, Pmode,		\
+		     plus_constant (Pmode, TRAMP, TRAMPOLINE_SIZE), 	\
 		     Pmode);
 
 /* Clear the instruction cache from `beg' to `end'.  This makes an
Index: gcc/config/m68k/m68k.c
===================================================================
--- gcc/config/m68k/m68k.c	2017-08-30 12:08:15.987754412 +0100
+++ gcc/config/m68k/m68k.c	2017-09-01 14:49:15.704206121 +0100
@@ -2540,7 +2540,7 @@  m68k_call_tls_get_addr (rtx x, rtx eqv,
 
   m68k_libcall_value_in_a0_p = true;
   a0 = emit_library_call_value (m68k_get_tls_get_addr (), NULL_RTX, LCT_PURE,
-				Pmode, 1, x, Pmode);
+				Pmode, x, Pmode);
   m68k_libcall_value_in_a0_p = false;
   
   insns = get_insns ();
@@ -2589,7 +2589,7 @@  m68k_call_m68k_read_tp (void)
   /* Emit the call sequence.  */
   m68k_libcall_value_in_a0_p = true;
   a0 = emit_library_call_value (m68k_get_m68k_read_tp (), NULL_RTX, LCT_PURE,
-				Pmode, 0);
+				Pmode);
   m68k_libcall_value_in_a0_p = false;
   insns = get_insns ();
   end_sequence ();
Index: gcc/config/microblaze/microblaze.c
===================================================================
--- gcc/config/microblaze/microblaze.c	2017-08-30 12:08:15.988762312 +0100
+++ gcc/config/microblaze/microblaze.c	2017-09-01 14:49:15.705148560 +0100
@@ -585,7 +585,7 @@  microblaze_call_tls_get_addr (rtx x, rtx
 
   *valuep = emit_library_call_value (get_tls_get_addr (), NULL_RTX,
                                      LCT_PURE, /* LCT_CONST?  */
-                                     Pmode, 1, reg, Pmode);
+                                     Pmode, reg, Pmode);
 
   insns = get_insns ();
   end_sequence ();
@@ -3560,10 +3560,10 @@  microblaze_expand_divide (rtx operands[]
 
   emit_label (div_label);
   ret = emit_library_call_value (gen_rtx_SYMBOL_REF (Pmode, "__divsi3"), 
-				       operands[0], LCT_NORMAL, 
-				       GET_MODE (operands[0]), 2, operands[1], 
-				       GET_MODE (operands[1]), operands[2], 
-				       GET_MODE (operands[2]));
+				 operands[0], LCT_NORMAL,
+				 GET_MODE (operands[0]),
+				 operands[1], GET_MODE (operands[1]),
+				 operands[2], GET_MODE (operands[2]));
   if (ret != operands[0])
                 emit_move_insn (operands[0], ret);    
 
Index: gcc/config/mips/mips.h
===================================================================
--- gcc/config/mips/mips.h	2017-08-29 20:01:08.275372151 +0100
+++ gcc/config/mips/mips.h	2017-09-01 14:49:15.706090999 +0100
@@ -2603,7 +2603,7 @@  #define MIPS_ICACHE_SYNC(ADDR, SIZE)
   /* 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),	\
-		     LCT_NORMAL, VOIDmode, 3, ADDR, Pmode, SIZE, Pmode,	\
+		     LCT_NORMAL, VOIDmode, ADDR, Pmode, SIZE, Pmode,	\
 		     GEN_INT (3), TYPE_MODE (integer_type_node))
 
 
Index: gcc/config/mips/sdemtk.h
===================================================================
--- gcc/config/mips/sdemtk.h	2017-02-23 19:54:26.000000000 +0000
+++ gcc/config/mips/sdemtk.h	2017-09-01 14:49:15.706090999 +0100
@@ -70,7 +70,7 @@  #define CACHE_FLUSH_FUNC "mips_sync_icac
 #undef MIPS_ICACHE_SYNC
 #define MIPS_ICACHE_SYNC(ADDR, SIZE)					\
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, mips_cache_flush_func),	\
-		     LCT_NORMAL, VOIDmode, 2, ADDR, Pmode,		\
+		     LCT_NORMAL, VOIDmode, ADDR, Pmode,			\
 		     SIZE, TYPE_MODE (sizetype))
 
 /* This version of _mcount does not pop 2 words from the stack.  */
Index: gcc/config/nios2/nios2.c
===================================================================
--- gcc/config/nios2/nios2.c	2017-08-29 20:01:07.357372103 +0100
+++ gcc/config/nios2/nios2.c	2017-09-01 14:49:15.707033438 +0100
@@ -1734,7 +1734,7 @@  nios2_emit_expensive_div (rtx *operands,
 
   start_sequence ();
   final_result = emit_library_call_value (libfunc, NULL_RTX,
-                                          LCT_CONST, SImode, 2,
+                                          LCT_CONST, SImode,
                                           operands[1], SImode,
                                           operands[2], SImode);
 
@@ -3025,7 +3025,7 @@  nios2_trampoline_init (rtx m_tramp, tree
   rtx addr = force_reg (Pmode, XEXP (m_tramp, 0));
 
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__trampoline_setup"),
-		     LCT_NORMAL, VOIDmode, 3, addr, Pmode, fnaddr, Pmode,
+		     LCT_NORMAL, VOIDmode, addr, Pmode, fnaddr, Pmode,
 		     ctx_reg, Pmode);
 }
 
Index: gcc/config/pa/pa.c
===================================================================
--- gcc/config/pa/pa.c	2017-08-30 12:20:21.808623886 +0100
+++ gcc/config/pa/pa.c	2017-09-01 14:49:15.707975877 +0100
@@ -906,7 +906,7 @@  hppa_tls_call (rtx arg)
 
   ret = gen_reg_rtx (Pmode);
   emit_library_call_value (gen_tls_get_addr (), ret,
-		  	   LCT_CONST, Pmode, 1, arg, Pmode);
+			   LCT_CONST, Pmode, arg, Pmode);
 
   return ret;
 }
@@ -10192,7 +10192,7 @@  pa_trampoline_init (rtx m_tramp, tree fn
 
 #ifdef HAVE_ENABLE_EXECUTE_STACK
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__enable_execute_stack"),
-		     LCT_NORMAL, VOIDmode, 1, XEXP (m_tramp, 0), Pmode);
+		     LCT_NORMAL, VOIDmode, XEXP (m_tramp, 0), Pmode);
 #endif
 }
 
Index: gcc/config/pa/pa.md
===================================================================
--- gcc/config/pa/pa.md	2017-05-24 11:10:23.161110079 +0100
+++ gcc/config/pa/pa.md	2017-09-01 14:49:15.709860754 +0100
@@ -9637,7 +9637,7 @@  (define_expand "canonicalize_funcptr_for
 
       emit_library_call_value (canonicalize_funcptr_for_compare_libfunc,
       			       operands[0], LCT_NORMAL, Pmode,
-			       1, operands[1], Pmode);
+			       operands[1], Pmode);
       DONE;
     }
 
Index: gcc/config/powerpcspe/powerpcspe.c
===================================================================
--- gcc/config/powerpcspe/powerpcspe.c	2017-08-30 12:20:31.695622401 +0100
+++ gcc/config/powerpcspe/powerpcspe.c	2017-09-01 14:49:15.723997337 +0100
@@ -9694,7 +9694,7 @@  rs6000_legitimize_tls_address (rtx addr,
 	{
 	  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)
@@ -9719,7 +9719,7 @@  rs6000_legitimize_tls_address (rtx addr,
 	  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)
@@ -20417,7 +20417,7 @@  expand_strn_compare (rtx operands[], int
 	{
 	  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);
 	}
@@ -20436,7 +20436,7 @@  expand_strn_compare (rtx operands[], int
 
 	  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));
@@ -20683,7 +20683,7 @@  expand_strn_compare (rtx operands[], int
 	{
 	  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);
 	}
@@ -20698,7 +20698,7 @@  expand_strn_compare (rtx operands[], int
 	  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));
@@ -24720,7 +24720,7 @@  rs6000_generate_compare (rtx cmp, machin
 
       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.  */
@@ -24736,8 +24736,7 @@  rs6000_generate_compare (rtx cmp, machin
 	  /* 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.  */
@@ -24756,8 +24755,7 @@  rs6000_generate_compare (rtx cmp, machin
 	  /* 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,
@@ -25121,8 +25119,8 @@  rs6000_expand_float128_convert (rtx dest
       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))
@@ -33083,7 +33081,7 @@  output_profile_hook (int labelno ATTRIBU
 #endif
       if (NO_PROFILE_COUNTERS)
 	emit_library_call (init_one_libfunc (RS6000_MCOUNT),
-			   LCT_NORMAL, VOIDmode, 0);
+			   LCT_NORMAL, VOIDmode);
       else
 	{
 	  char buf[30];
@@ -33095,7 +33093,7 @@  output_profile_hook (int labelno ATTRIBU
 	  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)
@@ -33114,7 +33112,7 @@  output_profile_hook (int labelno ATTRIBU
 	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);
     }
 }
@@ -35464,7 +35462,7 @@  rs6000_trampoline_init (rtx m_tramp, tre
     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,
Index: gcc/config/powerpcspe/powerpcspe.md
===================================================================
--- gcc/config/powerpcspe/powerpcspe.md	2017-08-29 20:01:07.760372124 +0100
+++ gcc/config/powerpcspe/powerpcspe.md	2017-09-01 14:49:15.728709531 +0100
@@ -7997,7 +7997,7 @@  (define_expand "neg<mode>2"
 	{
 	  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]))
Index: gcc/config/riscv/riscv.h
===================================================================
--- gcc/config/riscv/riscv.h	2017-08-29 20:01:08.126372143 +0100
+++ gcc/config/riscv/riscv.h	2017-09-01 14:49:15.728709531 +0100
@@ -340,7 +340,7 @@  #define PROFILE_HOOK(LABEL)						\
     rtx fun, ra;							\
     ra = get_hard_reg_initial_val (Pmode, RETURN_ADDR_REGNUM);		\
     fun = gen_rtx_SYMBOL_REF (Pmode, MCOUNT_NAME);			\
-    emit_library_call (fun, LCT_NORMAL, VOIDmode, 1, ra, Pmode);	\
+    emit_library_call (fun, LCT_NORMAL, VOIDmode, ra, Pmode);		\
   }
 
 /* All the work done in PROFILE_HOOK, but still required.  */
Index: gcc/config/rs6000/rs6000-string.c
===================================================================
--- gcc/config/rs6000/rs6000-string.c	2017-08-30 12:08:15.999849211 +0100
+++ gcc/config/rs6000/rs6000-string.c	2017-09-01 14:49:15.729651970 +0100
@@ -843,7 +843,7 @@  expand_strn_compare (rtx operands[], int
 	{
 	  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
 
 	  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
 	{
 	  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
 	  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));
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	2017-08-31 07:32:43.678061469 +0100
+++ gcc/config/rs6000/rs6000.c	2017-09-01 14:49:15.737191481 +0100
@@ -9233,7 +9233,7 @@  rs6000_legitimize_tls_address (rtx addr,
 	{
 	  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,
 	  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, machin
 
       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, machin
 	  /* 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, machin
 	  /* 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
       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 ATTRIBU
 #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 ATTRIBU
 	  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 ATTRIBU
 	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, tre
     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,
Index: gcc/config/rs6000/rs6000.md
===================================================================
--- gcc/config/rs6000/rs6000.md	2017-08-31 07:32:43.679061469 +0100
+++ gcc/config/rs6000/rs6000.md	2017-09-01 14:49:15.740961236 +0100
@@ -7886,7 +7886,7 @@  (define_expand "neg<mode>2"
 	{
 	  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]))
Index: gcc/config/sh/sh.c
===================================================================
--- gcc/config/sh/sh.c	2017-08-30 12:08:16.005896611 +0100
+++ gcc/config/sh/sh.c	2017-09-01 14:49:15.744730991 +0100
@@ -10090,7 +10090,7 @@  sh_trampoline_init (rtx tramp_mem, tree
 	  || (!(TARGET_SH4A || TARGET_SH4_300) && TARGET_USERMODE))
 	emit_library_call (function_symbol (NULL, "__ic_invalidate",
 					    FUNCTION_ORDINARY).sym,
-			   LCT_NORMAL, VOIDmode, 1, tramp, SImode);
+			   LCT_NORMAL, VOIDmode, tramp, SImode);
       else
 	emit_insn (gen_ic_invalidate_line (tramp));
     }
Index: gcc/config/sparc/sparc.c
===================================================================
--- gcc/config/sparc/sparc.c	2017-08-30 12:20:31.699622400 +0100
+++ gcc/config/sparc/sparc.c	2017-09-01 14:49:15.747558308 +0100
@@ -3399,11 +3399,11 @@  emit_soft_tfmode_libcall (const char *fu
   if (GET_MODE (operands[0]) == TFmode)
     {
       if (nargs == 2)
-	emit_library_call (func_sym, LCT_NORMAL, VOIDmode, 2,
+	emit_library_call (func_sym, LCT_NORMAL, VOIDmode,
 			   arg[0], GET_MODE (arg[0]),
 			   arg[1], GET_MODE (arg[1]));
       else
-	emit_library_call (func_sym, LCT_NORMAL, VOIDmode, 3,
+	emit_library_call (func_sym, LCT_NORMAL, VOIDmode,
 			   arg[0], GET_MODE (arg[0]),
 			   arg[1], GET_MODE (arg[1]),
 			   arg[2], GET_MODE (arg[2]));
@@ -3418,7 +3418,7 @@  emit_soft_tfmode_libcall (const char *fu
       gcc_assert (nargs == 2);
 
       ret = emit_library_call_value (func_sym, operands[0], LCT_NORMAL,
-				     GET_MODE (operands[0]), 1,
+				     GET_MODE (operands[0]),
 				     arg[1], GET_MODE (arg[1]));
 
       if (ret != operands[0])
@@ -8131,7 +8131,7 @@  sparc_emit_float_lib_cmp (rtx x, rtx y,
 
       libfunc = gen_rtx_SYMBOL_REF (Pmode, qpfunc);
       emit_library_call (libfunc, LCT_NORMAL,
-			 DImode, 2,
+			 DImode,
 			 XEXP (slot0, 0), Pmode,
 			 XEXP (slot1, 0), Pmode);
       mode = DImode;
@@ -8140,7 +8140,7 @@  sparc_emit_float_lib_cmp (rtx x, rtx y,
     {
       libfunc = gen_rtx_SYMBOL_REF (Pmode, qpfunc);
       emit_library_call (libfunc, LCT_NORMAL,
-			 SImode, 2,
+			 SImode,
 			 x, TFmode, y, TFmode);
       mode = SImode;
     }
@@ -9632,7 +9632,7 @@  sparc32_initialize_trampoline (rtx m_tra
      the stack address is accessible.  */
 #ifdef HAVE_ENABLE_EXECUTE_STACK
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__enable_execute_stack"),
-                     LCT_NORMAL, VOIDmode, 1, XEXP (m_tramp, 0), Pmode);
+                     LCT_NORMAL, VOIDmode, XEXP (m_tramp, 0), Pmode);
 #endif
 
 }
@@ -9679,7 +9679,7 @@  sparc64_initialize_trampoline (rtx m_tra
      the stack address is accessible.  */
 #ifdef HAVE_ENABLE_EXECUTE_STACK
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__enable_execute_stack"),
-                     LCT_NORMAL, VOIDmode, 1, XEXP (m_tramp, 0), Pmode);
+                     LCT_NORMAL, VOIDmode, XEXP (m_tramp, 0), Pmode);
 #endif
 }
 
@@ -10183,13 +10183,13 @@  sparc_profile_hook (int labelno)
   fun = gen_rtx_SYMBOL_REF (Pmode, MCOUNT_FUNCTION);
   if (NO_PROFILE_COUNTERS)
     {
-      emit_library_call (fun, LCT_NORMAL, VOIDmode, 0);
+      emit_library_call (fun, LCT_NORMAL, VOIDmode);
     }
   else
     {
       ASM_GENERATE_INTERNAL_LABEL (buf, "LP", labelno);
       lab = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
-      emit_library_call (fun, LCT_NORMAL, VOIDmode, 1, lab, Pmode);
+      emit_library_call (fun, LCT_NORMAL, VOIDmode, lab, Pmode);
     }
 }
 
Index: gcc/config/spu/spu.c
===================================================================
--- gcc/config/spu/spu.c	2017-08-30 12:20:21.817623885 +0100
+++ gcc/config/spu/spu.c	2017-09-01 14:49:15.749443186 +0100
@@ -4201,14 +4201,14 @@  ea_load_store (rtx mem, bool is_store, r
       if (!cache_fetch_dirty)
 	cache_fetch_dirty = init_one_libfunc ("__cache_fetch_dirty");
       emit_library_call_value (cache_fetch_dirty, data_addr, LCT_NORMAL, Pmode,
-			       2, ea_addr, EAmode, ndirty, SImode);
+			       ea_addr, EAmode, ndirty, SImode);
     }
   else
     {
       if (!cache_fetch)
 	cache_fetch = init_one_libfunc ("__cache_fetch");
       emit_library_call_value (cache_fetch, data_addr, LCT_NORMAL, Pmode,
-			       1, ea_addr, EAmode);
+			       ea_addr, EAmode);
     }
 }
 
Index: gcc/config/spu/spu.md
===================================================================
--- gcc/config/spu/spu.md	2017-08-03 10:40:55.728174484 +0100
+++ gcc/config/spu/spu.md	2017-09-01 14:49:15.750385624 +0100
@@ -864,9 +864,10 @@  (define_expand "floatunssidf2"
     {
        start_sequence ();
        value =
-         emit_library_call_value (convert_optab_libfunc (ufloat_optab,
-                                                         DFmode, SImode),
-                   NULL_RTX, LCT_NORMAL, DFmode, 1, operands[1], SImode);
+	 emit_library_call_value (convert_optab_libfunc (ufloat_optab,
+							 DFmode, SImode),
+				  NULL_RTX, LCT_NORMAL, DFmode,
+				  operands[1], SImode);
        rtx_insn *insns = get_insns ();
        end_sequence ();
        emit_libcall_block (insns, operands[0], value,
@@ -959,7 +960,8 @@  (define_expand "floatunsdidf2"
       value =
          emit_library_call_value (convert_optab_libfunc (ufloat_optab,
                                                          DFmode, DImode),
-                   NULL_RTX, LCT_NORMAL, DFmode, 1, operands[1], DImode);
+				  NULL_RTX, LCT_NORMAL, DFmode,
+				  operands[1], DImode);
       rtx_insn *insns = get_insns ();
       end_sequence ();
       emit_libcall_block (insns, operands[0], value,
Index: gcc/config/tilegx/tilegx.c
===================================================================
--- gcc/config/tilegx/tilegx.c	2017-08-30 12:20:21.817623885 +0100
+++ gcc/config/tilegx/tilegx.c	2017-09-01 14:49:15.751328063 +0100
@@ -5063,7 +5063,7 @@  tilegx_trampoline_init (rtx m_tramp, tre
 					      TRAMPOLINE_SIZE));
 
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_cache"),
-		     LCT_NORMAL, VOIDmode, 2, begin_addr, Pmode,
+		     LCT_NORMAL, VOIDmode, begin_addr, Pmode,
 		     end_addr, Pmode);
 }
 
Index: gcc/config/tilepro/tilepro.c
===================================================================
--- gcc/config/tilepro/tilepro.c	2017-08-30 12:20:21.818623885 +0100
+++ gcc/config/tilepro/tilepro.c	2017-09-01 14:49:15.753212941 +0100
@@ -4472,7 +4472,7 @@  tilepro_trampoline_init (rtx m_tramp, tr
 					      TRAMPOLINE_SIZE));
 
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_cache"),
-		     LCT_NORMAL, VOIDmode, 2, begin_addr, Pmode,
+		     LCT_NORMAL, VOIDmode, begin_addr, Pmode,
 		     end_addr, Pmode);
 }
 
Index: gcc/config/visium/visium.c
===================================================================
--- gcc/config/visium/visium.c	2017-08-30 12:08:16.010936110 +0100
+++ gcc/config/visium/visium.c	2017-09-01 14:49:15.754155380 +0100
@@ -2380,7 +2380,7 @@  expand_block_move_4 (rtx dst, rtx dst_re
       emit_insn (insn);
     }
   else
-    emit_library_call (long_int_memcpy_libfunc, LCT_NORMAL, VOIDmode, 3,
+    emit_library_call (long_int_memcpy_libfunc, LCT_NORMAL, VOIDmode,
 		       dst_reg, Pmode,
 		       src_reg, Pmode,
 		       convert_to_mode (TYPE_MODE (sizetype),
@@ -2416,7 +2416,7 @@  expand_block_move_2 (rtx dst, rtx dst_re
   unsigned HOST_WIDE_INT bytes = UINTVAL (bytes_rtx);
   unsigned int rem = bytes % 2;
 
-  emit_library_call (wrd_memcpy_libfunc, LCT_NORMAL, VOIDmode, 3,
+  emit_library_call (wrd_memcpy_libfunc, LCT_NORMAL, VOIDmode,
 		     dst_reg, Pmode,
 		     src_reg, Pmode,
 		     convert_to_mode (TYPE_MODE (sizetype),
@@ -2440,7 +2440,7 @@  expand_block_move_2 (rtx dst, rtx dst_re
 static void
 expand_block_move_1 (rtx dst_reg, rtx src_reg, rtx bytes_rtx)
 {
-  emit_library_call (byt_memcpy_libfunc, LCT_NORMAL, VOIDmode, 3,
+  emit_library_call (byt_memcpy_libfunc, LCT_NORMAL, VOIDmode,
 		     dst_reg, Pmode,
 		     src_reg, Pmode,
 		     convert_to_mode (TYPE_MODE (sizetype),
@@ -2459,7 +2459,7 @@  expand_block_set_4 (rtx dst, rtx dst_reg
   unsigned int rem = bytes % 4;
 
   value_rtx = convert_to_mode (Pmode, value_rtx, 1);
-  emit_library_call (long_int_memset_libfunc, LCT_NORMAL, VOIDmode, 3,
+  emit_library_call (long_int_memset_libfunc, LCT_NORMAL, VOIDmode,
 		     dst_reg, Pmode,
 		     value_rtx, Pmode,
 		     convert_to_mode (TYPE_MODE (sizetype),
@@ -2505,7 +2505,7 @@  expand_block_set_2 (rtx dst, rtx dst_reg
   unsigned int rem = bytes % 2;
 
   value_rtx = convert_to_mode (Pmode, value_rtx, 1);
-  emit_library_call (wrd_memset_libfunc, LCT_NORMAL, VOIDmode, 3,
+  emit_library_call (wrd_memset_libfunc, LCT_NORMAL, VOIDmode,
 		     dst_reg, Pmode,
 		     value_rtx, Pmode,
 		     convert_to_mode (TYPE_MODE (sizetype),
@@ -2529,7 +2529,7 @@  expand_block_set_2 (rtx dst, rtx dst_reg
 expand_block_set_1 (rtx dst_reg, rtx value_rtx, rtx bytes_rtx)
 {
   value_rtx = convert_to_mode (Pmode, value_rtx, 1);
-  emit_library_call (byt_memset_libfunc, LCT_NORMAL, VOIDmode, 3,
+  emit_library_call (byt_memset_libfunc, LCT_NORMAL, VOIDmode,
 		     dst_reg, Pmode,
 		     value_rtx, Pmode,
 		     convert_to_mode (TYPE_MODE (sizetype),
@@ -2681,7 +2681,7 @@  visium_trampoline_init (rtx m_tramp, tre
 					     GEN_INT (0xffff), NULL_RTX),
 				 0x04940000));
 
-  emit_library_call (set_trampoline_parity_libfunc, LCT_NORMAL, VOIDmode, 1,
+  emit_library_call (set_trampoline_parity_libfunc, LCT_NORMAL, VOIDmode,
 		     addr, SImode);
 }
 
@@ -2721,7 +2721,7 @@  visium_profile_hook (void)
 {
   visium_frame_needed = true;
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "mcount"), LCT_NORMAL,
-		     VOIDmode, 0);
+		     VOIDmode);
 }
 
 /* A C expression whose value is RTL representing the address in a stack frame
Index: gcc/config/xtensa/xtensa.c
===================================================================
--- gcc/config/xtensa/xtensa.c	2017-08-30 12:08:16.010936110 +0100
+++ gcc/config/xtensa/xtensa.c	2017-09-01 14:49:15.755097819 +0100
@@ -1343,7 +1343,7 @@  xtensa_expand_nonlocal_goto (rtx *operan
     containing_fp = force_reg (Pmode, containing_fp);
 
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__xtensa_nonlocal_goto"),
-		     LCT_NORMAL, VOIDmode, 2,
+		     LCT_NORMAL, VOIDmode,
 		     containing_fp, Pmode,
 		     goto_handler, Pmode);
 }
@@ -1623,7 +1623,7 @@  xtensa_setup_frame_addresses (void)
   if (TARGET_WINDOWED_ABI)
     emit_library_call
       (gen_rtx_SYMBOL_REF (Pmode, "__xtensa_libgcc_window_spill"),
-       LCT_NORMAL, VOIDmode, 0);
+       LCT_NORMAL, VOIDmode);
 }
 
 
@@ -4045,7 +4045,7 @@  xtensa_trampoline_init (rtx m_tramp, tre
   emit_move_insn (adjust_address (m_tramp, SImode, chain_off), chain);
   emit_move_insn (adjust_address (m_tramp, SImode, func_off), func);
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__xtensa_sync_caches"),
-		     LCT_NORMAL, VOIDmode, 1, XEXP (m_tramp, 0), Pmode);
+		     LCT_NORMAL, VOIDmode, XEXP (m_tramp, 0), Pmode);
 }
 
 /* Implement TARGET_LEGITIMATE_CONSTANT_P.  */
Index: gcc/except.c
===================================================================
--- gcc/except.c	2017-08-30 12:18:46.621641267 +0100
+++ gcc/except.c	2017-09-01 14:49:15.756040258 +0100
@@ -1190,7 +1190,7 @@  sjlj_emit_function_enter (rtx_code_label
     }
 
   emit_library_call (unwind_sjlj_register_libfunc, LCT_NORMAL, VOIDmode,
-		     1, XEXP (fc, 0), Pmode);
+		     XEXP (fc, 0), Pmode);
 
   seq = get_insns ();
   end_sequence ();
@@ -1232,7 +1232,7 @@  sjlj_emit_function_exit (void)
   start_sequence ();
 
   emit_library_call (unwind_sjlj_unregister_libfunc, LCT_NORMAL, VOIDmode,
-		     1, XEXP (crtl->eh.sjlj_fc, 0), Pmode);
+		     XEXP (crtl->eh.sjlj_fc, 0), Pmode);
 
   seq = get_insns ();
   end_sequence ();
Index: gcc/explow.c
===================================================================
--- gcc/explow.c	2017-08-30 12:20:41.642620906 +0100
+++ gcc/explow.c	2017-09-01 14:49:15.756040258 +0100
@@ -1408,7 +1408,7 @@  allocate_dynamic_stack_space (rtx size,
       func = init_one_libfunc ("__morestack_allocate_stack_space");
 
       space = emit_library_call_value (func, target, LCT_NORMAL, Pmode,
-				       1, ask, Pmode);
+				       ask, Pmode);
 
       if (available_label == NULL_RTX)
 	return space;
@@ -1621,8 +1621,8 @@  probe_stack_range (HOST_WIDE_INT first,
 					         stack_pointer_rtx,
 					         plus_constant (Pmode,
 								size, first)));
-      emit_library_call (stack_check_libfunc, LCT_THROW, VOIDmode, 1, addr,
-			 Pmode);
+      emit_library_call (stack_check_libfunc, LCT_THROW, VOIDmode,
+			 addr, Pmode);
     }
 
   /* Next see if we have an insn to check the stack.  */
Index: gcc/expr.c
===================================================================
--- gcc/expr.c	2017-08-30 12:20:12.565625275 +0100
+++ gcc/expr.c	2017-09-01 14:49:15.758867574 +0100
@@ -327,7 +327,7 @@  convert_mode_scalar (rtx to, rtx from, i
 
       start_sequence ();
       value = emit_library_call_value (libcall, NULL_RTX, LCT_CONST, to_mode,
-				       1, from, from_mode);
+				       from, from_mode);
       insns = get_insns ();
       end_sequence ();
       emit_libcall_block (insns, to, value,
Index: gcc/optabs.c
===================================================================
--- gcc/optabs.c	2017-08-30 12:20:12.567625274 +0100
+++ gcc/optabs.c	2017-09-01 14:49:15.760752452 +0100
@@ -1759,7 +1759,7 @@  expand_binop (machine_mode mode, optab b
       /* Pass 1 for NO_QUEUE so we don't lose any increments
 	 if the libcall is cse'd or moved.  */
       value = emit_library_call_value (libfunc,
-				       NULL_RTX, LCT_CONST, mode, 2,
+				       NULL_RTX, LCT_CONST, mode,
 				       op0, mode, op1x, op1_mode);
 
       insns = get_insns ();
@@ -2092,7 +2092,7 @@  expand_twoval_binop_libfunc (optab binop
   libval_mode = smallest_int_mode_for_size (2 * GET_MODE_BITSIZE (mode));
   start_sequence ();
   libval = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST,
-				    libval_mode, 2,
+				    libval_mode,
 				    op0, mode,
 				    op1, mode);
   /* Get the part of VAL containing the value that we want.  */
@@ -2966,7 +2966,7 @@  expand_unop (machine_mode mode, optab un
       /* Pass 1 for NO_QUEUE so we don't lose any increments
 	 if the libcall is cse'd or moved.  */
       value = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST, outmode,
-				       1, op0, mode);
+				       op0, mode);
       insns = get_insns ();
       end_sequence ();
 
@@ -3917,7 +3917,7 @@  prepare_cmp_insn (rtx x, rtx y, enum rtx
 
       ret_mode = targetm.libgcc_cmp_return_mode ();
       result = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST,
-					ret_mode, 2, x, mode, y, mode);
+					ret_mode, x, mode, y, mode);
 
       /* There are two kinds of comparison routines. Biased routines
 	 return 0/1/2, and unbiased routines return -1/0/1. Other parts
@@ -4171,7 +4171,7 @@  prepare_float_lib_cmp (rtx x, rtx y, enu
 
   start_sequence ();
   value = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST,
-				   cmp_mode, 2, x, mode, y, mode);
+				   cmp_mode, x, mode, y, mode);
   insns = get_insns ();
   end_sequence ();
 
@@ -4811,8 +4811,7 @@  expand_float (rtx to, rtx from, int unsi
       start_sequence ();
 
       value = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST,
-				       GET_MODE (to), 1, from,
-				       GET_MODE (from));
+				       GET_MODE (to), from, GET_MODE (from));
       insns = get_insns ();
       end_sequence ();
 
@@ -5004,8 +5003,7 @@  expand_fix (rtx to, rtx from, int unsign
       start_sequence ();
 
       value = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST,
-				       GET_MODE (to), 1, from,
-				       GET_MODE (from));
+				       GET_MODE (to), from, GET_MODE (from));
       insns = get_insns ();
       end_sequence ();
 
@@ -5097,7 +5095,7 @@  expand_fixed_convert (rtx to, rtx from,
 
   start_sequence ();
   value = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST, to_mode,
-				   1, from, from_mode);
+				   from, from_mode);
   insns = get_insns ();
   end_sequence ();
 
@@ -5944,7 +5942,7 @@  maybe_emit_sync_lock_test_and_set (rtx t
 
 	  addr = convert_memory_address (ptr_mode, XEXP (mem, 0));
 	  return emit_library_call_value (libfunc, NULL_RTX, LCT_NORMAL,
-					  mode, 2, addr, ptr_mode,
+					  mode, addr, ptr_mode,
 					  val, mode);
 	}
     }
@@ -6252,7 +6250,7 @@  expand_atomic_compare_and_swap (rtx *pta
     {
       rtx addr = convert_memory_address (ptr_mode, XEXP (mem, 0));
       rtx target = emit_library_call_value (libfunc, NULL_RTX, LCT_NORMAL,
-					    mode, 3, addr, ptr_mode,
+					    mode, addr, ptr_mode,
 					    expected, mode, desired, mode);
       emit_move_insn (target_oval, target);
 
@@ -6313,7 +6311,7 @@  expand_mem_thread_fence (enum memmodel m
   else if (targetm.have_memory_barrier ())
     emit_insn (targetm.gen_memory_barrier ());
   else if (synchronize_libfunc != NULL_RTX)
-    emit_library_call (synchronize_libfunc, LCT_NORMAL, VOIDmode, 0);
+    emit_library_call (synchronize_libfunc, LCT_NORMAL, VOIDmode);
   else
     expand_asm_memory_barrier ();
 }
@@ -6820,7 +6818,7 @@  expand_atomic_fetch_op (rtx target, rtx
 	{
 	  rtx addr = convert_memory_address (ptr_mode, XEXP (mem, 0));
 	  result = emit_library_call_value (libfunc, NULL, LCT_NORMAL, mode,
-					    2, addr, ptr_mode, val, mode);
+					    addr, ptr_mode, val, mode);
 
 	  if (!unused_result && fixup)
 	    result = expand_simple_binop (mode, code, result, val, target,