blob: dd20b9c4be3914a4280a21cebf4d3ee6db70777e [file] [log] [blame]
# Copyright 2016 The Fuchsia Authors
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
import("../../../mesa.gni")
config("nir_public_config") {
include_dirs = [ "." ]
}
mesa_source_set("nir") {
public_configs = [
":nir_public_config",
]
public_deps = [
":gen",
]
deps = [
":nir_compiler_workaround",
"$mesa_build_root/include:c_compat",
"$mesa_build_root/src/compiler/glsl:ir_expression_operation",
"$mesa_build_root/src/util",
]
include_dirs = [
"..",
"$mesa_build_root/src/mapi",
"$mesa_build_root/src/mesa",
]
sources = [
"nir.c",
"nir.h",
"nir_builder.h",
"nir_builtin_builder.c",
"nir_clone.c",
"nir_constant_expressions.h",
"nir_control_flow.c",
"nir_control_flow.h",
"nir_control_flow_private.h",
"nir_deref.c",
"nir_dominance.c",
"nir_from_ssa.c",
"nir_gather_info.c",
"nir_gs_count_vertices.c",
"nir_inline_functions.c",
"nir_instr_set.c",
"nir_instr_set.h",
"nir_linking_helpers.c",
"nir_liveness.c",
"nir_loop_analyze.c",
"nir_lower_alu_to_scalar.c",
"nir_lower_bit_size.c",
"nir_lower_clip.c",
"nir_lower_clip_cull_distance_arrays.c",
"nir_lower_constant_initializers.c",
"nir_lower_double_ops.c",
"nir_lower_global_vars_to_local.c",
"nir_lower_gs_intrinsics.c",
"nir_lower_idiv.c",
"nir_lower_indirect_derefs.c",
"nir_lower_int64.c",
"nir_lower_io.c",
"nir_lower_io_arrays_to_elements.c",
"nir_lower_io_to_temporaries.c",
"nir_lower_load_const_to_scalar.c",
"nir_lower_locals_to_regs.c",
"nir_lower_packing.c",
"nir_lower_patch_vertices.c",
"nir_lower_phis_to_scalar.c",
"nir_lower_regs_to_ssa.c",
"nir_lower_returns.c",
"nir_lower_subgroups.c",
"nir_lower_system_values.c",
"nir_lower_tex.c",
"nir_lower_to_source_mods.c",
"nir_lower_two_sided_color.c",
"nir_lower_var_copies.c",
"nir_lower_vars_to_ssa.c",
"nir_lower_vec_to_movs.c",
"nir_lower_wpos_center.c",
"nir_metadata.c",
"nir_move_vec_src_uses_to_dest.c",
"nir_normalize_cubemap_coords.c",
"nir_opt_constant_folding.c",
"nir_opt_copy_prop_vars.c",
"nir_opt_copy_propagate.c",
"nir_opt_cse.c",
"nir_opt_dce.c",
"nir_opt_dead_cf.c",
"nir_opt_gcm.c",
"nir_opt_global_to_local.c",
"nir_opt_if.c",
"nir_opt_intrinsics.c",
"nir_opt_large_constants.c",
"nir_opt_loop_unroll.c",
"nir_opt_move_comparisons.c",
"nir_opt_peephole_select.c",
"nir_opt_remove_phis.c",
"nir_opt_trivial_continues.c",
"nir_opt_undef.c",
"nir_phi_builder.c",
"nir_print.c",
"nir_propagate_invariant.c",
"nir_remove_dead_variables.c",
"nir_repair_ssa.c",
"nir_search.c",
"nir_search.h",
"nir_serialize.c",
"nir_split_per_member_structs.c",
"nir_split_var_copies.c",
"nir_sweep.c",
"nir_to_lcssa.c",
"nir_validate.c",
"nir_vla.h",
"nir_worklist.c",
"nir_worklist.h",
]
}
# With -O2 this file causes an infinite loop with clang 3.9.0
mesa_source_set("nir_compiler_workaround") {
sources = [
"nir_lower_wpos_ytransform.c",
]
cflags_c = [ "-O1" ]
include_dirs = [ "$mesa_build_root/src/mesa" ]
deps = [
":gen",
"$mesa_build_root/src/util",
]
}
group("nir_headers") {
public_configs = [ ":nir_public_config" ]
public_deps = [
":gen",
]
}
action("nir_opcodes") {
output_name = "nir_opcodes.h"
script_name = "nir_opcodes_h.py"
script = "$mesa_build_root/scripts/gn_script_wrapper.py"
outputs = [
"$target_gen_dir/$output_name",
]
inputs = [
"nir_opcodes.py",
script_name,
]
args = [
"$magma_python_path",
rebase_path(target_gen_dir) + "/$output_name",
rebase_path(".") + "/$script_name",
]
}
action("nir_builder_opcodes") {
output_name = "nir_builder_opcodes.h"
script_name = "nir_builder_opcodes_h.py"
script = "$mesa_build_root/scripts/gn_script_wrapper.py"
outputs = [
"$target_gen_dir/$output_name",
]
inputs = [
"nir_opcodes.py",
script_name,
]
args = [
"$magma_python_path",
rebase_path(target_gen_dir) + "/$output_name",
rebase_path(".") + "/$script_name",
]
}
action("nir_constant_expressions") {
output_name = "nir_constant_expressions.c"
script_name = "nir_constant_expressions.py"
script = "$mesa_build_root/scripts/gn_script_wrapper.py"
outputs = [
"$target_gen_dir/$output_name",
]
inputs = [
"nir_opcodes.py",
script_name,
]
args = [
"$magma_python_path",
rebase_path(target_gen_dir) + "/$output_name",
rebase_path(".") + "/$script_name",
]
}
action("nir_opcodes_c") {
output_name = "nir_opcodes.c"
script_name = "nir_opcodes_c.py"
script = "$mesa_build_root/scripts/gn_script_wrapper.py"
outputs = [
"$target_gen_dir/$output_name",
]
inputs = [
"nir_opcodes.py",
script_name,
]
args = [
"$magma_python_path",
rebase_path(target_gen_dir) + "/$output_name",
rebase_path(".") + "/$script_name",
]
}
action("nir_opt_algebraic") {
output_name = "nir_opt_algebraic.c"
script_name = "nir_opt_algebraic.py"
script = "$mesa_build_root/scripts/gn_script_wrapper.py"
outputs = [
"$target_gen_dir/$output_name",
]
inputs = [
"nir_algebraic.py",
script_name,
]
args = [
"$magma_python_path",
rebase_path(target_gen_dir) + "/$output_name",
rebase_path(".") + "/$script_name",
]
}
action("nir_intrinsics_h") {
output_name = "nir_intrinsics.h"
script = "$mesa_build_root/scripts/python_exec.py"
outputs = [
"$target_gen_dir/$output_name",
]
inputs = [
"nir_intrinsics_h.py",
"nir_intrinsics.py",
]
args = [
rebase_path("$magma_python_path"),
rebase_path("nir_intrinsics_h.py"),
"--outdir",
rebase_path(target_gen_dir),
]
}
action("nir_intrinsics_c") {
output_name = "nir_intrinsics.c"
script = "$mesa_build_root/scripts/python_exec.py"
outputs = [
"$target_gen_dir/$output_name",
]
inputs = [
"nir_intrinsics_c.py",
"nir_intrinsics.py",
]
args = [
rebase_path("$magma_python_path"),
rebase_path("nir_intrinsics_c.py"),
"--outdir",
rebase_path(target_gen_dir),
]
}
config("gen_public_config") {
include_dirs = [ target_gen_dir ]
}
mesa_source_set("gen") {
public_configs = [ ":gen_public_config" ]
public_deps = [
":nir_builder_opcodes",
":nir_constant_expressions",
":nir_intrinsics_c",
":nir_intrinsics_h",
":nir_opcodes",
":nir_opcodes_c",
":nir_opt_algebraic",
"$mesa_build_root/src/util",
]
include_dirs = [
"$mesa_build_root/src/mesa",
"$mesa_build_root/src/mapi",
".",
]
sources = [
"$target_gen_dir/nir_constant_expressions.c",
"$target_gen_dir/nir_intrinsics.c",
"$target_gen_dir/nir_opcodes.c",
"$target_gen_dir/nir_opt_algebraic.c",
]
}