<div dir="ltr">Can you give an example of where you would use such a feature?<div><br></div><div>It seems entirely too abstract (at least to me) at the moment.</div><div><br><div class="gmail_quote">On Tue, Apr 7, 2009 at 1:11 AM, David Greene <span dir="ltr"><<a href="mailto:dag@cray.com">dag@cray.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I've got another idea for a tblgen extension but I don't have a good feel for<br>
how feasible it is. Hopefully someone can provide guidance.<br>
<br>
What I want to do is something like this:<br>
<br>
class C1<int A, string B> {<br>
int foo = A;<br>
string bar = B;<br>
}<br>
<br>
class Bb<int A> : C1<A, "foo">;<br>
class Cb<int A> : C1<A, "bar">;<br>
<br>
class C2<C1 Base, int A> : Base<A>;<br>
<br>
def I1 : C2<Bb, 1>;<br>
def I2 : C2<Cb, 2>;<br>
<br>
and this:<br>
<br>
class Z<int A> {<br>
int moo = A;<br>
}<br>
<br>
class Z1 : Z<1>;<br>
class Z2 : Z<2>;<br>
<br>
multiclass C2<int A, string B, Z ZZ> {<br>
def D1 : Bb<A>, ZZ;<br>
def D2 : Cb<A>, ZZ;<br>
}<br>
<br>
defm D3 : C2<1, Z1>;<br>
defm D4 : C2<2, Z2>;<br>
<br>
Right now tblgen doesn't understand class name arguments like this as it<br>
expects to resolve subclasses immediately. Being able to resolve subclasses<br>
lazily would open up a whole lot of opportunity to reduce redundancy in .td<br>
files.<br>
<br>
My sense is to implement this we'd need something like a ClassInit (analogous<br>
to a VarInit) and a call to resolve references at the right time. But I don't<br>
know how deeply coded subclasses are in tblgen. Are things going to break<br>
spectacularly if subclass information isn't available immediately?<br>
<br>
Anyone have a sense of the amount of work to add a feature like this?<br>
<br>
-Dave<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div><br></div></div>