diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2018-10-10 10:17:55 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2018-11-15 18:42:25 -0800 |
commit | f46adb44bf7eeeb15ddaed81f73433b5e7a3bff6 (patch) | |
tree | aabeddd12dd16e432245c01892b2920ad47396c1 | |
parent | 7329ae3ce62ef525ea269adbfd95aad07d484abb (diff) | |
download | meson-f46adb44bf7eeeb15ddaed81f73433b5e7a3bff6.zip meson-f46adb44bf7eeeb15ddaed81f73433b5e7a3bff6.tar.gz meson-f46adb44bf7eeeb15ddaed81f73433b5e7a3bff6.tar.bz2 |
compilers: Enable PGO for ICC
ICC doesn't use the same -fprofile-generate/-fprofile-use that GCC and
Clang use, instead it has -prof-gen and -prof-use. I've gone ahead and
added the threadsafe option to -prof-gen, as meson currently doesn't
have a way to specify that level of granularity and GCC and Clang's
profiles are threadsafe.
-rw-r--r-- | mesonbuild/compilers/compilers.py | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 306e5d6..755bd46 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -457,9 +457,9 @@ def get_base_compile_args(options, compiler): try: pgo_val = options['b_pgo'].value if pgo_val == 'generate': - args.append('-fprofile-generate') + args.extend(compiler.get_profile_generate_args()) elif pgo_val == 'use': - args.extend(['-fprofile-use', '-fprofile-correction']) + args.extend(compiler.get_profile_use_args()) except KeyError: pass try: @@ -503,9 +503,9 @@ def get_base_link_args(options, linker, is_shared_module): try: pgo_val = options['b_pgo'].value if pgo_val == 'generate': - args.append('-fprofile-generate') + args.extend(linker.get_profile_generate_args()) elif pgo_val == 'use': - args.extend(['-fprofile-use', '-fprofile-correction']) + args.extend(linker.get_profile_use_args()) except KeyError: pass try: @@ -674,7 +674,6 @@ class CompilerArgs(list): to recursively search for symbols in the libraries. This is not needed with other linkers. ''' - # A standalone argument must never be deduplicated because it is # defined by what comes _after_ it. Thus dedupping this: # -D FOO -D BAR @@ -1258,6 +1257,14 @@ class Compiler: """ return 'other' + def get_profile_generate_args(self): + raise EnvironmentException( + '%s does not support get_profile_generate_args ' % self.get_id()) + + def get_profile_use_args(self): + raise EnvironmentException( + '%s does not support get_profile_use_args ' % self.get_id()) + @enum.unique class CompilerType(enum.Enum): @@ -1498,6 +1505,12 @@ class GnuLikeCompiler(abc.ABC): def get_argument_syntax(self): return 'gcc' + def get_profile_generate_args(self): + return ['-fprofile-generate'] + + def get_profile_use_args(self): + return ['-fprofile-use', '-fprofile-correction'] + class GnuCompiler(GnuLikeCompiler): """ @@ -1779,6 +1792,12 @@ class IntelCompiler(GnuLikeCompiler): ] return super().compiles(*args, **kwargs) + def get_profile_generate_args(self): + return ['-prof-gen=threadsafe'] + + def get_profile_use_args(self): + return ['-prof-use'] + class ArmCompiler: # Functionality that is common to all ARM family compilers. |