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