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