[llvm-commits] [llvm] r167111 - in /llvm/trunk: include/llvm/IRBuilder.h unittests/VMCore/IRBuilderTest.cpp

Chandler Carruth chandlerc at google.com
Wed Oct 31 03:35:08 PDT 2012


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.

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