forked from OSchip/llvm-project
New function for tablegenning: clang_tablegen.
llvm-svn: 126093
This commit is contained in:
parent
3145e923c1
commit
6f72540e46
|
@ -121,6 +121,36 @@ configure_file(
|
|||
${CLANG_SOURCE_DIR}/include/clang/Config/config.h.cmake
|
||||
${CLANG_BINARY_DIR}/include/clang/Config/config.h)
|
||||
|
||||
include(LLVMParseArguments)
|
||||
|
||||
function(clang_tablegen)
|
||||
# Syntax:
|
||||
# clang_tablegen output-file [tablegen-arg ...] SOURCE source-file
|
||||
# [[TARGET cmake-target-name] [DEPENDS extra-dependency ...]]
|
||||
#
|
||||
# Generates a custom command for invoking tblgen as
|
||||
#
|
||||
# tblgen source-file -o=output-file tablegen-arg ...
|
||||
#
|
||||
# and, if cmake-target-name is provided, creates a custom target for
|
||||
# executing the custom command depending on output-file. It is
|
||||
# possible to list more files to depend after DEPENDS.
|
||||
|
||||
parse_arguments( CTG "SOURCE;TARGET;DEPENDS" "" ${ARGN} )
|
||||
|
||||
if( NOT CTG_SOURCE )
|
||||
message(FATAL_ERROR "SOURCE source-file required by clang_tablegen")
|
||||
endif()
|
||||
|
||||
set( LLVM_TARGET_DEFINITIONS ${CTG_SOURCE} )
|
||||
tablegen( ${CTG_DEFAULT_ARGS} )
|
||||
|
||||
list( GET CTG_DEFAULT_ARGS 0 output_file )
|
||||
if( CTG_TARGET )
|
||||
add_custom_target( ${CTG_TARGET} DEPENDS ${output_file} ${CTG_DEPENDS} )
|
||||
endif()
|
||||
endfunction(clang_tablegen)
|
||||
|
||||
macro(add_clang_library name)
|
||||
llvm_process_sources(srcs ${ARGN})
|
||||
if(MSVC_IDE OR XCODE)
|
||||
|
|
|
@ -1,24 +1,17 @@
|
|||
set(LLVM_TARGET_DEFINITIONS ../Basic/Attr.td)
|
||||
tablegen(Attrs.inc
|
||||
-gen-clang-attr-classes
|
||||
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../)
|
||||
add_custom_target(ClangAttrClasses
|
||||
DEPENDS Attrs.inc)
|
||||
clang_tablegen(Attrs.inc -gen-clang-attr-classes
|
||||
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../
|
||||
SOURCE ../Basic/Attr.td
|
||||
TARGET ClangAttrClasses)
|
||||
|
||||
tablegen(AttrImpl.inc
|
||||
-gen-clang-attr-impl
|
||||
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../)
|
||||
add_custom_target(ClangAttrImpl
|
||||
DEPENDS AttrImpl.inc)
|
||||
clang_tablegen(AttrImpl.inc -gen-clang-attr-impl
|
||||
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../
|
||||
SOURCE ../Basic/Attr.td
|
||||
TARGET ClangAttrImpl)
|
||||
|
||||
set(LLVM_TARGET_DEFINITIONS ../Basic/StmtNodes.td)
|
||||
tablegen(StmtNodes.inc
|
||||
-gen-clang-stmt-nodes)
|
||||
add_custom_target(ClangStmtNodes
|
||||
DEPENDS StmtNodes.inc)
|
||||
clang_tablegen(StmtNodes.inc -gen-clang-stmt-nodes
|
||||
SOURCE ../Basic/StmtNodes.td
|
||||
TARGET ClangStmtNodes)
|
||||
|
||||
set(LLVM_TARGET_DEFINITIONS ../Basic/DeclNodes.td)
|
||||
tablegen(DeclNodes.inc
|
||||
-gen-clang-decl-nodes)
|
||||
add_custom_target(ClangDeclNodes
|
||||
DEPENDS DeclNodes.inc)
|
||||
clang_tablegen(DeclNodes.inc -gen-clang-decl-nodes
|
||||
SOURCE ../Basic/DeclNodes.td
|
||||
TARGET ClangDeclNodes)
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
macro(clang_diag_gen component)
|
||||
tablegen(Diagnostic${component}Kinds.inc
|
||||
-gen-clang-diags-defs -clang-component=${component})
|
||||
add_custom_target(ClangDiagnostic${component}
|
||||
DEPENDS Diagnostic${component}Kinds.inc)
|
||||
clang_tablegen(Diagnostic${component}Kinds.inc
|
||||
-gen-clang-diags-defs -clang-component=${component}
|
||||
SOURCE Diagnostic.td
|
||||
TARGET ClangDiagnostic${component})
|
||||
endmacro(clang_diag_gen)
|
||||
|
||||
set(LLVM_TARGET_DEFINITIONS Diagnostic.td)
|
||||
clang_diag_gen(Analysis)
|
||||
clang_diag_gen(AST)
|
||||
clang_diag_gen(Common)
|
||||
|
@ -14,19 +13,16 @@ clang_diag_gen(Frontend)
|
|||
clang_diag_gen(Lex)
|
||||
clang_diag_gen(Parse)
|
||||
clang_diag_gen(Sema)
|
||||
tablegen(DiagnosticGroups.inc
|
||||
-gen-clang-diag-groups)
|
||||
add_custom_target(ClangDiagnosticGroups
|
||||
DEPENDS DiagnosticGroups.inc)
|
||||
clang_tablegen(DiagnosticGroups.inc -gen-clang-diag-groups
|
||||
SOURCE Diagnostic.td
|
||||
TARGET ClangDiagnosticGroups)
|
||||
|
||||
set(LLVM_TARGET_DEFINITIONS Attr.td)
|
||||
tablegen(AttrList.inc
|
||||
-gen-clang-attr-list
|
||||
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../)
|
||||
add_custom_target(ClangAttrList
|
||||
DEPENDS AttrList.inc)
|
||||
clang_tablegen(AttrList.inc -gen-clang-attr-list
|
||||
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../
|
||||
SOURCE Attr.td
|
||||
TARGET ClangAttrList)
|
||||
|
||||
# ARM NEON
|
||||
set(LLVM_TARGET_DEFINITIONS arm_neon.td)
|
||||
tablegen(arm_neon.inc -gen-arm-neon-sema)
|
||||
add_custom_target(ClangARMNeon DEPENDS arm_neon.inc)
|
||||
clang_tablegen(arm_neon.inc -gen-arm-neon-sema
|
||||
SOURCE arm_neon.td
|
||||
TARGET ClangARMNeon)
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
set(LLVM_TARGET_DEFINITIONS Options.td)
|
||||
tablegen(Options.inc
|
||||
-gen-opt-parser-defs)
|
||||
add_custom_target(ClangDriverOptions
|
||||
DEPENDS Options.inc)
|
||||
clang_tablegen(Options.inc -gen-opt-parser-defs
|
||||
SOURCE Options.td
|
||||
TARGET ClangDriverOptions)
|
||||
|
||||
set(LLVM_TARGET_DEFINITIONS CC1Options.td)
|
||||
tablegen(CC1Options.inc
|
||||
-gen-opt-parser-defs)
|
||||
add_custom_target(ClangCC1Options
|
||||
DEPENDS CC1Options.inc)
|
||||
clang_tablegen(CC1Options.inc -gen-opt-parser-defs
|
||||
SOURCE CC1Options.td
|
||||
TARGET ClangCC1Options)
|
||||
|
||||
set(LLVM_TARGET_DEFINITIONS CC1AsOptions.td)
|
||||
tablegen(CC1AsOptions.inc
|
||||
-gen-opt-parser-defs)
|
||||
add_custom_target(ClangCC1AsOptions
|
||||
DEPENDS CC1AsOptions.inc)
|
||||
clang_tablegen(CC1AsOptions.inc -gen-opt-parser-defs
|
||||
SOURCE CC1AsOptions.td
|
||||
TARGET ClangCC1AsOptions)
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
set(LLVM_TARGET_DEFINITIONS ../Basic/Attr.td)
|
||||
tablegen(AttrSpellings.inc
|
||||
-gen-clang-attr-spelling-list
|
||||
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../)
|
||||
add_custom_target(ClangAttrSpellings
|
||||
clang_tablegen(AttrSpellings.inc -gen-clang-attr-spelling-list
|
||||
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../
|
||||
SOURCE ../Basic/Attr.td
|
||||
TARGET ClangAttrSpellings
|
||||
DEPENDS AttrSpellings.inc)
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
set(LLVM_TARGET_DEFINITIONS ../Basic/Attr.td)
|
||||
tablegen(AttrPCHRead.inc
|
||||
-gen-clang-attr-pch-read
|
||||
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../)
|
||||
add_custom_target(ClangAttrPCHRead
|
||||
DEPENDS AttrPCHRead.inc)
|
||||
clang_tablegen(AttrPCHRead.inc -gen-clang-attr-pch-read
|
||||
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../
|
||||
SOURCE ../Basic/Attr.td
|
||||
TARGET ClangAttrPCHRead)
|
||||
|
||||
tablegen(AttrPCHWrite.inc
|
||||
-gen-clang-attr-pch-write
|
||||
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../)
|
||||
add_custom_target(ClangAttrPCHWrite
|
||||
DEPENDS AttrPCHWrite.inc)
|
||||
clang_tablegen(AttrPCHWrite.inc -gen-clang-attr-pch-write
|
||||
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../
|
||||
SOURCE ../Basic/Attr.td
|
||||
TARGET ClangAttrPCHWrite)
|
||||
|
|
|
@ -28,8 +28,8 @@ if(MSVC_IDE OR XCODE)
|
|||
endif()
|
||||
|
||||
# Generate arm_neon.h
|
||||
set(LLVM_TARGET_DEFINITIONS ${CLANG_SOURCE_DIR}/include/clang/Basic/arm_neon.td)
|
||||
tablegen(arm_neon.h.inc -gen-arm-neon)
|
||||
clang_tablegen(arm_neon.h.inc -gen-arm-neon
|
||||
SOURCE ${CLANG_SOURCE_DIR}/include/clang/Basic/arm_neon.td)
|
||||
|
||||
set(out_files)
|
||||
foreach( f ${files} )
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
set(LLVM_TARGET_DEFINITIONS Checkers.td)
|
||||
tablegen(Checkers.inc
|
||||
-gen-clang-sa-checkers
|
||||
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../../include)
|
||||
add_custom_target(ClangSACheckers
|
||||
DEPENDS Checkers.inc)
|
||||
clang_tablegen(Checkers.inc -gen-clang-sa-checkers
|
||||
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../../include
|
||||
SOURCE Checkers.td
|
||||
TARGET ClangSACheckers)
|
||||
|
||||
set(LLVM_USED_LIBS clangBasic clangAST)
|
||||
|
||||
|
|
Loading…
Reference in New Issue