[LLVMdev] GEP::getIndexValid() with other iterators

Chris Lattner clattner at apple.com
Wed Jul 23 00:00:26 PDT 2008


On Jul 22, 2008, at 11:54 PM, Matthijs Kooijman wrote:

> Hi Chris,
>
>
>> I'd prefer to not turn this into a template.  Why not just define a
>> version that takes an array of uint64_t's or something like that?
> because I want to be able to pass in iterators. I could define a  
> version that
> takes std<uint64_t>::iterators, but next thing we know, we also need  
> them for
> lists, SmallVectors, etc. That's why one of the original  
> getIndexedType
> methods is a template, and that's why I think it makes sense to make  
> another
> one a template.

What flavor of iterators do you want to pass in?  vector or  
smallvector?  If so, a pointer to the first element + extents is fine.

> Any particular objections to this? Is the code size increase a  
> problem?
> AFAICS, in cases where you need this method, it will be a tradeoff  
> between
> speed (having to iterate all your indices and create a new list with  
> the
> Value* versions) and code size (having a version of  
> getIndexedPointer that can
> handle your particular flavour of iterator).

My basic objection is that I don't like tons of code in header files.   
It obfuscates the header and slows down compile times (of llvm itself)

-Chris



More information about the llvm-dev mailing list