Skip to content

Commit 0b49f2f

Browse files
committed
MCSpecifierExpr: Use SubclassData to encode the relocation specifier
1 parent 58e38b8 commit 0b49f2f

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

llvm/include/llvm/MC/MCExpr.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -495,19 +495,17 @@ class LLVM_ABI MCTargetExpr : public MCExpr {
495495
class LLVM_ABI MCSpecifierExpr : public MCExpr {
496496
protected:
497497
const MCExpr *Expr;
498-
// Target-specific relocation specifier code
499-
const Spec specifier;
500498

501499
explicit MCSpecifierExpr(const MCExpr *Expr, Spec S, SMLoc Loc = SMLoc())
502-
: MCExpr(Specifier, Loc), Expr(Expr), specifier(S) {}
500+
: MCExpr(Specifier, Loc, S), Expr(Expr) {}
503501

504502
public:
505503
static const MCSpecifierExpr *create(const MCExpr *Expr, Spec S,
506504
MCContext &Ctx, SMLoc Loc = SMLoc());
507505
static const MCSpecifierExpr *create(const MCSymbol *Sym, Spec S,
508506
MCContext &Ctx, SMLoc Loc = SMLoc());
509507

510-
Spec getSpecifier() const { return specifier; }
508+
Spec getSpecifier() const { return getSubclassData(); }
511509
const MCExpr *getSubExpr() const { return Expr; }
512510

513511
static bool classof(const MCExpr *E) {

llvm/lib/Target/AVR/MCTargetDesc/AVRMCAsmInfo.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ AVRMCExpr::Specifier AVRMCExpr::parseSpecifier(StringRef Name) {
6363
const char *AVRMCExpr::getName() const {
6464
const auto &Modifier =
6565
llvm::find_if(ModifierNames, [this](ModifierEntry const &Mod) {
66-
return Mod.specifier == specifier;
66+
return Mod.specifier == getSpecifier();
6767
});
6868

6969
if (Modifier != std::end(ModifierNames)) {
@@ -75,7 +75,7 @@ const char *AVRMCExpr::getName() const {
7575
AVR::Fixups AVRMCExpr::getFixupKind() const {
7676
AVR::Fixups Kind = AVR::Fixups::LastTargetFixupKind;
7777

78-
switch (specifier) {
78+
switch (getSpecifier()) {
7979
case AVR::S_LO8:
8080
Kind = isNegated() ? AVR::fixup_lo8_ldi_neg : AVR::fixup_lo8_ldi;
8181
break;
@@ -133,7 +133,7 @@ int64_t AVRMCExpr::evaluateAsInt64(int64_t Value) const {
133133
if (Negated)
134134
Value *= -1;
135135

136-
switch (specifier) {
136+
switch (getSpecifier()) {
137137
case AVR::S_LO8:
138138
Value &= 0xff;
139139
break;

0 commit comments

Comments
 (0)