[CMake] Add new cmake option to control adding comments in GenDAGISel

Add new cmake option `LLVM_OMIT_DAGISEL_COMMENTS` to control adding
of comments in GenDAGISel for none debug builds

Ref: https://reviews.llvm.org/D78884

Reviewed By: nemanjai, MaskRay, #powerpc

Differential Revision: https://reviews.llvm.org/D114122
This commit is contained in:
Lei Huang 2021-11-17 15:43:35 -06:00
parent 66d4ce7e26
commit 1db1cb028d
2 changed files with 6 additions and 4 deletions

View File

@ -646,6 +646,11 @@ if(CMAKE_CROSSCOMPILING OR (LLVM_OPTIMIZED_TABLEGEN AND (LLVM_ENABLE_ASSERTIONS
set(LLVM_USE_HOST_TOOLS ON)
endif()
option(LLVM_OMIT_DAGISEL_COMMENTS "Do not add comments to DAG ISel" ON)
if (CMAKE_BUILD_TYPE AND uppercase_CMAKE_BUILD_TYPE MATCHES "^(RELWITHDEBINFO|DEBUG)$")
set(LLVM_OMIT_DAGISEL_COMMENTS OFF)
endif()
if (MSVC_IDE)
option(LLVM_ADD_NATIVE_VISUALIZERS_TO_SOLUTION "Configure project to use Visual Studio native visualizers" TRUE)
endif()

View File

@ -53,10 +53,7 @@ function(tablegen project ofn)
list(APPEND LLVM_TABLEGEN_FLAGS "-gisel-coverage-file=${LLVM_GISEL_COV_PREFIX}all")
endif()
endif()
# Comments are only useful for Debug builds. Omit them if the backend
# supports it.
if (NOT (uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR
uppercase_CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO"))
if (LLVM_OMIT_DAGISEL_COMMENTS)
list(FIND ARGN "-gen-dag-isel" idx)
if (NOT idx EQUAL -1)
list(APPEND LLVM_TABLEGEN_FLAGS "-omit-comments")