Debian Codegraph @

llvm-project/llvm/unittests/Analysis/CMakeLists.txt

raw
1 set(LLVM_LINK_COMPONENTS
2 Analysis
3 AsmParser
4 Core
5 Passes
6 Support
7 TargetParser
8 TransformUtils
9 IPO
10 )
11
12 set(ANALYSIS_TEST_SOURCES
13 AliasAnalysisTest.cpp
14 AliasSetTrackerTest.cpp
15 AssumeBundleQueriesTest.cpp
16 BasicAliasAnalysisTest.cpp
17 BlockFrequencyInfoTest.cpp
18 BranchProbabilityInfoTest.cpp
19 CallGraphTest.cpp
20 CaptureTrackingTest.cpp
21 CFGTest.cpp
22 CGSCCPassManagerTest.cpp
23 ConstraintSystemTest.cpp
24 DDGTest.cpp
25 DivergenceAnalysisTest.cpp
26 DomTreeUpdaterTest.cpp
27 GlobalsModRefTest.cpp
28 FunctionPropertiesAnalysisTest.cpp
29 InlineCostTest.cpp
30 IRSimilarityIdentifierTest.cpp
31 IVDescriptorsTest.cpp
32 LazyCallGraphTest.cpp
33 LoadsTest.cpp
34 LoopInfoTest.cpp
35 LoopNestTest.cpp
36 MemoryBuiltinsTest.cpp
37 MemoryProfileInfoTest.cpp
38 MemorySSATest.cpp
39 MLModelRunnerTest.cpp
40 PhiValuesTest.cpp
41 PluginInlineAdvisorAnalysisTest.cpp
42 ProfileSummaryInfoTest.cpp
43 ScalarEvolutionTest.cpp
44 VectorFunctionABITest.cpp
45 SparsePropagation.cpp
46 TargetLibraryInfoTest.cpp
47 TensorSpecTest.cpp
48 TBAATest.cpp
49 UnrollAnalyzerTest.cpp
50 ValueLatticeTest.cpp
51 ValueTrackingTest.cpp
52 VectorUtilsTest.cpp
53 )
54
55 # The unit tests target does not use InlineAdvisorPlugin.cpp
56 # so if not added to LLVM_OPTIONAL_SOURCES, FileCheck will
57 # complain about unused file.
58 set(LLVM_OPTIONAL_SOURCES InlineAdvisorPlugin.cpp)
59
60 set(MLGO_TESTS TFUtilsTest.cpp)
61 if (LLVM_HAVE_TFLITE)
62 LIST(APPEND ANALYSIS_TEST_SOURCES ${MLGO_TESTS})
63 else()
64 LIST(APPEND LLVM_OPTIONAL_SOURCES ${MLGO_TESTS})
65 endif()
66
67 add_llvm_unittest_with_input_files(AnalysisTests
68 ${ANALYSIS_TEST_SOURCES}
69 )
70
71 target_link_libraries(AnalysisTests PRIVATE LLVMTestingSupport)
72
73 # The advisor plugin expects to not link against the Analysis, Support and Core
74 # libraries, but expects them to exist in the process loading the plugin. This
75 # doesn't work with DLLs on Windows (where a shared library can't have undefined
76 # references), so just skip this testcase on Windows.
77 if (NOT WIN32)
78 # On AIX, enable run-time linking to allow symbols from the plugins shared
79 # objects to be properly bound.
80 if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
81 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-brtl")
82 endif()
83
84 # This plugin is built as a stand-alone plugin, so since we don't use the
85 # ANALYSIS_TEST_SOURCES files, we have to add them to LLVM_OPTIONAL_SOURCES
86 # so that FileCheck doesn't complain about unsued files.
87 LIST(APPEND LLVM_OPTIONAL_SOURCES ${ANALYSIS_TEST_SOURCES})
88
89 unset(LLVM_LINK_COMPONENTS)
90 add_llvm_library(InlineAdvisorPlugin MODULE BUILDTREE_ONLY InlineAdvisorPlugin.cpp)
91 # Put PLUGIN next to the unit test executable.
92 set_output_directory(InlineAdvisorPlugin
93 BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
94 LIBRARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
95 )
96 set_target_properties(InlineAdvisorPlugin PROPERTIES FOLDER "Tests")
97
98 export_executable_symbols_for_plugins(AnalysisTests)
99 # The plugin depends on some of the output files of intrinsics_gen, so make sure
100 # it is built before the plugin.
101 add_dependencies(InlineAdvisorPlugin intrinsics_gen)
102 add_dependencies(AnalysisTests InlineAdvisorPlugin)
103 set_property(TARGET InlineAdvisorPlugin PROPERTY FOLDER "Tests/UnitTests/AnalysisTests")
104 endif()