[PATCH] D40096: Allow similar TargetOpcodes to use inheritance to factor out commonality. NFC.

Daniel Sanders via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 15 12:48:52 PST 2017


dsanders created this revision.
Herald added a subscriber: igorb.

While implementing atomicrmw in https://reviews.llvm.org/D40074 I found that
inheritance is unusable for all the Generic Opcodes in GlobalISel. This is
because the whole header is included inside a 'let mayLoad = 0, mayStore = 0 ... in'
block. In TableGen, the order of precedence for field assignments is:

1. Values from classes the record inherits from.
2. Values from 'let Name=Value in { ... }'
3. Values from 'let Name=Value;'

As such the 'let mayLoad = 0, mayStore = 0, ... in' surrounding the
'include "GenericOpcodes.td"' was overriding any values provided via inheritance.
We hadn't noticed this before because we were only using 'let Name=Value;' to
specialize opcodes.

Fix this by moving the default values to the lowest precedence. This is
accomplished by moving the values to a common base class
(StandardPseudoInstruction for most TargetOpcodes, and GenericOpcode for
GlobalISel specific TargetOpcodes)


https://reviews.llvm.org/D40096

Files:
  include/llvm/Target/GenericOpcodes.td
  include/llvm/Target/Target.td

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40096.123073.patch
Type: text/x-patch
Size: 28427 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171115/abcee454/attachment.bin>


More information about the llvm-commits mailing list