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/lib/Target/Lanai | |
parent | dc7b84c66c10f47adf22baab0103eb9f6593cd72 (diff) | |
download | bcm5719-llvm-aa708763d30384c0da0b0779be96ba45f65773df.tar.gz bcm5719-llvm-aa708763d30384c0da0b0779be96ba45f65773df.zip |
[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/lib/Target/Lanai')
-rw-r--r-- | llvm/lib/Target/Lanai/MCTargetDesc/LanaiInstPrinter.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/Target/Lanai/MCTargetDesc/LanaiInstPrinter.h | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Target/Lanai/MCTargetDesc/LanaiInstPrinter.cpp b/llvm/lib/Target/Lanai/MCTargetDesc/LanaiInstPrinter.cpp index 0d42612824b..1e6764b066a 100644 --- a/llvm/lib/Target/Lanai/MCTargetDesc/LanaiInstPrinter.cpp +++ b/llvm/lib/Target/Lanai/MCTargetDesc/LanaiInstPrinter.cpp @@ -137,9 +137,10 @@ bool LanaiInstPrinter::printAlias(const MCInst *MI, raw_ostream &OS) { } } -void LanaiInstPrinter::printInst(const MCInst *MI, raw_ostream &OS, +void LanaiInstPrinter::printInst(const MCInst *MI, uint64_t Address, StringRef Annotation, - const MCSubtargetInfo & /*STI*/) { + const MCSubtargetInfo & /*STI*/, + raw_ostream &OS) { if (!printAlias(MI, OS) && !printAliasInstr(MI, OS)) printInstruction(MI, OS); printAnnotation(OS, Annotation); diff --git a/llvm/lib/Target/Lanai/MCTargetDesc/LanaiInstPrinter.h b/llvm/lib/Target/Lanai/MCTargetDesc/LanaiInstPrinter.h index 721a129a859..9f882ea68e7 100644 --- a/llvm/lib/Target/Lanai/MCTargetDesc/LanaiInstPrinter.h +++ b/llvm/lib/Target/Lanai/MCTargetDesc/LanaiInstPrinter.h @@ -24,8 +24,8 @@ public: const MCRegisterInfo &MRI) : MCInstPrinter(MAI, MII, MRI) {} - void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot, - const MCSubtargetInfo &STI) override; + void printInst(const MCInst *MI, uint64_t Address, StringRef Annot, + const MCSubtargetInfo &STI, raw_ostream &O) override; void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O, const char *Modifier = nullptr); void printPredicateOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); |