1bf215546Sopenharmony_ci# Copyright © 2018 Valve Corporation
2bf215546Sopenharmony_ci
3bf215546Sopenharmony_ci# Permission is hereby granted, free of charge, to any person obtaining a copy
4bf215546Sopenharmony_ci# of this software and associated documentation files (the "Software"), to deal
5bf215546Sopenharmony_ci# in the Software without restriction, including without limitation the rights
6bf215546Sopenharmony_ci# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7bf215546Sopenharmony_ci# copies of the Software, and to permit persons to whom the Software is
8bf215546Sopenharmony_ci# furnished to do so, subject to the following conditions:
9bf215546Sopenharmony_ci
10bf215546Sopenharmony_ci# The above copyright notice and this permission notice shall be included in
11bf215546Sopenharmony_ci# all copies or substantial portions of the Software.
12bf215546Sopenharmony_ci
13bf215546Sopenharmony_ci# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14bf215546Sopenharmony_ci# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15bf215546Sopenharmony_ci# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16bf215546Sopenharmony_ci# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17bf215546Sopenharmony_ci# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18bf215546Sopenharmony_ci# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19bf215546Sopenharmony_ci# SOFTWARE.
20bf215546Sopenharmony_ci
21bf215546Sopenharmony_ciaco_depends = files('aco_opcodes.py')
22bf215546Sopenharmony_ci
23bf215546Sopenharmony_ciaco_opcodes_h = custom_target(
24bf215546Sopenharmony_ci  'aco_opcodes.h',
25bf215546Sopenharmony_ci  input : 'aco_opcodes_h.py',
26bf215546Sopenharmony_ci  output : 'aco_opcodes.h',
27bf215546Sopenharmony_ci  command : [prog_python, '@INPUT@'],
28bf215546Sopenharmony_ci  capture : true,
29bf215546Sopenharmony_ci  depend_files : aco_depends,
30bf215546Sopenharmony_ci)
31bf215546Sopenharmony_ci
32bf215546Sopenharmony_ciaco_opcodes_c = custom_target(
33bf215546Sopenharmony_ci  'aco_opcodes.cpp',
34bf215546Sopenharmony_ci  input : 'aco_opcodes_cpp.py',
35bf215546Sopenharmony_ci  output : 'aco_opcodes.cpp',
36bf215546Sopenharmony_ci  command : [prog_python, '@INPUT@'],
37bf215546Sopenharmony_ci  capture : true,
38bf215546Sopenharmony_ci  depend_files : aco_depends,
39bf215546Sopenharmony_ci)
40bf215546Sopenharmony_ci
41bf215546Sopenharmony_ciaco_builder_h = custom_target(
42bf215546Sopenharmony_ci  'aco_builder.h',
43bf215546Sopenharmony_ci  input : 'aco_builder_h.py',
44bf215546Sopenharmony_ci  output : 'aco_builder.h',
45bf215546Sopenharmony_ci  command : [prog_python, '@INPUT@'],
46bf215546Sopenharmony_ci  capture : true,
47bf215546Sopenharmony_ci  depend_files : aco_depends,
48bf215546Sopenharmony_ci)
49bf215546Sopenharmony_ci
50bf215546Sopenharmony_cilibaco_files = files(
51bf215546Sopenharmony_ci  'aco_dead_code_analysis.cpp',
52bf215546Sopenharmony_ci  'aco_dominance.cpp',
53bf215546Sopenharmony_ci  'aco_instruction_selection.cpp',
54bf215546Sopenharmony_ci  'aco_instruction_selection.h',
55bf215546Sopenharmony_ci  'aco_instruction_selection_setup.cpp',
56bf215546Sopenharmony_ci  'aco_interface.cpp',
57bf215546Sopenharmony_ci  'aco_interface.h',
58bf215546Sopenharmony_ci  'aco_ir.cpp',
59bf215546Sopenharmony_ci  'aco_ir.h',
60bf215546Sopenharmony_ci  'aco_assembler.cpp',
61bf215546Sopenharmony_ci  'aco_form_hard_clauses.cpp',
62bf215546Sopenharmony_ci  'aco_insert_exec_mask.cpp',
63bf215546Sopenharmony_ci  'aco_insert_NOPs.cpp',
64bf215546Sopenharmony_ci  'aco_insert_waitcnt.cpp',
65bf215546Sopenharmony_ci  'aco_reduce_assign.cpp',
66bf215546Sopenharmony_ci  'aco_register_allocation.cpp',
67bf215546Sopenharmony_ci  'aco_live_var_analysis.cpp',
68bf215546Sopenharmony_ci  'aco_lower_phis.cpp',
69bf215546Sopenharmony_ci  'aco_lower_to_cssa.cpp',
70bf215546Sopenharmony_ci  'aco_lower_to_hw_instr.cpp',
71bf215546Sopenharmony_ci  'aco_optimizer.cpp',
72bf215546Sopenharmony_ci  'aco_optimizer_postRA.cpp',
73bf215546Sopenharmony_ci  'aco_opt_value_numbering.cpp',
74bf215546Sopenharmony_ci  'aco_print_asm.cpp',
75bf215546Sopenharmony_ci  'aco_print_ir.cpp',
76bf215546Sopenharmony_ci  'aco_reindex_ssa.cpp',
77bf215546Sopenharmony_ci  'aco_scheduler.cpp',
78bf215546Sopenharmony_ci  'aco_spill.cpp',
79bf215546Sopenharmony_ci  'aco_ssa_elimination.cpp',
80bf215546Sopenharmony_ci  'aco_statistics.cpp',
81bf215546Sopenharmony_ci  'aco_util.h',
82bf215546Sopenharmony_ci  'aco_validate.cpp',
83bf215546Sopenharmony_ci)
84bf215546Sopenharmony_ci
85bf215546Sopenharmony_cicpp_args_aco = cpp.get_supported_arguments(['-fno-exceptions', '-fno-rtti', '-Wimplicit-fallthrough', '-Wshadow', '-DNOMINMAX'])
86bf215546Sopenharmony_ci
87bf215546Sopenharmony_ci_libaco = static_library(
88bf215546Sopenharmony_ci  'aco',
89bf215546Sopenharmony_ci  [libaco_files, aco_opcodes_c, aco_opcodes_h, aco_builder_h],
90bf215546Sopenharmony_ci  include_directories : [
91bf215546Sopenharmony_ci   inc_include, inc_src, inc_compiler, inc_amd, inc_amd_common,
92bf215546Sopenharmony_ci  ],
93bf215546Sopenharmony_ci  dependencies : [
94bf215546Sopenharmony_ci    dep_llvm, dep_thread, dep_valgrind, idep_nir_headers, idep_amdgfxregs_h, idep_mesautil,
95bf215546Sopenharmony_ci  ],
96bf215546Sopenharmony_ci  gnu_symbol_visibility : 'hidden',
97bf215546Sopenharmony_ci  build_by_default : true,
98bf215546Sopenharmony_ci  cpp_args : [cpp_args_aco, cpp_msvc_compat_args],
99bf215546Sopenharmony_ci)
100bf215546Sopenharmony_ci
101bf215546Sopenharmony_ci# Also link with aco
102bf215546Sopenharmony_ciidep_aco = declare_dependency(
103bf215546Sopenharmony_ci  include_directories : include_directories('.'),
104bf215546Sopenharmony_ci  link_with : _libaco,
105bf215546Sopenharmony_ci)
106