On Apr 27, 2008, at 10:58 AM, Talin wrote:> I would certainly make use of this in my frontend. > > I suggest the names "getfield" and "setfield" for the two operations, >I agree that 'get/insertvalue' are pretty generic, and am welcome to suggestions. Get/set *field* imply that this applies only to structs, but it also works with arrays. I would actually prefer get/insert *element* but insertelement is already taken.> since (to me anyway) "insert" implies adding something new, as opposed > to overwriting an existing value.The logic for using insert is that it replaces an element and produces the new aggregate as a whole, it doesn't update something in place (which set implies, at least to me). 'insert' is also useful because of its analogy with 'insertelement', the vector instruction. One nice thing about get/setvalue is that they are short :) -Chris
Chris Lattner wrote:> On Apr 27, 2008, at 10:58 AM, Talin wrote: > >> I would certainly make use of this in my frontend. >> >> I suggest the names "getfield" and "setfield" for the two operations, >> > > I agree that 'get/insertvalue' are pretty generic, and am welcome to > suggestions. Get/set *field* imply that this applies only to structs, > but it also works with arrays. I would actually prefer get/insert > *element* but insertelement is already taken.What's wrong with using insert/extractelement for arrays and structs as well as vectors? They're all sequence types. Nick>> since (to me anyway) "insert" implies adding something new, as opposed >> to overwriting an existing value. > > The logic for using insert is that it replaces an element and produces > the new aggregate as a whole, it doesn't update something in place > (which set implies, at least to me). 'insert' is also useful because > of its analogy with 'insertelement', the vector instruction. > > One nice thing about get/setvalue is that they are short :) > > -Chris > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
On Apr 27, 2008, at 12:49 PM, Nick Lewycky wrote:> Chris Lattner wrote: >> On Apr 27, 2008, at 10:58 AM, Talin wrote: >> >>> I would certainly make use of this in my frontend. >>> >>> I suggest the names "getfield" and "setfield" for the two >>> operations, >>> >> >> I agree that 'get/insertvalue' are pretty generic, and am welcome to >> suggestions. Get/set *field* imply that this applies only to >> structs, >> but it also works with arrays. I would actually prefer get/insert >> *element* but insertelement is already taken. > > What's wrong with using insert/extractelement for arrays and structs > as > well as vectors? They're all sequence types.Vector insert/extract element take (potentially variable) Value*'s for the index and only allows one index. Aggregate get/set take constants and are variadic. -Chris