diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2016-12-11 14:21:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-11 14:21:30 +0200 |
commit | e128d26b350e4b8ba02e4de8858aa3deafa07ce1 (patch) | |
tree | 4d6e7f3b068e2854df0b1c888e42f087c448dae6 /mesonbuild/compilers.py | |
parent | f2b3ab826b9a8b75851853dcf972555fb7e5e2a0 (diff) | |
parent | 70f39ee21ee632d1e23b8c3cdcd11817818b9495 (diff) | |
download | meson-e128d26b350e4b8ba02e4de8858aa3deafa07ce1.zip meson-e128d26b350e4b8ba02e4de8858aa3deafa07ce1.tar.gz meson-e128d26b350e4b8ba02e4de8858aa3deafa07ce1.tar.bz2 |
Merge pull request #1095 from centricular/llvm-ir-assembly
Implement support for LLVM IR compilation
Diffstat (limited to 'mesonbuild/compilers.py')
-rw-r--r-- | mesonbuild/compilers.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index 2ee4aac..e474d2e 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -59,6 +59,16 @@ def is_source(fname): suffix = fname.split('.')[-1] return suffix in clike_suffixes +def is_assembly(fname): + if hasattr(fname, 'fname'): + fname = fname.fname + return fname.split('.')[-1].lower() == 's' + +def is_llvm_ir(fname): + if hasattr(fname, 'fname'): + fname = fname.fname + return fname.split('.')[-1] == 'll' + def is_object(fname): if hasattr(fname, 'fname'): fname = fname.fname @@ -2018,6 +2028,8 @@ class GnuCompiler: if self.gcc_type != GCC_OSX: self.base_options.append('b_lundef') self.base_options.append('b_asneeded') + # All GCC backends can do assembly + self.can_compile_suffixes.add('s') def get_colorout_args(self, colortype): if mesonlib.version_compare(self.version, '>=4.9.0'): @@ -2071,8 +2083,6 @@ class GnuCCompiler(GnuCompiler, CCompiler): def __init__(self, exelist, version, gcc_type, is_cross, exe_wrapper=None, defines=None): CCompiler.__init__(self, exelist, version, is_cross, exe_wrapper) GnuCompiler.__init__(self, gcc_type, defines) - # Gcc can do asm, too. - self.can_compile_suffixes.add('s') self.warn_args = {'1': ['-Wall', '-Winvalid-pch'], '2': ['-Wall', '-Wextra', '-Winvalid-pch'], '3' : ['-Wall', '-Wpedantic', '-Wextra', '-Winvalid-pch']} @@ -2185,6 +2195,8 @@ class ClangCompiler(): if self.clang_type != CLANG_OSX: self.base_options.append('b_lundef') self.base_options.append('b_asneeded') + # All Clang backends can do assembly and LLVM IR + self.can_compile_suffixes.update(['ll', 's']) def get_pic_args(self): if self.clang_type in (CLANG_WIN, CLANG_OSX): @@ -2240,8 +2252,6 @@ class ClangCCompiler(ClangCompiler, CCompiler): def __init__(self, exelist, version, clang_type, is_cross, exe_wrapper=None): CCompiler.__init__(self, exelist, version, is_cross, exe_wrapper) ClangCompiler.__init__(self, clang_type) - # Clang can do asm, too. - self.can_compile_suffixes.add('s') self.warn_args = {'1': ['-Wall', '-Winvalid-pch'], '2': ['-Wall', '-Wextra', '-Winvalid-pch'], '3' : ['-Wall', '-Wpedantic', '-Wextra', '-Winvalid-pch']} |