-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[SystemZ] Support PrintBranchImmAsAddress in disassembler #141064
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
As noticed in llvm#140471, the SystemZ target currently implements disassembly of PC-relative target addresses differently from other back-ends. This patch brings SystemZ in line with other targets. Specifically, this patch changes the relevant MCInst instructions to carry a PC-relative displacement instead of an absolute target address in their immediate fields. When printing the instruction, this displacement will either be shown as is (e.g. for llvm-mc), or else translated into an absolute address at print time (e.g. for llvm-objdump). The existing llvm-mc based tests using PC-relative operands no longer work and have to be rewritten, but printing displacements makes those tests easier to maintain anyway.
@llvm/pr-subscribers-mc @llvm/pr-subscribers-backend-systemz Author: Ulrich Weigand (uweigand) ChangesAs noticed in #140471, the SystemZ target currently implements disassembly of PC-relative target addresses differently from other back-ends. This patch brings SystemZ in line with other targets. Specifically, this patch changes the relevant MCInst instructions to carry a PC-relative displacement instead of an absolute target address in their immediate fields. When printing the instruction, this displacement will either be shown as is (e.g. for llvm-mc), or else translated into an absolute address at print time (e.g. for llvm-objdump). The existing llvm-mc based tests using PC-relative operands no longer work and have to be rewritten, but printing displacements makes those tests easier to maintain anyway. Patch is 77.64 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/141064.diff 12 Files Affected:
diff --git a/llvm/lib/Target/SystemZ/Disassembler/SystemZDisassembler.cpp b/llvm/lib/Target/SystemZ/Disassembler/SystemZDisassembler.cpp
index 8f7367b4f2dd8..bd188f5b4b520 100644
--- a/llvm/lib/Target/SystemZ/Disassembler/SystemZDisassembler.cpp
+++ b/llvm/lib/Target/SystemZ/Disassembler/SystemZDisassembler.cpp
@@ -280,9 +280,9 @@ static DecodeStatus decodePCDBLOperand(MCInst &Inst, uint64_t Imm,
uint64_t Address, bool isBranch,
const MCDisassembler *Decoder) {
assert(isUInt<N>(Imm) && "Invalid PC-relative offset");
- uint64_t Value = SignExtend64<N>(Imm) * 2 + Address;
+ uint64_t Value = SignExtend64<N>(Imm) * 2;
- if (!tryAddingSymbolicOperand(Value, isBranch, Address, 2, N / 8,
+ if (!tryAddingSymbolicOperand(Value + Address, isBranch, Address, 2, N / 8,
Inst, Decoder))
Inst.addOperand(MCOperand::createImm(Value));
diff --git a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinterCommon.cpp b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinterCommon.cpp
index 80391a5266532..b03ad98f2c38e 100644
--- a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinterCommon.cpp
+++ b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinterCommon.cpp
@@ -148,22 +148,38 @@ void SystemZInstPrinterCommon::printU48ImmOperand(const MCInst *MI, int OpNum,
printUImmOperand<48>(MI, OpNum, O);
}
-void SystemZInstPrinterCommon::printPCRelOperand(const MCInst *MI, int OpNum,
+void SystemZInstPrinterCommon::printPCRelOperand(const MCInst *MI,
+ uint64_t Address, int OpNum,
raw_ostream &O) {
const MCOperand &MO = MI->getOperand(OpNum);
+
+ // If the label has already been resolved to an immediate offset (say, when
+ // we're running the disassembler), just print the immediate.
if (MO.isImm()) {
- WithMarkup M = markup(O, Markup::Immediate);
- O << "0x";
- O.write_hex(MO.getImm());
- } else
+ int64_t Offset = MO.getImm();
+ if (PrintBranchImmAsAddress)
+ markup(O, Markup::Target) << formatHex(Address + Offset);
+ else
+ markup(O, Markup::Immediate) << formatImm(Offset);
+ return;
+ }
+
+ // If the branch target is simply an address then print it in hex.
+ const MCConstantExpr *BranchTarget = dyn_cast<MCConstantExpr>(MO.getExpr());
+ int64_t TargetAddress;
+ if (BranchTarget && BranchTarget->evaluateAsAbsolute(TargetAddress)) {
+ markup(O, Markup::Target) << formatHex((uint64_t)TargetAddress);
+ } else {
+ // Otherwise, just print the expression.
MO.getExpr()->print(O, &MAI);
+ }
}
void SystemZInstPrinterCommon::printPCRelTLSOperand(const MCInst *MI,
uint64_t Address, int OpNum,
raw_ostream &O) {
// Output the PC-relative operand.
- printPCRelOperand(MI, OpNum, O);
+ printPCRelOperand(MI, Address, OpNum, O);
// Output the TLS marker if present.
if ((unsigned)OpNum + 1 < MI->getNumOperands()) {
diff --git a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinterCommon.h b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinterCommon.h
index 304aa03d988dc..427dbba6ad1b4 100644
--- a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinterCommon.h
+++ b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinterCommon.h
@@ -71,11 +71,8 @@ class SystemZInstPrinterCommon : public MCInstPrinter {
void printS32ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
void printU32ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
void printU48ImmOperand(const MCInst *MI, int OpNum, raw_ostream &O);
- void printPCRelOperand(const MCInst *MI, int OpNum, raw_ostream &O);
- void printPCRelOperand(const MCInst *MI, uint64_t /*Address*/, int OpNum,
- raw_ostream &O) {
- printPCRelOperand(MI, OpNum, O);
- }
+ void printPCRelOperand(const MCInst *MI, uint64_t Address, int OpNum,
+ raw_ostream &O);
void printPCRelTLSOperand(const MCInst *MI, uint64_t Address, int OpNum,
raw_ostream &O);
diff --git a/llvm/test/MC/Disassembler/SystemZ/insns-pcrel.txt b/llvm/test/MC/Disassembler/SystemZ/insns-pcrel.txt
deleted file mode 100644
index f12441c9c6cba..0000000000000
--- a/llvm/test/MC/Disassembler/SystemZ/insns-pcrel.txt
+++ /dev/null
@@ -1,1949 +0,0 @@
-# Test instructions that have PC-relative operands. There is no attempt
-# to keep the instructions in alphabetical order, since adding new instructions
-# in the middle would mean updating all later offsets.
-# RUN: llvm-mc --disassemble %s -triple=s390x-linux-gnu -mcpu=zEC12 | FileCheck %s
-
-# 0x00000000:
-# CHECK: brasl %r0, 0x0
-0xc0 0x05 0x00 0x00 0x00 0x00
-
-# 0x00000006:
-# CHECK: brasl %r14, 0x6
-0xc0 0xe5 0x00 0x00 0x00 0x00
-
-# 0x0000000c:
-# CHECK: brasl %r15, 0xc
-0xc0 0xf5 0x00 0x00 0x00 0x00
-
-# 0x00000012:
-# CHECK: brasl %r0, 0x10
-0xc0 0x05 0xff 0xff 0xff 0xff
-
-# 0x00000018:
-# CHECK: brasl %r14, 0xffffffff00000018
-0xc0 0xe5 0x80 0x00 0x00 0x00
-
-# 0x0000001e:
-# CHECK: brasl %r15, 0x10000001c
-0xc0 0xf5 0x7f 0xff 0xff 0xff
-
-# 0x00000024:
-# CHECK: bras %r0, 0x24
-0xa7 0x05 0x00 0x00
-
-# 0x00000028:
-# CHECK: bras %r14, 0x28
-0xa7 0xe5 0x00 0x00
-
-# 0x0000002c:
-# CHECK: bras %r15, 0x2c
-0xa7 0xf5 0x00 0x00
-
-# 0x00000030:
-# CHECK: bras %r0, 0x2e
-0xa7 0x05 0xff 0xff
-
-# 0x00000034:
-# CHECK: bras %r14, 0xffffffffffff0034
-0xa7 0xe5 0x80 0x00
-
-# 0x00000038:
-# CHECK: bras %r15, 0x10036
-0xa7 0xf5 0x7f 0xff
-
-# 0x0000003c:
-# CHECK: jgnop 0x3c
-0xc0 0x04 0x00 0x00 0x00 0x00
-
-# 0x00000042:
-# CHECK: jgo 0x42
-0xc0 0x14 0x00 0x00 0x00 0x00
-
-# 0x00000048:
-# CHECK: jgh 0x48
-0xc0 0x24 0x00 0x00 0x00 0x00
-
-# 0x0000004e:
-# CHECK: jgnle 0x4e
-0xc0 0x34 0x00 0x00 0x00 0x00
-
-# 0x00000054:
-# CHECK: jgl 0x54
-0xc0 0x44 0x00 0x00 0x00 0x00
-
-# 0x0000005a:
-# CHECK: jgnhe 0x5a
-0xc0 0x54 0x00 0x00 0x00 0x00
-
-# 0x00000060:
-# CHECK: jglh 0x60
-0xc0 0x64 0x00 0x00 0x00 0x00
-
-# 0x00000066:
-# CHECK: jgne 0x66
-0xc0 0x74 0x00 0x00 0x00 0x00
-
-# 0x0000006c:
-# CHECK: jge 0x6c
-0xc0 0x84 0x00 0x00 0x00 0x00
-
-# 0x00000072:
-# CHECK: jgnlh 0x72
-0xc0 0x94 0x00 0x00 0x00 0x00
-
-# 0x00000078:
-# CHECK: jghe 0x78
-0xc0 0xa4 0x00 0x00 0x00 0x00
-
-# 0x0000007e:
-# CHECK: jgnl 0x7e
-0xc0 0xb4 0x00 0x00 0x00 0x00
-
-# 0x00000084:
-# CHECK: jgle 0x84
-0xc0 0xc4 0x00 0x00 0x00 0x00
-
-# 0x0000008a:
-# CHECK: jgnh 0x8a
-0xc0 0xd4 0x00 0x00 0x00 0x00
-
-# 0x00000090:
-# CHECK: jgno 0x90
-0xc0 0xe4 0x00 0x00 0x00 0x00
-
-# 0x00000096:
-# CHECK: jg 0x96
-0xc0 0xf4 0x00 0x00 0x00 0x00
-
-# 0x0000009c:
-# CHECK: jgnop 0x9a
-0xc0 0x04 0xff 0xff 0xff 0xff
-
-# 0x000000a2:
-# CHECK: jgnop 0xffffffff000000a2
-0xc0 0x04 0x80 0x00 0x00 0x00
-
-# 0x000000a8:
-# CHECK: jgnop 0x1000000a6
-0xc0 0x04 0x7f 0xff 0xff 0xff
-
-# 0x000000ae:
-# CHECK: jg 0xac
-0xc0 0xf4 0xff 0xff 0xff 0xff
-
-# 0x000000b4:
-# CHECK: jg 0xffffffff000000b4
-0xc0 0xf4 0x80 0x00 0x00 0x00
-
-# 0x000000ba:
-# CHECK: jg 0x1000000b8
-0xc0 0xf4 0x7f 0xff 0xff 0xff
-
-# 0x000000c0:
-# CHECK: jnop 0xc0
-0xa7 0x04 0x00 0x00
-
-# 0x000000c4:
-# CHECK: jo 0xc4
-0xa7 0x14 0x00 0x00
-
-# 0x000000c8:
-# CHECK: jh 0xc8
-0xa7 0x24 0x00 0x00
-
-# 0x000000cc:
-# CHECK: jnle 0xcc
-0xa7 0x34 0x00 0x00
-
-# 0x000000d0:
-# CHECK: jl 0xd0
-0xa7 0x44 0x00 0x00
-
-# 0x000000d4:
-# CHECK: jnhe 0xd4
-0xa7 0x54 0x00 0x00
-
-# 0x000000d8:
-# CHECK: jlh 0xd8
-0xa7 0x64 0x00 0x00
-
-# 0x000000dc:
-# CHECK: jne 0xdc
-0xa7 0x74 0x00 0x00
-
-# 0x000000e0:
-# CHECK: je 0xe0
-0xa7 0x84 0x00 0x00
-
-# 0x000000e4:
-# CHECK: jnlh 0xe4
-0xa7 0x94 0x00 0x00
-
-# 0x000000e8:
-# CHECK: jhe 0xe8
-0xa7 0xa4 0x00 0x00
-
-# 0x000000ec:
-# CHECK: jnl 0xec
-0xa7 0xb4 0x00 0x00
-
-# 0x000000f0:
-# CHECK: jle 0xf0
-0xa7 0xc4 0x00 0x00
-
-# 0x000000f4:
-# CHECK: jnh 0xf4
-0xa7 0xd4 0x00 0x00
-
-# 0x000000f8:
-# CHECK: jno 0xf8
-0xa7 0xe4 0x00 0x00
-
-# 0x000000fc:
-# CHECK: j 0xfc
-0xa7 0xf4 0x00 0x00
-
-# 0x00000100:
-# CHECK: jnop 0xfe
-0xa7 0x04 0xff 0xff
-
-# 0x00000104:
-# CHECK: jnop 0xffffffffffff0104
-0xa7 0x04 0x80 0x00
-
-# 0x00000108:
-# CHECK: jnop 0x10106
-0xa7 0x04 0x7f 0xff
-
-# 0x0000010c:
-# CHECK: j 0x10a
-0xa7 0xf4 0xff 0xff
-
-# 0x00000110:
-# CHECK: j 0xffffffffffff0110
-0xa7 0xf4 0x80 0x00
-
-# 0x00000114:
-# CHECK: j 0x10112
-0xa7 0xf4 0x7f 0xff
-
-# 0x00000118:
-# CHECK: cgfrl %r0, 0x118
-0xc6 0x0c 0x00 0x00 0x00 0x00
-
-# 0x0000011e:
-# CHECK: cgfrl %r15, 0x11e
-0xc6 0xfc 0x00 0x00 0x00 0x00
-
-# 0x00000124:
-# CHECK: cgfrl %r0, 0x122
-0xc6 0x0c 0xff 0xff 0xff 0xff
-
-# 0x0000012a:
-# CHECK: cgfrl %r15, 0x128
-0xc6 0xfc 0xff 0xff 0xff 0xff
-
-# 0x00000130:
-# CHECK: cgfrl %r0, 0xffffffff00000130
-0xc6 0x0c 0x80 0x00 0x00 0x00
-
-# 0x00000136:
-# CHECK: cgfrl %r15, 0xffffffff00000136
-0xc6 0xfc 0x80 0x00 0x00 0x00
-
-# 0x0000013c:
-# CHECK: cgfrl %r0, 0x10000013a
-0xc6 0x0c 0x7f 0xff 0xff 0xff
-
-# 0x00000142:
-# CHECK: cgfrl %r15, 0x100000140
-0xc6 0xfc 0x7f 0xff 0xff 0xff
-
-# 0x00000148:
-# CHECK: cghrl %r0, 0x148
-0xc6 0x04 0x00 0x00 0x00 0x00
-
-# 0x0000014e:
-# CHECK: cghrl %r15, 0x14e
-0xc6 0xf4 0x00 0x00 0x00 0x00
-
-# 0x00000154:
-# CHECK: cghrl %r0, 0x152
-0xc6 0x04 0xff 0xff 0xff 0xff
-
-# 0x0000015a:
-# CHECK: cghrl %r15, 0x158
-0xc6 0xf4 0xff 0xff 0xff 0xff
-
-# 0x00000160:
-# CHECK: cghrl %r0, 0xffffffff00000160
-0xc6 0x04 0x80 0x00 0x00 0x00
-
-# 0x00000166:
-# CHECK: cghrl %r15, 0xffffffff00000166
-0xc6 0xf4 0x80 0x00 0x00 0x00
-
-# 0x0000016c:
-# CHECK: cghrl %r0, 0x10000016a
-0xc6 0x04 0x7f 0xff 0xff 0xff
-
-# 0x00000172:
-# CHECK: cghrl %r15, 0x100000170
-0xc6 0xf4 0x7f 0xff 0xff 0xff
-
-# 0x00000178:
-# CHECK: cgrl %r0, 0x178
-0xc6 0x08 0x00 0x00 0x00 0x00
-
-# 0x0000017e:
-# CHECK: cgrl %r15, 0x17e
-0xc6 0xf8 0x00 0x00 0x00 0x00
-
-# 0x00000184:
-# CHECK: cgrl %r0, 0x182
-0xc6 0x08 0xff 0xff 0xff 0xff
-
-# 0x0000018a:
-# CHECK: cgrl %r15, 0x188
-0xc6 0xf8 0xff 0xff 0xff 0xff
-
-# 0x00000190:
-# CHECK: cgrl %r0, 0xffffffff00000190
-0xc6 0x08 0x80 0x00 0x00 0x00
-
-# 0x00000196:
-# CHECK: cgrl %r15, 0xffffffff00000196
-0xc6 0xf8 0x80 0x00 0x00 0x00
-
-# 0x0000019c:
-# CHECK: cgrl %r0, 0x10000019a
-0xc6 0x08 0x7f 0xff 0xff 0xff
-
-# 0x000001a2:
-# CHECK: cgrl %r15, 0x1000001a0
-0xc6 0xf8 0x7f 0xff 0xff 0xff
-
-# 0x000001a8:
-# CHECK: chrl %r0, 0x1a8
-0xc6 0x05 0x00 0x00 0x00 0x00
-
-# 0x000001ae:
-# CHECK: chrl %r15, 0x1ae
-0xc6 0xf5 0x00 0x00 0x00 0x00
-
-# 0x000001b4:
-# CHECK: chrl %r0, 0x1b2
-0xc6 0x05 0xff 0xff 0xff 0xff
-
-# 0x000001ba:
-# CHECK: chrl %r15, 0x1b8
-0xc6 0xf5 0xff 0xff 0xff 0xff
-
-# 0x000001c0:
-# CHECK: chrl %r0, 0xffffffff000001c0
-0xc6 0x05 0x80 0x00 0x00 0x00
-
-# 0x000001c6:
-# CHECK: chrl %r15, 0xffffffff000001c6
-0xc6 0xf5 0x80 0x00 0x00 0x00
-
-# 0x000001cc:
-# CHECK: chrl %r0, 0x1000001ca
-0xc6 0x05 0x7f 0xff 0xff 0xff
-
-# 0x000001d2:
-# CHECK: chrl %r15, 0x1000001d0
-0xc6 0xf5 0x7f 0xff 0xff 0xff
-
-# 0x000001d8:
-# CHECK: clgfrl %r0, 0x1d8
-0xc6 0x0e 0x00 0x00 0x00 0x00
-
-# 0x000001de:
-# CHECK: clgfrl %r15, 0x1de
-0xc6 0xfe 0x00 0x00 0x00 0x00
-
-# 0x000001e4:
-# CHECK: clgfrl %r0, 0x1e2
-0xc6 0x0e 0xff 0xff 0xff 0xff
-
-# 0x000001ea:
-# CHECK: clgfrl %r15, 0x1e8
-0xc6 0xfe 0xff 0xff 0xff 0xff
-
-# 0x000001f0:
-# CHECK: clgfrl %r0, 0xffffffff000001f0
-0xc6 0x0e 0x80 0x00 0x00 0x00
-
-# 0x000001f6:
-# CHECK: clgfrl %r15, 0xffffffff000001f6
-0xc6 0xfe 0x80 0x00 0x00 0x00
-
-# 0x000001fc:
-# CHECK: clgfrl %r0, 0x1000001fa
-0xc6 0x0e 0x7f 0xff 0xff 0xff
-
-# 0x00000202:
-# CHECK: clgfrl %r15, 0x100000200
-0xc6 0xfe 0x7f 0xff 0xff 0xff
-
-# 0x00000208:
-# CHECK: clghrl %r0, 0x208
-0xc6 0x06 0x00 0x00 0x00 0x00
-
-# 0x0000020e:
-# CHECK: clghrl %r15, 0x20e
-0xc6 0xf6 0x00 0x00 0x00 0x00
-
-# 0x00000214:
-# CHECK: clghrl %r0, 0x212
-0xc6 0x06 0xff 0xff 0xff 0xff
-
-# 0x0000021a:
-# CHECK: clghrl %r15, 0x218
-0xc6 0xf6 0xff 0xff 0xff 0xff
-
-# 0x00000220:
-# CHECK: clghrl %r0, 0xffffffff00000220
-0xc6 0x06 0x80 0x00 0x00 0x00
-
-# 0x00000226:
-# CHECK: clghrl %r15, 0xffffffff00000226
-0xc6 0xf6 0x80 0x00 0x00 0x00
-
-# 0x0000022c:
-# CHECK: clghrl %r0, 0x10000022a
-0xc6 0x06 0x7f 0xff 0xff 0xff
-
-# 0x00000232:
-# CHECK: clghrl %r15, 0x100000230
-0xc6 0xf6 0x7f 0xff 0xff 0xff
-
-# 0x00000238:
-# CHECK: clgrl %r0, 0x238
-0xc6 0x0a 0x00 0x00 0x00 0x00
-
-# 0x0000023e:
-# CHECK: clgrl %r15, 0x23e
-0xc6 0xfa 0x00 0x00 0x00 0x00
-
-# 0x00000244:
-# CHECK: clgrl %r0, 0x242
-0xc6 0x0a 0xff 0xff 0xff 0xff
-
-# 0x0000024a:
-# CHECK: clgrl %r15, 0x248
-0xc6 0xfa 0xff 0xff 0xff 0xff
-
-# 0x00000250:
-# CHECK: clgrl %r0, 0xffffffff00000250
-0xc6 0x0a 0x80 0x00 0x00 0x00
-
-# 0x00000256:
-# CHECK: clgrl %r15, 0xffffffff00000256
-0xc6 0xfa 0x80 0x00 0x00 0x00
-
-# 0x0000025c:
-# CHECK: clgrl %r0, 0x10000025a
-0xc6 0x0a 0x7f 0xff 0xff 0xff
-
-# 0x00000262:
-# CHECK: clgrl %r15, 0x100000260
-0xc6 0xfa 0x7f 0xff 0xff 0xff
-
-# 0x00000268:
-# CHECK: clhrl %r0, 0x268
-0xc6 0x07 0x00 0x00 0x00 0x00
-
-# 0x0000026e:
-# CHECK: clhrl %r15, 0x26e
-0xc6 0xf7 0x00 0x00 0x00 0x00
-
-# 0x00000274:
-# CHECK: clhrl %r0, 0x272
-0xc6 0x07 0xff 0xff 0xff 0xff
-
-# 0x0000027a:
-# CHECK: clhrl %r15, 0x278
-0xc6 0xf7 0xff 0xff 0xff 0xff
-
-# 0x00000280:
-# CHECK: clhrl %r0, 0xffffffff00000280
-0xc6 0x07 0x80 0x00 0x00 0x00
-
-# 0x00000286:
-# CHECK: clhrl %r15, 0xffffffff00000286
-0xc6 0xf7 0x80 0x00 0x00 0x00
-
-# 0x0000028c:
-# CHECK: clhrl %r0, 0x10000028a
-0xc6 0x07 0x7f 0xff 0xff 0xff
-
-# 0x00000292:
-# CHECK: clhrl %r15, 0x100000290
-0xc6 0xf7 0x7f 0xff 0xff 0xff
-
-# 0x00000298:
-# CHECK: clrl %r0, 0x298
-0xc6 0x0f 0x00 0x00 0x00 0x00
-
-# 0x0000029e:
-# CHECK: clrl %r15, 0x29e
-0xc6 0xff 0x00 0x00 0x00 0x00
-
-# 0x000002a4:
-# CHECK: clrl %r0, 0x2a2
-0xc6 0x0f 0xff 0xff 0xff 0xff
-
-# 0x000002aa:
-# CHECK: clrl %r15, 0x2a8
-0xc6 0xff 0xff 0xff 0xff 0xff
-
-# 0x000002b0:
-# CHECK: clrl %r0, 0xffffffff000002b0
-0xc6 0x0f 0x80 0x00 0x00 0x00
-
-# 0x000002b6:
-# CHECK: clrl %r15, 0xffffffff000002b6
-0xc6 0xff 0x80 0x00 0x00 0x00
-
-# 0x000002bc:
-# CHECK: clrl %r0, 0x1000002ba
-0xc6 0x0f 0x7f 0xff 0xff 0xff
-
-# 0x000002c2:
-# CHECK: clrl %r15, 0x1000002c0
-0xc6 0xff 0x7f 0xff 0xff 0xff
-
-# 0x000002c8:
-# CHECK: crl %r0, 0x2c8
-0xc6 0x0d 0x00 0x00 0x00 0x00
-
-# 0x000002ce:
-# CHECK: crl %r15, 0x2ce
-0xc6 0xfd 0x00 0x00 0x00 0x00
-
-# 0x000002d4:
-# CHECK: crl %r0, 0x2d2
-0xc6 0x0d 0xff 0xff 0xff 0xff
-
-# 0x000002da:
-# CHECK: crl %r15, 0x2d8
-0xc6 0xfd 0xff 0xff 0xff 0xff
-
-# 0x000002e0:
-# CHECK: crl %r0, 0xffffffff000002e0
-0xc6 0x0d 0x80 0x00 0x00 0x00
-
-# 0x000002e6:
-# CHECK: crl %r15, 0xffffffff000002e6
-0xc6 0xfd 0x80 0x00 0x00 0x00
-
-# 0x000002ec:
-# CHECK: crl %r0, 0x1000002ea
-0xc6 0x0d 0x7f 0xff 0xff 0xff
-
-# 0x000002f2:
-# CHECK: crl %r15, 0x1000002f0
-0xc6 0xfd 0x7f 0xff 0xff 0xff
-
-# 0x000002f8:
-# CHECK: larl %r0, 0x2f8
-0xc0 0x00 0x00 0x00 0x00 0x00
-
-# 0x000002fe:
-# CHECK: larl %r15, 0x2fe
-0xc0 0xf0 0x00 0x00 0x00 0x00
-
-# 0x00000304:
-# CHECK: larl %r0, 0x302
-0xc0 0x00 0xff 0xff 0xff 0xff
-
-# 0x0000030a:
-# CHECK: larl %r15, 0x308
-0xc0 0xf0 0xff 0xff 0xff 0xff
-
-# 0x00000310:
-# CHECK: larl %r0, 0xffffffff00000310
-0xc0 0x00 0x80 0x00 0x00 0x00
-
-# 0x00000316:
-# CHECK: larl %r15, 0xffffffff00000316
-0xc0 0xf0 0x80 0x00 0x00 0x00
-
-# 0x0000031c:
-# CHECK: larl %r0, 0x10000031a
-0xc0 0x00 0x7f 0xff 0xff 0xff
-
-# 0x00000322:
-# CHECK: larl %r15, 0x100000320
-0xc0 0xf0 0x7f 0xff 0xff 0xff
-
-# 0x00000328:
-# CHECK: lgfrl %r0, 0x328
-0xc4 0x0c 0x00 0x00 0x00 0x00
-
-# 0x0000032e:
-# CHECK: lgfrl %r15, 0x32e
-0xc4 0xfc 0x00 0x00 0x00 0x00
-
-# 0x00000334:
-# CHECK: lgfrl %r0, 0x332
-0xc4 0x0c 0xff 0xff 0xff 0xff
-
-# 0x0000033a:
-# CHECK: lgfrl %r15, 0x338
-0xc4 0xfc 0xff 0xff 0xff 0xff
-
-# 0x00000340:
-# CHECK: lgfrl %r0, 0xffffffff00000340
-0xc4 0x0c 0x80 0x00 0x00 0x00
-
-# 0x00000346:
-# CHECK: lgfrl %r15, 0xffffffff00000346
-0xc4 0xfc 0x80 0x00 0x00 0x00
-
-# 0x0000034c:
-# CHECK: lgfrl %r0, 0x10000034a
-0xc4 0x0c 0x7f 0xff 0xff 0xff
-
-# 0x00000352:
-# CHECK: lgfrl %r15, 0x100000350
-0xc4 0xfc 0x7f 0xff 0xff 0xff
-
-# 0x00000358:
-# CHECK: lghrl %r0, 0x358
-0xc4 0x04 0x00 0x00 0x00 0x00
-
-# 0x0000035e:
-# CHECK: lghrl %r15, 0x35e
-0xc4 0xf4 0x00 0x00 0x00 0x00
-
-# 0x00000364:
-# CHECK: lghrl %r0, 0x362
-0xc4 0x04 0xff 0xff 0xff 0xff
-
-# 0x0000036a:
-# CHECK: lghrl %r15, 0x368
-0xc4 0xf4 0xff 0xff 0xff 0xff
-
-# 0x00000370:
-# CHECK: lghrl %r0, 0xffffffff00000370
-0xc4 0x04 0x80 0x00 0x00 0x00
-
-# 0x00000376:
-# CHECK: lghrl %r15, 0xffffffff00000376
-0xc4 0xf4 0x80 0x00 0x00 0x00
-
-# 0x0000037c:
-# CHECK: lghrl %r0, 0x10000037a
-0xc4 0x04 0x7f 0xff 0xff 0xff
-
-# 0x00000382:
-# CHECK: lghrl %r15, 0x100000380
-0xc4 0xf4 0x7f 0xff 0xff 0xff
-
-# 0x00000388:
-# CHECK: lgrl %r0, 0x388
-0xc4 0x08 0x00 0x00 0x00 0x00
-
-# 0x0000038e:
-# CHECK: lgrl %r15, 0x38e
-0xc4 0xf8 0x00 0x00 0x00 0x00
-
-# 0x00000394:
-# CHECK: lgrl %r0, 0x392
-0xc4 0x08 0xff 0xff 0xff 0xff
-
-# 0x0000039a:
-# CHECK: lgrl %r15, 0x398
-0xc4 0xf8 0xff 0xff 0xff 0xff
-
-# 0x000003a0:
-# CHECK: lgrl %r0, 0xffffffff000003a0
-0xc4 0x08 0x80 0x00 0x00 0x00
-
-# 0x000003a6:
-# CHECK: lgrl %r15, 0xffffffff000003a6
-0xc4 0xf8 0x80 0x00 0x00 0x00
-
-# 0x000003ac:
-# CHECK: lgrl %r0, 0x1000003aa
-0xc4 0x08 0x7f 0xff 0xff 0xff
-
-# 0x000003b2:
-# CHECK: lgrl %r15, 0x1000003b0
-0xc4 0xf8 0x7f 0xff 0xff 0xff
-
-# 0x000003b8:
-# CHECK: lhrl %r0, 0x3b8
-0xc4 0x05 0x00 0x00 0x00 0x00
-
-# 0x000003be:
-# CHECK: lhrl %r15, 0x3be
-0xc4 0xf5 0x00 0x00 0x00 0x00
-
-# 0x000003c4:
-# CHECK: lhrl %r0, 0x3c2
-0xc4 0x05 0xff 0xff 0xff 0xff
-
-# 0x000003ca:
-# CHECK: lhrl %r15, 0x3c8
-0xc4 0xf5 0xff 0xff 0xff 0xff
-
-# 0x000003d0:
-# CHECK: lhrl %r0, 0xffffffff000003d0
-0xc4 0x05 0x80 0x00 0x00 0x00
-
-# 0x000003d6:
-# CHECK: lhrl %r15, 0xffffffff000003d6
-0xc4 0xf5 0x80 0x00 0x00 0x00
-
-# 0x000003dc:
-# CHECK: lhrl %r0, 0x1000003da
-0xc4 0x05 0x7f 0xff 0xff 0xff
-
-# 0x000003e2:
-# CHECK: lhrl %r15, 0x1000003e0
-0xc4 0xf5 0x7f 0xff 0xff 0xff
-
-# 0x000003e8:
-# CHECK: llgfrl %r0, 0x3e8
-0xc4 0x0e 0x00 0x00 0x00 0x00
-
-# 0x000003ee:
-# CHECK: llgfrl %r15, 0x3ee
-0xc4 0xfe 0x00 0x00 0x00 0x00
-
-# 0x000003f4:
-# CHECK: llgfrl %r0, 0x3f2
-0xc4 0x0e 0xff 0xff 0xff 0xff
-
-# 0x000003fa:
-# CHECK: llgfrl %r15, 0x3f8
-0xc4 0xfe 0xff 0xff 0xff 0xff
-
-# 0x00000400:
-# CHECK: llgfrl %r0, 0xffffffff00000400
-0xc4 0x0e 0x80 0x00 0x00 0x00
-
-# 0x00000406:
-# CHECK: llgfrl %r15, 0xffffffff00000406
-0xc4 0xfe 0x80 0x00 0x00 0x00
-
-# 0x0000040c:
-# CHECK: llgfrl %r0, 0x10000040a
-0xc4 0x0e 0x7f 0xff 0xff 0xff
-
-# 0x00000412:
-# CHECK: llgfrl %r15, 0x100000410
-0xc4 0xfe 0x7f 0xff 0xff 0xff
-
-# 0x00000418:
-# CHECK: llghrl %r0, 0x418
-0xc4 0x06 0x00 0x00 0x00 0x00
-
-# 0x0000041e:
-# CHECK: llghrl %r15, 0x41e
-0xc4 0xf6 0x00 0x00 0x00 0x00
-
-# 0x00000424:
-# CHECK: llghrl %r0, 0x422
-0xc4 0x06 0xff 0xff 0xff 0xff
-
-# 0x0000042a:
-# CHECK: llghrl %r15, 0x428
-0xc4 0xf6 0xff 0xff 0xff 0xff
-
-# 0x00000430:
-# CHECK: llghrl %r0, 0xffffffff00000430
-0xc4 0x06 0x80 0x00 0x00 0x00
-
-# 0x00000436:
-# CHECK: llghrl %r15, 0xffffffff00000436
-0xc4 0xf6 0x80 0x00 0x00 0x00
-
-# 0x0000043c:
-# CHECK: llghrl %r0, 0x10000043a
-0xc4 0x06 0x7f 0xff 0xff 0xff
-
-# 0x00000442:
-# CHECK: llghrl %r15, 0x100000440
-0xc4 0xf6 0x7f 0xff 0xff 0xff
-
-# 0x00000448:
-# CHECK: llhrl %r0, 0x448
-0xc4 0x02 0x00 0x00 0x00 0x00
-
-# 0x0000044e:
-# CHECK: llhrl %r15, 0x44e
-0xc4 0xf2 0x00 0x00 0x00 0x00
-
-# 0x00000454:
-# CHECK: llhrl %r0, 0x452
-0xc4 0x02 0xff 0xff 0xff 0xff
-
-# 0x0000045a:
-# CHECK: llhrl %r15, 0x458
-0xc4 0xf2 0xff 0xff 0xff 0xff
-
-# 0x00000460:
-# CHECK: llhrl %r0, 0xffffffff00000460
-0xc4 0x02 0x80 0x00 0x00 0x00
-
-# 0x00000466:
-# CHECK: llhrl %r15, 0xffffffff00000466
-0xc4 0xf2 0x80 0x00 0x00 0x00
-
-# 0x0000046c:
-# CHECK: llhrl %r0, 0x10000046a
-0xc4 0x02 0x7f 0xff 0xff 0xff
-
-# 0x00000472:
-# CHECK: llhrl %r15, 0x100000470
-0xc4 0xf2 0x7f 0xff 0xff 0xff
-
-# 0x00000478:
-# CHECK: lrl %r0, 0x478
-0xc4 0x0d 0x00 0x00 0x00 0x00
-
-# 0x0000047e:
-# CHECK: lrl %r15, 0x47e
-0xc4 0xfd 0x00 0x00 0x00 0x00
-
-# 0x00000484:
-# CHECK: lrl %r0, 0x482
-0xc4 0x0d 0xff 0xff 0xff 0xff
-
-# 0x0000048a:
-# CHECK: lrl %r15, 0x488
-0xc4 0xfd 0xff 0xff 0xff 0xff
-
-# 0x00000490:
-# CHECK: lrl %r0, 0xffffffff00000490
-0xc4 0x0d 0x80 0x00 0x00 0x00
-
-# 0x00000496:
-# CHECK: lrl %r15, 0xffffffff00000496
-0xc4 0xfd 0x80 0x00 0x00 0x00
-
-# 0x0000049c:
...
[truncated]
|
As noticed in llvm#140471, the SystemZ target currently implements disassembly of PC-relative target addresses differently from other back-ends. This patch brings SystemZ in line with other targets. Specifically, this patch changes the relevant MCInst instructions to carry a PC-relative displacement instead of an absolute target address in their immediate fields. When printing the instruction, this displacement will either be shown as is (e.g. for llvm-mc), or else translated into an absolute address at print time (e.g. for llvm-objdump). The existing llvm-mc based tests using PC-relative operands no longer work and have to be rewritten, but printing displacements makes those tests easier to maintain anyway.
As noticed in llvm#140471, the SystemZ target currently implements disassembly of PC-relative target addresses differently from other back-ends. This patch brings SystemZ in line with other targets. Specifically, this patch changes the relevant MCInst instructions to carry a PC-relative displacement instead of an absolute target address in their immediate fields. When printing the instruction, this displacement will either be shown as is (e.g. for llvm-mc), or else translated into an absolute address at print time (e.g. for llvm-objdump). The existing llvm-mc based tests using PC-relative operands no longer work and have to be rewritten, but printing displacements makes those tests easier to maintain anyway.
As noticed in #140471, the SystemZ target currently implements disassembly of PC-relative target addresses differently from other back-ends. This patch brings SystemZ in line with other targets.
Specifically, this patch changes the relevant MCInst instructions to carry a PC-relative displacement instead of an absolute target address in their immediate fields. When printing the instruction, this displacement will either be shown as is (e.g. for llvm-mc), or else translated into an absolute address at print time (e.g. for llvm-objdump).
The existing llvm-mc based tests using PC-relative operands no longer work and have to be rewritten, but printing displacements makes those tests easier to maintain anyway.