@@ -124,7 +124,7 @@ class HexagonAsmParser : public MCTargetAsmParser {
124
124
125
125
bool parseDirectiveAttribute (SMLoc L);
126
126
127
- bool RegisterMatchesArch (unsigned MatchNum) const ;
127
+ bool RegisterMatchesArch (MCRegister MatchNum) const ;
128
128
129
129
bool matchBundleOptions ();
130
130
bool handleNoncontigiousRegister (bool Contigious, SMLoc &Loc);
@@ -145,10 +145,10 @@ class HexagonAsmParser : public MCTargetAsmParser {
145
145
int processInstruction (MCInst &Inst, OperandVector const &Operands,
146
146
SMLoc IDLoc);
147
147
148
- unsigned matchRegister (StringRef Name);
148
+ MCRegister matchRegister (StringRef Name);
149
149
150
- // / @name Auto-generated Match Functions
151
- // / {
150
+ // / @name Auto-generated Match Functions
151
+ // / {
152
152
153
153
#define GET_ASSEMBLER_HEADER
154
154
#include " HexagonGenAsmMatcher.inc"
@@ -205,7 +205,7 @@ struct HexagonOperand : public MCParsedAsmOperand {
205
205
};
206
206
207
207
struct RegTy {
208
- unsigned RegNum;
208
+ MCRegister RegNum;
209
209
};
210
210
211
211
struct ImmTy {
@@ -434,9 +434,9 @@ struct HexagonOperand : public MCParsedAsmOperand {
434
434
}
435
435
436
436
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) {
438
438
HexagonOperand *Op = new HexagonOperand (Register, Context);
439
- Op->Reg .RegNum = RegNum ;
439
+ Op->Reg .RegNum = Reg ;
440
440
Op->StartLoc = S;
441
441
Op->EndLoc = E;
442
442
return std::unique_ptr<HexagonOperand>(Op);
@@ -867,7 +867,7 @@ bool HexagonAsmParser::ParseDirectiveComm(bool IsLocal, SMLoc Loc) {
867
867
}
868
868
869
869
// validate register against architecture
870
- bool HexagonAsmParser::RegisterMatchesArch (unsigned MatchNum) const {
870
+ bool HexagonAsmParser::RegisterMatchesArch (MCRegister MatchNum) const {
871
871
if (HexagonMCRegisterClasses[Hexagon::V62RegsRegClassID].contains (MatchNum))
872
872
if (!getSTI ().hasFeature (Hexagon::ArchV62))
873
873
return false ;
@@ -929,7 +929,7 @@ bool HexagonAsmParser::parseOperand(OperandVector &Operands) {
929
929
MCAsmLexer &Lexer = getLexer ();
930
930
if (!parseRegister (Register, Begin, End)) {
931
931
if (!ErrorMissingParenthesis)
932
- switch (Register) {
932
+ switch (Register. id () ) {
933
933
default :
934
934
break ;
935
935
case Hexagon::P0:
@@ -1054,8 +1054,8 @@ ParseStatus HexagonAsmParser::tryParseRegister(MCRegister &Reg, SMLoc &StartLoc,
1054
1054
llvm::erase_if (Collapsed, isSpace);
1055
1055
StringRef FullString = Collapsed;
1056
1056
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)) {
1059
1059
if (DotSplit.second .empty ()) {
1060
1060
Reg = DotReg;
1061
1061
EndLoc = Lexer.getLoc ();
@@ -1074,8 +1074,8 @@ ParseStatus HexagonAsmParser::tryParseRegister(MCRegister &Reg, SMLoc &StartLoc,
1074
1074
}
1075
1075
}
1076
1076
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)) {
1079
1079
do {
1080
1080
Lexer.UnLex (Lookahead.pop_back_val ());
1081
1081
} while (!Lookahead.empty () && !Lexer.is (AsmToken::Colon));
@@ -1358,13 +1358,13 @@ int HexagonAsmParser::processInstruction(MCInst &Inst,
1358
1358
1359
1359
return std::make_pair (matchRegister (R1), matchRegister (R2));
1360
1360
};
1361
- auto GetScalarRegs = [RI, GetRegPair](unsigned RegPair) {
1361
+ auto GetScalarRegs = [RI, GetRegPair](MCRegister RegPair) {
1362
1362
const unsigned Lower = RI->getEncodingValue (RegPair);
1363
1363
const RegPairVals RegPair_ = std::make_pair (Lower + 1 , Lower);
1364
1364
1365
1365
return GetRegPair (RegPair_);
1366
1366
};
1367
- auto GetVecRegs = [GetRegPair](unsigned VecRegPair) {
1367
+ auto GetVecRegs = [GetRegPair](MCRegister VecRegPair) {
1368
1368
const RegPairVals RegPair =
1369
1369
HexagonMCInstrInfo::GetVecRegPairIndices (VecRegPair);
1370
1370
@@ -1461,7 +1461,8 @@ int HexagonAsmParser::processInstruction(MCInst &Inst,
1461
1461
// Translate a "$Rdd = $Rss" to "$Rdd = combine($Rs, $Rt)"
1462
1462
case Hexagon::A2_tfrp: {
1463
1463
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 ());
1465
1466
MO.setReg (RegPair.first );
1466
1467
Inst.addOperand (MCOperand::createReg (RegPair.second ));
1467
1468
Inst.setOpcode (Hexagon::A2_combinew);
@@ -1471,7 +1472,8 @@ int HexagonAsmParser::processInstruction(MCInst &Inst,
1471
1472
case Hexagon::A2_tfrpt:
1472
1473
case Hexagon::A2_tfrpf: {
1473
1474
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 ());
1475
1477
MO.setReg (RegPair.first );
1476
1478
Inst.addOperand (MCOperand::createReg (RegPair.second ));
1477
1479
Inst.setOpcode ((Inst.getOpcode () == Hexagon::A2_tfrpt)
@@ -1482,7 +1484,8 @@ int HexagonAsmParser::processInstruction(MCInst &Inst,
1482
1484
case Hexagon::A2_tfrptnew:
1483
1485
case Hexagon::A2_tfrpfnew: {
1484
1486
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 ());
1486
1489
MO.setReg (RegPair.first );
1487
1490
Inst.addOperand (MCOperand::createReg (RegPair.second ));
1488
1491
Inst.setOpcode ((Inst.getOpcode () == Hexagon::A2_tfrptnew)
@@ -1494,7 +1497,7 @@ int HexagonAsmParser::processInstruction(MCInst &Inst,
1494
1497
// Translate a "$Vdd = $Vss" to "$Vdd = vcombine($Vs, $Vt)"
1495
1498
case Hexagon::V6_vassignp: {
1496
1499
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 ());
1498
1501
MO.setReg (RegPair.first );
1499
1502
Inst.addOperand (MCOperand::createReg (RegPair.second ));
1500
1503
Inst.setOpcode (Hexagon::V6_vcombine);
@@ -2051,8 +2054,8 @@ int HexagonAsmParser::processInstruction(MCInst &Inst,
2051
2054
return Match_Success;
2052
2055
}
2053
2056
2054
- unsigned HexagonAsmParser::matchRegister (StringRef Name) {
2055
- if (unsigned Reg = MatchRegisterName (Name))
2057
+ MCRegister HexagonAsmParser::matchRegister (StringRef Name) {
2058
+ if (MCRegister Reg = MatchRegisterName (Name))
2056
2059
return Reg;
2057
2060
return MatchRegisterAltName (Name);
2058
2061
}
0 commit comments