
`InitAll***` functions are used by `opt`-style tools to init all MLIR dialects/passes/extensions. Currently they are implemeted as inline functions and include essentially the entire MLIR header tree. Each file which includes this header (~10 currently) takes 10+ sec and multiple GB of ram to compile (tested with clang-19), which limits amount of parallel compiler jobs which can be run. Also, flang just includes this file into one of its headers. Move the actual registration code to the static library, so it's compiled only once. Discourse thread https://discourse.llvm.org/t/rfc-moving-initall-implementation-into-static-library/87559
31 lines
544 B
CMake
31 lines
544 B
CMake
set(LLVM_LINK_COMPONENTS
|
|
Support
|
|
)
|
|
|
|
set(LIBS
|
|
MLIRAffineAnalysis
|
|
MLIRAnalysis
|
|
MLIRCastInterfaces
|
|
MLIRDialect
|
|
MLIRIR
|
|
MLIRParser
|
|
MLIRPass
|
|
MLIRRegisterAllDialects
|
|
MLIRSupport
|
|
MLIRTransformUtils
|
|
MLIRTransforms
|
|
)
|
|
|
|
include_directories(../../../clang/include)
|
|
|
|
add_mlir_tool(mlir-rewrite
|
|
mlir-rewrite.cpp
|
|
|
|
SUPPORT_PLUGINS
|
|
)
|
|
mlir_target_link_libraries(mlir-rewrite PRIVATE ${LIBS})
|
|
llvm_update_compile_flags(mlir-rewrite)
|
|
|
|
mlir_check_all_link_libraries(mlir-rewrite)
|
|
export_executable_symbols_for_plugins(mlir-rewrite)
|