[PATCH] Make DataLayout Non-Optional in the Module

Eric Christopher echristo at gmail.com
Mon Mar 2 10:39:23 PST 2015


On Mon, Mar 2, 2015 at 10:33 AM Chandler Carruth <chandlerc at google.com>
wrote:

>
> On Mon, Mar 2, 2015 at 10:21 AM, Mehdi Amini <mehdi.amini at apple.com>
> wrote:
>
>> > On Mar 2, 2015, at 9:40 AM, Eric Christopher <echristo at gmail.com>
>> wrote:
>> >
>> > Few small comments:
>> >
>> > a) You've got Function::getDataLayout - I think I'd prefer people to
>> generally have to ask the Function parent to get the data layout. (It's
>> also a little inconsistent in the code, but should be fairly sed'able).
>>
>> Not sure I understand what you mean. Are you saying that getDataLayout()
>> should be available on the module only?
>> Note: I haven’t added this, there is a getDataLayout() in Instruction,
>> BasicBlock, and GlobalValue.
>> It saves some space when the only thing you have is an instruction:
>>    I->getParent()->getParent()->getParent()->getDataLayout();
>
>
> Rather than replicating all of the things we want to dig out of the module
> at each layer, I'd rather add a "getModule" along side the "getParent".
>

Which could also return nullptr at each level FWIW. But yes, Mehdi and I
are talking about the general "get the module" from wherever you are and
ask it.

-eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150302/66097dca/attachment.html>


More information about the llvm-commits mailing list