Tomas Matheson 71c5964f5c
[ARM][AArch64] autogenerate header file for TargetParser from Target tablegen files (#88378)
Introduce a mechanism to share data between the ARM and AArch64 backends and
TargetParser, to reduce duplication of code. This is similar to the current
RISC-V implementation.

The target tablegen file (in this case `ARM.td` or `AArch64.td`) is
processed during building of `TargetParser` to generate the following
files in the build tree:
 - `build/include/llvm/TargetParser/ARMTargetParserDef.inc`
 - `build/include/llvm/TargetParser/AArch64TargetParserDef.inc`

For now, the use of these generated files is limited to files _outside_
of `TargetParser`. The main reason for this is that the modifications to
`TargetParser` will require additional data added to the tablegen files,
which I want to split into separate PRs.
2024-04-24 09:18:36 +01:00

45 lines
1.1 KiB
CMake

# Ensure that libLLVMTargetParser does not carry any static global initializer.
# ManagedStatic can be used to enable lazy-initialization of globals.
#
# HAS_WERROR_GLOBAL_CTORS and LLVM_HAS_NOGLOBAL_CTOR_MUTEX should have been set
# by llvm/lib/Support/CMakeLists.txt (which provides the required Support
# dependency).
if (HAS_WERROR_GLOBAL_CTORS AND NOT LLVM_HAS_NOGLOBAL_CTOR_MUTEX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=global-constructors")
endif()
# Solaris code uses kstat, so specify dependency explicitly for shared builds.
if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
set(system_libs kstat)
endif()
add_llvm_component_library(LLVMTargetParser
AArch64TargetParser.cpp
ARMTargetParserCommon.cpp
ARMTargetParser.cpp
CSKYTargetParser.cpp
Host.cpp
LoongArchTargetParser.cpp
RISCVISAInfo.cpp
RISCVTargetParser.cpp
SubtargetFeature.cpp
TargetParser.cpp
Triple.cpp
X86TargetParser.cpp
ADDITIONAL_HEADER_DIRS
Unix
Windows
LINK_LIBS
${system_libs}
LINK_COMPONENTS
Support
DEPENDS
ARMTargetParserTableGen
AArch64TargetParserTableGen
RISCVTargetParserTableGen
)