[clang] [clang] Refactor target attribute mangling. (PR #81893)

Alexandros Lamprineas via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 28 07:25:16 PST 2024


================
@@ -857,6 +864,36 @@ void AArch64TargetCodeGenInfo::checkFunctionCallABI(
           << Callee->getDeclName();
 }
 
+void AArch64ABIInfo::appendAttributeMangling(TargetClonesAttr *Attr,
+                                             unsigned Index,
+                                             raw_ostream &Out) const {
+  appendAttributeMangling(Attr->getFeatureStr(Index), Out);
+}
+
+void AArch64ABIInfo::appendAttributeMangling(StringRef AttrStr,
+                                             raw_ostream &Out) const {
+  if (AttrStr == "default") {
+    Out << ".default";
+    return;
+  }
+
+  Out << "._";
+  SmallVector<StringRef, 8> Features;
+  AttrStr.split(Features, "+");
+  for (auto &Feat : Features)
+    Feat = Feat.trim();
+
+  // TODO Lexicographical order won't break the ABI if priorities change.
----------------
labrinea wrote:

I can change this to say FIXME instead and write a more descriptive comment. For context please read https://github.com/llvm/llvm-project/pull/79316#discussion_r1469932618. It shouldn't stick around for long, as soon as we reach a conclusion I can update the sorting criteria of this lambda.

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


More information about the cfe-commits mailing list