[Lldb-commits] [PATCH] D123582: [lldb][AArch64] Automatically add all extensions to disassembler

David Spickett via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 12 03:18:35 PDT 2022


DavidSpickett created this revision.
Herald added a subscriber: kristof.beyls.
Herald added a project: All.
DavidSpickett requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This means we don't have to remember to update this code as much.

This is all tested in lldb/test/Shell/Commands/command-disassemble-aarch64-extensions.s
which I added previously.

We don't have a way to get the latest base architecture yet
so that remains manual. Having all the extensions specified
will probably be equivalent to the latest architecture version
in any case.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123582

Files:
  lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp


Index: lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
===================================================================
--- lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
+++ lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
@@ -22,6 +22,7 @@
 #include "llvm/MC/MCSubtargetInfo.h"
 #include "llvm/MC/MCTargetOptions.h"
 #include "llvm/MC/TargetRegistry.h"
+#include "llvm/Support/AArch64TargetParser.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ScopedPrinter.h"
 #include "llvm/Support/TargetSelect.h"
@@ -41,6 +42,8 @@
 #include "lldb/Utility/RegularExpression.h"
 #include "lldb/Utility/Stream.h"
 
+#include <numeric>
+
 using namespace lldb;
 using namespace lldb_private;
 
@@ -1177,12 +1180,17 @@
       features_str += "+dspr2,";
   }
 
-  // If any AArch64 variant, enable latest ISA with any optional
-  // extensions like MTE.
+  // If any AArch64 variant, enable latest ISA with all extensions.
   if (triple.isAArch64()) {
-    features_str += "+v9.3a,+mte,+sm4,+sha2,+sha3,+aes,+fp16fml,+sve2-aes,+"
-                    "sve2-sm4,+sve2-sha3,+sve2-bitperm,+f32mm,+f64mm,+tme,+"
-                    "ls64,+sme,+sme-f64,+sme-i64,+spe,+rand,+brbe";
+    features_str += "+v9.3a,";
+    std::vector<llvm::StringRef> features;
+    // Get all possible features
+    llvm::AArch64::getExtensionFeatures(-1, features);
+    features_str +=
+        std::accumulate(features.begin(), features.end(), features_str,
+                        [](std::string features, llvm::StringRef feature) {
+                          return features + feature.str() + ",";
+                        });
 
     if (triple.getVendor() == llvm::Triple::Apple)
       cpu = "apple-latest";


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123582.422159.patch
Type: text/x-patch
Size: 1739 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220412/4fb5e246/attachment.bin>


More information about the lldb-commits mailing list