@@ -101,12 +101,12 @@ class MSP430Operand : public MCParsedAsmOperand {
101
101
} Kind;
102
102
103
103
struct Memory {
104
- unsigned Reg;
104
+ MCRegister Reg;
105
105
const MCExpr *Offset;
106
106
};
107
107
union {
108
108
const MCExpr *Imm;
109
- unsigned Reg;
109
+ MCRegister Reg;
110
110
StringRef Tok;
111
111
Memory Mem;
112
112
};
@@ -116,11 +116,11 @@ class MSP430Operand : public MCParsedAsmOperand {
116
116
public:
117
117
MSP430Operand (StringRef Tok, SMLoc const &S)
118
118
: Kind(k_Tok), Tok(Tok), Start(S), End(S) {}
119
- MSP430Operand (KindTy Kind, unsigned Reg, SMLoc const &S, SMLoc const &E)
119
+ MSP430Operand (KindTy Kind, MCRegister Reg, SMLoc const &S, SMLoc const &E)
120
120
: Kind(Kind), Reg(Reg), Start(S), End(E) {}
121
121
MSP430Operand (MCExpr const *Imm, SMLoc const &S, SMLoc const &E)
122
122
: Kind(k_Imm), Imm(Imm), Start(S), End(E) {}
123
- MSP430Operand (unsigned Reg, MCExpr const *Expr, SMLoc const &S,
123
+ MSP430Operand (MCRegister Reg, MCExpr const *Expr, SMLoc const &S,
124
124
SMLoc const &E)
125
125
: Kind(k_Mem), Mem({Reg, Expr}), Start(S), End(E) {}
126
126
@@ -188,7 +188,7 @@ class MSP430Operand : public MCParsedAsmOperand {
188
188
return Reg;
189
189
}
190
190
191
- void setReg (unsigned RegNo) {
191
+ void setReg (MCRegister RegNo) {
192
192
assert (Kind == k_Reg && " Invalid access!" );
193
193
Reg = RegNo;
194
194
}
@@ -197,30 +197,29 @@ class MSP430Operand : public MCParsedAsmOperand {
197
197
return std::make_unique<MSP430Operand>(Str, S);
198
198
}
199
199
200
- static std::unique_ptr<MSP430Operand> CreateReg (unsigned RegNum , SMLoc S,
200
+ static std::unique_ptr<MSP430Operand> CreateReg (MCRegister Reg , SMLoc S,
201
201
SMLoc E) {
202
- return std::make_unique<MSP430Operand>(k_Reg, RegNum , S, E);
202
+ return std::make_unique<MSP430Operand>(k_Reg, Reg , S, E);
203
203
}
204
204
205
205
static std::unique_ptr<MSP430Operand> CreateImm (const MCExpr *Val, SMLoc S,
206
206
SMLoc E) {
207
207
return std::make_unique<MSP430Operand>(Val, S, E);
208
208
}
209
209
210
- static std::unique_ptr<MSP430Operand> CreateMem (unsigned RegNum,
211
- const MCExpr *Val,
212
- SMLoc S, SMLoc E) {
213
- return std::make_unique<MSP430Operand>(RegNum, Val, S, E);
210
+ static std::unique_ptr<MSP430Operand>
211
+ CreateMem (MCRegister Reg, const MCExpr *Val, SMLoc S, SMLoc E) {
212
+ return std::make_unique<MSP430Operand>(Reg, Val, S, E);
214
213
}
215
214
216
- static std::unique_ptr<MSP430Operand> CreateIndReg (unsigned RegNum , SMLoc S,
217
- SMLoc E) {
218
- return std::make_unique<MSP430Operand>(k_IndReg, RegNum , S, E);
215
+ static std::unique_ptr<MSP430Operand> CreateIndReg (MCRegister Reg , SMLoc S,
216
+ SMLoc E) {
217
+ return std::make_unique<MSP430Operand>(k_IndReg, Reg , S, E);
219
218
}
220
219
221
- static std::unique_ptr<MSP430Operand> CreatePostIndReg (unsigned RegNum, SMLoc S ,
222
- SMLoc E) {
223
- return std::make_unique<MSP430Operand>(k_PostIndReg, RegNum , S, E);
220
+ static std::unique_ptr<MSP430Operand> CreatePostIndReg (MCRegister Reg ,
221
+ SMLoc S, SMLoc E) {
222
+ return std::make_unique<MSP430Operand>(k_PostIndReg, Reg , S, E);
224
223
}
225
224
226
225
SMLoc getStartLoc () const override { return Start; }
@@ -545,8 +544,8 @@ extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeMSP430AsmParser() {
545
544
#define GET_MATCHER_IMPLEMENTATION
546
545
#include " MSP430GenAsmMatcher.inc"
547
546
548
- static unsigned convertGR16ToGR8 (unsigned Reg) {
549
- switch (Reg) {
547
+ static MCRegister convertGR16ToGR8 (MCRegister Reg) {
548
+ switch (Reg. id () ) {
550
549
default :
551
550
llvm_unreachable (" Unknown GR16 register" );
552
551
case MSP430::PC: return MSP430::PCB;
@@ -575,7 +574,7 @@ unsigned MSP430AsmParser::validateTargetOperandClass(MCParsedAsmOperand &AsmOp,
575
574
if (!Op.isReg ())
576
575
return Match_InvalidOperand;
577
576
578
- unsigned Reg = Op.getReg ();
577
+ MCRegister Reg = Op.getReg ();
579
578
bool isGR16 =
580
579
MSP430MCRegisterClasses[MSP430::GR16RegClassID].contains (Reg);
581
580
0 commit comments