@@ -3851,11 +3851,11 @@ class ARMOperand : public MCParsedAsmOperand {
3851
3851
}
3852
3852
3853
3853
static std::unique_ptr<ARMOperand>
3854
- CreateVectorListIndexed (unsigned RegNum , unsigned Count, unsigned Index,
3854
+ CreateVectorListIndexed (MCRegister Reg , unsigned Count, unsigned Index,
3855
3855
bool isDoubleSpaced, SMLoc S, SMLoc E,
3856
3856
ARMAsmParser &Parser) {
3857
3857
auto Op = std::make_unique<ARMOperand>(k_VectorListIndexed, Parser);
3858
- Op->VectorList .RegNum = RegNum ;
3858
+ Op->VectorList .RegNum = Reg ;
3859
3859
Op->VectorList .Count = Count;
3860
3860
Op->VectorList .LaneIndex = Index;
3861
3861
Op->VectorList .isDoubleSpaced = isDoubleSpaced;
@@ -4568,13 +4568,13 @@ ParseStatus ARMAsmParser::parseCoprocOptionOperand(OperandVector &Operands) {
4568
4568
// For register list parsing, we need to map from raw GPR register numbering
4569
4569
// to the enumeration values. The enumeration values aren't sorted by
4570
4570
// register number due to our using "sp", "lr" and "pc" as canonical names.
4571
- static unsigned getNextRegister (unsigned Reg) {
4571
+ static MCRegister getNextRegister (MCRegister Reg) {
4572
4572
// If this is a GPR, we need to do it manually, otherwise we can rely
4573
4573
// on the sort ordering of the enumeration since the other reg-classes
4574
4574
// are sane.
4575
4575
if (!ARMMCRegisterClasses[ARM::GPRRegClassID].contains (Reg))
4576
4576
return Reg + 1 ;
4577
- switch (Reg) {
4577
+ switch (Reg. id () ) {
4578
4578
default : llvm_unreachable (" Invalid GPR number!" );
4579
4579
case ARM::R0: return ARM::R1; case ARM::R1: return ARM::R2;
4580
4580
case ARM::R2: return ARM::R3; case ARM::R3: return ARM::R4;
@@ -6982,9 +6982,9 @@ bool ARMAsmParser::CDEConvertDualRegOperand(StringRef Mnemonic,
6982
6982
if (!Op2.isReg ())
6983
6983
return Error (Op2.getStartLoc (), Op2Diag);
6984
6984
6985
- unsigned RNext;
6986
- unsigned RPair;
6987
- switch (Op2.getReg ()) {
6985
+ MCRegister RNext;
6986
+ MCRegister RPair;
6987
+ switch (Op2.getReg (). id () ) {
6988
6988
default :
6989
6989
return Error (Op2.getStartLoc (), Op2Diag);
6990
6990
case ARM::R0:
@@ -7459,7 +7459,7 @@ bool ARMAsmParser::parseInstruction(ParseInstructionInfo &Info, StringRef Name,
7459
7459
// 'false' otherwise. If Reg is in the register list or is HiReg, set
7460
7460
// 'containsReg' to true.
7461
7461
static bool checkLowRegisterList (const MCInst &Inst, unsigned OpNo,
7462
- unsigned Reg, unsigned HiReg,
7462
+ MCRegister Reg, MCRegister HiReg,
7463
7463
bool &containsReg) {
7464
7464
containsReg = false ;
7465
7465
for (unsigned i = OpNo; i < Inst.getNumOperands (); ++i) {
@@ -7475,9 +7475,9 @@ static bool checkLowRegisterList(const MCInst &Inst, unsigned OpNo,
7475
7475
7476
7476
// Check if the specified regisgter is in the register list of the inst,
7477
7477
// starting at the indicated operand number.
7478
- static bool listContainsReg (const MCInst &Inst, unsigned OpNo, unsigned Reg) {
7478
+ static bool listContainsReg (const MCInst &Inst, unsigned OpNo, MCRegister Reg) {
7479
7479
for (unsigned i = OpNo, e = Inst.getNumOperands (); i < e; ++i) {
7480
- unsigned OpReg = Inst.getOperand (i).getReg ();
7480
+ MCRegister OpReg = Inst.getOperand (i).getReg ();
7481
7481
if (OpReg == Reg)
7482
7482
return true ;
7483
7483
}
@@ -8061,7 +8061,8 @@ bool ARMAsmParser::validateInstruction(MCInst &Inst,
8061
8061
.getToken () == " !" );
8062
8062
8063
8063
bool ListContainsBase;
8064
- if (checkLowRegisterList (Inst, 3 , Rn, 0 , ListContainsBase) && !isThumbTwo ())
8064
+ if (checkLowRegisterList (Inst, 3 , Rn, MCRegister (), ListContainsBase) &&
8065
+ !isThumbTwo ())
8065
8066
return Error (
8066
8067
Operands[getRegListInd (Operands, MnemonicOpsEndInd)]->getStartLoc (),
8067
8068
" registers must be in range r0-r7" );
@@ -8140,7 +8141,8 @@ bool ARMAsmParser::validateInstruction(MCInst &Inst,
8140
8141
// switched to the t2 encodings in processInstruction() if necessary.
8141
8142
case ARM::tPOP: {
8142
8143
bool ListContainsBase;
8143
- if (checkLowRegisterList (Inst, 2 , 0 , ARM::PC, ListContainsBase) &&
8144
+ if (checkLowRegisterList (Inst, 2 , MCRegister (), ARM::PC,
8145
+ ListContainsBase) &&
8144
8146
!isThumbTwo ())
8145
8147
return Error (Operands[MnemonicOpsEndInd]->getStartLoc (),
8146
8148
" registers must be in range r0-r7 or pc" );
@@ -8150,7 +8152,8 @@ bool ARMAsmParser::validateInstruction(MCInst &Inst,
8150
8152
}
8151
8153
case ARM::tPUSH: {
8152
8154
bool ListContainsBase;
8153
- if (checkLowRegisterList (Inst, 2 , 0 , ARM::LR, ListContainsBase) &&
8155
+ if (checkLowRegisterList (Inst, 2 , MCRegister (), ARM::LR,
8156
+ ListContainsBase) &&
8154
8157
!isThumbTwo ())
8155
8158
return Error (Operands[MnemonicOpsEndInd]->getStartLoc (),
8156
8159
" registers must be in range r0-r7 or lr" );
@@ -10785,14 +10788,14 @@ bool ARMAsmParser::processInstruction(MCInst &Inst,
10785
10788
// doesn't match what tLDMIA can do, we need to use the 32-bit encoding
10786
10789
// instead if we're in Thumb2. Otherwise, this should have generated
10787
10790
// an error in validateInstruction().
10788
- unsigned Rn = Inst.getOperand (0 ).getReg ();
10791
+ MCRegister Rn = Inst.getOperand (0 ).getReg ();
10789
10792
bool hasWritebackToken =
10790
10793
(static_cast <ARMOperand &>(*Operands[MnemonicOpsEndInd + 1 ])
10791
10794
.isToken () &&
10792
10795
static_cast <ARMOperand &>(*Operands[MnemonicOpsEndInd + 1 ])
10793
10796
.getToken () == " !" );
10794
10797
bool listContainsBase;
10795
- if (checkLowRegisterList (Inst, 3 , Rn, 0 , listContainsBase) ||
10798
+ if (checkLowRegisterList (Inst, 3 , Rn, MCRegister () , listContainsBase) ||
10796
10799
(!listContainsBase && !hasWritebackToken) ||
10797
10800
(listContainsBase && hasWritebackToken)) {
10798
10801
// 16-bit encoding isn't sufficient. Switch to the 32-bit version.
@@ -10811,9 +10814,9 @@ bool ARMAsmParser::processInstruction(MCInst &Inst,
10811
10814
// If the register list contains any high registers, we need to use
10812
10815
// the 32-bit encoding instead if we're in Thumb2. Otherwise, this
10813
10816
// should have generated an error in validateInstruction().
10814
- unsigned Rn = Inst.getOperand (0 ).getReg ();
10817
+ MCRegister Rn = Inst.getOperand (0 ).getReg ();
10815
10818
bool listContainsBase;
10816
- if (checkLowRegisterList (Inst, 4 , Rn, 0 , listContainsBase)) {
10819
+ if (checkLowRegisterList (Inst, 4 , Rn, MCRegister () , listContainsBase)) {
10817
10820
// 16-bit encoding isn't sufficient. Switch to the 32-bit version.
10818
10821
assert (isThumbTwo ());
10819
10822
Inst.setOpcode (ARM::t2STMIA_UPD);
@@ -10826,7 +10829,7 @@ bool ARMAsmParser::processInstruction(MCInst &Inst,
10826
10829
// If the register list contains any high registers, we need to use
10827
10830
// the 32-bit encoding instead if we're in Thumb2. Otherwise, this
10828
10831
// should have generated an error in validateInstruction().
10829
- if (!checkLowRegisterList (Inst, 2 , 0 , ARM::PC, listContainsBase))
10832
+ if (!checkLowRegisterList (Inst, 2 , MCRegister () , ARM::PC, listContainsBase))
10830
10833
return false ;
10831
10834
assert (isThumbTwo ());
10832
10835
Inst.setOpcode (ARM::t2LDMIA_UPD);
@@ -10837,7 +10840,7 @@ bool ARMAsmParser::processInstruction(MCInst &Inst,
10837
10840
}
10838
10841
case ARM::tPUSH: {
10839
10842
bool listContainsBase;
10840
- if (!checkLowRegisterList (Inst, 2 , 0 , ARM::LR, listContainsBase))
10843
+ if (!checkLowRegisterList (Inst, 2 , MCRegister () , ARM::LR, listContainsBase))
10841
10844
return false ;
10842
10845
assert (isThumbTwo ());
10843
10846
Inst.setOpcode (ARM::t2STMDB_UPD);
@@ -11224,7 +11227,7 @@ unsigned ARMAsmParser::checkTargetMatchPredicate(MCInst &Inst) {
11224
11227
continue ;
11225
11228
}
11226
11229
11227
- unsigned Reg = Op.getReg ();
11230
+ MCRegister Reg = Op.getReg ();
11228
11231
if ((Reg == ARM::SP) && !hasV8Ops ())
11229
11232
return Match_RequiresV8;
11230
11233
else if (Reg == ARM::PC)
0 commit comments