Skip to content

Commit 1321739

Browse files
authored
AVR: Do not add target specific STI member to AVRAsmParser (#156442)
The base class has a pointer STI member already; the target subclass had a reference with the same name. Just use the base class field.
1 parent 8a820f1 commit 1321739

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

llvm/lib/Target/AVR/AsmParser/AVRAsmParser.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ using namespace llvm;
3838
namespace {
3939
/// Parses AVR assembly from a stream.
4040
class AVRAsmParser : public MCTargetAsmParser {
41-
const MCSubtargetInfo &STI;
4241
MCAsmParser &Parser;
4342
const MCRegisterInfo *MRI;
4443
const std::string GENERATE_STUBS = "gs";
@@ -93,7 +92,7 @@ class AVRAsmParser : public MCTargetAsmParser {
9392
public:
9493
AVRAsmParser(const MCSubtargetInfo &STI, MCAsmParser &Parser,
9594
const MCInstrInfo &MII, const MCTargetOptions &Options)
96-
: MCTargetAsmParser(Options, STI, MII), STI(STI), Parser(Parser) {
95+
: MCTargetAsmParser(Options, STI, MII), Parser(Parser) {
9796
MCAsmParserExtension::Initialize(Parser);
9897
MRI = getContext().getRegisterInfo();
9998

@@ -318,7 +317,7 @@ bool AVRAsmParser::missingFeature(llvm::SMLoc const &Loc,
318317

319318
bool AVRAsmParser::emit(MCInst &Inst, SMLoc const &Loc, MCStreamer &Out) const {
320319
Inst.setLoc(Loc);
321-
Out.emitInstruction(Inst, STI);
320+
Out.emitInstruction(Inst, *STI);
322321

323322
return false;
324323
}
@@ -411,7 +410,7 @@ bool AVRAsmParser::tryParseRegisterOperand(OperandVector &Operands) {
411410

412411
// Reject R0~R15 on avrtiny.
413412
if (AVR::R0 <= Reg && Reg <= AVR::R15 &&
414-
STI.hasFeature(AVR::FeatureTinyEncoding))
413+
STI->hasFeature(AVR::FeatureTinyEncoding))
415414
return Error(Parser.getTok().getLoc(), "invalid register on avrtiny");
416415

417416
AsmToken const &T = Parser.getTok();
@@ -758,7 +757,7 @@ unsigned AVRAsmParser::validateTargetOperandClass(MCParsedAsmOperand &AsmOp,
758757

759758
// Reject R0~R15 on avrtiny.
760759
if (0 <= RegNum && RegNum <= 15 &&
761-
STI.hasFeature(AVR::FeatureTinyEncoding))
760+
STI->hasFeature(AVR::FeatureTinyEncoding))
762761
return Match_InvalidRegisterOnTiny;
763762

764763
std::ostringstream RegName;

0 commit comments

Comments
 (0)