[llvm] a4d1259 - [llvm-objdump] Default to --mcpu=future for PPC32
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 12 18:24:23 PDT 2023
Author: Fangrui Song
Date: 2023-07-12T18:24:18-07:00
New Revision: a4d1259e617c94d2382a55b6bf48683363a0b849
URL: https://github.com/llvm/llvm-project/commit/a4d1259e617c94d2382a55b6bf48683363a0b849
DIFF: https://github.com/llvm/llvm-project/commit/a4d1259e617c94d2382a55b6bf48683363a0b849.diff
LOG: [llvm-objdump] Default to --mcpu=future for PPC32
Extend D127824 to the 32-bit Power architecture.
AFAICT GNU objdump -d dumps all instructions for 32-bit as well.
Reviewed By: #powerpc, nemanjai
Differential Revision: https://reviews.llvm.org/D155114
Added:
Modified:
llvm/docs/CommandGuide/llvm-objdump.rst
llvm/lib/Object/ELFObjectFile.cpp
llvm/test/tools/llvm-objdump/ELF/PowerPC/mcpu.s
Removed:
################################################################################
diff --git a/llvm/docs/CommandGuide/llvm-objdump.rst b/llvm/docs/CommandGuide/llvm-objdump.rst
index 9023abfa526afd..cd3d14b4114347 100644
--- a/llvm/docs/CommandGuide/llvm-objdump.rst
+++ b/llvm/docs/CommandGuide/llvm-objdump.rst
@@ -28,7 +28,7 @@ combined with other commands:
.. 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, PowerPC, 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>``.
diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp
index 1569aa48965b67..165bab6ac51426 100644
--- a/llvm/lib/Object/ELFObjectFile.cpp
+++ b/llvm/lib/Object/ELFObjectFile.cpp
@@ -358,6 +358,7 @@ std::optional<StringRef> ELFObjectFileBase::tryGetCPUName() const {
switch (getEMachine()) {
case ELF::EM_AMDGPU:
return getAMDGPUCPUName();
+ case ELF::EM_PPC:
case ELF::EM_PPC64:
return StringRef("future");
default:
diff --git a/llvm/test/tools/llvm-objdump/ELF/PowerPC/mcpu.s b/llvm/test/tools/llvm-objdump/ELF/PowerPC/mcpu.s
index 24ae2c9f3e50aa..35cc8e82a8780d 100644
--- a/llvm/test/tools/llvm-objdump/ELF/PowerPC/mcpu.s
+++ b/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>
More information about the llvm-commits
mailing list