[PATCH] D81590: [llvm-objdump] Decrease instruction indentation for non-x86

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 11 09:21:38 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG5ee571735ddf: [llvm-objdump] Decrease instruction indentation for non-x86 (authored by MaskRay).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81590/new/

https://reviews.llvm.org/D81590

Files:
  llvm/test/tools/llvm-objdump/ELF/AArch64/disassemble-align.s
  llvm/tools/llvm-objdump/llvm-objdump.cpp


Index: llvm/tools/llvm-objdump/llvm-objdump.cpp
===================================================================
--- llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -741,9 +741,11 @@
       dumpBytes(Bytes, OS);
     }
 
-    // The output of printInst starts with a tab. Print some spaces so that
-    // the tab has 1 column and advances to the target tab stop.
-    unsigned TabStop = NoShowRawInsn ? 16 : 40;
+    // The output of printInst starts with a tab. Print some spaces so that the
+    // tab has 1 column and advances to the target tab stop. Give more columns
+    // to x86 which may encode an instruction with many bytes.
+    unsigned TabStop =
+        NoShowRawInsn ? 16 : STI.getTargetTriple().isX86() ? 40 : 24;
     unsigned Column = OS.tell() - Start;
     OS.indent(Column < TabStop - 1 ? TabStop - 1 - Column : 7 - Column % 8);
 
Index: llvm/test/tools/llvm-objdump/ELF/AArch64/disassemble-align.s
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-objdump/ELF/AArch64/disassemble-align.s
@@ -0,0 +1,12 @@
+# RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t
+# RUN: llvm-objdump -d %t | tr '\t' '|' | FileCheck --match-full-lines --strict-whitespace %s
+
+## Use '|' to show where the tabs line up.
+#       CHECK:0000000000000000 <$x.0>:
+#  CHECK-NEXT:       0: 62 10 00 91  |add|x2, x3, #4
+# CHECK-EMPTY:
+#  CHECK-NEXT:0000000000000004 <$d.1>:
+#  CHECK-NEXT:       4:|ff ff 00 00|.word|0x0000ffff
+
+  add x2, x3, #4
+  .word 0xffff


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81590.270167.patch
Type: text/x-patch
Size: 1567 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200611/41b72fd6/attachment.bin>


More information about the llvm-commits mailing list