The RenderMethod field in RegisterOperand class sets the name of the method on the target specific operand to call to add the target specific operand to an MCInst. This patch defines RenderMethod for mips RegisterOperand classes and removes redundant code from MipsAsmParser.cpp

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184292 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Vladimir Medic 2013-06-19 10:14:36 +00:00
parent f9326c248a
commit dd5fe2ffc6
2 changed files with 10 additions and 19 deletions

View File

@ -357,36 +357,23 @@ public:
bool isCPURegsAsm() const {
return Kind == k_Register && Reg.Kind == Kind_CPURegs;
}
void addCPURegsAsmOperands(MCInst &Inst, unsigned N) const {
void addRegAsmOperands(MCInst &Inst, unsigned N) const {
Inst.addOperand(MCOperand::CreateReg(Reg.RegNum));
}
bool isCPU64RegsAsm() const {
return Kind == k_Register && Reg.Kind == Kind_CPU64Regs;
}
void addCPU64RegsAsmOperands(MCInst &Inst, unsigned N) const {
Inst.addOperand(MCOperand::CreateReg(Reg.RegNum));
}
bool isHWRegsAsm() const {
assert((Kind == k_Register) && "Invalid access!");
return Reg.Kind == Kind_HWRegs;
}
void addHWRegsAsmOperands(MCInst &Inst, unsigned N) const {
Inst.addOperand(MCOperand::CreateReg(Reg.RegNum));
}
bool isHW64RegsAsm() const {
assert((Kind == k_Register) && "Invalid access!");
return Reg.Kind == Kind_HW64Regs;
}
void addHW64RegsAsmOperands(MCInst &Inst, unsigned N) const {
Inst.addOperand(MCOperand::CreateReg(Reg.RegNum));
}
void addCCRAsmOperands(MCInst &Inst, unsigned N) const {
Inst.addOperand(MCOperand::CreateReg(Reg.RegNum));
}
bool isCCRAsm() const {
assert((Kind == k_Register) && "Invalid access!");

View File

@ -388,17 +388,21 @@ def ACRegsDSP : RegisterClass<"Mips", [untyped], 64, (sequence "AC%u", 0, 3)> {
def DSPCC : RegisterClass<"Mips", [v4i8, v2i16], 32, (add DSPCCond)>;
// Register Operands.
def CPURegsAsmOperand : AsmOperandClass {
class MipsAsmRegOperand : AsmOperandClass {
let RenderMethod = "addRegAsmOperands";
}
def CPURegsAsmOperand : MipsAsmRegOperand {
let Name = "CPURegsAsm";
let ParserMethod = "parseCPURegs";
}
def CPU64RegsAsmOperand : AsmOperandClass {
def CPU64RegsAsmOperand : MipsAsmRegOperand {
let Name = "CPU64RegsAsm";
let ParserMethod = "parseCPU64Regs";
}
def CCRAsmOperand : AsmOperandClass {
def CCRAsmOperand : MipsAsmRegOperand {
let Name = "CCRAsm";
let ParserMethod = "parseCCRRegs";
}
@ -415,12 +419,12 @@ def CCROpnd : RegisterOperand<CCR, "printCPURegs"> {
let ParserMatchClass = CCRAsmOperand;
}
def HWRegsAsmOperand : AsmOperandClass {
def HWRegsAsmOperand : MipsAsmRegOperand {
let Name = "HWRegsAsm";
let ParserMethod = "parseHWRegs";
}
def HW64RegsAsmOperand : AsmOperandClass {
def HW64RegsAsmOperand : MipsAsmRegOperand {
let Name = "HW64RegsAsm";
let ParserMethod = "parseHW64Regs";
}