[llvm] [llvm-objdump] Add the --visualize-jumps option (PR #74858)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 14 01:01:43 PST 2023


================
@@ -471,32 +473,92 @@ static bool getHidden(RelocationRef RelRef) {
   return false;
 }
 
-/// Get the column at which we want to start printing the instruction
-/// disassembly, taking into account anything which appears to the left of it.
-unsigned objdump::getInstStartColumn(const MCSubtargetInfo &STI) {
-  return !ShowRawInsn ? 16 : STI.getTargetTriple().isX86() ? 40 : 24;
+static int ControlFlowColumnWidth = 0;
+void objdump::setControlFlowColumnWidth(int Width) {
+  ControlFlowColumnWidth = Width;
 }
 
-static void AlignToInstStartColumn(size_t Start, const MCSubtargetInfo &STI,
-                                   raw_ostream &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 = getInstStartColumn(STI);
-  unsigned Column = OS.tell() - Start;
-  OS.indent(Column < TabStop - 1 ? TabStop - 1 - Column : 7 - Column % 8);
+unsigned EncodingColumnWidth(Triple const &Triple) {
+  switch (Triple.getArch()) {
+  case Triple::x86:
+  case Triple::x86_64:
+    return 30;
+  default:
+    return 14;
+  }
+}
+
+unsigned objdump::GetColumnIndent(MCSubtargetInfo const &STI,
----------------
jh7370 wrote:

```suggestion
unsigned objdump::getColumnIndent(MCSubtargetInfo const &STI,
```

https://github.com/llvm/llvm-project/pull/74858


More information about the llvm-commits mailing list