Skip to content

Commit cf679e6

Browse files
committed
SystemZ: Rename SystemZMCExpr::VK_ to SystemZ::S_
Prepare for removing SystemZMCExpr. Adopt the newer naming convention used by most other targets.
1 parent 993c158 commit cf679e6

10 files changed

+100
-105
lines changed

llvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,12 +1707,12 @@ ParseStatus SystemZAsmParser::parsePCRel(OperandVector &Operands,
17071707
if (Parser.getTok().isNot(AsmToken::Identifier))
17081708
return Error(Parser.getTok().getLoc(), "unexpected token");
17091709

1710-
SystemZMCExpr::Specifier Kind = SystemZMCExpr::VK_None;
1710+
SystemZMCExpr::Specifier Kind = SystemZ::S_None;
17111711
StringRef Name = Parser.getTok().getString();
17121712
if (Name == "tls_gdcall")
1713-
Kind = SystemZMCExpr::VK_TLSGD;
1713+
Kind = SystemZ::S_TLSGD;
17141714
else if (Name == "tls_ldcall")
1715-
Kind = SystemZMCExpr::VK_TLSLDM;
1715+
Kind = SystemZ::S_TLSLDM;
17161716
else
17171717
return Error(Parser.getTok().getLoc(), "unknown TLS tag");
17181718
Parser.Lex();

llvm/lib/Target/SystemZ/MCTargetDesc/SystemZELFObjectWriter.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "MCTargetDesc/SystemZMCExpr.h"
9+
#include "MCTargetDesc/SystemZMCAsmInfo.h"
1010
#include "MCTargetDesc/SystemZMCFixups.h"
1111
#include "MCTargetDesc/SystemZMCTargetDesc.h"
1212
#include "llvm/BinaryFormat/ELF.h"
@@ -103,14 +103,14 @@ unsigned SystemZELFObjectWriter::getRelocType(const MCFixup &Fixup,
103103
bool IsPCRel) const {
104104
SMLoc Loc = Fixup.getLoc();
105105
unsigned Kind = Fixup.getKind();
106-
auto Specifier = SystemZMCExpr::Specifier(Target.getSpecifier());
106+
auto Specifier = SystemZ::Specifier(Target.getSpecifier());
107107
switch (Specifier) {
108-
case SystemZMCExpr::VK_INDNTPOFF:
109-
case SystemZMCExpr::VK_NTPOFF:
110-
case SystemZMCExpr::VK_TLSGD:
111-
case SystemZMCExpr::VK_TLSLD:
112-
case SystemZMCExpr::VK_TLSLDM:
113-
case SystemZMCExpr::VK_DTPOFF:
108+
case SystemZ::S_INDNTPOFF:
109+
case SystemZ::S_NTPOFF:
110+
case SystemZ::S_TLSGD:
111+
case SystemZ::S_TLSLD:
112+
case SystemZ::S_TLSLDM:
113+
case SystemZ::S_DTPOFF:
114114
if (auto *SA = Target.getAddSym())
115115
cast<MCSymbolELF>(SA)->setType(ELF::STT_TLS);
116116
break;
@@ -119,12 +119,12 @@ unsigned SystemZELFObjectWriter::getRelocType(const MCFixup &Fixup,
119119
}
120120

121121
switch (Specifier) {
122-
case SystemZMCExpr::VK_None:
122+
case SystemZ::S_None:
123123
if (IsPCRel)
124124
return getPCRelReloc(Loc, Kind);
125125
return getAbsoluteReloc(Loc, Kind);
126126

127-
case SystemZMCExpr::VK_NTPOFF:
127+
case SystemZ::S_NTPOFF:
128128
assert(!IsPCRel && "NTPOFF shouldn't be PC-relative");
129129
switch (Kind) {
130130
case FK_Data_4:
@@ -135,14 +135,14 @@ unsigned SystemZELFObjectWriter::getRelocType(const MCFixup &Fixup,
135135
reportError(Loc, "Unsupported thread-local address (local-exec)");
136136
return 0;
137137

138-
case SystemZMCExpr::VK_INDNTPOFF:
138+
case SystemZ::S_INDNTPOFF:
139139
if (IsPCRel && Kind == SystemZ::FK_390_PC32DBL)
140140
return ELF::R_390_TLS_IEENT;
141141
reportError(Loc,
142142
"Only PC-relative INDNTPOFF accesses are supported for now");
143143
return 0;
144144

145-
case SystemZMCExpr::VK_DTPOFF:
145+
case SystemZ::S_DTPOFF:
146146
assert(!IsPCRel && "DTPOFF shouldn't be PC-relative");
147147
switch (Kind) {
148148
case FK_Data_4:
@@ -153,7 +153,7 @@ unsigned SystemZELFObjectWriter::getRelocType(const MCFixup &Fixup,
153153
reportError(Loc, "Unsupported thread-local address (local-dynamic)");
154154
return 0;
155155

156-
case SystemZMCExpr::VK_TLSLDM:
156+
case SystemZ::S_TLSLDM:
157157
assert(!IsPCRel && "TLSLDM shouldn't be PC-relative");
158158
switch (Kind) {
159159
case FK_Data_4:
@@ -166,7 +166,7 @@ unsigned SystemZELFObjectWriter::getRelocType(const MCFixup &Fixup,
166166
reportError(Loc, "Unsupported thread-local address (local-dynamic)");
167167
return 0;
168168

169-
case SystemZMCExpr::VK_TLSGD:
169+
case SystemZ::S_TLSGD:
170170
assert(!IsPCRel && "TLSGD shouldn't be PC-relative");
171171
switch (Kind) {
172172
case FK_Data_4:
@@ -179,14 +179,14 @@ unsigned SystemZELFObjectWriter::getRelocType(const MCFixup &Fixup,
179179
reportError(Loc, "Unsupported thread-local address (general-dynamic)");
180180
return 0;
181181

182-
case SystemZMCExpr::VK_GOT:
183-
case SystemZMCExpr::VK_GOTENT:
182+
case SystemZ::S_GOT:
183+
case SystemZ::S_GOTENT:
184184
if (IsPCRel && Kind == SystemZ::FK_390_PC32DBL)
185185
return ELF::R_390_GOTENT;
186186
reportError(Loc, "Only PC-relative GOT accesses are supported for now");
187187
return 0;
188188

189-
case SystemZMCExpr::VK_PLT:
189+
case SystemZ::S_PLT:
190190
assert(IsPCRel && "@PLT shouldn't be PC-relative");
191191
switch (Kind) {
192192
case SystemZ::FK_390_PC12DBL:
@@ -209,8 +209,8 @@ unsigned SystemZELFObjectWriter::getRelocType(const MCFixup &Fixup,
209209
bool SystemZELFObjectWriter::needsRelocateWithSymbol(const MCValue &V,
210210
unsigned Type) const {
211211
switch (V.getSpecifier()) {
212-
case SystemZMCExpr::VK_GOT:
213-
case SystemZMCExpr::VK_PLT:
212+
case SystemZ::S_GOT:
213+
case SystemZ::S_PLT:
214214
return true;
215215
default:
216216
return false;

llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinterCommon.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "SystemZInstPrinterCommon.h"
10-
#include "MCTargetDesc/SystemZMCExpr.h"
10+
#include "MCTargetDesc/SystemZMCAsmInfo.h"
1111
#include "llvm/MC/MCExpr.h"
1212
#include "llvm/MC/MCInst.h"
1313
#include "llvm/MC/MCRegister.h"
@@ -186,10 +186,10 @@ void SystemZInstPrinterCommon::printPCRelTLSOperand(const MCInst *MI,
186186
const MCOperand &MO = MI->getOperand(OpNum + 1);
187187
const MCSymbolRefExpr &refExp = cast<MCSymbolRefExpr>(*MO.getExpr());
188188
switch (refExp.getSpecifier()) {
189-
case SystemZMCExpr::VK_TLSGD:
189+
case SystemZ::S_TLSGD:
190190
O << ":tls_gdcall:";
191191
break;
192-
case SystemZMCExpr::VK_TLSLDM:
192+
case SystemZ::S_TLSLDM:
193193
O << ":tls_ldcall:";
194194
break;
195195
default:

llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,11 @@
1414
using namespace llvm;
1515

1616
const MCAsmInfo::VariantKindDesc variantKindDescs[] = {
17-
{SystemZMCExpr::VK_DTPOFF, "DTPOFF"},
18-
{SystemZMCExpr::VK_GOT, "GOT"},
19-
{SystemZMCExpr::VK_GOTENT, "GOTENT"},
20-
{SystemZMCExpr::VK_INDNTPOFF, "INDNTPOFF"},
21-
{SystemZMCExpr::VK_NTPOFF, "NTPOFF"},
22-
{SystemZMCExpr::VK_PLT, "PLT"},
23-
{SystemZMCExpr::VK_TLSGD, "TLSGD"},
24-
{SystemZMCExpr::VK_TLSLD, "TLSLD"},
25-
{SystemZMCExpr::VK_TLSLDM, "TLSLDM"},
17+
{SystemZ::S_DTPOFF, "DTPOFF"}, {SystemZ::S_GOT, "GOT"},
18+
{SystemZ::S_GOTENT, "GOTENT"}, {SystemZ::S_INDNTPOFF, "INDNTPOFF"},
19+
{SystemZ::S_NTPOFF, "NTPOFF"}, {SystemZ::S_PLT, "PLT"},
20+
{SystemZ::S_TLSGD, "TLSGD"}, {SystemZ::S_TLSLD, "TLSLD"},
21+
{SystemZ::S_TLSLDM, "TLSLDM"},
2622
};
2723

2824
SystemZMCAsmInfoELF::SystemZMCAsmInfoELF(const Triple &TT) {

llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,28 @@ class SystemZMCAsmInfoGOFF : public MCAsmInfoGOFF {
2828
bool isAcceptableChar(char C) const override;
2929
};
3030

31+
namespace SystemZ {
32+
using Specifier = uint16_t;
33+
enum {
34+
S_None,
35+
36+
S_DTPOFF,
37+
S_GOT,
38+
S_GOTENT,
39+
S_INDNTPOFF,
40+
S_NTPOFF,
41+
S_PLT,
42+
S_TLSGD,
43+
S_TLSLD,
44+
S_TLSLDM,
45+
46+
// HLASM docs for address constants:
47+
// https://www.ibm.com/docs/en/hla-and-tf/1.6?topic=value-address-constants
48+
S_RCon, // Address of ADA of symbol.
49+
S_VCon, // Address of external function symbol.
50+
};
51+
} // namespace SystemZ
52+
3153
} // end namespace llvm
3254

3355
#endif

llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCExpr.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "SystemZMCExpr.h"
10+
#include "SystemZMCAsmInfo.h"
1011
#include "llvm/MC/MCAsmInfo.h"
1112
#include "llvm/MC/MCContext.h"
1213
using namespace llvm;
@@ -20,11 +21,11 @@ const SystemZMCExpr *SystemZMCExpr::create(MCSpecifierExpr::Spec S,
2021

2122
StringRef SystemZMCExpr::getVariantKindName() const {
2223
switch (getSpecifier()) {
23-
case VK_None:
24+
case SystemZ::S_None:
2425
return "A";
25-
case VK_SystemZ_RCon:
26+
case SystemZ::S_RCon:
2627
return "R";
27-
case VK_SystemZ_VCon:
28+
case SystemZ::S_VCon:
2829
return "V";
2930
default:
3031
llvm_unreachable("Invalid kind");

llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCExpr.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,6 @@ namespace llvm {
1818
class SystemZMCExpr : public MCSpecifierExpr {
1919
public:
2020
using Specifier = Spec;
21-
enum {
22-
VK_None,
23-
24-
VK_DTPOFF = MCSymbolRefExpr::FirstTargetSpecifier,
25-
VK_GOT,
26-
VK_GOTENT,
27-
VK_INDNTPOFF,
28-
VK_NTPOFF,
29-
VK_PLT,
30-
VK_TLSGD,
31-
VK_TLSLD,
32-
VK_TLSLDM,
33-
34-
// HLASM docs for address constants:
35-
// https://www.ibm.com/docs/en/hla-and-tf/1.6?topic=value-address-constants
36-
VK_SystemZ_RCon, // Address of ADA of symbol.
37-
VK_SystemZ_VCon, // Address of external function symbol.
38-
};
3921

4022
private:
4123
explicit SystemZMCExpr(const MCExpr *Expr, Spec S)

0 commit comments

Comments
 (0)