summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp')
-rw-r--r--llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp153
1 files changed, 40 insertions, 113 deletions
diff --git a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
index ae70fdd37c1..2e70d35fc4a 100644
--- a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
+++ b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
@@ -195,7 +195,6 @@ class MipsAsmParser : public MCTargetAsmParser {
OperandMatchResultTy parseImm(OperandVector &Operands);
OperandMatchResultTy parseJumpTarget(OperandVector &Operands);
OperandMatchResultTy parseInvNum(OperandVector &Operands);
- OperandMatchResultTy parseMovePRegPair(OperandVector &Operands);
OperandMatchResultTy parseRegisterList(OperandVector &Operands);
bool searchSymbolAlias(OperandVector &Operands);
@@ -760,7 +759,6 @@ private:
k_RegisterIndex, /// A register index in one or more RegKind.
k_Token, /// A simple token
k_RegList, /// A physical register list
- k_RegPair /// A pair of physical register
} Kind;
public:
@@ -778,7 +776,6 @@ public:
delete RegList.List;
case k_RegisterIndex:
case k_Token:
- case k_RegPair:
break;
}
}
@@ -1038,6 +1035,17 @@ public:
Inst.addOperand(MCOperand::createReg(getGPRMM16Reg()));
}
+ void addGPRMM16AsmRegMovePPairFirstOperands(MCInst &Inst, unsigned N) const {
+ assert(N == 1 && "Invalid number of operands!");
+ Inst.addOperand(MCOperand::createReg(getGPRMM16Reg()));
+ }
+
+ void addGPRMM16AsmRegMovePPairSecondOperands(MCInst &Inst,
+ unsigned N) const {
+ assert(N == 1 && "Invalid number of operands!");
+ Inst.addOperand(MCOperand::createReg(getGPRMM16Reg()));
+ }
+
/// Render the operand to an MCInst as a GPR64
/// Asserts if the wrong number of operands are requested, or the operand
/// is not a k_RegisterIndex compatible with RegKind_GPR
@@ -1217,29 +1225,6 @@ public:
Inst.addOperand(MCOperand::createReg(RegNo));
}
- void addRegPairOperands(MCInst &Inst, unsigned N) const {
- assert(N == 2 && "Invalid number of operands!");
- assert((RegIdx.Kind & RegKind_GPR) && "Invalid access!");
- unsigned RegNo = getRegPair();
- AsmParser.warnIfRegIndexIsAT(RegNo, StartLoc);
- Inst.addOperand(MCOperand::createReg(
- RegIdx.RegInfo->getRegClass(
- AsmParser.getABI().AreGprs64bit()
- ? Mips::GPR64RegClassID
- : Mips::GPR32RegClassID).getRegister(RegNo++)));
- Inst.addOperand(MCOperand::createReg(
- RegIdx.RegInfo->getRegClass(
- AsmParser.getABI().AreGprs64bit()
- ? Mips::GPR64RegClassID
- : Mips::GPR32RegClassID).getRegister(RegNo)));
- }
-
- void addMovePRegPairOperands(MCInst &Inst, unsigned N) const {
- assert(N == 2 && "Invalid number of operands!");
- for (auto RegNo : getRegList())
- Inst.addOperand(MCOperand::createReg(RegNo));
- }
-
bool isReg() const override {
// As a special case until we sort out the definition of div/divu, accept
// $0/$zero here so that MCK_ZERO works correctly.
@@ -1406,34 +1391,6 @@ public:
bool isRegList() const { return Kind == k_RegList; }
- bool isMovePRegPair() const {
- if (Kind != k_RegList || RegList.List->size() != 2)
- return false;
-
- unsigned R0 = RegList.List->front();
- unsigned R1 = RegList.List->back();
-
- if ((R0 == Mips::A1 && R1 == Mips::A2) ||
- (R0 == Mips::A1 && R1 == Mips::A3) ||
- (R0 == Mips::A2 && R1 == Mips::A3) ||
- (R0 == Mips::A0 && R1 == Mips::S5) ||
- (R0 == Mips::A0 && R1 == Mips::S6) ||
- (R0 == Mips::A0 && R1 == Mips::A1) ||
- (R0 == Mips::A0 && R1 == Mips::A2) ||
- (R0 == Mips::A0 && R1 == Mips::A3) ||
- (R0 == Mips::A1_64 && R1 == Mips::A2_64) ||
- (R0 == Mips::A1_64 && R1 == Mips::A3_64) ||
- (R0 == Mips::A2_64 && R1 == Mips::A3_64) ||
- (R0 == Mips::A0_64 && R1 == Mips::S5_64) ||
- (R0 == Mips::A0_64 && R1 == Mips::S6_64) ||
- (R0 == Mips::A0_64 && R1 == Mips::A1_64) ||
- (R0 == Mips::A0_64 && R1 == Mips::A2_64) ||
- (R0 == Mips::A0_64 && R1 == Mips::A3_64))
- return true;
-
- return false;
- }
-
StringRef getToken() const {
assert(Kind == k_Token && "Invalid access!");
return StringRef(Tok.Data, Tok.Length);
@@ -1481,11 +1438,6 @@ public:
return *(RegList.List);
}
- unsigned getRegPair() const {
- assert((Kind == k_RegPair) && "Invalid access!");
- return RegIdx.Index;
- }
-
static std::unique_ptr<MipsOperand> CreateToken(StringRef Str, SMLoc S,
MipsAsmParser &Parser) {
auto Op = llvm::make_unique<MipsOperand>(k_Token, Parser);
@@ -1593,18 +1545,6 @@ public:
return Op;
}
- static std::unique_ptr<MipsOperand> CreateRegPair(const MipsOperand &MOP,
- SMLoc S, SMLoc E,
- MipsAsmParser &Parser) {
- auto Op = llvm::make_unique<MipsOperand>(k_RegPair, Parser);
- Op->RegIdx.Index = MOP.RegIdx.Index;
- Op->RegIdx.RegInfo = MOP.RegIdx.RegInfo;
- Op->RegIdx.Kind = MOP.RegIdx.Kind;
- Op->StartLoc = S;
- Op->EndLoc = E;
- return Op;
- }
-
bool isGPRZeroAsmReg() const {
return isRegIdx() && RegIdx.Kind & RegKind_GPR && RegIdx.Index == 0;
}
@@ -1640,6 +1580,19 @@ public:
(RegIdx.Index >= 16 && RegIdx.Index <= 20));
}
+ bool isMM16AsmRegMovePPairFirst() const {
+ if (!(isRegIdx() && RegIdx.Kind))
+ return false;
+ return RegIdx.Index >= 4 && RegIdx.Index <= 6;
+ }
+
+ bool isMM16AsmRegMovePPairSecond() const {
+ if (!(isRegIdx() && RegIdx.Kind))
+ return false;
+ return (RegIdx.Index == 21 || RegIdx.Index == 22 ||
+ (RegIdx.Index >= 5 && RegIdx.Index <= 7));
+ }
+
bool isFGRAsmReg() const {
// AFGR64 is $0-$15 but we handle this in getAFGR64()
return isRegIdx() && RegIdx.Kind & RegKind_FGR && RegIdx.Index <= 31;
@@ -1720,9 +1673,6 @@ public:
OS << Reg << " ";
OS << ">";
break;
- case k_RegPair:
- OS << "RegPair<" << RegIdx.Index << "," << RegIdx.Index + 1 << ">";
- break;
}
}
@@ -2288,6 +2238,22 @@ bool MipsAsmParser::processInstruction(MCInst &Inst, SMLoc IDLoc,
if (Inst.getOperand(0).getReg() == Mips::RA)
return Error(IDLoc, "invalid operand for instruction");
break;
+ case Mips::MOVEP_MM:
+ case Mips::MOVEP_MMR6: {
+ unsigned R0 = Inst.getOperand(0).getReg();
+ unsigned R1 = Inst.getOperand(1).getReg();
+ bool RegPair = ((R0 == Mips::A1 && R1 == Mips::A2) ||
+ (R0 == Mips::A1 && R1 == Mips::A3) ||
+ (R0 == Mips::A2 && R1 == Mips::A3) ||
+ (R0 == Mips::A0 && R1 == Mips::S5) ||
+ (R0 == Mips::A0 && R1 == Mips::S6) ||
+ (R0 == Mips::A0 && R1 == Mips::A1) ||
+ (R0 == Mips::A0 && R1 == Mips::A2) ||
+ (R0 == Mips::A0 && R1 == Mips::A3));
+ if (!RegPair)
+ return Error(IDLoc, "invalid operand for instruction");
+ break;
+ }
}
}
@@ -6278,45 +6244,6 @@ MipsAsmParser::parseRegisterList(OperandVector &Operands) {
return MatchOperand_Success;
}
-OperandMatchResultTy
-MipsAsmParser::parseMovePRegPair(OperandVector &Operands) {
- MCAsmParser &Parser = getParser();
- SmallVector<std::unique_ptr<MCParsedAsmOperand>, 8> TmpOperands;
- SmallVector<unsigned, 10> Regs;
-
- if (Parser.getTok().isNot(AsmToken::Dollar))
- return MatchOperand_ParseFail;
-
- SMLoc S = Parser.getTok().getLoc();
-
- if (parseAnyRegister(TmpOperands) != MatchOperand_Success)
- return MatchOperand_ParseFail;
-
- MipsOperand *Reg = &static_cast<MipsOperand &>(*TmpOperands.back());
- unsigned RegNo = isGP64bit() ? Reg->getGPR64Reg() : Reg->getGPR32Reg();
- Regs.push_back(RegNo);
-
- SMLoc E = Parser.getTok().getLoc();
- if (Parser.getTok().isNot(AsmToken::Comma)) {
- Error(E, "',' expected");
- return MatchOperand_ParseFail;
- }
-
- // Remove comma.
- Parser.Lex();
-
- if (parseAnyRegister(TmpOperands) != MatchOperand_Success)
- return MatchOperand_ParseFail;
-
- Reg = &static_cast<MipsOperand &>(*TmpOperands.back());
- RegNo = isGP64bit() ? Reg->getGPR64Reg() : Reg->getGPR32Reg();
- Regs.push_back(RegNo);
-
- Operands.push_back(MipsOperand::CreateRegList(Regs, S, E, *this));
-
- return MatchOperand_Success;
-}
-
/// Sometimes (i.e. load/stores) the operand may be followed immediately by
/// either this.
/// ::= '(', register, ')'
OpenPOWER on IntegriCloud