Skip to content

Commit fa3d789

Browse files
authored
[RFC][TableGen] Restructure TableGen Source (#80847)
Refactor of the llvm-tblgen source into: - a "Basic" library, which contains the bare minimum utilities to build `llvm-min-tablegen` - a "Common" library which contains all of the helpers for TableGen backends. Such helpers can be shared by more than one backend, and even unit tested (e.g. CodeExpander is, maybe we can add more over time) Fixes #80647
1 parent babbdad commit fa3d789

File tree

89 files changed

+238
-203
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+238
-203
lines changed

llvm/unittests/TableGen/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ add_llvm_unittest(TableGenTests DISABLE_LLVM_LINK_LLVM_DYLIB
1515
ParserEntryPointTest.cpp
1616
)
1717

18-
target_link_libraries(TableGenTests PRIVATE LLVMTableGenGlobalISel LLVMTableGen)
18+
target_link_libraries(TableGenTests PRIVATE LLVMTableGenCommon LLVMTableGen)

llvm/unittests/TableGen/CodeExpanderTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "GlobalISel/CodeExpander.h"
10-
#include "GlobalISel/CodeExpansions.h"
9+
#include "Common/GlobalISel/CodeExpander.h"
10+
#include "Common/GlobalISel/CodeExpansions.h"
1111

1212
#include "llvm/Support/raw_ostream.h"
1313
#include "llvm/TableGen/Error.h"

llvm/utils/TableGen/AsmMatcherEmitter.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@
9595
//
9696
//===----------------------------------------------------------------------===//
9797

98-
#include "CodeGenInstAlias.h"
99-
#include "CodeGenInstruction.h"
100-
#include "CodeGenRegisters.h"
101-
#include "CodeGenTarget.h"
102-
#include "SubtargetFeatureInfo.h"
103-
#include "Types.h"
98+
#include "Common/CodeGenInstAlias.h"
99+
#include "Common/CodeGenInstruction.h"
100+
#include "Common/CodeGenRegisters.h"
101+
#include "Common/CodeGenTarget.h"
102+
#include "Common/SubtargetFeatureInfo.h"
103+
#include "Common/Types.h"
104104
#include "llvm/ADT/CachedHashString.h"
105105
#include "llvm/ADT/PointerUnion.h"
106106
#include "llvm/ADT/STLExtras.h"

llvm/utils/TableGen/AsmWriterEmitter.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
//
1212
//===----------------------------------------------------------------------===//
1313

14-
#include "AsmWriterInst.h"
15-
#include "CodeGenInstAlias.h"
16-
#include "CodeGenInstruction.h"
17-
#include "CodeGenRegisters.h"
18-
#include "CodeGenTarget.h"
19-
#include "SequenceToOffsetTable.h"
20-
#include "Types.h"
14+
#include "Basic/SequenceToOffsetTable.h"
15+
#include "Common/AsmWriterInst.h"
16+
#include "Common/CodeGenInstAlias.h"
17+
#include "Common/CodeGenInstruction.h"
18+
#include "Common/CodeGenRegisters.h"
19+
#include "Common/CodeGenTarget.h"
20+
#include "Common/Types.h"
2121
#include "llvm/ADT/ArrayRef.h"
2222
#include "llvm/ADT/DenseMap.h"
2323
#include "llvm/ADT/STLExtras.h"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# The basic TableGen library contains as little dependencies as possible.
2+
# In particular, it does not depend on vt_gen -> it does not use ValueTypes.
3+
#
4+
# This library is the only thing included in `llvm-min-tablegen`.
5+
6+
set(LLVM_LINK_COMPONENTS
7+
Support
8+
TableGen
9+
)
10+
11+
add_llvm_library(LLVMTableGenBasic STATIC OBJECT EXCLUDE_FROM_ALL
12+
CodeGenIntrinsics.cpp
13+
SDNodeProperties.cpp
14+
)
15+
set_target_properties(LLVMTableGenBasic PROPERTIES FOLDER "Tablegenning")
16+
17+
# Users may include its headers as "Basic/*.h"
18+
target_include_directories(LLVMTableGenBasic
19+
INTERFACE
20+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
21+
)

0 commit comments

Comments
 (0)