2014-10-31 20:12:54 +01:00
|
|
|
// Copyright 2014 Dolphin Emulator Project
|
2021-07-05 03:22:19 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2014-10-31 20:12:54 +01:00
|
|
|
|
|
|
|
#pragma once
|
2022-02-16 19:45:02 +01:00
|
|
|
|
2015-05-26 05:26:43 +02:00
|
|
|
#include <string>
|
2022-02-16 19:45:02 +01:00
|
|
|
|
|
|
|
#include <fmt/format.h>
|
|
|
|
|
2015-01-20 18:01:37 +01:00
|
|
|
#include "Common/CommonTypes.h"
|
2014-10-31 20:12:54 +01:00
|
|
|
|
|
|
|
namespace JitRegister
|
|
|
|
{
|
2015-05-02 22:30:56 +02:00
|
|
|
void Init(const std::string& perf_dir);
|
2014-10-31 20:12:54 +01:00
|
|
|
void Shutdown();
|
2022-02-16 19:45:02 +01:00
|
|
|
void Register(const void* base_address, u32 code_size, const std::string& symbol_name);
|
2017-08-25 20:59:31 +02:00
|
|
|
bool IsEnabled();
|
2015-01-05 20:24:37 +01:00
|
|
|
|
2022-02-16 19:45:02 +01:00
|
|
|
template <typename... Args>
|
|
|
|
inline void Register(const void* base_address, u32 code_size, fmt::format_string<Args...> format,
|
|
|
|
Args&&... args)
|
2015-01-05 20:24:37 +01:00
|
|
|
{
|
2022-02-16 19:45:02 +01:00
|
|
|
Register(base_address, code_size, fmt::format(format, std::forward<Args>(args)...));
|
2015-01-05 20:24:37 +01:00
|
|
|
}
|
|
|
|
|
2022-02-16 19:45:02 +01:00
|
|
|
template <typename... Args>
|
|
|
|
inline void Register(const void* start, const void* end, fmt::format_string<Args...> format,
|
|
|
|
Args&&... args)
|
2015-01-05 20:24:37 +01:00
|
|
|
{
|
2016-06-24 10:43:46 +02:00
|
|
|
u32 code_size = (u32)((const char*)end - (const char*)start);
|
2022-02-16 19:45:02 +01:00
|
|
|
Register(start, code_size, fmt::format(format, std::forward<Args>(args)...));
|
2015-01-05 20:24:37 +01:00
|
|
|
}
|
2019-05-06 01:48:12 +02:00
|
|
|
} // namespace JitRegister
|