[PATCH] D155114: [llvm-objdump] Default to --mcpu=future for PPC32

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 12 13:30:09 PDT 2023


MaskRay created this revision.
MaskRay added reviewers: PowerPC, nemanjai, qiucf, jhenderson.
Herald added subscribers: shchenz, hiraditya, emaste.
Herald added a project: All.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Extend D127824 <https://reviews.llvm.org/D127824> to the 32-bit Power architecture.
AFAICT GNU objdump -d dumps all instructions for 32-bit as well.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155114

Files:
  llvm/docs/CommandGuide/llvm-objdump.rst
  llvm/lib/Object/ELFObjectFile.cpp
  llvm/test/tools/llvm-objdump/ELF/PowerPC/mcpu.s


Index: llvm/test/tools/llvm-objdump/ELF/PowerPC/mcpu.s
===================================================================
--- llvm/test/tools/llvm-objdump/ELF/PowerPC/mcpu.s
+++ llvm/test/tools/llvm-objdump/ELF/PowerPC/mcpu.s
@@ -5,6 +5,9 @@
 # RUN: llvm-objdump -d --no-show-raw-insn --mcpu=future %t | FileCheck %s --check-prefixes=CHECK,FUTURE
 # RUN: llvm-objdump -d --no-show-raw-insn --mcpu=pwr9 %t | FileCheck %s --check-prefixes=CHECK,UNKNOWN
 
+# RUN: llvm-mc -triple=powerpc -filetype=obj %s -o %t
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s --check-prefixes=CHECK,FUTURE
+
 # CHECK-LABEL: <_start>:
 # FUTURE-NEXT:   pld 3, 0(0), 1
 # UNKNOWN-COUNT-2: <unknown>
Index: llvm/lib/Object/ELFObjectFile.cpp
===================================================================
--- llvm/lib/Object/ELFObjectFile.cpp
+++ llvm/lib/Object/ELFObjectFile.cpp
@@ -358,6 +358,7 @@
   switch (getEMachine()) {
   case ELF::EM_AMDGPU:
     return getAMDGPUCPUName();
+  case ELF::EM_PPC:
   case ELF::EM_PPC64:
     return StringRef("future");
   default:
Index: llvm/docs/CommandGuide/llvm-objdump.rst
===================================================================
--- llvm/docs/CommandGuide/llvm-objdump.rst
+++ llvm/docs/CommandGuide/llvm-objdump.rst
@@ -28,7 +28,7 @@
 .. option:: -d, --disassemble
 
   Disassemble all executable sections found in the input files. On some
-  architectures (AArch64, PPC64, x86), all known instructions are disassembled by
+  architectures (AArch64, Power, x86), all known instructions are disassembled by
   default. On the others, :option:`--mcpu` or :option:`--mattr` is needed to
   enable some instruction sets. Disabled instructions are displayed as
   ``<unknown>``.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155114.539710.patch
Type: text/x-patch
Size: 1730 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230712/5827ea50/attachment.bin>


More information about the llvm-commits mailing list