[PATCH] D44110: TableGen: Add !dag function for construction
Nicolai Hähnle via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 9 03:38:04 PST 2018
nhaehnle added inline comments.
================
Comment at: docs/TableGen/LangIntro.rst:178
+
+ Example: !dag(op, [a1, a2], ["name1", "name2"]) results in
+ (op a1:$name1, a2:$name2).
----------------
tra wrote:
> nhaehnle wrote:
> > tra wrote:
> > > Is it possible to construct a dag that has mix of dags and records as children? E.g `(op1 (op11 a111, a112:$n112), a12)` ? That is sometimes needsd to construct patterns where one of the arguments should be a dag (e.g. NVPTX uses a wrapper node for global symbols).
> > Unfortunately, no. This is the weakness in the type system I think I've already mentioned elsewhere: since we don't have an `any` type, a list that mixes records and dags won't type-check. It would have to be a `list<any>`.
> >
> > I think it makes sense to address that (although I haven't done so), but as a separate change.
> OK. We should probably then mention in the description that all children must be of the same type.
> Speaking of which, would records of different types, but with shared ancestry be allowed? I assume they would.
>
Yes, shared ancestry is possible. I'm adding an explanation.
================
Comment at: test/TableGen/dag-functional.td:48
+
+class C<list<int> nodes, list<string> names> {
+ dag ret1 = !dag(ops, ?, names);
----------------
tra wrote:
> Would there be a benefit of testing !dag with nodes being list<dag> or list<SomeClass> (and, possibly using records of different type, but inherited from SomeClass)?
Yes, makes sense. I'm adding those tests above.
Repository:
rL LLVM
https://reviews.llvm.org/D44110
More information about the llvm-commits
mailing list