• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2023-2024 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
14set(GENERATED_DIR ${CMAKE_CURRENT_BINARY_DIR}/libllvmbackend/generated)
15
16set(LLVM_BACKEND_EMIT_INTRINSIC_GEN ${GENERATED_DIR}/emit_intrinsic_llvm_ir_constructor_gen.inl)
17panda_gen_file(
18    DATA ${GEN_PLUGIN_OPTIONS_YAML}
19    TEMPLATE ${PANDA_ROOT}/libllvmbackend/templates/emit_intrinsic_llvm_ir_constructor_gen.inl.erb
20    API ${PANDA_ROOT}/templates/plugin_options.rb
21    EXTRA_DEPENDENCIES ${YAML_FILES} plugin_options_merge
22    OUTPUTFILE ${LLVM_BACKEND_EMIT_INTRINSIC_GEN}
23)
24
25add_custom_target(llvmbackend_emit_intrinsic_gen DEPENDS
26    plugin_options_gen
27    ${LLVM_BACKEND_EMIT_INTRINSIC_GEN}
28)
29
30set(LLVM_BACKEND_ENTRY_GEN ${GENERATED_DIR}/llvm_ir_constructor_gen.inl)
31panda_gen_file(
32    DATA ${GEN_PLUGIN_OPTIONS_YAML}
33    TEMPLATE ${PANDA_ROOT}/libllvmbackend/templates/llvm_ir_constructor_gen.inl.erb
34    API ${PANDA_ROOT}/templates/plugin_options.rb
35    EXTRA_DEPENDENCIES ${YAML_FILES} plugin_options_merge
36    OUTPUTFILE ${LLVM_BACKEND_ENTRY_GEN}
37)
38
39set(LLVM_BACKEND_ENTRY_GEN_H ${GENERATED_DIR}/llvm_ir_constructor_gen.h.inl)
40panda_gen_file(
41    DATA ${GEN_PLUGIN_OPTIONS_YAML}
42    TEMPLATE ${PANDA_ROOT}/libllvmbackend/templates/llvm_ir_constructor_gen.h.inl.erb
43    API ${PANDA_ROOT}/templates/plugin_options.rb
44    EXTRA_DEPENDENCIES ${YAML_FILES} plugin_options_merge
45    OUTPUTFILE ${LLVM_BACKEND_ENTRY_GEN_H}
46)
47
48add_custom_target(llvmbackend_ir_constructor_gen DEPENDS
49    plugin_options_gen
50    ${LLVM_BACKEND_ENTRY_GEN}
51    ${LLVM_BACKEND_ENTRY_GEN_H}
52)
53
54set(LLVM_BACKEND_GET_INTRINSIC_ID_GEN_H ${GENERATED_DIR}/get_intrinsic_id_llvm_ark_interface_gen.h.inl)
55panda_gen_file(
56    DATA ${GEN_PLUGIN_OPTIONS_YAML}
57    TEMPLATE ${PANDA_ROOT}/libllvmbackend/templates/get_intrinsic_id_llvm_ark_interface_gen.h.inl.erb
58    API ${PANDA_ROOT}/templates/plugin_options.rb
59    EXTRA_DEPENDENCIES ${YAML_FILES} plugin_options_merge
60    OUTPUTFILE ${LLVM_BACKEND_GET_INTRINSIC_ID_GEN_H}
61)
62
63set(LLVM_BACKEND_GET_INTRINSIC_ID_GEN ${GENERATED_DIR}/get_intrinsic_id_llvm_ark_interface_gen.inl)
64panda_gen_file(
65    DATA ${GEN_PLUGIN_OPTIONS_YAML}
66    TEMPLATE ${PANDA_ROOT}/libllvmbackend/templates/get_intrinsic_id_llvm_ark_interface_gen.inl.erb
67    API ${PANDA_ROOT}/templates/plugin_options.rb
68    EXTRA_DEPENDENCIES ${YAML_FILES} plugin_options_merge
69    OUTPUTFILE ${LLVM_BACKEND_GET_INTRINSIC_ID_GEN}
70)
71
72add_custom_target(llvmbackend_get_intrinsic_id_gen DEPENDS
73    plugin_options_gen
74    ${LLVM_BACKEND_GET_INTRINSIC_ID_GEN_H}
75    ${LLVM_BACKEND_GET_INTRINSIC_ID_GEN}
76)
77
78add_dependencies(llvmbackend llvmbackend_emit_intrinsic_gen)
79add_dependencies(llvmbackend llvmbackend_ir_constructor_gen)
80add_dependencies(llvmbackend llvmbackend_get_intrinsic_id_gen)
81
82add_dependencies(panda_gen_files
83    llvmbackend_emit_intrinsic_gen
84    llvmbackend_ir_constructor_gen
85    llvmbackend_get_intrinsic_id_gen
86)
87