Debian Codegraph @

Source/Core/Common/JitRegister.h

raw symbols SCIP
1 // Copyright 2014 Dolphin Emulator Project
2 // SPDX-License-Identifier: GPL-2.0-or-later
3
4 #pragma once
5
6 #include <string>
7
8 #include <fmt/format.h>
9
10 #include "Common/CommonTypes.h"
11
12 namespace Common::JitRegister
13 {
14 void Init(const std::string& perf_dir);
15 void Shutdown();
16 void Register(const void* base_address, u32 code_size, const std::string& symbol_name);
17 bool IsEnabled();
18
19 template <typename... Args>
20 inline void Register(const void* base_address, u32 code_size, fmt::format_string<Args...> format,
21 Args&&... args)
22 {
23 if (!IsEnabled())
24 return;
25
26 Register(base_address, code_size, fmt::format(format, std::forward<Args>(args)...));
27 }
28
29 template <typename... Args>
30 inline void Register(const void* start, const void* end, fmt::format_string<Args...> format,
31 Args&&... args)
32 {
33 if (!IsEnabled())
34 return;
35
36 u32 code_size = (u32)((const char*)end - (const char*)start);
37 Register(start, code_size, fmt::format(format, std::forward<Args>(args)...));
38 }
39 } // namespace Common::JitRegister