Skip to content

Commit

Permalink
Ignore -ftree-parallelize-loops={0,1} using gt
Browse files Browse the repository at this point in the history
2015-07-14  Tom de Vries  <[email protected]>

	* gcc.c (greater_than_spec_func): Declare forward.
	(LINK_COMMAND_SPEC, GOMP_SELF_SPECS): Use gt to ignore
	-ftree-parallelize-loops={0,1}.
	(static_spec_functions): Add greater_than_spec_func function with name
	"gt".
	(greater_than_spec_func): New function.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225764 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
vries committed Jul 14, 2015
1 parent 8a6be96 commit 1b316d6
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 2 deletions.
9 changes: 9 additions & 0 deletions gcc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2015-07-14 Tom de Vries <[email protected]>

* gcc.c (greater_than_spec_func): Declare forward.
(LINK_COMMAND_SPEC, GOMP_SELF_SPECS): Use gt to ignore
-ftree-parallelize-loops={0,1}.
(static_spec_functions): Add greater_than_spec_func function with name
"gt".
(greater_than_spec_func): New function.

2015-07-14 Richard Biener <[email protected]>

* tree-ssa-dom.c (record_temporary_equivalences): Merge
Expand Down
49 changes: 47 additions & 2 deletions gcc/gcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ static const char *compare_debug_self_opt_spec_function (int, const char **);
static const char *compare_debug_auxbase_opt_spec_function (int, const char **);
static const char *pass_through_libs_spec_func (int, const char **);
static const char *replace_extension_spec_func (int, const char **);
static const char *greater_than_spec_func (int, const char **);
static char *convert_white_space (char *);

/* The Specs Language
Expand Down Expand Up @@ -881,7 +882,8 @@ proper position among the other output files. */
%{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} " VTABLE_VERIFICATION_SPEC " \
%{static:} %{L*} %(mfwrap) %(link_libgcc) " SANITIZER_EARLY_SPEC " %o\
" CHKP_SPEC " \
%{fopenacc|fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*} 1):\
%:include(libgomp.spec)%(link_gomp)}\
%{fcilkplus:%:include(libcilkrts.spec)%(link_cilkrts)}\
%{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
%(mflib) " STACK_SPLIT_SPEC "\
Expand Down Expand Up @@ -1042,7 +1044,8 @@ static const char *const multilib_defaults_raw[] = MULTILIB_DEFAULTS;
/* Linking to libgomp implies pthreads. This is particularly important
for targets that use different start files and suchlike. */
#ifndef GOMP_SELF_SPECS
#define GOMP_SELF_SPECS "%{fopenacc|fopenmp|ftree-parallelize-loops=*: " \
#define GOMP_SELF_SPECS \
"%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*} 1): " \
"-pthread}"
#endif

Expand Down Expand Up @@ -1482,6 +1485,7 @@ static const struct spec_function static_spec_functions[] =
{ "compare-debug-auxbase-opt", compare_debug_auxbase_opt_spec_function },
{ "pass-through-libs", pass_through_libs_spec_func },
{ "replace-extension", replace_extension_spec_func },
{ "gt", greater_than_spec_func },
#ifdef EXTRA_SPEC_FUNCTIONS
EXTRA_SPEC_FUNCTIONS
#endif
Expand Down Expand Up @@ -9428,6 +9432,47 @@ replace_extension_spec_func (int argc, const char **argv)
return result;
}

/* Returns "" if the n in ARGV[1] == -opt=<n> is greater than ARGV[2].
Otherwise, return NULL. */

static const char *
greater_than_spec_func (int argc, const char **argv)
{
char *converted;

if (argc == 1)
return NULL;

gcc_assert (argc == 3);
gcc_assert (argv[0][0] == '-');
gcc_assert (argv[0][1] == '\0');

/* Point p to <n> in in -opt=<n>. */
const char *p = argv[1];
while (true)
{
char c = *p;
if (c == '\0')
gcc_unreachable ();

++p;

if (c == '=')
break;
}

long arg = strtol (p, &converted, 10);
gcc_assert (converted != p);

long lim = strtol (argv[2], &converted, 10);
gcc_assert (converted != argv[2]);

if (arg > lim)
return "";

return NULL;
}

/* Insert backslash before spaces in ORIG (usually a file path), to
avoid being broken by spec parser.
Expand Down

0 comments on commit 1b316d6

Please sign in to comment.