On Jul 16, 2008, at 9:58 AM, Matthijs Kooijman wrote:> Hi all, > > once more with the patch inline for easy review. I did not include the > argpromotion pass here, since it's not the main topic of this post.Hi Matthijs, 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? -Chris
Matthijs Kooijman
2008-Jul-23 06:54 UTC
[LLVMdev] GEP::getIndexValid() with other iterators
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. 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). Gr. Matthijs -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: Digital signature URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080723/51e4e3b6/attachment.sig>
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