[cfe-commits] [PATCH] [VCPP] Add __ptr64 qualifier
Aaron Ballman
aaron at aaronballman.com
Thu Nov 8 13:33:35 PST 2012
I finally had the chance to dig a bit deeper into this...
I'm not certain we'd need to do anything aside from fix 64-bit
mangling of pointers, truth be told. From looking at the
documentation, it seems those type attributes are ignored on Windows.
It doesn't appear that cl mangles them identically, regardless of
target architecture (including ARM).
Namely:
// Code
int * __ptr32 p32;
int * __ptr64 p64;
// Assembly
PUBLIC ?p32@@3PAHA ; p32
PUBLIC ?p64@@3PEAHEA ; p64
Those mangled names are the same when I compile for x86, x64 and ARM,
so empirical testing seems to agree with documented behavior from
MSDN.
Basically, I think we can parse and eat __ptr64 and __ptr32, and
simply mangle as proper for the native architecture and be fine.
~Aaron
On Thu, Nov 8, 2012 at 4:15 PM, Charles Davis <cdavis5x at gmail.com> wrote:
>
> Files still have wrong line endings (should be LF, not CR-LF). That's kinda annoying, because when the commit goes through, we'll see basically the whole file diff'd and we can't see where the actual, substantial changes took place.
>
>
> ================
> Comment at: test/CodeGenCXX/mangle-ms-ptr64.cpp:7-9
> @@ +6,5 @@
> +
> +// CHECK: @"\01?VS_p32@@3PAHA" = global i32* null
> +// CHK64: @"\01?VS_p32@@3PAHA" = global i32* null
> +int * __ptr32 VS_p32;
> +
> ----------------
> Clang currently recognizes the `__ptr32` and `__ptr64` keywords, but doesn't yet attach them to the declaration. We haven't yet worked out exactly how to do that. One way might be to assign the non-native pointer size (i.e. `__ptr32` in 64-bit mode and `__ptr64` in 32-bit mode) to a different address space. But that requires Micah's pointer-sizes-in-address-spaces work, which was just recently reverted.
>
> I'm open to suggestions.
>
>
> http://llvm-reviews.chandlerc.com/D101
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list