Skip to content

Commit 2f1c082

Browse files
committed
SystemZMCExpr: Migrate to MCSpecifierExpr
1 parent ce270b4 commit 2f1c082

File tree

3 files changed

+9
-29
lines changed

3 files changed

+9
-29
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ void SystemZInstPrinterCommon::printPCRelTLSOperand(const MCInst *MI,
185185
if ((unsigned)OpNum + 1 < MI->getNumOperands()) {
186186
const MCOperand &MO = MI->getOperand(OpNum + 1);
187187
const MCSymbolRefExpr &refExp = cast<MCSymbolRefExpr>(*MO.getExpr());
188-
switch (getSpecifier(&refExp)) {
188+
switch (refExp.getSpecifier()) {
189189
case SystemZMCExpr::VK_TLSGD:
190190
O << ":tls_gdcall:";
191191
break;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ using namespace llvm;
1212

1313
#define DEBUG_TYPE "systemzmcexpr"
1414

15-
const SystemZMCExpr *SystemZMCExpr::create(SystemZMCExpr::Specifier Kind,
15+
const SystemZMCExpr *SystemZMCExpr::create(MCSpecifierExpr::Spec S,
1616
const MCExpr *Expr, MCContext &Ctx) {
17-
return new (Ctx) SystemZMCExpr(Kind, Expr);
17+
return new (Ctx) SystemZMCExpr(Expr, S);
1818
}
1919

2020
StringRef SystemZMCExpr::getVariantKindName() const {

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

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515

1616
namespace llvm {
1717

18-
class SystemZMCExpr : public MCTargetExpr {
18+
class SystemZMCExpr : public MCSpecifierExpr {
1919
public:
20-
enum Specifier : uint8_t {
20+
using Specifier = Spec;
21+
enum {
2122
VK_None,
2223

2324
VK_DTPOFF = MCSymbolRefExpr::FirstTargetSpecifier,
@@ -37,40 +38,19 @@ class SystemZMCExpr : public MCTargetExpr {
3738
};
3839

3940
private:
40-
const Specifier specifier;
41-
const MCExpr *Expr;
42-
43-
explicit SystemZMCExpr(Specifier S, const MCExpr *Expr)
44-
: specifier(S), Expr(Expr) {}
41+
explicit SystemZMCExpr(const MCExpr *Expr, Spec S)
42+
: MCSpecifierExpr(Expr, S) {}
4543

4644
public:
47-
static const SystemZMCExpr *create(Specifier Kind, const MCExpr *Expr,
45+
static const SystemZMCExpr *create(Spec Kind, const MCExpr *Expr,
4846
MCContext &Ctx);
4947

50-
Specifier getSpecifier() const { return specifier; }
51-
const MCExpr *getSubExpr() const { return Expr; }
52-
5348
StringRef getVariantKindName() const;
5449

5550
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
5651
bool evaluateAsRelocatableImpl(MCValue &Res,
5752
const MCAssembler *Asm) const override;
58-
void visitUsedExpr(MCStreamer &Streamer) const override {
59-
Streamer.visitUsedExpr(*getSubExpr());
60-
}
61-
MCFragment *findAssociatedFragment() const override {
62-
return getSubExpr()->findAssociatedFragment();
63-
}
64-
65-
static bool classof(const MCExpr *E) {
66-
return E->getKind() == MCExpr::Target;
67-
}
6853
};
69-
70-
static inline SystemZMCExpr::Specifier
71-
getSpecifier(const MCSymbolRefExpr *SRE) {
72-
return SystemZMCExpr::Specifier(SRE->getKind());
73-
}
7454
} // end namespace llvm
7555

7656
#endif

0 commit comments

Comments
 (0)