1b1994897Sopenharmony_ci# Copyright (c) 2021-2022 Huawei Device Co., Ltd. 2b1994897Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 3b1994897Sopenharmony_ci# you may not use this file except in compliance with the License. 4b1994897Sopenharmony_ci# You may obtain a copy of the License at 5b1994897Sopenharmony_ci# 6b1994897Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 7b1994897Sopenharmony_ci# 8b1994897Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software 9b1994897Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 10b1994897Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11b1994897Sopenharmony_ci# See the License for the specific language governing permissions and 12b1994897Sopenharmony_ci# limitations under the License. 13b1994897Sopenharmony_ci 14b1994897Sopenharmony_ciimport("//arkcompiler/runtime_core/ark_config.gni") 15b1994897Sopenharmony_ci 16b1994897Sopenharmony_ciconfig("bytecodeopt_public_config") { 17b1994897Sopenharmony_ci include_dirs = [ 18b1994897Sopenharmony_ci "$target_gen_dir", 19b1994897Sopenharmony_ci "$ark_root/bytecode_optimizer", 20b1994897Sopenharmony_ci ] 21b1994897Sopenharmony_ci if (enable_bytecode_optimizer) { 22b1994897Sopenharmony_ci defines = [ "ENABLE_BYTECODE_OPT" ] 23b1994897Sopenharmony_ci } 24b1994897Sopenharmony_ci} 25b1994897Sopenharmony_ci 26b1994897Sopenharmony_cilibarkbytecodeopt_sources = [ 27b1994897Sopenharmony_ci "$ark_root/bytecode_optimizer/bytecode_analysis_results.cpp", 28b1994897Sopenharmony_ci "$ark_root/bytecode_optimizer/codegen.cpp", 29b1994897Sopenharmony_ci "$ark_root/bytecode_optimizer/common.cpp", 30b1994897Sopenharmony_ci "$ark_root/bytecode_optimizer/constant_propagation/constant_propagation.cpp", 31b1994897Sopenharmony_ci "$ark_root/bytecode_optimizer/constant_propagation/lattice_element.cpp", 32b1994897Sopenharmony_ci "$ark_root/bytecode_optimizer/module_constant_analyzer.cpp", 33b1994897Sopenharmony_ci "$ark_root/bytecode_optimizer/optimize_bytecode.cpp", 34b1994897Sopenharmony_ci "$ark_root/bytecode_optimizer/reg_acc_alloc.cpp", 35b1994897Sopenharmony_ci "$ark_root/bytecode_optimizer/reg_encoder.cpp", 36b1994897Sopenharmony_ci] 37b1994897Sopenharmony_ci 38b1994897Sopenharmony_cilibarkbytecodeopt_configs = [ 39b1994897Sopenharmony_ci "$ark_root:ark_config", 40b1994897Sopenharmony_ci ":bytecodeopt_public_config", 41b1994897Sopenharmony_ci "$ark_root/compiler:arkcompiler_public_config", 42b1994897Sopenharmony_ci "$ark_root/libpandabase:arkbase_public_config", 43b1994897Sopenharmony_ci "$ark_root/libpandafile:arkfile_public_config", 44b1994897Sopenharmony_ci "$ark_root/assembler:arkassembler_public_config", 45b1994897Sopenharmony_ci] 46b1994897Sopenharmony_ci 47b1994897Sopenharmony_ciohos_shared_library("libarkbytecodeopt") { 48b1994897Sopenharmony_ci stack_protector_ret = false 49b1994897Sopenharmony_ci sources = libarkbytecodeopt_sources 50b1994897Sopenharmony_ci 51b1994897Sopenharmony_ci configs = libarkbytecodeopt_configs 52b1994897Sopenharmony_ci 53b1994897Sopenharmony_ci deps = [ 54b1994897Sopenharmony_ci ":bytecodeopt_options_gen_h", 55b1994897Sopenharmony_ci ":codegen_intrinsics_cpp", 56b1994897Sopenharmony_ci ":codegen_visitors_inc", 57b1994897Sopenharmony_ci ":isa_gen_arkbytecodeopt_check_width_cpp", 58b1994897Sopenharmony_ci ":isa_gen_arkbytecodeopt_check_width_h", 59b1994897Sopenharmony_ci ":isa_gen_arkbytecodeopt_insn_selection_cpp", 60b1994897Sopenharmony_ci ":isa_gen_arkbytecodeopt_insn_selection_h", 61b1994897Sopenharmony_ci ":reg_encoder_visitors_inc", 62b1994897Sopenharmony_ci "$ark_root/assembler:libarkassembler", 63b1994897Sopenharmony_ci "$ark_root/compiler:libarkcompiler", 64b1994897Sopenharmony_ci "$ark_root/libpandabase:libarkbase", 65b1994897Sopenharmony_ci "$ark_root/libpandafile:libarkfile", 66b1994897Sopenharmony_ci ] 67b1994897Sopenharmony_ci 68b1994897Sopenharmony_ci external_deps = [ sdk_libc_secshared_dep ] 69b1994897Sopenharmony_ci 70b1994897Sopenharmony_ci relative_install_dir = "ark" 71b1994897Sopenharmony_ci output_extension = "so" 72b1994897Sopenharmony_ci part_name = "runtime_core" 73b1994897Sopenharmony_ci subsystem_name = "arkcompiler" 74b1994897Sopenharmony_ci} 75b1994897Sopenharmony_ci 76b1994897Sopenharmony_ciohos_static_library("libarkbytecodeopt_frontend_static") { 77b1994897Sopenharmony_ci stack_protector_ret = false 78b1994897Sopenharmony_ci sources = libarkbytecodeopt_sources 79b1994897Sopenharmony_ci 80b1994897Sopenharmony_ci configs = libarkbytecodeopt_configs 81b1994897Sopenharmony_ci 82b1994897Sopenharmony_ci deps = [ 83b1994897Sopenharmony_ci ":bytecodeopt_options_gen_h", 84b1994897Sopenharmony_ci ":codegen_intrinsics_cpp", 85b1994897Sopenharmony_ci ":codegen_visitors_inc", 86b1994897Sopenharmony_ci ":isa_gen_arkbytecodeopt_check_width_cpp", 87b1994897Sopenharmony_ci ":isa_gen_arkbytecodeopt_check_width_h", 88b1994897Sopenharmony_ci ":isa_gen_arkbytecodeopt_insn_selection_cpp", 89b1994897Sopenharmony_ci ":isa_gen_arkbytecodeopt_insn_selection_h", 90b1994897Sopenharmony_ci ":reg_encoder_visitors_inc", 91b1994897Sopenharmony_ci "$ark_root/assembler:libarkassembler_frontend_static", 92b1994897Sopenharmony_ci "$ark_root/compiler:libarkcompiler_frontend_static", 93b1994897Sopenharmony_ci "$ark_root/libpandabase:libarkbase_frontend_static", 94b1994897Sopenharmony_ci "$ark_root/libpandafile:libarkfile_frontend_static", 95b1994897Sopenharmony_ci ] 96b1994897Sopenharmony_ci 97b1994897Sopenharmony_ci if (is_arkui_x) { 98b1994897Sopenharmony_ci deps += [ "$ark_third_party_root/bounds_checking_function:libsec_static" ] 99b1994897Sopenharmony_ci } else { 100b1994897Sopenharmony_ci external_deps = [ sdk_libc_secshared_dep ] 101b1994897Sopenharmony_ci } 102b1994897Sopenharmony_ci 103b1994897Sopenharmony_ci part_name = "runtime_core" 104b1994897Sopenharmony_ci subsystem_name = "arkcompiler" 105b1994897Sopenharmony_ci} 106b1994897Sopenharmony_ci 107b1994897Sopenharmony_ciark_isa_gen("isa_gen_arkbytecodeopt") { 108b1994897Sopenharmony_ci template_files = [ 109b1994897Sopenharmony_ci "insn_selection.h.erb", 110b1994897Sopenharmony_ci "insn_selection.cpp.erb", 111b1994897Sopenharmony_ci "check_width.cpp.erb", 112b1994897Sopenharmony_ci "check_width.h.erb", 113b1994897Sopenharmony_ci ] 114b1994897Sopenharmony_ci sources = "templates" 115b1994897Sopenharmony_ci destination = "$target_gen_dir/generated" 116b1994897Sopenharmony_ci requires = [ 117b1994897Sopenharmony_ci "bytecode_optimizer_isapi.rb", 118b1994897Sopenharmony_ci "$ark_root/assembler/asm_isapi.rb", 119b1994897Sopenharmony_ci ] 120b1994897Sopenharmony_ci} 121b1994897Sopenharmony_ci 122b1994897Sopenharmony_ciark_gen_file("bytecodeopt_options_gen_h") { 123b1994897Sopenharmony_ci template_file = "../templates/options/options.h.erb" 124b1994897Sopenharmony_ci data_file = "options.yaml" 125b1994897Sopenharmony_ci requires = [ "../templates/common.rb" ] 126b1994897Sopenharmony_ci output_file = "$target_gen_dir/generated/bytecodeopt_options_gen.h" 127b1994897Sopenharmony_ci} 128b1994897Sopenharmony_ci 129b1994897Sopenharmony_ciark_gen_file("reg_encoder_visitors_inc") { 130b1994897Sopenharmony_ci extra_dependencies = [ "$ark_root:concat_plugins_yamls" ] 131b1994897Sopenharmony_ci template_file = "templates/reg_encoder_visitors.inc.erb" 132b1994897Sopenharmony_ci data_file = "$target_gen_dir/../plugin_options.yaml" 133b1994897Sopenharmony_ci requires = [ "$ark_root/templates/plugin_options.rb" ] 134b1994897Sopenharmony_ci output_file = "$target_gen_dir/generated/reg_encoder_visitors.inc" 135b1994897Sopenharmony_ci} 136b1994897Sopenharmony_ci 137b1994897Sopenharmony_ciark_gen_file("codegen_visitors_inc") { 138b1994897Sopenharmony_ci extra_dependencies = [ "$ark_root:concat_plugins_yamls" ] 139b1994897Sopenharmony_ci template_file = "templates/codegen_visitors.inc.erb" 140b1994897Sopenharmony_ci data_file = "$target_gen_dir/../plugin_options.yaml" 141b1994897Sopenharmony_ci requires = [ "$ark_root/templates/plugin_options.rb" ] 142b1994897Sopenharmony_ci output_file = "$target_gen_dir/generated/codegen_visitors.inc" 143b1994897Sopenharmony_ci} 144b1994897Sopenharmony_ci 145b1994897Sopenharmony_ciark_gen_file("codegen_intrinsics_cpp") { 146b1994897Sopenharmony_ci extra_dependencies = [ "$ark_root:concat_plugins_yamls" ] 147b1994897Sopenharmony_ci template_file = "templates/codegen_intrinsics.cpp.erb" 148b1994897Sopenharmony_ci data_file = "$target_gen_dir/../plugin_options.yaml" 149b1994897Sopenharmony_ci requires = [ "$ark_root/templates/plugin_options.rb" ] 150b1994897Sopenharmony_ci output_file = "$target_gen_dir/generated/codegen_intrinsics.cpp" 151b1994897Sopenharmony_ci} 152