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
|
|
|
|
|
|
|
namespace JitRegister
|
|
|
|
{
|
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
|
|
|
{
|
|
|
|
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
|
|
|
}
|
2019-05-05 17:48:12 -06:00
|
|
|
} // namespace JitRegister
|