[LLVMdev] Target Data

Ryan Taylor ryta1203 at gmail.com
Fri Apr 6 14:34:42 PDT 2012


So could I just call TD->setAlignment() and comment out the assert (as I'm
sure it will assert) to overwrite the ABI alignments? Does this affect the
actual ABI permanently or does this only effect it while TD is in scope?

I'd rather not permanently overwrite it, as I use llvm to compile programs
for this architecture.

On Thu, Mar 22, 2012 at 2:56 PM, Ryan Taylor <ryta1203 at gmail.com> wrote:

>
>
> ---------- Forwarded message ----------
> From: Ryan Taylor <ryta1203 at gmail.com>
> Date: Thu, Mar 22, 2012 at 2:56 PM
> Subject: Re: [LLVMdev] Target Data
> To: Chris Lattner <clattner at apple.com>
>
>
> So I read that link yesterday and it says that it uses some default unless
> they are overridden by the datalayout keyword, which from what I can tell
> can only be put in an LLVM IR file to be read, is there a way to set this
> via the API?
>
> On Thu, Mar 22, 2012 at 2:46 PM, Chris Lattner <clattner at apple.com> wrote:
>
>>
>> On Mar 22, 2012, at 2:28 PM, Ryan Taylor wrote:
>>
>> I see, thanks.
>>
>> However, if I -emit-llvm and then append the "target datalayout" string
>> (then operate on that emitted llvm), I can then change the data type sizes
>> and alignments, correct?
>>
>>
>> If the frontend is making different assumptions than the target data
>> string, then you'll get broken code in a variety of situations.  A trivial
>> example is that sizeof() folds to an integer constant in the frontend.
>>
>> -Chris
>>
>>
>> Thanks.
>>
>> On Thu, Mar 22, 2012 at 2:25 PM, Chris Lattner <clattner at apple.com>wrote:
>>
>>>
>>> On Mar 21, 2012, at 5:57 PM, Ryan Taylor wrote:
>>>
>>> > Is it possible to change the widths of types independent of the
>>> architecture? Or to reset the widths of types?
>>> >
>>> > I haven't seen anything like this. Thanks.
>>>
>>> The datalayout string is required to match the target, if it exists:
>>> http://llvm.org/docs/LangRef.html#datalayout
>>>
>>> You can't control it to change how things are laid out.
>>>
>>> -Chris
>>>
>>>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120406/8c480a30/attachment.html>


More information about the llvm-dev mailing list