[llvm-commits] [llvm] r167111 - in /llvm/trunk: include/llvm/IRBuilder.h unittests/VMCore/IRBuilderTest.cpp
Benjamin Kramer
benny.kra at gmail.com
Wed Oct 31 03:43:52 PDT 2012
On 31.10.2012, at 11:35, Chandler Carruth <chandlerc at google.com> 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.
You still have to pass the DataLayout and the IRBuilder around.
Old: DL->getIntrPtrTy(Builder.getContext(), AddrSpace)
New: Builder.getIntrPtrType(DL, AddrSpace)
- Ben
>
> 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.
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list