arkcompiler_ets_runtime/ecmascript/compiler/BUILD.gn
huoqingyi 9cf6e63579 Fix bugs in ts aot
Description:
1.Fix the bug that Circuit IR args gates do not match the function args of the abc file.
2.Add class ArgumentAccessor to handle args gates of Circuit IR.
3.Modify to set the AOT function entry when constpool is being parsed.
4.For functions sharing the same instructions, add a map to collect duplicate infomation. The key of the map is the current method and the value is the first method with the same nstructions to be translated.

Issue:
https://gitee.com/openharmony/ark_js_runtime/issues/I5DA6V

Change-Id: I08e48444eb22c4fc2841e1cdae44b90286de84ac
Signed-off-by: huoqingyi <huoqingyi@huawei.com>
2022-07-04 16:19:11 +08:00

317 lines
7.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.
if (defined(ark_standalone_build)) {
import("//js_runtime/js_runtime_config.gni")
import("$build_root/ark.gni")
} else {
import("//ark/js_runtime/js_runtime_config.gni")
import("//build/ohos.gni")
action("build_llvm_libs") {
script = "compile_llvm_lib.sh"
sources = [ "$js_root/ecmascript/compiler/compile_llvm_lib.sh" ]
outputs = [ "${root_out_dir}/llvm" ]
}
}
config("include_llvm") {
if (compile_llvm_online) {
include_dirs = [
"//third_party/third_party_llvm-project/build/include",
"//third_party/third_party_llvm-project/llvm/include/",
]
} else {
include_dirs = [
"//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts/llvm/include",
"//prebuilts/ark_tools/ark_js_prebuilts/llvm_prebuilts/build/include",
]
}
}
source_set("libark_jsoptimizer_set") {
sources = [
"argument_accessor.cpp",
"assembler/aarch64/assembler_aarch64.cpp",
"assembler/aarch64/extend_assembler.cpp",
"assembler/x64/assembler_x64.cpp",
"assembler/x64/extended_assembler_x64.cpp",
"assembler_module.cpp",
"bc_call_signature.cpp",
"bytecode_circuit_builder.cpp",
"call_signature.cpp",
"circuit.cpp",
"circuit_builder.cpp",
"circuit_optimizer.cpp",
"common_stubs.cpp",
"file_generators.cpp",
"gate.cpp",
"gate_accessor.cpp",
"interpreter_stub.cpp",
"llvm_codegen.cpp",
"llvm_ir_builder.cpp",
"rt_call_signature.cpp",
"scheduler.cpp",
"stub.cpp",
"test_stubs.cpp",
"test_stubs_signature.cpp",
"trampoline/aarch64/assembler_stubs.cpp",
"trampoline/x64/assembler_stubs_x64.cpp",
"type.cpp",
"type_inference/type_infer.cpp",
"verifier.cpp",
]
public_configs = [
":include_llvm",
"$js_root:ark_jsruntime_compiler_config",
"$js_root:ark_jsruntime_public_config",
]
if (compile_llvm_online) {
lib_dirs = [ "//third_party/third_party_llvm-project/build/lib" ]
} else {
lib_dirs =
[ "//prebuilts/ark_tools/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",
"LLVMX86AsmParser",
"LLVMX86CodeGen",
"LLVMX86Desc",
"LLVMX86Disassembler",
"LLVMX86Info",
"LLVMFrontendOpenMP",
"LLVMBitWriter",
]
deps = [
"$ark_root/libpandabase:libarkbase",
"$ark_root/libpandafile:libarkfile",
]
if (compile_llvm_online) {
deps += [ ":build_llvm_libs" ]
}
}
source_set("ark_stub_compiler_set") {
sources = [ "stub_compiler.cpp" ]
include_dirs = [ "$target_gen_dir" ]
public_configs = [
":include_llvm",
"$js_root:ark_jsruntime_compiler_config",
"$js_root:ark_jsruntime_public_config",
]
deps = [
":libark_jsoptimizer_set",
":libark_mock_stub_set",
"$ark_root/libpandabase:libarkbase",
"$js_root:libark_js_intl_set",
"$js_root:libark_jsruntime_set",
]
}
source_set("ark_aot_compiler_set") {
sources = [
"aot_compiler.cpp",
"pass_manager.cpp",
"slowpath_lowering.cpp",
"type_lowering.cpp",
]
public_configs = [
":include_llvm",
"$js_root:ark_jsruntime_compiler_config",
"$js_root:ark_jsruntime_public_config",
]
deps = [
"$ark_root/libpandabase:libarkbase",
"$js_root:libark_jsruntime",
"$js_root/ecmascript/compiler:libark_jsoptimizer",
]
}
source_set("libark_stub_set") {
deps = [ ":build_stub_to_cpp" ]
sources = [ "$root_gen_dir/ark/js_runtime/stub_m.cpp" ]
public_configs = [
"$js_root:ark_jsruntime_common_config",
"$js_root:ark_jsruntime_public_config",
]
}
source_set("libark_mock_stub_set") {
sources = [ "mock/mock_stub_m.cpp" ]
public_configs = [
"$js_root:ark_jsruntime_common_config",
"$js_root:ark_jsruntime_public_config",
]
}
ohos_shared_library("libark_jsoptimizer") {
deps = [
":libark_jsoptimizer_set",
"$js_root:libark_jsruntime",
]
install_enable = false
output_extension = "so"
part_name = "ark_js_runtime"
subsystem_name = "ark"
}
if (!defined(ark_standalone_build)) {
ohos_shared_library("libark_jsoptimizer_test") {
deps = [
":libark_jsoptimizer_set",
"$js_root:libark_jsruntime_test_set",
]
install_enable = false
output_extension = "so"
subsystem_name = "test"
}
ohos_executable("ark_stub_compiler") {
deps = [ ":ark_stub_compiler_set" ]
install_enable = false
part_name = "ark_js_runtime"
subsystem_name = "ark"
}
ohos_executable("ark_aot_compiler") {
deps = [ ":ark_aot_compiler_set" ]
install_enable = false
part_name = "ark_js_runtime"
subsystem_name = "ark"
}
action("gen_stub_file") {
script = "$js_root/script/run_ark_executable.py"
deps =
[ "$js_root/ecmascript/compiler:ark_stub_compiler(${host_toolchain})" ]
stub_file_gen_dir = "$root_gen_dir/ark/js_runtime"
root_out_dir_with_host_toolchain =
get_label_info(":ark_stub_compiler(${host_toolchain})", "root_out_dir")
if (current_toolchain == host_toolchain) {
stub_option = " --stub-file=" + rebase_path(stub_file_gen_dir) + "/stub.m"
} else {
stub_option = " --stub-file=" + rebase_path(stub_file_gen_dir) +
"/stub.m" + " --target-triple=aarch64-unknown-linux-gnu"
}
args = [
"--script-file",
rebase_path(root_out_dir_with_host_toolchain) +
"/ark/ark_js_runtime/ark_stub_compiler",
"--script-options",
stub_option,
"--expect-output",
"0",
"--env-path",
rebase_path(root_out_dir_with_host_toolchain) + "/ark/ark:" +
rebase_path(root_out_dir_with_host_toolchain) +
"/ark/ark_js_runtime:" +
rebase_path(root_out_dir_with_host_toolchain) + "/thirdparty/icu:" +
rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
]
outputs = [ "$stub_file_gen_dir/stub.m" ]
}
action("build_stub_to_cpp") {
sources = [ "$root_gen_dir/ark/js_runtime/stub.m" ]
script = "$js_root/script/build_resource_to_cpp.py"
deps = [ ":gen_stub_file" ]
args = [
"--input",
rebase_path("$root_gen_dir/ark/js_runtime/stub.m"),
"--output",
rebase_path("$root_gen_dir/ark/js_runtime/stub_m.cpp"),
]
outputs = [ "$root_gen_dir/ark/js_runtime/stub_m.cpp" ]
}
}