[cfe-dev] [LLVMdev] Non-standard byte sizes

Ken Dyck kd at kendyck.com
Sat Jan 29 08:25:17 PST 2011


On Fri, Jan 28, 2011 at 4:57 PM, David Given <dg at cowlark.com> wrote:
> From what you've said it sounds like all I need to do is to do the right
> thing when lowering getelementptr, and it will all Just Work.
> Unfortunately I know from experience that clang doesn't always use
> getelementptr when doing point arithmetic --- how can I stop it trying
> to advance a pointer by one (64-bit) char by adding eight to it?

I added a StorageUnitSize property to the llvm TargetData class, which
I used to adjust pointer arithmetic in the parts of clang (and llvm,
for that matter) where there were problems.

It helps to have a C validation suite such as Plum Hall to uncover
these addressing issues.

> (Also, how do I change the size of the built-in types in clang? I could
> swear I once saw some command-line options to do this, but can't find
> them now. And I can't find any documentation for clang's -cc1 mode...)

The only way that I am aware of is to implement a TargetInfo class for
your target.

-Ken

[p.s. My apologies for sending this to you twice, David. I forgot to
cc the mailing lists on my earlier reply]



More information about the cfe-dev mailing list