File tree 14 files changed +126
-48
lines changed
14 files changed +126
-48
lines changed Original file line number Diff line number Diff line change @@ -168,10 +168,10 @@ endif()
168
168
169
169
if (CLANG_ENABLE_CIR)
170
170
if (CLANG_BUILT_STANDALONE)
171
- message (FATAL_ERROR
172
- "ClangIR is not yet supported in the standalone build. " )
173
- endif ( )
174
- if (NOT "${LLVM_ENABLE_PROJECTS} " MATCHES "MLIR|mlir" )
171
+ find_package (MLIR REQUIRED)
172
+ list ( APPEND CMAKE_MODULE_PATH " ${MLIR_DIR} " )
173
+ include (AddMLIR )
174
+ elseif (NOT "${LLVM_ENABLE_PROJECTS} " MATCHES "MLIR|mlir" )
175
175
message (FATAL_ERROR
176
176
"Cannot build ClangIR without MLIR in LLVM_ENABLE_PROJECTS" )
177
177
endif ()
Original file line number Diff line number Diff line change 6
6
7
7
get_property (dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
8
8
9
+ set (deps)
10
+ if (NOT CLANG_BUILT_STANDALONE)
11
+ set (deps ${dialect_libs} )
12
+ endif ()
13
+
9
14
add_clang_library(clangCIR
10
15
CIRAsm.cpp
11
16
CIRGenAtomic.cpp
@@ -52,16 +57,19 @@ add_clang_library(clangCIR
52
57
MLIRCIRASTAttrInterfacesIncGen
53
58
MLIRCIROpInterfacesIncGen
54
59
MLIRCIRLoopOpInterfaceIncGen
55
- ${dialect_libs }
60
+ ${deps }
56
61
57
62
LINK_LIBS
58
63
clangAST
59
64
clangBasic
60
65
clangLex
61
- ${dialect_libs}
62
66
MLIRCIR
63
67
MLIRCIRTransforms
64
68
MLIRCIRInterfaces
69
+ )
70
+
71
+ mlir_target_link_libraries(clangCIR PUBLIC
72
+ ${dialect_libs}
65
73
MLIRAffineToStandard
66
74
MLIRAnalysis
67
75
MLIRDLTIDialect
Original file line number Diff line number Diff line change
1
+ set (deps)
2
+ if (NOT CLANG_BUILT_STANDALONE)
3
+ set (deps
4
+ MLIRBuiltinLocationAttributesIncGen
5
+ MLIRSymbolInterfacesIncGen
6
+ )
7
+ endif ()
8
+
1
9
add_clang_library(MLIRCIR
2
10
CIRAttrs.cpp
3
11
CIROpenCLAttrs.cpp
@@ -8,22 +16,23 @@ add_clang_library(MLIRCIR
8
16
FPEnv.cpp
9
17
10
18
DEPENDS
11
- MLIRBuiltinLocationAttributesIncGen
19
+ ${deps}
12
20
MLIRCIROpsIncGen
13
21
MLIRCIREnumsGen
14
- MLIRSymbolInterfacesIncGen
15
22
MLIRCIRASTAttrInterfacesIncGen
16
23
MLIRCIROpInterfacesIncGen
17
24
MLIRCIRLoopOpInterfaceIncGen
18
25
19
26
LINK_LIBS PUBLIC
27
+ clangAST
28
+ )
29
+
30
+ mlir_target_link_libraries(MLIRCIR PUBLIC
20
31
MLIRIR
21
32
MLIRCIRInterfaces
22
33
MLIRDLTIDialect
23
34
MLIRDataLayoutInterfaces
24
35
MLIRFuncDialect
25
36
MLIRLoopLikeInterface
26
37
MLIRLLVMDialect
27
- MLIRSideEffectInterfaces
28
- clangAST
29
- )
38
+ MLIRSideEffectInterfaces)
Original file line number Diff line number Diff line change @@ -23,11 +23,13 @@ add_clang_library(MLIRCIRTransforms
23
23
clangBasic
24
24
TargetLowering
25
25
26
+ MLIRCIR
27
+ MLIRCIRInterfaces
28
+ )
29
+
30
+ mlir_target_link_libraries(MLIRCIRTransforms PUBLIC
26
31
MLIRAnalysis
27
32
MLIRIR
28
33
MLIRPass
29
34
MLIRTransformUtils
30
-
31
- MLIRCIR
32
- MLIRCIRInterfaces
33
35
)
Original file line number Diff line number Diff line change @@ -28,9 +28,12 @@ add_clang_library(TargetLowering
28
28
LINK_LIBS PUBLIC
29
29
30
30
clangBasic
31
+ MLIRCIR
32
+ MLIRCIRInterfaces
33
+ )
34
+
35
+ mlir_target_link_libraries(TargetLowering PUBLIC
31
36
MLIRIR
32
37
MLIRPass
33
38
MLIRDLTIDialect
34
- MLIRCIR
35
- MLIRCIRInterfaces
36
39
)
Original file line number Diff line number Diff line change @@ -5,6 +5,15 @@ set(LLVM_LINK_COMPONENTS
5
5
6
6
get_property (dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
7
7
8
+ set (deps)
9
+ if (NOT CLANG_BUILT_STANDALONE)
10
+ set (deps
11
+ MLIRBuiltinLocationAttributesIncGen
12
+ MLIRBuiltinTypeInterfacesIncGen
13
+ MLIRFunctionInterfacesIncGen
14
+ )
15
+ endif ()
16
+
8
17
add_clang_library(clangCIRFrontendAction
9
18
CIRGenAction.cpp
10
19
@@ -13,9 +22,7 @@ add_clang_library(clangCIRFrontendAction
13
22
MLIRCIRASTAttrInterfacesIncGen
14
23
MLIRCIROpInterfacesIncGen
15
24
MLIRCIRLoopOpInterfaceIncGen
16
- MLIRBuiltinLocationAttributesIncGen
17
- MLIRBuiltinTypeInterfacesIncGen
18
- MLIRFunctionInterfacesIncGen
25
+ ${deps}
19
26
20
27
LINK_LIBS
21
28
clangAST
@@ -26,8 +33,11 @@ add_clang_library(clangCIRFrontendAction
26
33
clangCIR
27
34
clangCIRLoweringDirectToLLVM
28
35
clangCIRLoweringThroughMLIR
29
- ${dialect_libs}
30
36
MLIRCIR
37
+ )
38
+
39
+ mlir_target_link_libraries(clangCIRFrontendAction PUBLIC
40
+ ${dialect_libs}
31
41
MLIRAnalysis
32
42
MLIRIR
33
43
MLIRParser
Original file line number Diff line number Diff line change @@ -13,8 +13,9 @@ add_clang_library(MLIRCIRInterfaces
13
13
MLIRCIRFPTypeInterfaceIncGen
14
14
MLIRCIRLoopOpInterfaceIncGen
15
15
MLIRCIROpInterfacesIncGen
16
+ )
16
17
17
- LINK_LIBS
18
+ mlir_target_link_libraries(clangCIRFrontendAction PUBLIC
18
19
${dialect_libs}
19
20
MLIRIR
20
21
MLIRSupport
Original file line number Diff line number Diff line change @@ -5,6 +5,15 @@ set(LLVM_LINK_COMPONENTS
5
5
6
6
get_property (dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
7
7
8
+ set (deps)
9
+ if (NOT CLANG_BUILT_STANDALONE)
10
+ set (deps
11
+ MLIRBuiltinLocationAttributesIncGen
12
+ MLIRBuiltinTypeInterfacesIncGen
13
+ MLIRFunctionInterfacesIncGen
14
+ )
15
+ endif ()
16
+
8
17
add_clang_library(clangCIRLoweringHelpers
9
18
LoweringHelpers.cpp
10
19
@@ -14,9 +23,7 @@ add_clang_library(clangCIRLoweringHelpers
14
23
MLIRCIRASTAttrInterfacesIncGen
15
24
MLIRCIROpInterfacesIncGen
16
25
MLIRCIRLoopOpInterfaceIncGen
17
- MLIRBuiltinLocationAttributesIncGen
18
- MLIRBuiltinTypeInterfacesIncGen
19
- MLIRFunctionInterfacesIncGen
26
+ ${deps}
20
27
21
28
LINK_LIBS
22
29
clangAST
@@ -25,8 +32,11 @@ add_clang_library(clangCIRLoweringHelpers
25
32
clangLex
26
33
clangFrontend
27
34
clangCIR
28
- ${dialect_libs}
29
35
MLIRCIR
36
+ )
37
+
38
+ mlir_target_link_libraries(clangCIRLoweringHelpers PUBLIC
39
+ ${dialect_libs}
30
40
MLIRAnalysis
31
41
MLIRBuiltinToLLVMIRTranslation
32
42
MLIRLLVMToLLVMIRTranslation
Original file line number Diff line number Diff line change @@ -5,6 +5,15 @@ set(LLVM_LINK_COMPONENTS
5
5
6
6
get_property (dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
7
7
8
+ set (deps)
9
+ if (NOT CLANG_BUILT_STANDALONE)
10
+ set (deps
11
+ MLIRBuiltinLocationAttributesIncGen
12
+ MLIRBuiltinTypeInterfacesIncGen
13
+ MLIRFunctionInterfacesIncGen
14
+ )
15
+ endif ()
16
+
8
17
add_clang_library(clangCIRLoweringDirectToLLVM
9
18
LowerToLLVMIR.cpp
10
19
LowerToLLVM.cpp
@@ -15,9 +24,7 @@ add_clang_library(clangCIRLoweringDirectToLLVM
15
24
MLIRCIRASTAttrInterfacesIncGen
16
25
MLIRCIROpInterfacesIncGen
17
26
MLIRCIRLoopOpInterfaceIncGen
18
- MLIRBuiltinLocationAttributesIncGen
19
- MLIRBuiltinTypeInterfacesIncGen
20
- MLIRFunctionInterfacesIncGen
27
+ ${deps}
21
28
22
29
LINK_LIBS
23
30
clangAST
@@ -27,8 +34,10 @@ add_clang_library(clangCIRLoweringDirectToLLVM
27
34
clangFrontend
28
35
clangCIR
29
36
clangCIRLoweringHelpers
30
- ${dialect_libs}
31
37
MLIRCIR
38
+ )
39
+ mlir_target_link_libraries(clangCIRLoweringDirectToLLVM PUBLIC
40
+ ${dialect_libs}
32
41
MLIRAnalysis
33
42
MLIRBuiltinToLLVMIRTranslation
34
43
MLIRLLVMToLLVMIRTranslation
Original file line number Diff line number Diff line change @@ -5,6 +5,15 @@ set(LLVM_LINK_COMPONENTS
5
5
6
6
get_property (dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
7
7
8
+ set (deps)
9
+ if (NOT CLANG_BUILT_STANDALONE)
10
+ set (deps
11
+ MLIRBuiltinLocationAttributesIncGen
12
+ MLIRBuiltinTypeInterfacesIncGen
13
+ MLIRFunctionInterfacesIncGen
14
+ )
15
+ endif ()
16
+
8
17
add_clang_library(clangCIRLoweringThroughMLIR
9
18
LowerCIRLoopToSCF.cpp
10
19
LowerCIRToMLIR.cpp
@@ -16,9 +25,7 @@ add_clang_library(clangCIRLoweringThroughMLIR
16
25
MLIRCIRASTAttrInterfacesIncGen
17
26
MLIRCIROpInterfacesIncGen
18
27
MLIRCIRLoopOpInterfaceIncGen
19
- MLIRBuiltinLocationAttributesIncGen
20
- MLIRBuiltinTypeInterfacesIncGen
21
- MLIRFunctionInterfacesIncGen
28
+ ${deps}
22
29
23
30
LINK_LIBS
24
31
clangAST
@@ -28,8 +35,11 @@ add_clang_library(clangCIRLoweringThroughMLIR
28
35
clangFrontend
29
36
clangCIR
30
37
clangCIRLoweringHelpers
31
- ${dialect_libs}
32
38
MLIRCIR
39
+ )
40
+
41
+ mlir_target_link_libraries(clangCIRLoweringThroughMLIR PUBLIC
42
+ ${dialect_libs}
33
43
MLIRAnalysis
34
44
MLIRBuiltinToLLVMIRTranslation
35
45
MLIRLLVMToLLVMIRTranslation
Original file line number Diff line number Diff line change @@ -17,14 +17,13 @@ set(deps)
17
17
if (CLANG_ENABLE_CIR)
18
18
list (APPEND link_libs
19
19
clangCIRFrontendAction
20
- MLIRCIRTransforms
21
- MLIRIR
22
- MLIRPass
23
- )
24
- list (APPEND deps
25
- MLIRBuiltinLocationAttributesIncGen
26
- MLIRBuiltinTypeInterfacesIncGen
27
20
)
21
+ if (NOT CLANG_BUILT_STANDALONE)
22
+ list (APPEND deps
23
+ MLIRBuiltinLocationAttributesIncGen
24
+ MLIRBuiltinTypeInterfacesIncGen
25
+ )
26
+ endif ()
28
27
29
28
include_directories (${LLVM_MAIN_SRC_DIR} /../mlir/include )
30
29
include_directories (${CMAKE_BINARY_DIR} /tools/mlir/include )
@@ -52,3 +51,11 @@ add_clang_library(clangFrontendTool
52
51
LINK_LIBS
53
52
${link_libs}
54
53
)
54
+
55
+ if (CLANG_ENABLE_CIR)
56
+ mlir_target_link_libraries(clangFrontendTool PUBLIC
57
+ MLIRCIRTransforms
58
+ MLIRIR
59
+ MLIRPass
60
+ )
61
+ endif ()
Original file line number Diff line number Diff line change @@ -4,14 +4,10 @@ get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)
4
4
include_directories (${LLVM_MAIN_SRC_DIR} /../mlir/include )
5
5
include_directories (${CMAKE_BINARY_DIR} /tools/mlir/include )
6
6
7
- set (LIBS
7
+ set (MLIR_LIBS
8
8
${dialect_libs}
9
9
${conversion_libs}
10
10
${test_libs}
11
- clangCIR
12
- clangCIRLoweringThroughMLIR
13
- clangCIRLoweringDirectToLLVM
14
- MLIRCIR
15
11
MLIRAffineAnalysis
16
12
MLIRAnalysis
17
13
MLIRDialect
@@ -24,12 +20,25 @@ set(LIBS
24
20
MLIRIR
25
21
)
26
22
23
+ set (LIBS
24
+ clangCIR
25
+ clangCIRLoweringThroughMLIR
26
+ clangCIRLoweringDirectToLLVM
27
+ MLIRCIR
28
+ )
29
+
30
+ set (DEPS ${LIBS} )
31
+ if (NOT CLANG_BUILT_STANDALONE)
32
+ list (APPEND DEPS ${MLIR_LIBS} )
33
+ endif ()
34
+
27
35
add_mlir_tool(cir-lsp-server
28
36
cir-lsp-server.cpp
29
37
30
38
DEPENDS
31
- ${LIBS }
39
+ ${DEPS }
32
40
)
33
41
34
42
target_link_libraries (cir-lsp-server PRIVATE ${LIBS} )
43
+ mlir_target_link_libraries(cir-lsp-server PRIVATE ${MLIR_LIBS} )
35
44
llvm_update_compile_flags(cir-lsp-server)
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ clang_target_link_libraries(cir-opt
17
17
MLIRCIRTransforms
18
18
)
19
19
20
- target_link_libraries (cir-opt
20
+ mlir_target_link_libraries (cir-opt
21
21
PRIVATE
22
22
${dialect_libs}
23
23
${conversion_libs}
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ clang_target_link_libraries(cir-translate
17
17
MLIRCIRTransforms
18
18
)
19
19
20
- target_link_libraries (cir-translate
20
+ mlir_target_link_libraries (cir-translate
21
21
PRIVATE
22
22
${dialect_libs}
23
23
${conversion_libs}
You can’t perform that action at this time.
0 commit comments