[LLVMdev] TableGen List Manipulation

Chris Lattner clattner at apple.com
Mon May 11 10:48:24 PDT 2009


On May 8, 2009, at 5:18 PM, David Greene wrote:

> I see that one can take slices of lists, but is there
> any way to conditionally take a slice?
>
> For example, let's say I have this (fictitious) code:
>
> class FOO<list<string> names> {
>  string First = names[0];
>  string Middle = !if(!eq(!length(names), 3), names[1], "");
>  string Last = !last(names);
> }
>
> Is there currently a way to implement this behavior or should I
> code up some new operators?

There isn't a good way to do this right now.  Would it make more sense  
to add a high level operator that does what you want, instead of a  
bunch of primitives?

-Chris




More information about the llvm-dev mailing list