Commit 64186aad by Thomas Schwinge Committed by Thomas Schwinge

Fix --enable-offload-targets/-foffload handling, pt. 1

	gcc/
	* configure.ac (offload_targets, OFFLOAD_TARGETS): Separate
	offload targets by commas, not colons.
	* config.in: Regenerate.
	* configure: Likewise.
	* gcc.c (driver::maybe_putenv_COLLECT_LTO_WRAPPER): Due to that,
	instead of setting up the default offload targets here...
	(process_command): ..., do it here.
	libgomp/
	* plugin/configfrag.ac (OFFLOAD_TARGETS): Clarify that offload
	targets are separated by commas.
	* config.h.in: Regenerate.

From-SVN: r228053
parent f2c9f71d
2015-09-23 Thomas Schwinge <thomas@codesourcery.com> 2015-09-23 Thomas Schwinge <thomas@codesourcery.com>
* configure.ac (offload_targets, OFFLOAD_TARGETS): Separate
offload targets by commas, not colons.
* config.in: Regenerate.
* configure: Likewise.
* gcc.c (driver::maybe_putenv_COLLECT_LTO_WRAPPER): Due to that,
instead of setting up the default offload targets here...
(process_command): ..., do it here.
libgomp/
* plugin/configfrag.ac (OFFLOAD_TARGETS): Clarify that offload
targets are separated by commas.
* config.h.in: Regenerate.
2015-09-23 Thomas Schwinge <thomas@codesourcery.com>
Nathan Sidwell <nathan@codesourcery.com> Nathan Sidwell <nathan@codesourcery.com>
* omp-low.h (omp_reduction_init_op): Declare. * omp-low.h (omp_reduction_init_op): Declare.
...@@ -1913,7 +1913,7 @@ ...@@ -1913,7 +1913,7 @@
#endif #endif
/* Define to hold the list of target names suitable for offloading. */ /* Define to offload targets, separated by commas. */
#ifndef USED_FOR_TARGET #ifndef USED_FOR_TARGET
#undef OFFLOAD_TARGETS #undef OFFLOAD_TARGETS
#endif #endif
......
...@@ -7696,7 +7696,7 @@ for tgt in `echo $enable_offload_targets | sed 's/,/ /g'`; do ...@@ -7696,7 +7696,7 @@ for tgt in `echo $enable_offload_targets | sed 's/,/ /g'`; do
if test x"$offload_targets" = x; then if test x"$offload_targets" = x; then
offload_targets=$tgt offload_targets=$tgt
else else
offload_targets="$offload_targets:$tgt" offload_targets="$offload_targets,$tgt"
fi fi
done done
......
...@@ -941,11 +941,11 @@ for tgt in `echo $enable_offload_targets | sed 's/,/ /g'`; do ...@@ -941,11 +941,11 @@ for tgt in `echo $enable_offload_targets | sed 's/,/ /g'`; do
if test x"$offload_targets" = x; then if test x"$offload_targets" = x; then
offload_targets=$tgt offload_targets=$tgt
else else
offload_targets="$offload_targets:$tgt" offload_targets="$offload_targets,$tgt"
fi fi
done done
AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets", AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets",
[Define to hold the list of target names suitable for offloading.]) [Define to offload targets, separated by commas.])
if test x"$offload_targets" != x; then if test x"$offload_targets" != x; then
AC_DEFINE(ENABLE_OFFLOADING, 1, AC_DEFINE(ENABLE_OFFLOADING, 1,
[Define this to enable support for offloading.]) [Define this to enable support for offloading.])
......
...@@ -284,7 +284,8 @@ static const char *const spec_version = DEFAULT_TARGET_VERSION; ...@@ -284,7 +284,8 @@ static const char *const spec_version = DEFAULT_TARGET_VERSION;
static const char *spec_machine = DEFAULT_TARGET_MACHINE; static const char *spec_machine = DEFAULT_TARGET_MACHINE;
static const char *spec_host_machine = DEFAULT_REAL_TARGET_MACHINE; static const char *spec_host_machine = DEFAULT_REAL_TARGET_MACHINE;
/* List of offload targets. */ /* List of offload targets. Separated by colon. Empty string for
-foffload=disable. */
static char *offload_targets = NULL; static char *offload_targets = NULL;
...@@ -4376,6 +4377,13 @@ process_command (unsigned int decoded_options_count, ...@@ -4376,6 +4377,13 @@ process_command (unsigned int decoded_options_count,
CL_DRIVER, &handlers, global_dc); CL_DRIVER, &handlers, global_dc);
} }
#ifdef ENABLE_OFFLOADING
/* If the user didn't specify any, default to all configured offload
targets. */
if (offload_targets == NULL)
handle_foffload_option (OFFLOAD_TARGETS);
#endif
if (output_file if (output_file
&& strcmp (output_file, "-") != 0 && strcmp (output_file, "-") != 0
&& strcmp (output_file, HOST_BIT_BUCKET) != 0) && strcmp (output_file, HOST_BIT_BUCKET) != 0)
...@@ -7572,22 +7580,17 @@ driver::maybe_putenv_COLLECT_LTO_WRAPPER () const ...@@ -7572,22 +7580,17 @@ driver::maybe_putenv_COLLECT_LTO_WRAPPER () const
void void
driver::maybe_putenv_OFFLOAD_TARGETS () const driver::maybe_putenv_OFFLOAD_TARGETS () const
{ {
const char *targets = offload_targets; if (offload_targets && offload_targets[0] != '\0')
/* If no targets specified by -foffload, use all available targets. */
if (!targets)
targets = OFFLOAD_TARGETS;
if (strlen (targets) > 0)
{ {
obstack_grow (&collect_obstack, "OFFLOAD_TARGET_NAMES=", obstack_grow (&collect_obstack, "OFFLOAD_TARGET_NAMES=",
sizeof ("OFFLOAD_TARGET_NAMES=") - 1); sizeof ("OFFLOAD_TARGET_NAMES=") - 1);
obstack_grow (&collect_obstack, targets, obstack_grow (&collect_obstack, offload_targets,
strlen (targets) + 1); strlen (offload_targets) + 1);
xputenv (XOBFINISH (&collect_obstack, char *)); xputenv (XOBFINISH (&collect_obstack, char *));
} }
free (offload_targets); free (offload_targets);
offload_targets = NULL;
} }
/* Reject switches that no pass was interested in. */ /* Reject switches that no pass was interested in. */
......
...@@ -594,6 +594,8 @@ append_offload_options (obstack *argv_obstack, const char *target, ...@@ -594,6 +594,8 @@ append_offload_options (obstack *argv_obstack, const char *target,
else else
{ {
opts = strchr (option->arg, '='); opts = strchr (option->arg, '=');
/* If there are offload targets specified, but no actual options,
there is nothing to do here. */
if (!opts) if (!opts)
continue; continue;
...@@ -606,10 +608,12 @@ append_offload_options (obstack *argv_obstack, const char *target, ...@@ -606,10 +608,12 @@ append_offload_options (obstack *argv_obstack, const char *target,
next = opts; next = opts;
next = (next > opts) ? opts : next; next = (next > opts) ? opts : next;
/* Are we looking for this offload target? */
if (strlen (target) == (size_t) (next - cur) if (strlen (target) == (size_t) (next - cur)
&& strncmp (target, cur, next - cur) == 0) && strncmp (target, cur, next - cur) == 0)
break; break;
/* Skip the comma or equal sign. */
cur = next + 1; cur = next + 1;
} }
......
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
*/ */
#undef LT_OBJDIR #undef LT_OBJDIR
/* Define to hold the list of target names suitable for offloading. */ /* Define to offload targets, separated by commas. */
#undef OFFLOAD_TARGETS #undef OFFLOAD_TARGETS
/* Name of package */ /* Name of package */
......
...@@ -141,7 +141,7 @@ if test x"$enable_offload_targets" != x; then ...@@ -141,7 +141,7 @@ if test x"$enable_offload_targets" != x; then
done done
fi fi
AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets", AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets",
[Define to hold the list of target names suitable for offloading.]) [Define to offload targets, separated by commas.])
AM_CONDITIONAL([PLUGIN_NVPTX], [test $PLUGIN_NVPTX = 1]) AM_CONDITIONAL([PLUGIN_NVPTX], [test $PLUGIN_NVPTX = 1])
AC_DEFINE_UNQUOTED([PLUGIN_NVPTX], [$PLUGIN_NVPTX], AC_DEFINE_UNQUOTED([PLUGIN_NVPTX], [$PLUGIN_NVPTX],
[Define to 1 if the NVIDIA plugin is built, 0 if not.]) [Define to 1 if the NVIDIA plugin is built, 0 if not.])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment