Skip to content

Commit df46140

Browse files
committed
XtensaMCExpr: Migrate to MCSpecifierExpr
1 parent e997eb4 commit df46140

File tree

2 files changed

+4
-28
lines changed

2 files changed

+4
-28
lines changed

llvm/lib/Target/Xtensa/MCTargetDesc/XtensaMCExpr.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,6 @@ void XtensaMCExpr::printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const {
4040
OS << ')';
4141
}
4242

43-
bool XtensaMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
44-
const MCAssembler *Asm) const {
45-
if (!getSubExpr()->evaluateAsRelocatable(Res, Asm))
46-
return false;
47-
Res.setSpecifier(specifier);
48-
return !Res.getSubSym();
49-
}
50-
51-
void XtensaMCExpr::visitUsedExpr(MCStreamer &Streamer) const {
52-
Streamer.visitUsedExpr(*getSubExpr());
53-
}
54-
5543
XtensaMCExpr::Specifier XtensaMCExpr::parseSpecifier(StringRef name) {
5644
return StringSwitch<XtensaMCExpr::Specifier>(name).Default(VK_None);
5745
}

llvm/lib/Target/Xtensa/MCTargetDesc/XtensaMCExpr.h

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,20 @@
2020
namespace llvm {
2121

2222
class StringRef;
23-
class XtensaMCExpr : public MCTargetExpr {
23+
class XtensaMCExpr : public MCSpecifierExpr {
2424
public:
25-
enum Specifier { VK_None, VK_TPOFF };
25+
using Specifier = uint16_t;
26+
enum { VK_None, VK_TPOFF };
2627

2728
private:
28-
const MCExpr *Expr;
29-
const Specifier specifier;
30-
3129
explicit XtensaMCExpr(const MCExpr *Expr, Specifier S)
32-
: Expr(Expr), specifier(S) {}
30+
: MCSpecifierExpr(Expr, S) {}
3331

3432
public:
3533
static const XtensaMCExpr *create(const MCExpr *Expr, Specifier,
3634
MCContext &Ctx);
3735

38-
Specifier getSpecifier() const { return specifier; }
39-
40-
const MCExpr *getSubExpr() const { return Expr; }
41-
4236
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
43-
bool evaluateAsRelocatableImpl(MCValue &Res,
44-
const MCAssembler *Asm) const override;
45-
void visitUsedExpr(MCStreamer &Streamer) const override;
46-
MCFragment *findAssociatedFragment() const override {
47-
return getSubExpr()->findAssociatedFragment();
48-
}
4937

5038
static Specifier parseSpecifier(StringRef name);
5139
static StringRef getSpecifierName(Specifier Kind);

0 commit comments

Comments
 (0)