diff --git a/llvm/lib/Target/MSP430/AsmParser/MSP430AsmParser.cpp b/llvm/lib/Target/MSP430/AsmParser/MSP430AsmParser.cpp index 34ae80669f2c..7a8835c3af60 100644 --- a/llvm/lib/Target/MSP430/AsmParser/MSP430AsmParser.cpp +++ b/llvm/lib/Target/MSP430/AsmParser/MSP430AsmParser.cpp @@ -101,12 +101,12 @@ class MSP430Operand : public MCParsedAsmOperand { } Kind; struct Memory { - unsigned Reg; + MCRegister Reg; const MCExpr *Offset; }; union { const MCExpr *Imm; - unsigned Reg; + MCRegister Reg; StringRef Tok; Memory Mem; }; @@ -116,11 +116,11 @@ class MSP430Operand : public MCParsedAsmOperand { public: MSP430Operand(StringRef Tok, SMLoc const &S) : Kind(k_Tok), Tok(Tok), Start(S), End(S) {} - MSP430Operand(KindTy Kind, unsigned Reg, SMLoc const &S, SMLoc const &E) + MSP430Operand(KindTy Kind, MCRegister Reg, SMLoc const &S, SMLoc const &E) : Kind(Kind), Reg(Reg), Start(S), End(E) {} MSP430Operand(MCExpr const *Imm, SMLoc const &S, SMLoc const &E) : Kind(k_Imm), Imm(Imm), Start(S), End(E) {} - MSP430Operand(unsigned Reg, MCExpr const *Expr, SMLoc const &S, + MSP430Operand(MCRegister Reg, MCExpr const *Expr, SMLoc const &S, SMLoc const &E) : Kind(k_Mem), Mem({Reg, Expr}), Start(S), End(E) {} @@ -188,7 +188,7 @@ public: return Reg; } - void setReg(unsigned RegNo) { + void setReg(MCRegister RegNo) { assert(Kind == k_Reg && "Invalid access!"); Reg = RegNo; } @@ -197,9 +197,9 @@ public: return std::make_unique(Str, S); } - static std::unique_ptr CreateReg(unsigned RegNum, SMLoc S, + static std::unique_ptr CreateReg(MCRegister Reg, SMLoc S, SMLoc E) { - return std::make_unique(k_Reg, RegNum, S, E); + return std::make_unique(k_Reg, Reg, S, E); } static std::unique_ptr CreateImm(const MCExpr *Val, SMLoc S, @@ -207,20 +207,19 @@ public: return std::make_unique(Val, S, E); } - static std::unique_ptr CreateMem(unsigned RegNum, - const MCExpr *Val, - SMLoc S, SMLoc E) { - return std::make_unique(RegNum, Val, S, E); + static std::unique_ptr + CreateMem(MCRegister Reg, const MCExpr *Val, SMLoc S, SMLoc E) { + return std::make_unique(Reg, Val, S, E); } - static std::unique_ptr CreateIndReg(unsigned RegNum, SMLoc S, - SMLoc E) { - return std::make_unique(k_IndReg, RegNum, S, E); + static std::unique_ptr CreateIndReg(MCRegister Reg, SMLoc S, + SMLoc E) { + return std::make_unique(k_IndReg, Reg, S, E); } - static std::unique_ptr CreatePostIndReg(unsigned RegNum, SMLoc S, - SMLoc E) { - return std::make_unique(k_PostIndReg, RegNum, S, E); + static std::unique_ptr CreatePostIndReg(MCRegister Reg, + SMLoc S, SMLoc E) { + return std::make_unique(k_PostIndReg, Reg, S, E); } SMLoc getStartLoc() const override { return Start; } @@ -545,8 +544,8 @@ extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeMSP430AsmParser() { #define GET_MATCHER_IMPLEMENTATION #include "MSP430GenAsmMatcher.inc" -static unsigned convertGR16ToGR8(unsigned Reg) { - switch (Reg) { +static MCRegister convertGR16ToGR8(MCRegister Reg) { + switch (Reg.id()) { default: llvm_unreachable("Unknown GR16 register"); case MSP430::PC: return MSP430::PCB; @@ -575,7 +574,7 @@ unsigned MSP430AsmParser::validateTargetOperandClass(MCParsedAsmOperand &AsmOp, if (!Op.isReg()) return Match_InvalidOperand; - unsigned Reg = Op.getReg(); + MCRegister Reg = Op.getReg(); bool isGR16 = MSP430MCRegisterClasses[MSP430::GR16RegClassID].contains(Reg);