[cfe-dev] Why is my 32-bit pointer treated like a 64-bit pointer?

Tim Northover via cfe-dev cfe-dev at lists.llvm.org
Wed Feb 8 07:09:37 PST 2017


On 8 February 2017 at 06:08, Patrik Eklöf via cfe-dev
<cfe-dev at lists.llvm.org> wrote:
> I’ve overridden TargetInfo::getPointerWidthV and
> TargetInfo::getPointerAlignV to properly return 32 bits for a pointer in
> address space 32.

Just about all that'll affect is sizeof/alignof and structure layout
algorithms. Things the C front-end handles.

> I’ve also modified the Pointers vector in the DataLayout
> to return 4 bytes for both size and alignment for address space 32. Is there
> something I’m missing? Why is clang treating the pointers as 64 bits?

That's closer to CodeGen, but I'm afraid the x86 backend just isn't
written to deal with different address-spaces having different pointer
sizes right now. Virtually all the choices it makes are based on a
simple "isTarget64BitLP64" check.

I'd expect it to be quite a lot of work in lib/Target/X86 to get this going.

Tim.



More information about the cfe-dev mailing list