arkcompiler_ets_runtime/ecmascript/compiler/BUILD.gn
zhangyukun 3b881fa018 Sync code from c_asm_interpreter to master
Use Stub to impl handlers of bytecodes and use tail call to impl
dispatch of handlers of bytecodes

Signed-off-by: zhangyukun <zhangyukun8@huawei.com>
Change-Id: I7afabdc40ddfa11345aa1029059514aa4f55b9f8
2022-02-22 17:01:18 +08:00

247 lines
5.8 KiB
Plaintext

# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//ark/js_runtime/js_runtime_config.gni")
import("//build/ohos.gni")
action("build_llvm_libs") {
script = "compile_llvm_lib.sh"
sources = [ "//ark/js_runtime/ecmascript/compiler/compile_llvm_lib.sh" ]
outputs = [ "${root_out_dir}/llvm" ]
}
config("include_llvm") {
if (compile_llvm_online) {
include_dirs = [
"//third_party/llvm-project/build/include",
"//third_party/llvm-project/llvm/include/",
]
} else {
include_dirs = [
"//prebuilts/ark_js_prebuilts/llvm_prebuilts/llvm/include",
"//prebuilts/ark_js_prebuilts/llvm_prebuilts/build/include",
]
}
}
config("ark_jsruntime_compiler_config") {
configs = [ "//ark/js_runtime:ark_jsruntime_common_config" ]
}
source_set("libark_jsoptimizer_static") {
sources = [
"bytecode_circuit_builder.cpp",
"circuit.cpp",
"circuit_builder.cpp",
"circuit_builder_helper.cpp",
"fast_stub.cpp",
"gate.cpp",
"gate_accessor.cpp",
"interpreter_stub.cpp",
"llvm_codegen.cpp",
"llvm_ir_builder.cpp",
"scheduler.cpp",
"stub.cpp",
"stub_descriptor.cpp",
"type.cpp",
"verifier.cpp",
]
public_configs = [
":include_llvm",
":ark_jsruntime_compiler_config",
"//ark/js_runtime:ark_jsruntime_public_config",
"$ark_root/runtime:arkruntime_public_config",
]
if (compile_llvm_online) {
lib_dirs = [ "//third_party/llvm-project/build/lib" ]
} else {
lib_dirs = [ "//prebuilts/ark_js_prebuilts/llvm_prebuilts/build/lib" ]
}
libs = [
"LLVMTarget",
"LLVMObject",
"LLVMMC",
"LLVMSupport",
"LLVMCore",
"LLVMExecutionEngine",
"LLVMInterpreter",
"LLVMMCJIT",
"LLVMExegesis",
"LLVMRuntimeDyld",
"LLVMInstCombine",
"LLVMAnalysis",
"LLVMScalarOpts",
"LLVMBinaryFormat",
"LLVMDebugInfoDWARF",
"LLVMRemarks",
"LLVMTextAPI",
"LLVMScalarOpts",
"LLVMTransformUtils",
"LLVMBitReader",
"LLVMAsmPrinter",
"LLVMProfileData",
"LLVMBitstreamReader",
"LLVMSelectionDAG",
"LLVMGlobalISel",
"LLVMLTO",
"LLVMCFGuard",
"LLVMVectorize",
"LLVMDemangle",
"LLVMipo",
"LLVMInstrumentation",
"LLVMDebugInfoCodeView",
"LLVMAggressiveInstCombine",
"LLVMAsmParser",
"LLVMMCParser",
"LLVMMIRParser",
"LLVMMCDisassembler",
"LLVMCodeGen",
"LLVMTransformUtils",
"LLVMIRReader",
"LLVMARMUtils",
"LLVMARMCodeGen",
"LLVMARMDisassembler",
"LLVMARMDesc",
"LLVMARMInfo",
"LLVMARMAsmParser",
"LLVMAArch64Utils",
"LLVMAArch64CodeGen",
"LLVMAArch64Info",
"LLVMAArch64Desc",
"LLVMAArch64Disassembler",
"LLVMAArch64AsmParser",
"LLVMX86Utils",
"LLVMX86AsmParser",
"LLVMX86CodeGen",
"LLVMX86Desc",
"LLVMX86Disassembler",
"LLVMX86Info",
]
deps = [
"$ark_root/libpandabase:libarkbase",
"$ark_root/libpandafile:libarkfile",
"$ark_root/runtime:arkruntime_header_deps",
]
}
ohos_shared_library("libark_jsoptimizer") {
deps = [
":libark_jsoptimizer_static",
"//ark/js_runtime:libark_jsruntime",
]
if (compile_llvm_online) {
deps += [ ":build_llvm_libs" ]
}
install_enable = true
part_name = "ark_js_runtime"
output_extension = "so"
if (!is_standard_system) {
relative_install_dir = "ark"
}
subsystem_name = "ark"
}
ohos_shared_library("libark_jsoptimizer_test") {
deps = [
":libark_jsoptimizer_static",
"//ark/js_runtime:libark_jsruntime_test_static",
]
if (is_standard_system) {
deps += [ "$ark_root/runtime:libarkruntime_static" ]
} else {
deps += [ "$ark_root/runtime:libarkruntime" ]
}
if (compile_llvm_online) {
deps += [ ":build_llvm_libs" ]
}
output_extension = "so"
subsystem_name = "test"
}
ark_gen_file("stub_aot_options_gen_h") {
template_file = "options.h.erb"
data_file = "stub_aot_options.yaml"
requires = [ "$ark_root/templates/common.rb" ]
output_file = "$target_gen_dir/generated/stub_aot_options_gen.h"
}
ohos_executable("ark_stub_opt") {
sources = [ "stub_aot_compiler.cpp" ]
include_dirs = [ "$target_gen_dir" ]
configs = [
":include_llvm",
":ark_jsruntime_compiler_config",
"//ark/js_runtime:ark_jsruntime_public_config",
"$ark_root/runtime:arkruntime_public_config",
]
deps = [
":stub_aot_options_gen_h",
"$ark_root/libpandabase:libarkbase",
"//ark/js_runtime:libark_jsruntime",
"//ark/js_runtime/ecmascript/compiler:libark_jsoptimizer",
]
if (!is_standard_system) {
deps += [ "$ark_root/runtime:libarkruntime" ]
}
part_name = "ark_js_runtime"
install_enable = false
output_name = "ark_stub_opt"
subsystem_name = "ark"
}
ohos_executable("ark_ts_aot") {
sources = [
"aot_compiler.cpp",
"pass_manager.cpp",
"slowpath_lowering.cpp",
]
configs = [
":include_llvm",
":ark_jsruntime_compiler_config",
"//ark/js_runtime:ark_jsruntime_public_config",
"$ark_root/runtime:arkruntime_public_config",
]
deps = [
"$ark_root/libpandabase:libarkbase",
"//ark/js_runtime:libark_jsruntime",
"//ark/js_runtime/ecmascript/compiler:libark_jsoptimizer",
]
if (!is_standard_system) {
deps += [ "$ark_root/runtime:libarkruntime" ]
}
part_name = "ark_js_runtime"
install_enable = false
output_name = "ark_ts_aot"
subsystem_name = "ark"
}