From e7fc7befa89b397dccaff896c76a0bff305094cd Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Mon, 30 Dec 2013 17:37:10 +0000 Subject: [PATCH] Remove EscapeFilter. It's funcionality can be covered by correctly using ExtendedFilter and ExactFilter. No functional change. llvm-svn: 198226 --- utils/TableGen/X86ModRMFilters.cpp | 2 -- utils/TableGen/X86ModRMFilters.h | 29 ------------------------- utils/TableGen/X86RecognizableInstr.cpp | 17 +++++++++++++-- 3 files changed, 15 insertions(+), 33 deletions(-) diff --git a/utils/TableGen/X86ModRMFilters.cpp b/utils/TableGen/X86ModRMFilters.cpp index 7166fe02d89..a311603df9d 100644 --- a/utils/TableGen/X86ModRMFilters.cpp +++ b/utils/TableGen/X86ModRMFilters.cpp @@ -17,8 +17,6 @@ void DumbFilter::anchor() { } void ModFilter::anchor() { } -void EscapeFilter::anchor() { } - void AddRegEscapeFilter::anchor() { } void ExtendedFilter::anchor() { } diff --git a/utils/TableGen/X86ModRMFilters.h b/utils/TableGen/X86ModRMFilters.h index 497915fe334..5ab1a48846b 100644 --- a/utils/TableGen/X86ModRMFilters.h +++ b/utils/TableGen/X86ModRMFilters.h @@ -84,35 +84,6 @@ public: } }; -/// EscapeFilter - Filters escape opcodes, which are classified in two ways. If -/// the ModR/M byte is between 0xc0 and 0xff, then there is one slot for each -/// possible value. Otherwise, there is one instruction for each value of the -/// nnn field [bits 5-3], known elsewhere as the reg field. -class EscapeFilter : public ModRMFilter { - virtual void anchor(); - bool C0_FF; - uint8_t NNN_or_ModRM; -public: - /// Constructor - /// - /// \param c0_ff True if the ModR/M byte must fall between 0xc0 and 0xff; - /// false otherwise. - /// - /// \param nnn_or_modRM If c0_ff is true, the required value of the entire - /// ModR/M byte. If c0_ff is false, the required value - /// of the nnn field. - EscapeFilter(bool c0_ff, uint8_t nnn_or_modRM) : - ModRMFilter(), - C0_FF(c0_ff), - NNN_or_ModRM(nnn_or_modRM) { - } - - bool accepts(uint8_t modRM) const { - return ((C0_FF && modRM >= 0xc0 && (modRM == NNN_or_ModRM)) || - (!C0_FF && modRM < 0xc0 && ((modRM & 0x38) >> 3) == NNN_or_ModRM)); - } -}; - /// AddRegEscapeFilter - Some escape opcodes have one of the register operands /// added to the ModR/M byte, meaning that a range of eight ModR/M values /// maps to a single instruction. Such instructions require the ModR/M byte diff --git a/utils/TableGen/X86RecognizableInstr.cpp b/utils/TableGen/X86RecognizableInstr.cpp index 3472c8a046c..1eb579df3f5 100644 --- a/utils/TableGen/X86RecognizableInstr.cpp +++ b/utils/TableGen/X86RecognizableInstr.cpp @@ -1081,7 +1081,7 @@ void RecognizableInstr::emitDecodePath(DisassemblerTables &tables) const { Spec->modifierBase = Opcode; filter = new AddRegEscapeFilter(Opcode); } else { - filter = new EscapeFilter(true, Opcode); + filter = new ExactFilter(Opcode); } opcodeToSet = 0xd8 + (Prefix - X86Local::D8); break; @@ -1127,7 +1127,20 @@ void RecognizableInstr::emitDecodePath(DisassemblerTables &tables) const { case 0xdd: case 0xde: case 0xdf: - filter = new EscapeFilter(false, Form - X86Local::MRM0m); + switch (Form) { + default: + llvm_unreachable("Unhandled escape opcode form"); + case X86Local::MRM0m: + case X86Local::MRM1m: + case X86Local::MRM2m: + case X86Local::MRM3m: + case X86Local::MRM4m: + case X86Local::MRM5m: + case X86Local::MRM6m: + case X86Local::MRM7m: + filter = new ExtendedFilter(false, Form - X86Local::MRM0m); + break; + } // switch (Form) break; default: if (needsModRMForDecode(Form))