[clang] [Clang][AArch64] Include SME attributes in the name mangling of function types (PR #114209)

Kerry McLaughlin via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 25 09:00:16 PST 2024


================
@@ -3535,6 +3536,39 @@ void CXXNameMangler::mangleExtFunctionInfo(const FunctionType *T) {
   // FIXME: noreturn
 }
 
+bool hasSharedState(unsigned SMEAttrs) {
+  switch (SMEAttrs) {
+  case FunctionType::ARM_In:
+  case FunctionType::ARM_Out:
+  case FunctionType::ARM_InOut:
+  case FunctionType::ARM_Preserves:
+    return true;
+  default:
+    return false;
+  }
+}
+
+void CXXNameMangler::mangleSMEAttrs(unsigned SMEAttrs) {
+  if (!SMEAttrs)
+    return;
+
+  // Streaming Mode
+  if (SMEAttrs & FunctionType::SME_PStateSMEnabledMask)
+    Out << "Lj1E";
+  else if (SMEAttrs & FunctionType::SME_PStateSMCompatibleMask)
+    Out << "Lj2E";
+  else
+    Out << "Lj0E";
+
+  // ZA & ZT0 State
+  Out << (hasSharedState(FunctionType::getArmZAState(SMEAttrs)) ? "Lj1E"
+                                                                : "Lj0E");
+  Out << (hasSharedState(FunctionType::getArmZT0State(SMEAttrs)) ? "Lj1E"
+                                                                 : "Lj0E");
----------------
kmclaughlin-arm wrote:

Hi @efriedma-quic, these should now receive different mangled names after the changes to https://github.com/ARM-software/acle/pull/358, as all of attributes are represented individually.

https://github.com/llvm/llvm-project/pull/114209


More information about the cfe-commits mailing list