• 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) {
22    defines = [ "ENABLE_BYTECODE_OPT" ]
23  }
24}
25
26libarkbytecodeopt_sources = [
27  "$ark_root/bytecode_optimizer/bytecode_analysis_results.cpp",
28  "$ark_root/bytecode_optimizer/codegen.cpp",
29  "$ark_root/bytecode_optimizer/common.cpp",
30  "$ark_root/bytecode_optimizer/constant_propagation/constant_propagation.cpp",
31  "$ark_root/bytecode_optimizer/constant_propagation/lattice_element.cpp",
32  "$ark_root/bytecode_optimizer/module_constant_analyzer.cpp",
33  "$ark_root/bytecode_optimizer/optimize_bytecode.cpp",
34  "$ark_root/bytecode_optimizer/reg_acc_alloc.cpp",
35  "$ark_root/bytecode_optimizer/reg_encoder.cpp",
36]
37
38libarkbytecodeopt_configs = [
39  "$ark_root:ark_config",
40  ":bytecodeopt_public_config",
41  "$ark_root/compiler:arkcompiler_public_config",
42  "$ark_root/libpandabase:arkbase_public_config",
43  "$ark_root/libpandafile:arkfile_public_config",
44  "$ark_root/assembler:arkassembler_public_config",
45]
46
47ohos_shared_library("libarkbytecodeopt") {
48  stack_protector_ret = false
49  sources = libarkbytecodeopt_sources
50
51  configs = libarkbytecodeopt_configs
52
53  deps = [
54    ":bytecodeopt_options_gen_h",
55    ":codegen_intrinsics_cpp",
56    ":codegen_visitors_inc",
57    ":isa_gen_arkbytecodeopt_check_width_cpp",
58    ":isa_gen_arkbytecodeopt_check_width_h",
59    ":isa_gen_arkbytecodeopt_insn_selection_cpp",
60    ":isa_gen_arkbytecodeopt_insn_selection_h",
61    ":reg_encoder_visitors_inc",
62    "$ark_root/assembler:libarkassembler",
63    "$ark_root/compiler:libarkcompiler",
64    "$ark_root/libpandabase:libarkbase",
65    "$ark_root/libpandafile:libarkfile",
66  ]
67
68  external_deps = [ sdk_libc_secshared_dep ]
69  if (enable_hilog && defined(ohos_indep_compiler_enable) &&
70      ohos_indep_compiler_enable) {
71    external_deps += [ "hilog:libhilog" ]
72  }
73
74  relative_install_dir = "ark"
75  output_extension = "so"
76  part_name = "runtime_core"
77  subsystem_name = "arkcompiler"
78}
79
80ohos_static_library("libarkbytecodeopt_frontend_static") {
81  stack_protector_ret = false
82  sources = libarkbytecodeopt_sources
83
84  configs = libarkbytecodeopt_configs
85
86  deps = [
87    ":bytecodeopt_options_gen_h",
88    ":codegen_intrinsics_cpp",
89    ":codegen_visitors_inc",
90    ":isa_gen_arkbytecodeopt_check_width_cpp",
91    ":isa_gen_arkbytecodeopt_check_width_h",
92    ":isa_gen_arkbytecodeopt_insn_selection_cpp",
93    ":isa_gen_arkbytecodeopt_insn_selection_h",
94    ":reg_encoder_visitors_inc",
95    "$ark_root/assembler:libarkassembler_frontend_static",
96    "$ark_root/compiler:libarkcompiler_frontend_static",
97    "$ark_root/libpandabase:libarkbase_frontend_static",
98    "$ark_root/libpandafile:libarkfile_frontend_static",
99  ]
100
101  if (is_arkui_x) {
102    deps += [ "$ark_third_party_root/bounds_checking_function:libsec_static" ]
103  } else {
104    external_deps = [ sdk_libc_secshared_dep ]
105    if (enable_hilog && defined(ohos_indep_compiler_enable) &&
106        ohos_indep_compiler_enable) {
107      external_deps += [ "hilog:libhilog" ]
108    }
109  }
110
111  part_name = "runtime_core"
112  subsystem_name = "arkcompiler"
113}
114
115ark_isa_gen("isa_gen_arkbytecodeopt") {
116  template_files = [
117    "insn_selection.h.erb",
118    "insn_selection.cpp.erb",
119    "check_width.cpp.erb",
120    "check_width.h.erb",
121  ]
122  sources = "templates"
123  destination = "$target_gen_dir/generated"
124  requires = [
125    "bytecode_optimizer_isapi.rb",
126    "$ark_root/assembler/asm_isapi.rb",
127  ]
128}
129
130ark_gen_file("bytecodeopt_options_gen_h") {
131  template_file = "../templates/options/options.h.erb"
132  data_file = "options.yaml"
133  requires = [ "../templates/common.rb" ]
134  output_file = "$target_gen_dir/generated/bytecodeopt_options_gen.h"
135}
136
137ark_gen_file("reg_encoder_visitors_inc") {
138  extra_dependencies = [ "$ark_root:concat_plugins_yamls" ]
139  template_file = "templates/reg_encoder_visitors.inc.erb"
140  data_file = "$target_gen_dir/../plugin_options.yaml"
141  requires = [ "$ark_root/templates/plugin_options.rb" ]
142  output_file = "$target_gen_dir/generated/reg_encoder_visitors.inc"
143}
144
145ark_gen_file("codegen_visitors_inc") {
146  extra_dependencies = [ "$ark_root:concat_plugins_yamls" ]
147  template_file = "templates/codegen_visitors.inc.erb"
148  data_file = "$target_gen_dir/../plugin_options.yaml"
149  requires = [ "$ark_root/templates/plugin_options.rb" ]
150  output_file = "$target_gen_dir/generated/codegen_visitors.inc"
151}
152
153ark_gen_file("codegen_intrinsics_cpp") {
154  extra_dependencies = [ "$ark_root:concat_plugins_yamls" ]
155  template_file = "templates/codegen_intrinsics.cpp.erb"
156  data_file = "$target_gen_dir/../plugin_options.yaml"
157  requires = [ "$ark_root/templates/plugin_options.rb" ]
158  output_file = "$target_gen_dir/generated/codegen_intrinsics.cpp"
159}
160