[llvm-bugs] [Bug 52180] New: defvar and foreach not accepted in all record bodies
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Oct 14 10:25:55 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=52180
Bug ID: 52180
Summary: defvar and foreach not accepted in all record bodies
Product: tools
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: TableGen
Assignee: unassignedbugs at nondot.org
Reporter: joseph.nash at amd.com
CC: llvm-bugs at lists.llvm.org
The text of https://llvm.org/docs/TableGen/ProgRef.html suggests the defvar and
foreach constructs should be valid in all record bodies. Running the example
below shows that isn't true. If you ignore the text, and only look at the
grammar on the TableGen manual, there is still a mismatch. defvar should be
valid in a class definition. foreach text also says it is valid in a record
body, but that isn't present in the grammar.
It would be great if both these constructs were always available, but at least
the intended and actual behavior should be documented.
Related:
https://reviews.llvm.org/D85838/new/#inline-1064437
Perhaps in the doc upgrade some info was lost?
reproducer.td
// global scope
// foreach and defvar ok
defvar x = "str";
foreach i = 1...5 in {
}
// record def
// foreach broken
// defvar ok
def test {
// error: Unknown token when expecting a type
/*foreach i = 1..5 in {*/
/*}*/
}
def test2 {
defvar k = "str";
}
// class definition
// foreach and defvar broken
class T1<int K> {
// error: Unknown token when expecting a type
/*foreach i = 1...5 in {*/
/*}*/
// error: Variable not defined: 'K'
/*defvar Q = K;*/
}
def myT1 : T1<1>;
// multiclass definition
// defvar ok at entry and within multidefs
// foreach ok at entry and broken within multidefs
multiclass T3<int K> {
foreach i = 1...5 in {
}
defvar Q = K;
def name1 {
// error: Unknown token when expecting a type
/*foreach i = 1...5 in {*/
/*}*/
defvar L = K;
}
}
defm myT3 : T3<1>;
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211014/3bfb24de/attachment.html>
More information about the llvm-bugs
mailing list