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