[PATCH] D47430: TableGen: Streamline the semantics of NAME

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 27 13:49:16 PDT 2018


nhaehnle created this revision.
nhaehnle added reviewers: tra, simon_tatham, craig.topper, MartinO, arsenm.
Herald added a subscriber: wdng.
Herald added a reviewer: javed.absar.
nhaehnle added a dependency: D47429: TableGen: add some more helpful error messages.
nhaehnle added a dependent revision: D47431: TableGen: Allow foreach in multiclass to depend on template args.

The new rules are straightforward. The main rules to keep in mind
are:

1. NAME is an implicit template argument of class and multiclass, and will be substituted by the name of the instantiating def/defm.

2. The name of a def/defm in a multiclass must contain a reference to NAME. If such a reference is not present, it is automatically prepended.

And for some additional subtleties, consider these:

3. defm with no name generates a unique name but has no special behavior otherwise.

4. def with no name generates an anonymous record, whose name is unique but undefined. In particular, the name won't contain a reference to NAME.

Keeping rules 1&2 in mind should allow a predictable behavior of
name resolution that is simple to follow.

Some existing .td files have to be adjusted because they ended up
depending on the undocumented quirks of the old implementation.

Change-Id: I694095231565b30f563e6fd0417b41ee01a12589


Repository:
  rL LLVM

https://reviews.llvm.org/D47430

Files:
  docs/TableGen/LangRef.rst
  include/llvm/TableGen/Record.h
  lib/TableGen/Record.cpp
  lib/TableGen/TGParser.cpp
  lib/TableGen/TGParser.h
  lib/Target/AArch64/AArch64InstrFormats.td
  lib/Target/AMDGPU/BUFInstructions.td
  lib/Target/AMDGPU/MIMGInstructions.td
  lib/Target/X86/X86InstrAVX512.td
  lib/Target/X86/X86InstrSSE.td
  test/TableGen/Dag.td
  test/TableGen/MultiClassDefName.td
  test/TableGen/lisp.td
  test/TableGen/name-resolution-consistency.td
  test/TableGen/subst.td

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47430.148766.patch
Type: text/x-patch
Size: 115666 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180527/d496fffb/attachment.bin>


More information about the llvm-commits mailing list