|
13 | 13 |
|
14 | 14 | namespace llvm { |
15 | 15 |
|
16 | | -class ARMMCExpr : public MCTargetExpr { |
| 16 | +class ARMMCExpr : public MCSpecifierExpr { |
17 | 17 | public: |
18 | | - enum Specifier { |
| 18 | + using Specifier = uint16_t; |
| 19 | + enum { |
19 | 20 | VK_None, |
20 | 21 | VK_HI16 = |
21 | 22 | MCSymbolRefExpr::FirstTargetSpecifier, // The R_ARM_MOVT_ABS relocation |
@@ -57,16 +58,10 @@ class ARMMCExpr : public MCTargetExpr { |
57 | 58 | }; |
58 | 59 |
|
59 | 60 | private: |
60 | | - const Specifier specifier; |
61 | | - const MCExpr *Expr; |
62 | | - |
63 | 61 | explicit ARMMCExpr(Specifier S, const MCExpr *Expr) |
64 | | - : specifier(S), Expr(Expr) {} |
| 62 | + : MCSpecifierExpr(Expr, S) {} |
65 | 63 |
|
66 | 64 | public: |
67 | | - /// @name Construction |
68 | | - /// @{ |
69 | | - |
70 | 65 | static const ARMMCExpr *create(Specifier S, const MCExpr *Expr, |
71 | 66 | MCContext &Ctx); |
72 | 67 |
|
@@ -94,33 +89,12 @@ class ARMMCExpr : public MCTargetExpr { |
94 | 89 | return create(VK_LO_0_7, Expr, Ctx); |
95 | 90 | } |
96 | 91 |
|
97 | | - /// @} |
98 | | - /// @name Accessors |
99 | | - /// @{ |
100 | | - |
101 | | - Specifier getSpecifier() const { return specifier; } |
102 | | - const MCExpr *getSubExpr() const { return Expr; } |
103 | | - |
104 | | - /// @} |
105 | | - |
106 | 92 | void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override; |
107 | 93 | bool evaluateAsRelocatableImpl(MCValue &Res, |
108 | 94 | const MCAssembler *Asm) const override { |
109 | 95 | return false; |
110 | 96 | } |
111 | | - void visitUsedExpr(MCStreamer &Streamer) const override; |
112 | | - MCFragment *findAssociatedFragment() const override { |
113 | | - return getSubExpr()->findAssociatedFragment(); |
114 | | - } |
115 | | - |
116 | | - static bool classof(const MCExpr *E) { |
117 | | - return E->getKind() == MCExpr::Target; |
118 | | - } |
119 | 97 | }; |
120 | | - |
121 | | -static inline ARMMCExpr::Specifier getSpecifier(const MCSymbolRefExpr *SRE) { |
122 | | - return ARMMCExpr::Specifier(SRE->getKind()); |
123 | | -} |
124 | 98 | } // end namespace llvm |
125 | 99 |
|
126 | 100 | #endif |
0 commit comments