16
16
namespace llvm {
17
17
18
18
// / A expression in AVR machine code.
19
- class AVRMCExpr : public MCTargetExpr {
19
+ class AVRMCExpr : public MCSpecifierExpr {
20
20
public:
21
+ using Specifier = Spec;
21
22
// / Specifies the type of an expression.
22
- enum Specifier {
23
+ enum {
23
24
VK_None,
24
25
25
26
VK_AVR_NONE = MCSymbolRefExpr::FirstTargetSpecifier,
@@ -48,11 +49,8 @@ class AVRMCExpr : public MCTargetExpr {
48
49
static const AVRMCExpr *create (Specifier S, const MCExpr *Expr,
49
50
bool isNegated, MCContext &Ctx);
50
51
51
- // / Gets the type of the expression.
52
- Specifier getSpecifier () const { return specifier; }
53
52
// / Gets the name of the expression.
54
53
const char *getName () const ;
55
- const MCExpr *getSubExpr () const { return SubExpr; }
56
54
// / Gets the fixup which corresponds to the expression.
57
55
AVR::Fixups getFixupKind () const ;
58
56
// / Evaluates the fixup as a constant value.
@@ -64,30 +62,18 @@ class AVRMCExpr : public MCTargetExpr {
64
62
void printImpl (raw_ostream &OS, const MCAsmInfo *MAI) const override ;
65
63
bool evaluateAsRelocatableImpl (MCValue &Res,
66
64
const MCAssembler *Asm) const override ;
67
- void visitUsedExpr (MCStreamer &streamer) const override ;
68
-
69
- MCFragment *findAssociatedFragment () const override {
70
- return getSubExpr ()->findAssociatedFragment ();
71
- }
72
-
73
- static bool classof (const MCExpr *E) {
74
- return E->getKind () == MCExpr::Target;
75
- }
76
65
77
66
public:
78
67
static Specifier parseSpecifier (StringRef Name);
79
68
80
69
private:
81
70
int64_t evaluateAsInt64 (int64_t Value) const ;
82
71
83
- const Specifier specifier;
84
- const MCExpr *SubExpr;
85
72
bool Negated;
86
73
87
74
private:
88
75
explicit AVRMCExpr (Specifier S, const MCExpr *Expr, bool Negated)
89
- : specifier(S), SubExpr(Expr), Negated(Negated) {}
90
- ~AVRMCExpr () = default ;
76
+ : MCSpecifierExpr(Expr, S), Negated(Negated) {}
91
77
};
92
78
93
79
} // end namespace llvm
0 commit comments