[LLVMdev] API design (and Boost and tr1)
Chris Lattner
sabre at nondot.org
Wed Jul 4 12:57:59 PDT 2007
On Wed, 4 Jul 2007, David A. Greene wrote:
> On Monday 02 July 2007 23:24, David A. Greene wrote:
>>>> - Changing the API
>>>> a) Template it to take two iterators. This causes code size bloat.
>>
>> This seems like the right solution to me. Unless llvm is running on
>> extremely limited memory embedded systems, the extra code space
>> shouldn't be an issue.
>
> It turns out this wasn't quite a simple as we'd thought. The problem is
> the CallInst constructors that take two Value * arguments. They look
> just like the teamplte versions that take iterators.
Wow, this sounds very complex :)
> template<typename InputIterator>
> CallInst(Value *Func, InputIterator ArgBegin, InputIterator ArgEnd,
> const std::string &Name = "", Instruction *InsertBefore = 0,
Is it acceptable to just make the template argument be the container?
That way you could pass:
std::vector.. V;
...
new CallInst(Callee, V, "foo");
etc. The disadvantage is that you lose the ability to pass a subrange.
However, if you know you're using a subrange, you should be able to use
another ctor form.
-Chris
--
http://nondot.org/sabre/
http://llvm.org/
More information about the llvm-dev
mailing list