diff options
author | Fangrui Song <maskray@google.com> | 2020-01-03 10:55:30 -0800 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2020-01-06 20:42:22 -0800 |
commit | aa708763d30384c0da0b0779be96ba45f65773df (patch) | |
tree | 933d9337751484de17464cf352092f7147b466b3 /llvm/tools/llvm-objdump/llvm-objdump.cpp | |
parent | dc7b84c66c10f47adf22baab0103eb9f6593cd72 (diff) | |
download | llvm-aa708763d30384c0da0b0779be96ba45f65773df.zip llvm-aa708763d30384c0da0b0779be96ba45f65773df.tar.gz llvm-aa708763d30384c0da0b0779be96ba45f65773df.tar.bz2 |
[MC] Add parameter `Address` to MCInstPrinter::printInst
printInst prints a branch/call instruction as `b offset` (there are many
variants on various targets) instead of `b address`.
It is a convention to use address instead of offset in most external
symbolizers/disassemblers. This difference makes `llvm-objdump -d`
output unsatisfactory.
Add `uint64_t Address` to printInst(), so that it can pass the argument to
printInstruction(). `raw_ostream &OS` is moved to the last to be
consistent with other print* methods.
The next step is to pass `Address` to printInstruction() (generated by
tablegen from the instruction set description). We can gradually migrate
targets to print addresses instead of offsets.
In any case, downstream projects which don't know `Address` can pass 0 as
the argument.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D72172
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
-rw-r--r-- | llvm/tools/llvm-objdump/llvm-objdump.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index 004edff..d25ebf3 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -708,7 +708,7 @@ public: OS.indent(Column < TabStop - 1 ? TabStop - 1 - Column : 7 - Column % 8); if (MI) - IP.printInst(MI, OS, "", STI); + IP.printInst(MI, Address.Address, "", STI, OS); else OS << "\t<unknown>"; } @@ -744,7 +744,7 @@ public: std::string Buffer; { raw_string_ostream TempStream(Buffer); - IP.printInst(MI, TempStream, "", STI); + IP.printInst(MI, Address.Address, "", STI, TempStream); } StringRef Contents(Buffer); // Split off bundle attributes @@ -811,7 +811,7 @@ public: SmallString<40> InstStr; raw_svector_ostream IS(InstStr); - IP.printInst(MI, IS, "", STI); + IP.printInst(MI, Address.Address, "", STI, IS); OS << left_justify(IS.str(), 60); } else { @@ -865,7 +865,7 @@ public: dumpBytes(Bytes, OS); } if (MI) - IP.printInst(MI, OS, "", STI); + IP.printInst(MI, Address.Address, "", STI, OS); else OS << "\t<unknown>"; } |