Commit a478ffff by Andi Kleen Committed by Andi Kleen

common.opt (fwhopr=): Update for -fwhopr=jobserver


       * common.opt (fwhopr=): Update for -fwhopr=jobserver
       * doc/invoke.texi (fwhopr): Document -fwhopr=jobserver.
       * lto-wrapper.c (run_gcc): Add jobserver mode.
       * opts.c (common_handle_option): Fix OPT_fwhopr for non numeric
         argument.

From-SVN: r163680
parent 7d2c38c0
2010-08-31 Andi Kleen <ak@linux.intel.com>
* common.opt (fwhopr=): Update for -fwhopr=jobserver
* doc/invoke.texi (fwhopr): Document -fwhopr=jobserver.
* lto-wrapper.c (run_gcc): Add jobserver mode.
* opts.c (common_handle_option): Fix OPT_fwhopr for non numeric
argument.
2010-08-31 Uros Bizjak <ubizjak@gmail.com> 2010-08-31 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.md (popdi1): Rewrite using POST_INC memory operand. * config/i386/i386.md (popdi1): Rewrite using POST_INC memory operand.
......
...@@ -1579,8 +1579,8 @@ Common ...@@ -1579,8 +1579,8 @@ Common
Enable partitioned link-time optimization Enable partitioned link-time optimization
fwhopr= fwhopr=
Common RejectNegative UInteger Joined Var(flag_whopr) Common RejectNegative Joined Var(flag_whopr)
Enable partitioned link-time optimization with specified number of parallel jobs Partitioned link-time optimization with number of parallel jobs or jobserver.
ftree-builtin-call-dce ftree-builtin-call-dce
Common Report Var(flag_tree_builtin_call_dce) Init(0) Optimization Common Report Var(flag_tree_builtin_call_dce) Init(0) Optimization
......
...@@ -7619,6 +7619,13 @@ parallel using @var{n} parallel jobs by utilizing an installed ...@@ -7619,6 +7619,13 @@ parallel using @var{n} parallel jobs by utilizing an installed
@command{make} program. The environment variable @env{MAKE} may be @command{make} program. The environment variable @env{MAKE} may be
used to override the program used. used to override the program used.
You can also specify @option{-fwhopr=jobserver} to use GNU make's
job server mode to determine the number of parallel jobs. This
is useful when the Makefile calling GCC is already parallel.
The parent Makefile will need a @samp{+} prepended to the command recipe
for this to work. This will likely only work if @env{MAKE} is
GNU make.
Disabled by default. Disabled by default.
@item -fwpa @item -fwpa
......
...@@ -303,6 +303,7 @@ run_gcc (unsigned argc, char *argv[]) ...@@ -303,6 +303,7 @@ run_gcc (unsigned argc, char *argv[])
struct obstack env_obstack; struct obstack env_obstack;
bool seen_o = false; bool seen_o = false;
int parallel = 0; int parallel = 0;
int jobserver = 0;
/* Get the driver and options. */ /* Get the driver and options. */
collect_gcc = getenv ("COLLECT_GCC"); collect_gcc = getenv ("COLLECT_GCC");
...@@ -373,11 +374,19 @@ run_gcc (unsigned argc, char *argv[]) ...@@ -373,11 +374,19 @@ run_gcc (unsigned argc, char *argv[])
lto_mode = LTO_MODE_WHOPR; lto_mode = LTO_MODE_WHOPR;
if (option[7] == '=') if (option[7] == '=')
{ {
if (!strcmp (option + 8, "jobserver"))
{
jobserver = 1;
parallel = 1;
}
else
{
parallel = atoi (option+8); parallel = atoi (option+8);
if (parallel <= 1) if (parallel <= 1)
parallel = 0; parallel = 0;
} }
} }
}
else else
*argv_ptr++ = option; *argv_ptr++ = option;
} }
...@@ -567,23 +576,32 @@ cont: ...@@ -567,23 +576,32 @@ cont:
{ {
struct pex_obj *pex; struct pex_obj *pex;
char jobs[32]; char jobs[32];
fprintf (mstream, "all:"); fprintf (mstream, "all:");
for (i = 0; i < nr; ++i) for (i = 0; i < nr; ++i)
fprintf (mstream, " \\\n\t%s", output_names[i]); fprintf (mstream, " \\\n\t%s", output_names[i]);
fprintf (mstream, "\n"); fprintf (mstream, "\n");
fclose (mstream); fclose (mstream);
/* Avoid passing --jobserver-fd= and similar flags. */ if (!jobserver)
{
/* Avoid passing --jobserver-fd= and similar flags
unless jobserver mode is explicitly enabled. */
putenv (xstrdup ("MAKEFLAGS=")); putenv (xstrdup ("MAKEFLAGS="));
putenv (xstrdup ("MFLAGS=")); putenv (xstrdup ("MFLAGS="));
}
new_argv[0] = getenv ("MAKE"); new_argv[0] = getenv ("MAKE");
if (!new_argv[0]) if (!new_argv[0])
new_argv[0] = "make"; new_argv[0] = "make";
new_argv[1] = "-f"; new_argv[1] = "-f";
new_argv[2] = makefile; new_argv[2] = makefile;
i = 3;
if (!jobserver)
{
snprintf (jobs, 31, "-j%d", parallel); snprintf (jobs, 31, "-j%d", parallel);
new_argv[3] = jobs; new_argv[i++] = jobs;
new_argv[4] = "all"; }
new_argv[5] = NULL; new_argv[i++] = "all";
new_argv[i++] = NULL;
pex = collect_execute (CONST_CAST (char **, new_argv)); pex = collect_execute (CONST_CAST (char **, new_argv));
collect_wait (new_argv[0], pex); collect_wait (new_argv[0], pex);
maybe_unlink_file (makefile); maybe_unlink_file (makefile);
......
...@@ -2089,7 +2089,7 @@ common_handle_option (const struct cl_decoded_option *decoded, ...@@ -2089,7 +2089,7 @@ common_handle_option (const struct cl_decoded_option *decoded,
break; break;
case OPT_fwhopr: case OPT_fwhopr:
flag_whopr = value; flag_whopr = arg;
break; break;
case OPT_w: case OPT_w:
......
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