diff --git a/src/backend_x64/emit_x64_vector.cpp b/src/backend_x64/emit_x64_vector.cpp index 7f5377ef..7e4fcd93 100644 --- a/src/backend_x64/emit_x64_vector.cpp +++ b/src/backend_x64/emit_x64_vector.cpp @@ -9,6 +9,7 @@ #include "backend_x64/emit_x64.h" #include "common/assert.h" #include "common/common_types.h" +#include "common/mp.h" #include "frontend/ir/basic_block.h" #include "frontend/ir/microinstruction.h" #include "frontend/ir/opcodes.h" @@ -31,7 +32,7 @@ static void EmitVectorOperation(BlockOfCode& code, EmitContext& ctx, IR::Inst* i template static void EmitTwoArgumentFallback(BlockOfCode& code, EmitContext& ctx, IR::Inst* inst, Lambda lambda) { - const auto fn = +lambda; // Force decay of lambda to function pointer + const auto fn = static_cast*>(lambda); constexpr u32 stack_space = 3 * 16; auto args = ctx.reg_alloc.GetArgumentInfo(inst); const Xbyak::Xmm arg1 = ctx.reg_alloc.UseXmm(args[0]); diff --git a/src/common/mp.h b/src/common/mp.h index f96d8947..ec934b82 100644 --- a/src/common/mp.h +++ b/src/common/mp.h @@ -13,7 +13,9 @@ namespace Dynarmic::mp { /// Used to provide information about an arbitrary function. template -struct FunctionInfo; +struct FunctionInfo : public FunctionInfo +{ +}; /** * Partial specialization for function types. @@ -32,6 +34,8 @@ struct FunctionInfo static_assert(args_count != 0 && ParameterIndex < args_count, "Non-existent function parameter index"); using type = std::tuple_element_t>; }; + + using equivalent_function_type = R(Args...); }; /// Partial specialization for function pointers @@ -79,4 +83,12 @@ using return_type_t = typename FunctionInfo::return_type; template using class_type_t = typename FunctionInfo::class_type; +/** + * Helper template for retrieving the equivalent function type of a member function or functor. + * + * @tparam Function The function type to get the return type of. + */ +template +using equivalent_function_type_t = typename FunctionInfo::equivalent_function_type; + } // namespace Dynarmic::mp