diff --git a/src/frontend/decoder/decoder_detail.h b/src/frontend/decoder/decoder_detail.h index f1b8cee5..17f0cc07 100644 --- a/src/frontend/decoder/decoder_detail.h +++ b/src/frontend/decoder/decoder_detail.h @@ -121,6 +121,21 @@ private: }; } }; + + template + struct VisitorCaller { + template + static auto Make(std::integer_sequence, + CallRetT (Visitor::* const fn)(Args...) const, + const std::array arg_masks, + const std::array arg_shifts) { + static_assert(std::is_same::value, "Member function is not from Matcher's Visitor"); + return [fn, arg_masks, arg_shifts](const Visitor& v, opcode_type instruction) { + (void)instruction; + return (v.*fn)(static_cast((instruction & arg_masks[iota]) >> arg_shifts[iota])...); + }; + } + }; #ifdef _MSC_VER #pragma warning(pop) #endif