[PATCH] D55715: Add AddressSpace mangling to MS mode

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 14 13:57:46 PST 2018


erichkeane marked 2 inline comments as done.
erichkeane added inline comments.


================
Comment at: lib/AST/MicrosoftMangle.cpp:1806-1836
+    Extra.mangleSourceName("AS_");
+    Extra.mangleIntegerLiteral(llvm::APSInt::getUnsigned(TargetAS),
+                               /*IsBoolean*/ false);
+  } else {
+    switch (AS) {
+    default:
+      llvm_unreachable("Not a language specific address space");
----------------
rnk wrote:
> majnemer wrote:
> > Don't these need to be _AS_Foobar to avoid collisions with normal code?
> I think we're in __clang::, so it's OK? In any case, it's what's done for Itanium, IIUC. It's also not like we have to worry about conflicts with user macros.
Right, we're in __clang (thus cannot conflict), and cannot be replaced with macros or anything (since this is a mangling name), so I opted to save the char instead.  

However, I'll make it _AS_CU<whatever> just cause.


================
Comment at: test/CodeGenOpenCL/address-spaces-mangling.cl:7
+// RUN: %clang_cc1 %s -ffake-address-space-map -faddress-space-map-mangling=yes -triple x86_64-windows-pc -emit-llvm -o - | FileCheck -check-prefixes=MS_ASMANG,MS_ASMAN10 %s
+// RUN: %clang_cc1 %s -cl-std=CL2.0 -ffake-address-space-map -faddress-space-map-mangling=yes -triple x86_64-windows-pc -emit-llvm -o - | FileCheck -check-prefixes=MS_ASMANG,MS_ASMAN20 %s
+// RUN: %clang_cc1 %s -ffake-address-space-map -faddress-space-map-mangling=no -triple x86_64-windows-pc -emit-llvm -o - | FileCheck -check-prefixes=MS_NOASMANG,MS_NOASMAN10 %s
----------------
rnk wrote:
> erichkeane wrote:
> > erichkeane wrote:
> > > rnk wrote:
> > > > I would replace `-triple x86_64-windows-pc` here and everywhere with `-triple x86_64-windows-itanium` (or gnu instead of itanium) to test the Itanium mangling on Windows. I don't think `x86_64-windows-pc` parses into a real triple. After all, "pc" is parsed as the vendor, which is supposed to be second.
> > > Woops! I didn't mean to check this file in.  It has some other nasty problems that need to be fixed up, so I tested this feature in the mangle-address-space.  I'll still do this above.
> > @rnk I tried this, but it changes off of the MicrosoftMangler and switches back to the Itanium mangling.  Is there a better triple for testing microsoft mangling?
> Tacking on "-msvc" or "-itanium" or "-gnu" is the more explicit way to the C++ ABI. I guess I was confused, it looks like this file expects Itanium manglings from the -pc triple.
Ah, yeah, I should have figured that out.  I was originally looking to do the opencl-c++ test in this file but it has some bigger problems that cause issues (so I never finished it).

Somehow it stayed in my workspace when I stashed.

I'll update this whole patch as soon as my build passes.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55715/new/

https://reviews.llvm.org/D55715





More information about the cfe-commits mailing list