Skip to content

Commit beaa98b

Browse files
committed
AArch64MCExpr: Migrate to MCSpecifierExpr
1 parent 897ccdd commit beaa98b

File tree

2 files changed

+4
-50
lines changed

2 files changed

+4
-50
lines changed

llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,6 @@ void AArch64MCExpr::printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const {
9898
Expr->print(OS, MAI);
9999
}
100100

101-
void AArch64MCExpr::visitUsedExpr(MCStreamer &Streamer) const {
102-
Streamer.visitUsedExpr(*getSubExpr());
103-
}
104-
105-
MCFragment *AArch64MCExpr::findAssociatedFragment() const {
106-
llvm_unreachable("FIXME: what goes here?");
107-
}
108-
109101
bool AArch64MCExpr::evaluateAsRelocatableImpl(MCValue &Res,
110102
const MCAssembler *Asm) const {
111103
if (!getSubExpr()->evaluateAsRelocatable(Res, Asm))
@@ -136,11 +128,3 @@ void AArch64AuthMCExpr::printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const {
136128
OS << ",addr";
137129
OS << ')';
138130
}
139-
140-
void AArch64AuthMCExpr::visitUsedExpr(MCStreamer &Streamer) const {
141-
Streamer.visitUsedExpr(*getSubExpr());
142-
}
143-
144-
MCFragment *AArch64AuthMCExpr::findAssociatedFragment() const {
145-
llvm_unreachable("FIXME: what goes here?");
146-
}

llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.h

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121

2222
namespace llvm {
2323

24-
class AArch64MCExpr : public MCTargetExpr {
24+
class AArch64MCExpr : public MCSpecifierExpr {
2525
public:
26-
enum Specifier : uint16_t {
26+
using Specifier = uint16_t;
27+
enum {
2728
// clang-format off
2829
None = 0,
2930
// Symbol locations specifying (roughly speaking) what calculation should be
@@ -139,32 +140,13 @@ class AArch64MCExpr : public MCTargetExpr {
139140
// clang-format on
140141
};
141142

142-
private:
143-
const MCExpr *Expr;
144-
const Specifier specifier;
145-
146143
protected:
147144
explicit AArch64MCExpr(const MCExpr *Expr, Specifier S)
148-
: Expr(Expr), specifier(S) {}
145+
: MCSpecifierExpr(Expr, S) {}
149146

150147
public:
151-
/// @name Construction
152-
/// @{
153-
154148
static const AArch64MCExpr *create(const MCExpr *Expr, Specifier,
155149
MCContext &Ctx);
156-
157-
/// @}
158-
/// @name Accessors
159-
/// @{
160-
161-
/// Get the kind of this expression.
162-
Specifier getSpecifier() const { return specifier; }
163-
164-
/// Get the expression this modifier applies to.
165-
const MCExpr *getSubExpr() const { return Expr; }
166-
167-
/// @}
168150
/// @name VariantKind information extractors.
169151
/// @{
170152

@@ -185,16 +167,8 @@ class AArch64MCExpr : public MCTargetExpr {
185167
StringRef getSpecifierName() const;
186168

187169
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
188-
189-
void visitUsedExpr(MCStreamer &Streamer) const override;
190-
191-
MCFragment *findAssociatedFragment() const override;
192-
193170
bool evaluateAsRelocatableImpl(MCValue &Res,
194171
const MCAssembler *Asm) const override;
195-
static bool classof(const MCExpr *E) {
196-
return E->getKind() == MCExpr::Target;
197-
}
198172
};
199173

200174
class AArch64AuthMCExpr final : public AArch64MCExpr {
@@ -217,10 +191,6 @@ class AArch64AuthMCExpr final : public AArch64MCExpr {
217191

218192
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
219193

220-
void visitUsedExpr(MCStreamer &Streamer) const override;
221-
222-
MCFragment *findAssociatedFragment() const override;
223-
224194
static bool classof(const MCExpr *E) {
225195
return isa<AArch64MCExpr>(E) && classof(cast<AArch64MCExpr>(E));
226196
}

0 commit comments

Comments
 (0)