Templates
Not unlike C++, in TableGen, templates allow us to pass initialization values to classes. Let’s dive into an example:
When you run this file through TableGen, it generates the following records. Notice that classes and defs are listed in alphabetical order, not hierarchical. Also, TableGen flattens and merges all the fields from parent classes and templates into the final def. This way, each def stands alone without referencing its parent, except in the comments.