[LLVMdev] Enhancing TableGen

Jakob Stoklund Olesen jolesen at apple.com
Thu Oct 6 11:06:01 PDT 2011


On Oct 6, 2011, at 10:01 AM, David A. Greene wrote:

> I want to be able to use #..# pasted stuff in a variety of contexts.
> For example:
> 
> multiclass blah<string intr> {
>  for prefix = [<empty>, Vx, Vy] {
>    for suffix = [ps, pd] {
>      def #prefix#ADD#suffix# : ProcessSomePattern<
>        [(set RegClass:$dst, (!cast<Intrinsic>(#prefix#intr#suffix)
>                              RegClass:$src1, RegClass:$src2))]
>    }
>  }
> }
> 
> It's actually more complex than this but this gives the basic idea.  The
> key thing I need to be able to do is construct an instrinsic name given
> some base string, a prefix and a suffix.

David, I think the syntax you are proposing here is much better than the multidef syntax.

When I look at test/TableGen/MultiPat.td, I have a really hard time figuring out what is happening. Basically, I don't want our target descriptions to end up looking like that.

> Here's a critical question.  What type do the for loop iterators have?
> string?

That's probably good enough.

/jakob




More information about the llvm-dev mailing list