[PATCH] D62960: SVE opaque type for C intrinsics demo

Diana Picus via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 27 04:59:41 PDT 2019


rovka added a comment.

Just a few nits/suggestions.



================
Comment at: include/clang/Basic/AArch64SVEACLETypes.def:10
+//
+//  This file defines the database about various builtin singleton types.
+//
----------------
You can be more specific :)


================
Comment at: include/clang/Basic/AArch64SVEACLETypes.def:29
+#define SVE_VECTOR_TYPE(Name, Id, SingletonId, ElKind, ElBits, IsSigned, IsFP)\
+  BUILTIN_TYPE(Name, Id, SingletonId)
+#endif
----------------
Maybe use SVE_TYPE instead of BUILTIN_TYPE, to avoid any confusion?  You can't re-use a defition of BUILTIN_TYPE between this header and BuiltinTypes.def anyway, since they both undefine it at the end.


================
Comment at: include/clang/Serialization/ASTBitCodes.h:1021
 #include "clang/Basic/OpenCLExtensionTypes.def"
+// SVE Types
+#define SVE_VECTOR_TYPE(Name, Id, SingletonId, ElKind, ElBits, IsSigned, IsFP)\
----------------
super nit: /// \brief SVE types with auto numeration


================
Comment at: lib/AST/ASTContext.cpp:6645
+  case BuiltinType::Id:
+#include "clang/Basic/AArch64SVEACLETypes.def"
 #define BUILTIN_TYPE(KIND, ID)
----------------
Here and in most other places: no need for 2 defines, you can just #define BUILTIN_TYPE (or if you choose to rename it to SVE_TYPE) since it's the same code for both vectors and predicates.


================
Comment at: lib/AST/ItaniumMangle.cpp:2680
+    break;
+#include "clang/Basic/AArch64SVEACLETypes.def"
   }
----------------
erik.pilkington wrote:
> rsandifo-arm wrote:
> > erik.pilkington wrote:
> > > jfb wrote:
> > > > @rjmccall you probably should review this part.
> > > Sorry for the drive by comment, but: All of these mangling should really be using the "vendor extension" production IMO:
> > > 
> > > `<type> ::= u <source-name>`
> > > 
> > > As is, these manglings intrude on the users's namespace, (i.e. if they had a type named `objc_selector` or something), and confuse demanglers which incorrectly assume these are substitutable (vendor extension builtin types are substitutable too though, but that should be handled here).
> > It isn't obvious from the patch, but the SVE names that we're mangling are predefined names like __SVInt8_t. rather than user-facing names like svint8_t  The predefined names and their mangling are defined by the platform ABI (https://developer.arm.com/docs/100986/0000), so it wouldn't be valid for another part of the implementation to use those names for something else.
> > 
> > I realise you were making a general point here though, sorry.
> > 
> The mangling in the document you linked does use the vendor extension production here though, i.e. the example is `void f(int8x8_t)`, which mangles to _Z1f**u10__Int8x8_t**. It is true that this shouldn't ever collide with another mangling in practice, but my point is there isn't any need to smuggle it into the mangling by pretending it's a user defined type, when the itanium grammar and related tools have a special way for vendors to add builtin types.
I agree with Erik here, the example in the PCS document seems to suggest using u. I think either the patch needs to be updated or the document needs to be more clear about what the mangling is supposed to look like.


================
Comment at: lib/AST/MicrosoftMangle.cpp:2110
+    llvm_unreachable("mangling an sve type not yet supported");
+#include "clang/Basic/AArch64SVEACLETypes.def"
   }
----------------
Should we have llvm_unreachable or report a proper error? I like the unreachable if we're checking elsewhere that SVE isn't supported on Windows, but I notice we report errors for some of the other types.


================
Comment at: lib/CodeGen/CGDebugInfo.cpp:709
+  case BuiltinType::Id: \
+    return nullptr;
+#include "clang/Basic/AArch64SVEACLETypes.def"
----------------
I don't really know this code, but I can't help but notice that nullptr is only ever used for the void type. Is it safe to also use it for the SVE types, or can we do something else instead?


Repository:
  rC Clang

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

https://reviews.llvm.org/D62960





More information about the cfe-commits mailing list