forked from OSchip/llvm-project
[mips] Joint MipsMemSimmXXXAsmOperand into the single template class. NFC
This commit is contained in:
parent
2fcf3e934b
commit
7deb8ce4c1
|
@ -116,7 +116,7 @@ def mem_mm_9 : Operand<i32> {
|
|||
let PrintMethod = "printMemOperand";
|
||||
let MIOperandInfo = (ops ptr_rc, simm9);
|
||||
let EncoderMethod = "getMemEncodingMMImm9";
|
||||
let ParserMatchClass = MipsMemSimm9AsmOperand;
|
||||
let ParserMatchClass = MipsMemSimmAsmOperand<9>;
|
||||
let OperandType = "OPERAND_MEMORY";
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ def mem_mm_11 : Operand<i32> {
|
|||
let PrintMethod = "printMemOperand";
|
||||
let MIOperandInfo = (ops GPR32, simm11);
|
||||
let EncoderMethod = "getMemEncodingMMImm11";
|
||||
let ParserMatchClass = MipsMemSimm11AsmOperand;
|
||||
let ParserMatchClass = MipsMemSimmAsmOperand<11>;
|
||||
let OperandType = "OPERAND_MEMORY";
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ def mem_mm_16 : Operand<i32> {
|
|||
let MIOperandInfo = (ops ptr_rc, simm16);
|
||||
let EncoderMethod = "getMemEncodingMMImm16";
|
||||
let DecoderMethod = "DecodeMemMMImm16";
|
||||
let ParserMatchClass = MipsMemSimm16AsmOperand;
|
||||
let ParserMatchClass = MipsMemSimmAsmOperand<16>;
|
||||
let OperandType = "OPERAND_MEMORY";
|
||||
}
|
||||
|
||||
|
|
|
@ -1086,59 +1086,14 @@ def MipsMemAsmOperand : AsmOperandClass {
|
|||
let ParserMethod = "parseMemOperand";
|
||||
}
|
||||
|
||||
def MipsMemSimm9AsmOperand : AsmOperandClass {
|
||||
let Name = "MemOffsetSimm9";
|
||||
class MipsMemSimmAsmOperand<int Width, int Shift = 0> : AsmOperandClass {
|
||||
let Name = "MemOffsetSimm" # Width # "_" # Shift;
|
||||
let SuperClasses = [MipsMemAsmOperand];
|
||||
let RenderMethod = "addMemOperands";
|
||||
let ParserMethod = "parseMemOperand";
|
||||
let PredicateMethod = "isMemWithSimmOffset<9>";
|
||||
let DiagnosticType = "MemSImm9";
|
||||
}
|
||||
|
||||
def MipsMemSimm10AsmOperand : AsmOperandClass {
|
||||
let Name = "MemOffsetSimm10";
|
||||
let SuperClasses = [MipsMemAsmOperand];
|
||||
let RenderMethod = "addMemOperands";
|
||||
let ParserMethod = "parseMemOperand";
|
||||
let PredicateMethod = "isMemWithSimmOffset<10>";
|
||||
let DiagnosticType = "MemSImm10";
|
||||
}
|
||||
|
||||
def MipsMemSimm12AsmOperand : AsmOperandClass {
|
||||
let Name = "MemOffsetSimm12";
|
||||
let SuperClasses = [MipsMemAsmOperand];
|
||||
let RenderMethod = "addMemOperands";
|
||||
let ParserMethod = "parseMemOperand";
|
||||
let PredicateMethod = "isMemWithSimmOffset<12>";
|
||||
let DiagnosticType = "MemSImm12";
|
||||
}
|
||||
|
||||
foreach I = {1, 2, 3} in
|
||||
def MipsMemSimm10Lsl # I # AsmOperand : AsmOperandClass {
|
||||
let Name = "MemOffsetSimm10_" # I;
|
||||
let SuperClasses = [MipsMemAsmOperand];
|
||||
let RenderMethod = "addMemOperands";
|
||||
let ParserMethod = "parseMemOperand";
|
||||
let PredicateMethod = "isMemWithSimmOffset<10, " # I # ">";
|
||||
let DiagnosticType = "MemSImm10Lsl" # I;
|
||||
}
|
||||
|
||||
def MipsMemSimm11AsmOperand : AsmOperandClass {
|
||||
let Name = "MemOffsetSimm11";
|
||||
let SuperClasses = [MipsMemAsmOperand];
|
||||
let RenderMethod = "addMemOperands";
|
||||
let ParserMethod = "parseMemOperand";
|
||||
let PredicateMethod = "isMemWithSimmOffset<11>";
|
||||
let DiagnosticType = "MemSImm11";
|
||||
}
|
||||
|
||||
def MipsMemSimm16AsmOperand : AsmOperandClass {
|
||||
let Name = "MemOffsetSimm16";
|
||||
let SuperClasses = [MipsMemAsmOperand];
|
||||
let RenderMethod = "addMemOperands";
|
||||
let ParserMethod = "parseMemOperand";
|
||||
let PredicateMethod = "isMemWithSimmOffset<16>";
|
||||
let DiagnosticType = "MemSImm16";
|
||||
let PredicateMethod = "isMemWithSimmOffset<" # Width # ", " # Shift # ">";
|
||||
let DiagnosticType = !if(!eq(Shift, 0), "MemSImm" # Width,
|
||||
"MemSImm" # Width # "Lsl" # Shift);
|
||||
}
|
||||
|
||||
def MipsMemSimmPtrAsmOperand : AsmOperandClass {
|
||||
|
@ -1188,39 +1143,38 @@ def simm12 : Operand<i32> {
|
|||
def mem_simm9 : mem_generic {
|
||||
let MIOperandInfo = (ops ptr_rc, simm9);
|
||||
let EncoderMethod = "getMemEncoding";
|
||||
let ParserMatchClass = MipsMemSimm9AsmOperand;
|
||||
let ParserMatchClass = MipsMemSimmAsmOperand<9>;
|
||||
}
|
||||
|
||||
def mem_simm10 : mem_generic {
|
||||
let MIOperandInfo = (ops ptr_rc, simm10);
|
||||
let EncoderMethod = "getMemEncoding";
|
||||
let ParserMatchClass = MipsMemSimm10AsmOperand;
|
||||
let ParserMatchClass = MipsMemSimmAsmOperand<10>;
|
||||
}
|
||||
|
||||
foreach I = {1, 2, 3} in
|
||||
def mem_simm10_lsl # I : mem_generic {
|
||||
let MIOperandInfo = (ops ptr_rc, !cast<Operand>("simm10_lsl" # I));
|
||||
let EncoderMethod = "getMemEncoding<" # I # ">";
|
||||
let ParserMatchClass =
|
||||
!cast<AsmOperandClass>("MipsMemSimm10Lsl" # I # "AsmOperand");
|
||||
let ParserMatchClass = MipsMemSimmAsmOperand<10, I>;
|
||||
}
|
||||
|
||||
def mem_simm11 : mem_generic {
|
||||
let MIOperandInfo = (ops ptr_rc, simm11);
|
||||
let EncoderMethod = "getMemEncoding";
|
||||
let ParserMatchClass = MipsMemSimm11AsmOperand;
|
||||
let ParserMatchClass = MipsMemSimmAsmOperand<11>;
|
||||
}
|
||||
|
||||
def mem_simm12 : mem_generic {
|
||||
let MIOperandInfo = (ops ptr_rc, simm12);
|
||||
let EncoderMethod = "getMemEncoding";
|
||||
let ParserMatchClass = MipsMemSimm12AsmOperand;
|
||||
let ParserMatchClass = MipsMemSimmAsmOperand<12>;
|
||||
}
|
||||
|
||||
def mem_simm16 : mem_generic {
|
||||
let MIOperandInfo = (ops ptr_rc, simm16);
|
||||
let EncoderMethod = "getMemEncoding";
|
||||
let ParserMatchClass = MipsMemSimm16AsmOperand;
|
||||
let ParserMatchClass = MipsMemSimmAsmOperand<16>;
|
||||
}
|
||||
|
||||
def mem_simmptr : mem_generic {
|
||||
|
|
Loading…
Reference in New Issue