[PATCH] D74796: Add !iscomplete(Value)

Daniel Sanders via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 18 14:37:08 PST 2020


dsanders created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

It's currently very difficult to distinguish `0` from `?` in TableGen.
Comparisons such as `!eq(?, 0)` currently assert on the `?` because it isn't
a TypedInit, and `!eq({?}, 0)` is true because bits<> coerces `?` to 0. For
the same reason `!isa<int>(?)` and `!isa<int>({?})` give different outcomes
because `?` isn't convertible to `int` (and is therefore not foldable), even
though `{?}` is.

As part of this there is a slight relaxation to the folding requirements
of FieldInit so that field references are folded if they have a Concrete
value (fully evaluated) rather than a Complete value (fully evaluated but not
containing `?`).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74796

Files:
  llvm/include/llvm/TableGen/Record.h
  llvm/lib/TableGen/Record.cpp
  llvm/lib/TableGen/TGLexer.cpp
  llvm/lib/TableGen/TGLexer.h
  llvm/lib/TableGen/TGParser.cpp
  llvm/test/TableGen/field-access-initializers.td
  llvm/test/TableGen/isa-consistency.td
  llvm/test/TableGen/iscomplete.td

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74796.245276.patch
Type: text/x-patch
Size: 10188 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200218/ec6c74ac/attachment.bin>


More information about the llvm-commits mailing list