Jakob Stoklund Olesen | 6f36fa9 | 2012-06-11 15:37:55 +0000 | [diff] [blame] | 1 | //===- TableGenBackends.h - Declarations for LLVM TableGen Backends -------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file contains the declarations for all of the LLVM TableGen |
| 11 | // backends. A "TableGen backend" is just a function. See below for a |
| 12 | // precise description. |
| 13 | // |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
Benjamin Kramer | 00e08fc | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 16 | #ifndef LLVM_UTILS_TABLEGEN_TABLEGENBACKENDS_H |
| 17 | #define LLVM_UTILS_TABLEGEN_TABLEGENBACKENDS_H |
Jakob Stoklund Olesen | 6f36fa9 | 2012-06-11 15:37:55 +0000 | [diff] [blame] | 18 | |
| 19 | // A TableGen backend is a function that looks like |
| 20 | // |
| 21 | // EmitFoo(RecordKeeper &RK, raw_ostream &OS /*, anything else you need */ ) |
| 22 | // |
| 23 | // What you do inside of that function is up to you, but it will usually |
| 24 | // involve generating C++ code to the provided raw_ostream. |
| 25 | // |
| 26 | // The RecordKeeper is just a top-level container for an in-memory |
| 27 | // representation of the data encoded in the TableGen file. What a TableGen |
| 28 | // backend does is walk around that in-memory representation and generate |
| 29 | // stuff based on the information it contains. |
| 30 | // |
| 31 | // The in-memory representation is a node-graph (think of it like JSON but |
| 32 | // with a richer ontology of types), where the nodes are subclasses of |
| 33 | // Record. The methods `getClass`, `getDef` are the basic interface to |
| 34 | // access the node-graph. RecordKeeper also provides a handy method |
| 35 | // `getAllDerivedDefinitions`. Consult "include/llvm/TableGen/Record.h" for |
| 36 | // the exact interfaces provided by Record's and RecordKeeper. |
| 37 | // |
| 38 | // A common pattern for TableGen backends is for the EmitFoo function to |
| 39 | // instantiate a class which holds some context for the generation process, |
| 40 | // and then have most of the work happen in that class's methods. This |
| 41 | // pattern partly has historical roots in the previous TableGen backend API |
| 42 | // that involved a class and an invocation like `FooEmitter(RK).run(OS)`. |
| 43 | // |
| 44 | // Remember to wrap private things in an anonymous namespace. For most |
| 45 | // backends, this means that the EmitFoo function is the only thing not in |
| 46 | // the anonymous namespace. |
| 47 | |
| 48 | |
| 49 | // FIXME: Reorganize TableGen so that build dependencies can be more |
| 50 | // accurately expressed. Currently, touching any of the emitters (or |
| 51 | // anything that they transitively depend on) causes everything dependent |
| 52 | // on TableGen to be rebuilt (this includes all the targets!). Perhaps have |
| 53 | // a standalone TableGen binary and have the backends be loadable modules |
| 54 | // of some sort; then the dependency could be expressed as being on the |
| 55 | // module, and all the modules would have a common dependency on the |
| 56 | // TableGen binary with as few dependencies as possible on the rest of |
| 57 | // LLVM. |
| 58 | |
| 59 | |
| 60 | namespace llvm { |
| 61 | |
| 62 | class raw_ostream; |
| 63 | class RecordKeeper; |
| 64 | |
Reid Kleckner | af7c445 | 2018-06-23 02:02:38 +0000 | [diff] [blame] | 65 | void EmitIntrinsicEnums(RecordKeeper &RK, raw_ostream &OS, |
| 66 | bool TargetOnly = false); |
| 67 | void EmitIntrinsicImpl(RecordKeeper &RK, raw_ostream &OS, |
| 68 | bool TargetOnly = false); |
Jakob Stoklund Olesen | 6f36fa9 | 2012-06-11 15:37:55 +0000 | [diff] [blame] | 69 | void EmitAsmMatcher(RecordKeeper &RK, raw_ostream &OS); |
| 70 | void EmitAsmWriter(RecordKeeper &RK, raw_ostream &OS); |
| 71 | void EmitCallingConv(RecordKeeper &RK, raw_ostream &OS); |
| 72 | void EmitCodeEmitter(RecordKeeper &RK, raw_ostream &OS); |
| 73 | void EmitDAGISel(RecordKeeper &RK, raw_ostream &OS); |
| 74 | void EmitDFAPacketizer(RecordKeeper &RK, raw_ostream &OS); |
| 75 | void EmitDisassembler(RecordKeeper &RK, raw_ostream &OS); |
Jakob Stoklund Olesen | 6f36fa9 | 2012-06-11 15:37:55 +0000 | [diff] [blame] | 76 | void EmitFastISel(RecordKeeper &RK, raw_ostream &OS); |
| 77 | void EmitInstrInfo(RecordKeeper &RK, raw_ostream &OS); |
Oliver Stannard | bf70e59 | 2017-11-14 15:35:15 +0000 | [diff] [blame] | 78 | void EmitInstrDocs(RecordKeeper &RK, raw_ostream &OS); |
Jakob Stoklund Olesen | 6f36fa9 | 2012-06-11 15:37:55 +0000 | [diff] [blame] | 79 | void EmitPseudoLowering(RecordKeeper &RK, raw_ostream &OS); |
Sameer AbuAsal | 839cd7f | 2018-04-06 21:07:05 +0000 | [diff] [blame] | 80 | void EmitCompressInst(RecordKeeper &RK, raw_ostream &OS); |
Jakob Stoklund Olesen | 6f36fa9 | 2012-06-11 15:37:55 +0000 | [diff] [blame] | 81 | void EmitRegisterInfo(RecordKeeper &RK, raw_ostream &OS); |
| 82 | void EmitSubtarget(RecordKeeper &RK, raw_ostream &OS); |
Sebastian Pop | becdf4d | 2012-10-25 15:54:06 +0000 | [diff] [blame] | 83 | void EmitMapTable(RecordKeeper &RK, raw_ostream &OS); |
Michael J. Spencer | 96a564f | 2012-12-05 00:29:32 +0000 | [diff] [blame] | 84 | void EmitOptParser(RecordKeeper &RK, raw_ostream &OS); |
Sean Silva | 426db65 | 2013-03-21 23:40:38 +0000 | [diff] [blame] | 85 | void EmitCTags(RecordKeeper &RK, raw_ostream &OS); |
Akira Hatanaka | f805775 | 2015-11-11 20:35:42 +0000 | [diff] [blame] | 86 | void EmitAttributes(RecordKeeper &RK, raw_ostream &OS); |
Tim Northover | 69ada66 | 2016-07-05 21:23:04 +0000 | [diff] [blame] | 87 | void EmitSearchableTables(RecordKeeper &RK, raw_ostream &OS); |
Ahmed Bougacha | 8097fcb | 2016-12-21 23:26:20 +0000 | [diff] [blame] | 88 | void EmitGlobalISel(RecordKeeper &RK, raw_ostream &OS); |
Ayman Musa | b59d804 | 2017-03-07 08:11:19 +0000 | [diff] [blame] | 89 | void EmitX86EVEX2VEXTables(RecordKeeper &RK, raw_ostream &OS); |
Ayman Musa | cb92739 | 2017-10-08 09:20:32 +0000 | [diff] [blame] | 90 | void EmitX86FoldTables(RecordKeeper &RK, raw_ostream &OS); |
Daniel Sanders | 1086a51 | 2017-01-19 11:15:55 +0000 | [diff] [blame] | 91 | void EmitRegisterBank(RecordKeeper &RK, raw_ostream &OS); |
Clement Courbet | f4fb61b | 2018-10-25 07:44:01 +0000 | [diff] [blame] | 92 | void EmitExegesis(RecordKeeper &RK, raw_ostream &OS); |
Jakob Stoklund Olesen | 6f36fa9 | 2012-06-11 15:37:55 +0000 | [diff] [blame] | 93 | |
| 94 | } // End llvm namespace |
Benjamin Kramer | 00e08fc | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 95 | |
| 96 | #endif |