# Copyright (c) 2023 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("//arkcompiler/ets_runtime/js_runtime_config.gni")
include_directories = [
"${MAPLEALL_ROOT}/maple_be/include/cg",
"${MAPLEALL_ROOT}/maple_be/include/litecg",
"${MAPLEALL_ROOT}/maple_be/include/ad",
"${MAPLEALL_ROOT}/maple_be/include/ad/target",
"${MAPLEALL_ROOT}/maple_be/include/be",
"${MAPLEALL_ROOT}/maple_driver/include",
"${MAPLEALL_ROOT}/maple_util/include",
"${MAPLEALL_ROOT}/maple_ir/include",
"${MAPLEALL_ROOT}/maple_me/include",
"${MAPLEALL_ROOT}/mpl2mpl/include",
"${MAPLEALL_ROOT}/mempool/include",
"${MAPLEALL_ROOT}/maple_ipa/include",
"${MAPLEALL_ROOT}/maple_ipa/include/old",
"${MAPLEALL_ROOT}/maple_phase/include",
]
if (enable_jit_code_sign) {
include_directories += [ "$js_root/ecmascript/compiler" ]
}
deps_libcg = [
":libmplbe",
"${MAPLEALL_ROOT}/mempool:libmempool",
"${MAPLEALL_ROOT}/maple_phase:libmplphase",
"${MAPLEALL_ROOT}/mpl2mpl:libmpl2mpl",
"${MAPLEALL_ROOT}/maple_ir:libmplir",
"${MAPLEALL_ROOT}/maple_util:libmplutil",
"${MAPLEALL_ROOT}/maple_me:libmplme",
]
deps_libmplbe = [ ":libcglowerer" ]
if (TARGET == "aarch64" || TARGET == "x86_64") {
include_directories += [
"${MAPLEALL_ROOT}/maple_be/include/cg/x86_64",
"${MAPLEALL_ROOT}/maple_be/include/be/x86_64",
"${MAPLEALL_ROOT}/maple_be/include/cg/aarch64",
"${MAPLEALL_ROOT}/maple_be/include/be/aarch64",
]
deps_libcg += [
":libcgx8664",
":libcgaarch64",
":libcgphases",
"${MAPLEALL_ROOT}/maple_driver:libmaple_driver",
]
}
if (TARGET == "ark") {
include_directories += [
"${MAPLEALL_ROOT}/maple_be/include/cg/ark",
"${MAPLEALL_ROOT}/maple_be/include/be/ark",
]
deps_libcg += [ ":libcgark" ]
}
src_libcglowerer = [ "src/be/lower.cpp" ]
src_libmplbe = [
"src/be/becommon.cpp",
"src/be/switch_lowerer.cpp",
]
src_libcgaarch64 = [
"src/cg/aarch64/aarch64_targetinfo.cpp",
"src/cg/aarch64/aarch64_abi.cpp",
"src/cg/aarch64/aarch64_call_conv.cpp",
"src/cg/aarch64/aarch64_cfi_generator.cpp",
"src/cg/aarch64/aarch64_cgfunc.cpp",
"src/cg/aarch64/aarch64_emitter.cpp",
"src/cg/aarch64/aarch64_obj_emitter.cpp",
"src/cg/aarch64/aarch64_fixshortbranch.cpp",
"src/cg/aarch64/aarch64_proepilog.cpp",
"src/cg/aarch64/aarch64_operand.cpp",
"src/cg/aarch64/aarch64_reg_info.cpp",
"src/cg/aarch64/aarch64_insn.cpp",
"src/cg/aarch64/aarch64_isa.cpp",
"src/cg/aarch64/aarch64_memlayout.cpp",
"src/cg/aarch64/aarch64_args.cpp",
"src/cg/aarch64/aarch64_live.cpp",
"src/cg/aarch64/aarch64_offset_adjust.cpp",
"src/cg/aarch64/aarch64_optimize_common.cpp",
"src/cg/aarch64/aarch64_peep.cpp",
"src/cg/aarch64/aarch64_cg.cpp",
"src/cg/aarch64/aarch64_cfgo.cpp",
"src/cg/aarch64/aarch64_imm_valid.cpp",
]
src_libcgx86phases = [
"src/cg/peep.cpp",
"src/cg/cfgo.cpp",
"src/cg/cg_dominance.cpp",
"src/cg/cg_stackmap_computation.cpp",
]
src_libcgx8664 = [
"src/cg/x86_64/x64_targetinfo.cpp",
"src/cg/x86_64/x64_cg.cpp",
"src/cg/x86_64/x64_MPIsel.cpp",
"src/cg/x86_64/x64_cgfunc.cpp",
"src/cg/x86_64/x64_memlayout.cpp",
"src/cg/x86_64/x64_emitter.cpp",
"src/cg/x86_64/x64_abi.cpp",
"src/cg/x86_64/x64_call_conv.cpp",
"src/cg/x86_64/x64_standardize.cpp",
"src/cg/x86_64/x64_reg_info.cpp",
"src/cg/x86_64/x64_proepilog.cpp",
"src/cg/x86_64/x64_args.cpp",
"src/cg/x86_64/x64_peep.cpp",
"src/cg/x86_64/x64_cfgo.cpp",
"src/cg/x86_64/x64_isa.cpp",
"src/cg/x86_64/x64_optimize_common.cpp",
"src/cg/x86_64/elf_assembler.cpp",
"src/cg/x86_64/asm_assembler.cpp",
]
src_libcgark = [ "src/cg/ark/foo.cpp" ]
src_libcgphases = [
"src/cg/cfi_generator.cpp",
"src/cg/cfgo.cpp",
"src/cg/peep.cpp",
"src/cg/cg_dominance.cpp",
]
src_libcg = [
"src/cg/args.cpp",
"src/cg/cg_irbuilder.cpp",
"src/cg/cfi.cpp",
"src/cg/cgbb.cpp",
"src/cg/operand.cpp",
"src/cg/cgfunc.cpp",
"src/cg/cg_cfg.cpp",
"src/cg/cg_option.cpp",
"src/cg/cg_options.cpp",
"src/cg/optimize_common.cpp",
"src/cg/emit.cpp",
"src/cg/obj_emit.cpp",
"src/cg/ifile.cpp",
"src/cg/live.cpp",
"src/cg/loop.cpp",
"src/cg/isel.cpp",
"src/cg/standardize.cpp",
"src/cg/memlayout.cpp",
"src/cg/label_creation.cpp",
"src/cg/offset_adjust.cpp",
"src/cg/reg_alloc.cpp",
"src/cg/reg_alloc_lsra.cpp",
"src/cg/proepilog.cpp",
"src/cg/cg.cpp",
"src/cg/isa.cpp",
"src/cg/insn.cpp",
"src/cg/cg_phasemanager.cpp",
"src/litecg/litecg.cpp",
"src/litecg/lmir_builder.cpp",
"src/cg/target_registry.cpp",
"src/cg/target_select.cpp",
]
ohos_source_set("libcglowerer") {
stack_protector_ret = false
if (enable_sanitize) {
sanitize = {
cfi = true
cfi_cross_dso = true
debug = false
}
branch_protector_ret = "pac_ret"
}
configs = [ "${MAPLEALL_ROOT}:mapleallcompilecfg" ]
sources = src_libcglowerer
include_dirs = include_directories
external_deps = [ "bounds_checking_function:libsec_static" ]
part_name = "ets_runtime"
subsystem_name = "arkcompiler"
}
ohos_static_library("libmplbe") {
stack_protector_ret = false
if (enable_sanitize) {
sanitize = {
cfi = true
cfi_cross_dso = true
debug = false
}
branch_protector_ret = "pac_ret"
}
configs = [ "${MAPLEALL_ROOT}:mapleallcompilecfg" ]
sources = src_libmplbe
deps = deps_libmplbe
include_dirs = include_directories
output_dir = "${root_out_dir}/lib/${HOST_ARCH}"
external_deps = [ "bounds_checking_function:libsec_static" ]
part_name = "ets_runtime"
subsystem_name = "arkcompiler"
}
ohos_source_set("libcgaarch64") {
stack_protector_ret = false
if (enable_sanitize) {
sanitize = {
cfi = true
cfi_cross_dso = true
debug = false
}
branch_protector_ret = "pac_ret"
}
configs = [ "${MAPLEALL_ROOT}:mapleallcompilecfg" ]
sources = src_libcgaarch64
include_dirs = include_directories
defines = []
external_deps = [ "bounds_checking_function:libsec_static" ]
if (ets_runtime_enable_cmc_gc) {
# defines += [ "ENABLE_CMC_IR_FIX_REGISTER" ]
}
if (enable_jit_code_sign) {
defines += [ "JIT_ENABLE_CODE_SIGN" ]
external_deps += [ "code_signature:libjit_code_sign" ]
if (disable_fort_switch) {
defines += [ "JIT_FORT_DISABLE" ]
}
}
part_name = "ets_runtime"
subsystem_name = "arkcompiler"
}
ohos_source_set("libcgx8664") {
stack_protector_ret = false
if (enable_sanitize) {
sanitize = {
cfi = true
cfi_cross_dso = true
debug = false
}
branch_protector_ret = "pac_ret"
}
configs = [ "${MAPLEALL_ROOT}:mapleallcompilecfg" ]
sources = src_libcgx8664
include_dirs = include_directories
defines = []
external_deps = [ "bounds_checking_function:libsec_static" ]
if (ets_runtime_enable_cmc_gc) {
# defines += [ "ENABLE_CMC_IR_FIX_REGISTER" ]
}
part_name = "ets_runtime"
subsystem_name = "arkcompiler"
}
ohos_source_set("libcgx86phases") {
stack_protector_ret = false
if (enable_sanitize) {
sanitize = {
cfi = true
cfi_cross_dso = true
debug = false
}
branch_protector_ret = "pac_ret"
}
configs = [ "${MAPLEALL_ROOT}:mapleallcompilecfg" ]
sources = src_libcgx86phases
include_dirs = include_directories
external_deps = [ "bounds_checking_function:libsec_static" ]
part_name = "ets_runtime"
subsystem_name = "arkcompiler"
}
ohos_static_library("libcgark") {
stack_protector_ret = false
if (enable_sanitize) {
sanitize = {
cfi = true
cfi_cross_dso = true
debug = false
}
branch_protector_ret = "pac_ret"
}
configs = [ "${MAPLEALL_ROOT}:mapleallcompilecfg" ]
sources = src_libcgark
include_dirs = include_directories
external_deps = [ "bounds_checking_function:libsec_static" ]
part_name = "ets_runtime"
subsystem_name = "arkcompiler"
}
ohos_source_set("libcgphases") {
stack_protector_ret = false
if (enable_sanitize) {
sanitize = {
cfi = true
cfi_cross_dso = true
debug = false
}
branch_protector_ret = "pac_ret"
}
configs = [ "${MAPLEALL_ROOT}:mapleallcompilecfg" ]
sources = src_libcgphases
include_dirs = include_directories
defines = []
external_deps = [ "bounds_checking_function:libsec_static" ]
if (ets_runtime_enable_cmc_gc) {
# defines += [ "ENABLE_CMC_IR_FIX_REGISTER" ]
}
part_name = "ets_runtime"
subsystem_name = "arkcompiler"
}
ohos_static_library("libcg") {
stack_protector_ret = false
if (enable_sanitize) {
sanitize = {
cfi = true
cfi_cross_dso = true
debug = false
}
branch_protector_ret = "pac_ret"
}
configs = [ "${MAPLEALL_ROOT}:mapleallcompilecfg" ]
sources = src_libcg
include_dirs = include_directories
deps = deps_libcg
output_dir = "${root_out_dir}/lib/${HOST_ARCH}"
defines = []
external_deps = [ "bounds_checking_function:libsec_static" ]
if (ets_runtime_enable_cmc_gc) {
# defines += [ "ENABLE_CMC_IR_FIX_REGISTER" ]
}
part_name = "ets_runtime"
subsystem_name = "arkcompiler"
}