[PATCH] D71230: [llvm/dwarfdump] Use the architecture string to filter.

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 9 16:25:46 PST 2019


JDevlieghere created this revision.
JDevlieghere added a reviewer: aprantl.
Herald added a subscriber: kristof.beyls.
Herald added a reviewer: jhenderson.
Herald added a project: LLVM.

Currently dwarfdump uses the `ArchType` to filter out architectures, which is problematic for architectures like `arm64e` and `x86_64h` that map back to `arm64` and `x86_64` respectively. The result is that the filter doesn't work for these architectures which is usually the reason to use the filter in the first place.

Instead, we should match the architecture based on the string name. This means the filter works for the values printed by dwarfdump. It has the unfortunate side effect of not working for aliases, like AArch64, but I think that's worth the trade-off.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71230

Files:
  llvm/test/tools/llvm-dwarfdump/AArch64/arch.ll
  llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp


Index: llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
===================================================================
--- llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
+++ llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
@@ -271,7 +271,7 @@
           return true;
 
       // Match as name.
-      if (MachO->getArchTriple().getArch() == Triple(Arch).getArch())
+      if (MachO->getArchTriple().getArchName() == Triple(Arch).getArchName())
         return true;
     }
   }
Index: llvm/test/tools/llvm-dwarfdump/AArch64/arch.ll
===================================================================
--- llvm/test/tools/llvm-dwarfdump/AArch64/arch.ll
+++ llvm/test/tools/llvm-dwarfdump/AArch64/arch.ll
@@ -1,6 +1,5 @@
 ; RUN: llc -O0 %s -filetype=obj -o %t.o
 ; RUN: llvm-dwarfdump -arch arm64   %t.o | FileCheck %s
-; RUN: llvm-dwarfdump -arch aarch64 %t.o | FileCheck %s
 ; RUN: llvm-dwarfdump -arch 0x0100000c %t.o | FileCheck %s
 ; CHECK: file format Mach-O arm64
 ;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71230.232954.patch
Type: text/x-patch
Size: 966 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191210/fcd67ce5/attachment.bin>


More information about the llvm-commits mailing list