[PATCH] D145871: TableGen: Introduce `!range` operator for half-opened interval

NAKAMURA Takumi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 12 07:44:53 PDT 2023


chapuni created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
chapuni requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

`!range(a, b)` generates a list `[a,b)`. `a` is optional and `0` by default.

- `!range(-1, 4)` generates `[-1, 0, 1, 2, 3]`
- `!range(4)` generates `[0, 1, 2, 3]`
- `!range(2, 2)` generates `[]<list<int>>`

`!range(list)` is equivalent to `!range(0, !size(list))`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145871

Files:
  llvm/docs/TableGen/ProgRef.rst
  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/range-op-fail.td
  llvm/test/TableGen/range-op.td

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145871.504435.patch
Type: text/x-patch
Size: 9400 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230312/8c95e8d6/attachment.bin>


More information about the llvm-commits mailing list