From 1938f5c5b01c2c1ce7e5fea9778fb4ab540a7aaa Mon Sep 17 00:00:00 2001 From: Simon Atanasyan Date: Tue, 19 Nov 2019 17:32:13 +0300 Subject: [PATCH] [mips] Define mem_simm# operands using tblgen `foreach` loop. NFC --- lib/Target/Mips/MipsInstrInfo.td | 34 +++++--------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/lib/Target/Mips/MipsInstrInfo.td b/lib/Target/Mips/MipsInstrInfo.td index 4c277113d54..da8be7c640b 100644 --- a/lib/Target/Mips/MipsInstrInfo.td +++ b/lib/Target/Mips/MipsInstrInfo.td @@ -1140,17 +1140,11 @@ def simm12 : Operand { let DecoderMethod = "DecodeSimm12"; } -def mem_simm9 : mem_generic { - let MIOperandInfo = (ops ptr_rc, simm9); - let EncoderMethod = "getMemEncoding"; - let ParserMatchClass = MipsMemSimmAsmOperand<9>; -} - -def mem_simm10 : mem_generic { - let MIOperandInfo = (ops ptr_rc, simm10); - let EncoderMethod = "getMemEncoding"; - let ParserMatchClass = MipsMemSimmAsmOperand<10>; -} +foreach I = {9, 10, 11, 12, 16} in + def mem_simm # I : mem_generic { + let MIOperandInfo = (ops ptr_rc, !cast("simm" # I)); + let ParserMatchClass = MipsMemSimmAsmOperand; + } foreach I = {1, 2, 3} in def mem_simm10_lsl # I : mem_generic { @@ -1159,24 +1153,6 @@ foreach I = {1, 2, 3} in let ParserMatchClass = MipsMemSimmAsmOperand<10, I>; } -def mem_simm11 : mem_generic { - let MIOperandInfo = (ops ptr_rc, simm11); - let EncoderMethod = "getMemEncoding"; - let ParserMatchClass = MipsMemSimmAsmOperand<11>; -} - -def mem_simm12 : mem_generic { - let MIOperandInfo = (ops ptr_rc, simm12); - let EncoderMethod = "getMemEncoding"; - let ParserMatchClass = MipsMemSimmAsmOperand<12>; -} - -def mem_simm16 : mem_generic { - let MIOperandInfo = (ops ptr_rc, simm16); - let EncoderMethod = "getMemEncoding"; - let ParserMatchClass = MipsMemSimmAsmOperand<16>; -} - def mem_simmptr : mem_generic { let ParserMatchClass = MipsMemSimmPtrAsmOperand; }