blob: 293af622e4320c7836c2cfab29d1e77a6c12ef57 [file] [log] [blame]
Renato Golinca105642014-03-20 16:08:34 +00001=================
2TableGen BackEnds
3=================
4
5.. contents::
6 :local:
7
8Introduction
9============
10
11TableGen backends are at the core of TableGen's functionality. The source files
12provide the semantics to a generated (in memory) structure, but it's up to the
13backend to print this out in a way that is meaningful to the user (normally a
14C program including a file or a textual list of warnings, options and error
15messages).
16
17TableGen is used by both LLVM and Clang with very different goals. LLVM uses it
18as a way to automate the generation of massive amounts of information regarding
19instructions, schedules, cores and architecture features. Some backends generate
20output that is consumed by more than one source file, so they need to be created
21in a way that is easy to use pre-processor tricks. Some backends can also print
22C code structures, so that they can be directly included as-is.
23
24Clang, on the other hand, uses it mainly for diagnostic messages (errors,
25warnings, tips) and attributes, so more on the textual end of the scale.
26
27LLVM BackEnds
28=============
29
30.. warning::
31 This document is raw. Each section below needs three sub-sections: description
32 of its purpose with a list of users, output generated from generic input, and
33 finally why it needed a new backend (in case there's something similar).
34
35Emitter
36-------
37
38Generate machine code emitter.
39
40RegisterInfo
41------------
42
43Generate registers and register classes info.
44
45InstrInfo
46---------
47
48Generate instruction descriptions.
49
50AsmWriter
51---------
52
53Generate calling convention descriptions.
54
55AsmMatcher
56----------
57
58Generate assembly writer.
59
60Disassembler
61------------
62
63Generate disassembler.
64
65PseudoLowering
66--------------
67
68Generate pseudo instruction lowering.
69
70CallingConv
71-----------
72
73Generate assembly instruction matcher.
74
75DAGISel
76-------
77
78Generate a DAG instruction selector.
79
80DFAPacketizer
81-------------
82
83Generate DFA Packetizer for VLIW targets.
84
85FastISel
86--------
87
88Generate a "fast" instruction selector.
89
90Subtarget
91---------
92
93Generate subtarget enumerations.
94
95Intrinsic
96---------
97
98Generate intrinsic information.
99
100TgtIntrinsic
101------------
102
103Generate target intrinsic information.
104
105OptParserDefs
106-------------
107
108Print enum values for a class.
109
110CTags
111-----
112
113Generate ctags-compatible index.
114
115
116Clang BackEnds
117==============
118
119ClangAttrClasses
120----------------
121
122Generate clang attribute clases.
123
124ClangAttrParserStringSwitches
125-----------------------------
126
127Generate all parser-related attribute string switches.
128
129ClangAttrImpl
130-------------
131
132Generate clang attribute implementations.
133
134ClangAttrList
135-------------
136
137Generate a clang attribute list.
138
139ClangAttrPCHRead
140----------------
141
142Generate clang PCH attribute reader.
143
144ClangAttrPCHWrite
145-----------------
146
147Generate clang PCH attribute writer.
148
149ClangAttrSpellingList
150---------------------
151
152Generate a clang attribute spelling list.
153
154ClangAttrSpellingListIndex
155--------------------------
156
157Generate a clang attribute spelling index.
158
159ClangAttrASTVisitor
160-------------------
161
162Generate a recursive AST visitor for clang attribute.
163
164ClangAttrTemplateInstantiate
165----------------------------
166
167Generate a clang template instantiate code.
168
169ClangAttrParsedAttrList
170-----------------------
171
172Generate a clang parsed attribute list.
173
174ClangAttrParsedAttrImpl
175-----------------------
176
177Generate the clang parsed attribute helpers.
178
179ClangAttrParsedAttrKinds
180------------------------
181
182Generate a clang parsed attribute kinds.
183
184ClangAttrDump
185-------------
186
187Generate clang attribute dumper.
188
189ClangDiagsDefs
190--------------
191
192Generate Clang diagnostics definitions.
193
194ClangDiagGroups
195---------------
196
197Generate Clang diagnostic groups.
198
199ClangDiagsIndexName
200-------------------
201
202Generate Clang diagnostic name index.
203
204ClangCommentNodes
205-----------------
206
207Generate Clang AST comment nodes.
208
209ClangDeclNodes
210--------------
211
212Generate Clang AST declaration nodes.
213
214ClangStmtNodes
215--------------
216
217Generate Clang AST statement nodes.
218
219ClangSACheckers
220---------------
221
222Generate Clang Static Analyzer checkers.
223
224ClangCommentHTMLTags
225--------------------
226
227Generate efficient matchers for HTML tag names that are used in documentation comments.
228
229ClangCommentHTMLTagsProperties
230------------------------------
231
232Generate efficient matchers for HTML tag properties.
233
234ClangCommentHTMLNamedCharacterReferences
235----------------------------------------
236
237Generate function to translate named character references to UTF-8 sequences.
238
239ClangCommentCommandInfo
240-----------------------
241
242Generate command properties for commands that are used in documentation comments.
243
244ClangCommentCommandList
245-----------------------
246
247Generate list of commands that are used in documentation comments.
248
249ArmNeon
250-------
251
252Generate arm_neon.h for clang.
253
254ArmNeonSema
255-----------
256
257Generate ARM NEON sema support for clang.
258
259ArmNeonTest
260-----------
261
262Generate ARM NEON tests for clang.
263
264AttrDocs
265--------
266
267Generate attribute documentation.
268
269How to write a back-end
270=======================
271
272TODO.
273
274Until we get a step-by-step HowTo for writing TableGen backends, you can at
275least grab the boilerplate (build system, new files, etc.) from Clang's
276r173931.
277
278TODO: How they work, how to write one. This section should not contain details
279about any particular backend, except maybe ``-print-enums`` as an example. This
280should highlight the APIs in ``TableGen/Record.h``.
281