@@ -124,7 +124,7 @@ class HexagonAsmParser : public MCTargetAsmParser {
124124
125125 bool parseDirectiveAttribute (SMLoc L);
126126
127- bool RegisterMatchesArch (unsigned MatchNum) const ;
127+ bool RegisterMatchesArch (MCRegister MatchNum) const ;
128128
129129 bool matchBundleOptions ();
130130 bool handleNoncontigiousRegister (bool Contigious, SMLoc &Loc);
@@ -145,10 +145,10 @@ class HexagonAsmParser : public MCTargetAsmParser {
145145 int processInstruction (MCInst &Inst, OperandVector const &Operands,
146146 SMLoc IDLoc);
147147
148- unsigned matchRegister (StringRef Name);
148+ MCRegister matchRegister (StringRef Name);
149149
150- // / @name Auto-generated Match Functions
151- // / {
150+ // / @name Auto-generated Match Functions
151+ // / {
152152
153153#define GET_ASSEMBLER_HEADER
154154#include " HexagonGenAsmMatcher.inc"
@@ -205,7 +205,7 @@ struct HexagonOperand : public MCParsedAsmOperand {
205205 };
206206
207207 struct RegTy {
208- unsigned RegNum;
208+ MCRegister RegNum;
209209 };
210210
211211 struct ImmTy {
@@ -434,9 +434,9 @@ struct HexagonOperand : public MCParsedAsmOperand {
434434 }
435435
436436 static std::unique_ptr<HexagonOperand>
437- CreateReg (MCContext &Context, unsigned RegNum , SMLoc S, SMLoc E) {
437+ CreateReg (MCContext &Context, MCRegister Reg , SMLoc S, SMLoc E) {
438438 HexagonOperand *Op = new HexagonOperand (Register, Context);
439- Op->Reg .RegNum = RegNum ;
439+ Op->Reg .RegNum = Reg ;
440440 Op->StartLoc = S;
441441 Op->EndLoc = E;
442442 return std::unique_ptr<HexagonOperand>(Op);
@@ -867,7 +867,7 @@ bool HexagonAsmParser::ParseDirectiveComm(bool IsLocal, SMLoc Loc) {
867867}
868868
869869// validate register against architecture
870- bool HexagonAsmParser::RegisterMatchesArch (unsigned MatchNum) const {
870+ bool HexagonAsmParser::RegisterMatchesArch (MCRegister MatchNum) const {
871871 if (HexagonMCRegisterClasses[Hexagon::V62RegsRegClassID].contains (MatchNum))
872872 if (!getSTI ().hasFeature (Hexagon::ArchV62))
873873 return false ;
@@ -929,7 +929,7 @@ bool HexagonAsmParser::parseOperand(OperandVector &Operands) {
929929 MCAsmLexer &Lexer = getLexer ();
930930 if (!parseRegister (Register, Begin, End)) {
931931 if (!ErrorMissingParenthesis)
932- switch (Register) {
932+ switch (Register. id () ) {
933933 default :
934934 break ;
935935 case Hexagon::P0:
@@ -1054,8 +1054,8 @@ ParseStatus HexagonAsmParser::tryParseRegister(MCRegister &Reg, SMLoc &StartLoc,
10541054 llvm::erase_if (Collapsed, isSpace);
10551055 StringRef FullString = Collapsed;
10561056 std::pair<StringRef, StringRef> DotSplit = FullString.split (' .' );
1057- unsigned DotReg = matchRegister (DotSplit.first .lower ());
1058- if (DotReg != Hexagon::NoRegister && RegisterMatchesArch (DotReg)) {
1057+ MCRegister DotReg = matchRegister (DotSplit.first .lower ());
1058+ if (DotReg && RegisterMatchesArch (DotReg)) {
10591059 if (DotSplit.second .empty ()) {
10601060 Reg = DotReg;
10611061 EndLoc = Lexer.getLoc ();
@@ -1074,8 +1074,8 @@ ParseStatus HexagonAsmParser::tryParseRegister(MCRegister &Reg, SMLoc &StartLoc,
10741074 }
10751075 }
10761076 std::pair<StringRef, StringRef> ColonSplit = StringRef (FullString).split (' :' );
1077- unsigned ColonReg = matchRegister (ColonSplit.first .lower ());
1078- if (ColonReg != Hexagon::NoRegister && RegisterMatchesArch (DotReg)) {
1077+ MCRegister ColonReg = matchRegister (ColonSplit.first .lower ());
1078+ if (ColonReg && RegisterMatchesArch (DotReg)) {
10791079 do {
10801080 Lexer.UnLex (Lookahead.pop_back_val ());
10811081 } while (!Lookahead.empty () && !Lexer.is (AsmToken::Colon));
@@ -1358,13 +1358,13 @@ int HexagonAsmParser::processInstruction(MCInst &Inst,
13581358
13591359 return std::make_pair (matchRegister (R1), matchRegister (R2));
13601360 };
1361- auto GetScalarRegs = [RI, GetRegPair](unsigned RegPair) {
1361+ auto GetScalarRegs = [RI, GetRegPair](MCRegister RegPair) {
13621362 const unsigned Lower = RI->getEncodingValue (RegPair);
13631363 const RegPairVals RegPair_ = std::make_pair (Lower + 1 , Lower);
13641364
13651365 return GetRegPair (RegPair_);
13661366 };
1367- auto GetVecRegs = [GetRegPair](unsigned VecRegPair) {
1367+ auto GetVecRegs = [GetRegPair](MCRegister VecRegPair) {
13681368 const RegPairVals RegPair =
13691369 HexagonMCInstrInfo::GetVecRegPairIndices (VecRegPair);
13701370
@@ -1461,7 +1461,8 @@ int HexagonAsmParser::processInstruction(MCInst &Inst,
14611461 // Translate a "$Rdd = $Rss" to "$Rdd = combine($Rs, $Rt)"
14621462 case Hexagon::A2_tfrp: {
14631463 MCOperand &MO = Inst.getOperand (1 );
1464- const std::pair<unsigned , unsigned > RegPair = GetScalarRegs (MO.getReg ());
1464+ const std::pair<MCRegister, MCRegister> RegPair =
1465+ GetScalarRegs (MO.getReg ());
14651466 MO.setReg (RegPair.first );
14661467 Inst.addOperand (MCOperand::createReg (RegPair.second ));
14671468 Inst.setOpcode (Hexagon::A2_combinew);
@@ -1471,7 +1472,8 @@ int HexagonAsmParser::processInstruction(MCInst &Inst,
14711472 case Hexagon::A2_tfrpt:
14721473 case Hexagon::A2_tfrpf: {
14731474 MCOperand &MO = Inst.getOperand (2 );
1474- const std::pair<unsigned , unsigned > RegPair = GetScalarRegs (MO.getReg ());
1475+ const std::pair<MCRegister, MCRegister> RegPair =
1476+ GetScalarRegs (MO.getReg ());
14751477 MO.setReg (RegPair.first );
14761478 Inst.addOperand (MCOperand::createReg (RegPair.second ));
14771479 Inst.setOpcode ((Inst.getOpcode () == Hexagon::A2_tfrpt)
@@ -1482,7 +1484,8 @@ int HexagonAsmParser::processInstruction(MCInst &Inst,
14821484 case Hexagon::A2_tfrptnew:
14831485 case Hexagon::A2_tfrpfnew: {
14841486 MCOperand &MO = Inst.getOperand (2 );
1485- const std::pair<unsigned , unsigned > RegPair = GetScalarRegs (MO.getReg ());
1487+ const std::pair<MCRegister, MCRegister> RegPair =
1488+ GetScalarRegs (MO.getReg ());
14861489 MO.setReg (RegPair.first );
14871490 Inst.addOperand (MCOperand::createReg (RegPair.second ));
14881491 Inst.setOpcode ((Inst.getOpcode () == Hexagon::A2_tfrptnew)
@@ -1494,7 +1497,7 @@ int HexagonAsmParser::processInstruction(MCInst &Inst,
14941497 // Translate a "$Vdd = $Vss" to "$Vdd = vcombine($Vs, $Vt)"
14951498 case Hexagon::V6_vassignp: {
14961499 MCOperand &MO = Inst.getOperand (1 );
1497- const std::pair<unsigned , unsigned > RegPair = GetVecRegs (MO.getReg ());
1500+ const std::pair<MCRegister, MCRegister > RegPair = GetVecRegs (MO.getReg ());
14981501 MO.setReg (RegPair.first );
14991502 Inst.addOperand (MCOperand::createReg (RegPair.second ));
15001503 Inst.setOpcode (Hexagon::V6_vcombine);
@@ -2051,8 +2054,8 @@ int HexagonAsmParser::processInstruction(MCInst &Inst,
20512054 return Match_Success;
20522055}
20532056
2054- unsigned HexagonAsmParser::matchRegister (StringRef Name) {
2055- if (unsigned Reg = MatchRegisterName (Name))
2057+ MCRegister HexagonAsmParser::matchRegister (StringRef Name) {
2058+ if (MCRegister Reg = MatchRegisterName (Name))
20562059 return Reg;
20572060 return MatchRegisterAltName (Name);
20582061}
0 commit comments