summaryrefslogtreecommitdiff
path: root/lib/Target/Mips/AsmParser
diff options
context:
space:
mode:
authorVladimir Medic <Vladimir.Medic@imgtec.com>2013-09-16 10:29:42 +0000
committerVladimir Medic <Vladimir.Medic@imgtec.com>2013-09-16 10:29:42 +0000
commite925f7dbbf497412cd0cc3f67b9b96fed0cc3712 (patch)
treed437b605c6c2a28eebc0587ab88f8342319ef300 /lib/Target/Mips/AsmParser
parent9bc7603750926c15648dae0d31a5451861a0d11e (diff)
downloadllvm-e925f7dbbf497412cd0cc3f67b9b96fed0cc3712.tar.gz
llvm-e925f7dbbf497412cd0cc3f67b9b96fed0cc3712.tar.bz2
llvm-e925f7dbbf497412cd0cc3f67b9b96fed0cc3712.tar.xz
This patch implements Mips load/store instructions from/to coprocessor 2. Test cases are added.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190780 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips/AsmParser')
-rw-r--r--lib/Target/Mips/AsmParser/MipsAsmParser.cpp36
1 files changed, 35 insertions, 1 deletions
diff --git a/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
index c4ce4ff5b3..3033fef5d8 100644
--- a/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
+++ b/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
@@ -125,6 +125,9 @@ class MipsAsmParser : public MCTargetAsmParser {
MipsAsmParser::OperandMatchResultTy
parseHI32DSP(SmallVectorImpl<MCParsedAsmOperand*> &Operands);
+ MipsAsmParser::OperandMatchResultTy
+ parseCOP2(SmallVectorImpl<MCParsedAsmOperand*> &Operands);
+
bool searchSymbolAlias(SmallVectorImpl<MCParsedAsmOperand*> &Operands,
unsigned RegKind);
@@ -239,7 +242,8 @@ public:
Kind_FCCRegs,
Kind_ACC64DSP,
Kind_LO32DSP,
- Kind_HI32DSP
+ Kind_HI32DSP,
+ Kind_COP2
};
private:
@@ -457,6 +461,10 @@ public:
return Kind == k_Register && Reg.Kind == Kind_HI32DSP;
}
+ bool isCOP2Asm() const {
+ return Kind == k_Register && Reg.Kind == Kind_COP2;
+ }
+
/// getStartLoc - Get the location of the first token of this operand.
SMLoc getStartLoc() const {
return StartLoc;
@@ -1585,6 +1593,32 @@ MipsAsmParser::parseHI32DSP(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
return MatchOperand_Success;
}
+MipsAsmParser::OperandMatchResultTy
+MipsAsmParser::parseCOP2(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
+ // If the first token is not '$' we have an error.
+ if (Parser.getTok().isNot(AsmToken::Dollar))
+ return MatchOperand_NoMatch;
+
+ SMLoc S = Parser.getTok().getLoc();
+ Parser.Lex(); // Eat the '$'
+
+ const AsmToken &Tok = Parser.getTok(); // Get next token.
+
+ if (Tok.isNot(AsmToken::Integer))
+ return MatchOperand_NoMatch;
+
+ unsigned IntVal = Tok.getIntVal();
+
+ unsigned Reg = matchRegisterByNumber(IntVal, Mips::COP2RegClassID);
+
+ MipsOperand *Op = MipsOperand::CreateReg(Reg, S, Parser.getTok().getLoc());
+ Op->setRegKind(MipsOperand::Kind_COP2);
+ Operands.push_back(Op);
+
+ Parser.Lex(); // Eat the register number.
+ return MatchOperand_Success;
+}
+
bool MipsAsmParser::searchSymbolAlias(
SmallVectorImpl<MCParsedAsmOperand*> &Operands, unsigned RegKind) {