Target Data

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

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?

Thanks.

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

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?

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.