[llvm-commits] [llvm] r167111 - in /llvm/trunk: include/llvm/IRBuilder.h unittests/VMCore/IRBuilderTest.cpp
Duncan Sands
baldrick at free.fr
Wed Oct 31 03:37:47 PDT 2012
Hi Chandler,
On 31/10/12 11:35, Chandler Carruth wrote:
> On Wed, Oct 31, 2012 at 3:28 AM, Duncan Sands <baldrick at free.fr> wrote:
>> Hi Evgeniy,
>>
>>> Add IRBuilderBase::getIntPtrTy.
>>
>>
>>> --- llvm/trunk/include/llvm/IRBuilder.h (original)
>>> +++ llvm/trunk/include/llvm/IRBuilder.h Wed Oct 31 04:50:01 2012
>>> @@ -266,6 +267,10 @@
>>> return Type::getInt8PtrTy(Context, AddrSpace);
>>> }
>>>
>>> + IntegerType* getIntPtrTy(DataLayout *DL, unsigned AddrSpace = 0) {
>>> + return DL->getIntPtrType(Context, AddrSpace);
>>> + }
>>> +
>>>
>>> //===--------------------------------------------------------------------===//
>>> // Intrinsic creation methods
>>>
>>> //===--------------------------------------------------------------------===//
>>>
>>
>> I don't get it, why is this better than calling DataLayout directly?
>
> Because a lot of code passes around the IRBuilder everywhere it goes.
> It is very convenient to not have to pass around the DataLayout and
> the IRBuilder.
but you have to pass the data layout around even with this because it takes the
datalayout as a parameter! It would be different if a copy of the data layout
was kept in the IRBuilder.
Ciao, Duncan.
> It is also a nice complement to the rest of the int type getting helpers.
>
> Keep in mind, everything in IRBuilder exists solely to shorten code.
> There is nothing you can't do without the IRBuilder...
>
>> Also,
>> I'm
>> not sure that providing a default address space is wise.
>>
>> Ciao, Duncan.
More information about the llvm-commits
mailing list