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