emit_x64_vector: More explicit lambda decay
This commit is contained in:
parent
3afd2fcbad
commit
b062266b8e
2 changed files with 15 additions and 2 deletions
|
@ -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 <typename Lambda>
|
||||
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<mp::equivalent_function_type_t<Lambda>*>(lambda);
|
||||
constexpr u32 stack_space = 3 * 16;
|
||||
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
||||
const Xbyak::Xmm arg1 = ctx.reg_alloc.UseXmm(args[0]);
|
||||
|
|
|
@ -13,7 +13,9 @@ namespace Dynarmic::mp {
|
|||
|
||||
/// Used to provide information about an arbitrary function.
|
||||
template <typename Function>
|
||||
struct FunctionInfo;
|
||||
struct FunctionInfo : public FunctionInfo<decltype(&Function::operator())>
|
||||
{
|
||||
};
|
||||
|
||||
/**
|
||||
* Partial specialization for function types.
|
||||
|
@ -32,6 +34,8 @@ struct FunctionInfo<R(Args...)>
|
|||
static_assert(args_count != 0 && ParameterIndex < args_count, "Non-existent function parameter index");
|
||||
using type = std::tuple_element_t<ParameterIndex, std::tuple<Args...>>;
|
||||
};
|
||||
|
||||
using equivalent_function_type = R(Args...);
|
||||
};
|
||||
|
||||
/// Partial specialization for function pointers
|
||||
|
@ -79,4 +83,12 @@ using return_type_t = typename FunctionInfo<Function>::return_type;
|
|||
template <typename Function>
|
||||
using class_type_t = typename FunctionInfo<Function>::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 <typename Function>
|
||||
using equivalent_function_type_t = typename FunctionInfo<Function>::equivalent_function_type;
|
||||
|
||||
} // namespace Dynarmic::mp
|
||||
|
|
Loading…
Reference in a new issue