From 9e94000c164ac7aa9dd81d8a6823751ea49906a3 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 7 Oct 2010 20:14:23 +0000 Subject: [PATCH] reduce redundancy between pattern copies. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115968 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86InstrArithmetic.td | 106 ++++++++++++++------------- 1 file changed, 55 insertions(+), 51 deletions(-) diff --git a/lib/Target/X86/X86InstrArithmetic.td b/lib/Target/X86/X86InstrArithmetic.td index 7c024000314..72ec37da5e1 100644 --- a/lib/Target/X86/X86InstrArithmetic.td +++ b/lib/Target/X86/X86InstrArithmetic.td @@ -598,27 +598,29 @@ class ITy opcode, Format f, X86TypeInfo typeinfo, dag outs, dag ins, let hasREX_WPrefix = typeinfo.HasREX_WPrefix; } +// BinOpRR - Instructions like "add reg, reg, reg". +class BinOpRR opcode, string mnemonic, X86TypeInfo typeinfo, + list pattern> + : ITy; + // BinOpRR_R - Instructions like "add reg, reg, reg", where the pattern has // just a regclass (no eflags) as a result. class BinOpRR_R opcode, string mnemonic, X86TypeInfo typeinfo, SDNode opnode> - : ITy; + : BinOpRR; // BinOpRR_RF - Instructions like "add reg, reg, reg", where the pattern has // both a regclass and EFLAGS as a result. class BinOpRR_RF opcode, string mnemonic, X86TypeInfo typeinfo, SDNode opnode> - : ITy; + : BinOpRR; // BinOpRR_Rev - Instructions like "add reg, reg, reg" (reversed encoding). class BinOpRR_Rev opcode, string mnemonic, X86TypeInfo typeinfo> @@ -630,73 +632,75 @@ class BinOpRR_Rev opcode, string mnemonic, X86TypeInfo typeinfo> let isCodeGenOnly = 1; } -// BinOpRM_R - Instructions like "add reg, reg, [mem]". -class BinOpRM_R opcode, string mnemonic, X86TypeInfo typeinfo, - SDNode opnode> +// BinOpRM - Instructions like "add reg, reg, [mem]". +class BinOpRM opcode, string mnemonic, X86TypeInfo typeinfo, + list pattern> : ITy; + +// BinOpRM_R - Instructions like "add reg, reg, [mem]". +class BinOpRM_R opcode, string mnemonic, X86TypeInfo typeinfo, + SDNode opnode> + : BinOpRM; // BinOpRM_RF - Instructions like "add reg, reg, [mem]". class BinOpRM_RF opcode, string mnemonic, X86TypeInfo typeinfo, SDNode opnode> - : ITy; +// BinOpRI - Instructions like "add reg, reg, imm". +class BinOpRI opcode, string mnemonic, X86TypeInfo typeinfo, + Format f, list pattern> + : ITy { + let ImmT = typeinfo.ImmEncoding; +} + // BinOpRI_R - Instructions like "add reg, reg, imm". class BinOpRI_R opcode, string mnemonic, X86TypeInfo typeinfo, SDNode opnode, Format f> - : ITy { - let ImmT = typeinfo.ImmEncoding; -} + : BinOpRI; // BinOpRI_RF - Instructions like "add reg, reg, imm". class BinOpRI_RF opcode, string mnemonic, X86TypeInfo typeinfo, SDNode opnode, Format f> + : BinOpRI; + +// BinOpRI8 - Instructions like "add reg, reg, imm8". +class BinOpRI8 opcode, string mnemonic, X86TypeInfo typeinfo, + Format f, list pattern> : ITy { - let ImmT = typeinfo.ImmEncoding; + (ins typeinfo.RegClass:$src1, typeinfo.Imm8Operand:$src2), + mnemonic, "{$src2, $dst|$dst, $src2}", pattern> { + let ImmT = Imm8; // Always 8-bit immediate. } // BinOpRI8_R - Instructions like "add reg, reg, imm8". class BinOpRI8_R opcode, string mnemonic, X86TypeInfo typeinfo, SDNode opnode, Format f> - : ITy { - let ImmT = Imm8; // Always 8-bit immediate. -} + : BinOpRI8; // BinOpRI8_RF - Instructions like "add reg, reg, imm8". class BinOpRI8_RF opcode, string mnemonic, X86TypeInfo typeinfo, SDNode opnode, Format f> - : ITy { - let ImmT = Imm8; // Always 8-bit immediate. -} + : BinOpRI8; // BinOpMR - Instructions like "add [mem], reg". class BinOpMR opcode, string mnemonic, X86TypeInfo typeinfo,