CMake: Swap USE_ and WITH_ for ENABLE_
Consistency.
This commit is contained in:
@ -14,7 +14,7 @@
|
||||
#include "timing_event.h"
|
||||
Log_SetChannel(CPU::CodeCache);
|
||||
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
#include "cpu_recompiler_code_generator.h"
|
||||
#endif
|
||||
|
||||
@ -29,7 +29,7 @@ static constexpr u32 RECOMPILE_FRAMES_TO_FALL_BACK_TO_INTERPRETER = 100;
|
||||
static constexpr u32 RECOMPILE_COUNT_TO_FALL_BACK_TO_INTERPRETER = 20;
|
||||
static constexpr u32 INVALIDATE_THRESHOLD_TO_DISABLE_LINKING = 10;
|
||||
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
|
||||
// Currently remapping the code buffer doesn't work in macOS or Haiku.
|
||||
#if !defined(__HAIKU__) && !defined(__APPLE__)
|
||||
@ -56,7 +56,7 @@ static JitCodeBuffer s_code_buffer;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
static FastMapTable s_fast_map[FAST_MAP_TABLE_COUNT];
|
||||
static std::unique_ptr<CodeBlock::HostCodePointer[]> s_fast_map_pointers;
|
||||
|
||||
@ -227,7 +227,7 @@ static void ClearState();
|
||||
static BlockMap s_blocks;
|
||||
static std::array<std::vector<CodeBlock*>, Bus::RAM_8MB_CODE_PAGE_COUNT> m_ram_block_map;
|
||||
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
static HostCodeMap s_host_code_map;
|
||||
|
||||
static void AddBlockToHostCodeMap(CodeBlock* block);
|
||||
@ -237,17 +237,17 @@ static bool InitializeFastmem();
|
||||
static void ShutdownFastmem();
|
||||
static Common::PageFaultHandler::HandlerResult LUTPageFaultHandler(void* exception_pc, void* fault_address,
|
||||
bool is_write);
|
||||
#ifdef WITH_MMAP_FASTMEM
|
||||
#ifdef ENABLE_MMAP_FASTMEM
|
||||
static Common::PageFaultHandler::HandlerResult MMapPageFaultHandler(void* exception_pc, void* fault_address,
|
||||
bool is_write);
|
||||
#endif
|
||||
#endif // WITH_RECOMPILER
|
||||
#endif // ENABLE_RECOMPILER
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
Assert(s_blocks.empty());
|
||||
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
if (g_settings.IsUsingRecompiler())
|
||||
{
|
||||
#ifdef USE_STATIC_CODE_BUFFER
|
||||
@ -266,7 +266,7 @@ void Initialize()
|
||||
AllocateFastMap();
|
||||
|
||||
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
if (g_settings.IsUsingRecompiler())
|
||||
{
|
||||
if (g_settings.IsUsingFastmem() && !InitializeFastmem())
|
||||
@ -289,7 +289,7 @@ void ClearState()
|
||||
delete it.second;
|
||||
|
||||
s_blocks.clear();
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
s_host_code_map.clear();
|
||||
s_code_buffer.Reset();
|
||||
ResetFastMap();
|
||||
@ -299,7 +299,7 @@ void ClearState()
|
||||
void Shutdown()
|
||||
{
|
||||
ClearState();
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
ShutdownFastmem();
|
||||
FreeFastMap();
|
||||
s_code_buffer.Destroy();
|
||||
@ -395,7 +395,7 @@ template<PGXPMode pgxp_mode>
|
||||
g_state.npc = g_state.pc;
|
||||
}
|
||||
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
|
||||
void CompileDispatcher()
|
||||
{
|
||||
@ -449,7 +449,7 @@ FastMapTable* GetFastMapPointer()
|
||||
{
|
||||
switch (g_settings.cpu_execution_mode)
|
||||
{
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
case CPUExecutionMode::Recompiler:
|
||||
ExecuteRecompiler();
|
||||
break;
|
||||
@ -473,7 +473,7 @@ FastMapTable* GetFastMapPointer()
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(WITH_RECOMPILER)
|
||||
#if defined(ENABLE_RECOMPILER)
|
||||
|
||||
JitCodeBuffer& GetCodeBuffer()
|
||||
{
|
||||
@ -486,11 +486,11 @@ void Reinitialize()
|
||||
{
|
||||
ClearState();
|
||||
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
ShutdownFastmem();
|
||||
#endif
|
||||
|
||||
#if defined(WITH_RECOMPILER)
|
||||
#if defined(ENABLE_RECOMPILER)
|
||||
s_code_buffer.Destroy();
|
||||
|
||||
if (g_settings.IsUsingRecompiler())
|
||||
@ -507,7 +507,7 @@ void Reinitialize()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
if (g_settings.IsUsingRecompiler())
|
||||
{
|
||||
if (g_settings.IsUsingFastmem() && !InitializeFastmem())
|
||||
@ -523,7 +523,7 @@ void Reinitialize()
|
||||
void Flush()
|
||||
{
|
||||
ClearState();
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
if (g_settings.IsUsingRecompiler())
|
||||
CompileDispatcher();
|
||||
#endif
|
||||
@ -601,7 +601,7 @@ CodeBlock* LookupBlock(CodeBlockKey key, bool allow_flush)
|
||||
// add it to the page map if it's in ram
|
||||
AddBlockToPageMap(block);
|
||||
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
SetFastMap(block->GetPC(), block->host_code);
|
||||
AddBlockToHostCodeMap(block);
|
||||
#endif
|
||||
@ -636,7 +636,7 @@ bool RevalidateBlock(CodeBlock* block, bool allow_flush)
|
||||
// re-add it to the page map since it's still up-to-date
|
||||
block->invalidated = false;
|
||||
AddBlockToPageMap(block);
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
SetFastMap(block->GetPC(), block->host_code);
|
||||
#endif
|
||||
return true;
|
||||
@ -647,7 +647,7 @@ recompile:
|
||||
// and we don't want to nuke the block we're compiling...
|
||||
RemoveReferencesToBlock(block);
|
||||
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
RemoveBlockFromHostCodeMap(block);
|
||||
#endif
|
||||
|
||||
@ -684,7 +684,7 @@ recompile:
|
||||
|
||||
AddBlockToPageMap(block);
|
||||
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
// re-add to page map again
|
||||
SetFastMap(block->GetPC(), block->host_code);
|
||||
AddBlockToHostCodeMap(block);
|
||||
@ -809,7 +809,7 @@ bool CompileBlock(CodeBlock* block, bool allow_flush)
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
if (g_settings.IsUsingRecompiler())
|
||||
{
|
||||
// Ensure we're not going to run out of space while compiling this block.
|
||||
@ -846,7 +846,7 @@ bool CompileBlock(CodeBlock* block, bool allow_flush)
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
|
||||
void FastCompileBlockFunction()
|
||||
{
|
||||
@ -920,7 +920,7 @@ static void InvalidateBlock(CodeBlock* block, bool allow_frame_invalidation)
|
||||
|
||||
UnlinkBlock(block);
|
||||
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
SetFastMap(block->GetPC(), FastCompileBlockFunction);
|
||||
#endif
|
||||
}
|
||||
@ -956,7 +956,7 @@ void RemoveReferencesToBlock(CodeBlock* block)
|
||||
BlockMap::iterator iter = s_blocks.find(block->key.GetPC());
|
||||
Assert(iter != s_blocks.end() && iter->second == block);
|
||||
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
SetFastMap(block->GetPC(), FastCompileBlockFunction);
|
||||
#endif
|
||||
|
||||
@ -965,7 +965,7 @@ void RemoveReferencesToBlock(CodeBlock* block)
|
||||
RemoveBlockFromPageMap(block);
|
||||
|
||||
UnlinkBlock(block);
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
if (!block->invalidated)
|
||||
RemoveBlockFromHostCodeMap(block);
|
||||
#endif
|
||||
@ -1017,7 +1017,7 @@ void LinkBlock(CodeBlock* from, CodeBlock* to, void* host_pc, void* host_resolve
|
||||
li.block = from;
|
||||
to->link_predecessors.push_back(li);
|
||||
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
// apply in code
|
||||
if (host_pc)
|
||||
{
|
||||
@ -1034,7 +1034,7 @@ void UnlinkBlock(CodeBlock* block)
|
||||
if (block->link_predecessors.empty() && block->link_successors.empty())
|
||||
return;
|
||||
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
if (g_settings.IsUsingRecompiler() && g_settings.cpu_recompiler_block_linking)
|
||||
s_code_buffer.WriteProtect(false);
|
||||
#endif
|
||||
@ -1045,7 +1045,7 @@ void UnlinkBlock(CodeBlock* block)
|
||||
[block](const CodeBlock::LinkInfo& li) { return li.block == block; });
|
||||
Assert(iter != li.block->link_successors.end());
|
||||
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
// Restore blocks linked to this block back to the resolver
|
||||
if (li.host_pc)
|
||||
{
|
||||
@ -1064,7 +1064,7 @@ void UnlinkBlock(CodeBlock* block)
|
||||
[block](const CodeBlock::LinkInfo& li) { return li.block == block; });
|
||||
Assert(iter != li.block->link_predecessors.end());
|
||||
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
// Restore blocks we're linking to back to the resolver, since the successor won't be linked to us to backpatch if
|
||||
// it changes.
|
||||
if (li.host_pc)
|
||||
@ -1079,13 +1079,13 @@ void UnlinkBlock(CodeBlock* block)
|
||||
}
|
||||
block->link_successors.clear();
|
||||
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
if (g_settings.IsUsingRecompiler() && g_settings.cpu_recompiler_block_linking)
|
||||
s_code_buffer.WriteProtect(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
|
||||
void AddBlockToHostCodeMap(CodeBlock* block)
|
||||
{
|
||||
@ -1111,7 +1111,7 @@ bool InitializeFastmem()
|
||||
const CPUFastmemMode mode = g_settings.cpu_fastmem_mode;
|
||||
Assert(mode != CPUFastmemMode::Disabled);
|
||||
|
||||
#ifdef WITH_MMAP_FASTMEM
|
||||
#ifdef ENABLE_MMAP_FASTMEM
|
||||
const auto handler = (mode == CPUFastmemMode::MMap) ? MMapPageFaultHandler : LUTPageFaultHandler;
|
||||
#else
|
||||
const auto handler = LUTPageFaultHandler;
|
||||
@ -1137,7 +1137,7 @@ void ShutdownFastmem()
|
||||
CPU::UpdateFastmemBase();
|
||||
}
|
||||
|
||||
#ifdef WITH_MMAP_FASTMEM
|
||||
#ifdef ENABLE_MMAP_FASTMEM
|
||||
|
||||
Common::PageFaultHandler::HandlerResult MMapPageFaultHandler(void* exception_pc, void* fault_address, bool is_write)
|
||||
{
|
||||
@ -1256,11 +1256,11 @@ Common::PageFaultHandler::HandlerResult LUTPageFaultHandler(void* exception_pc,
|
||||
return Common::PageFaultHandler::HandlerResult::ExecuteNextHandler;
|
||||
}
|
||||
|
||||
#endif // WITH_RECOMPILER
|
||||
#endif // ENABLE_RECOMPILER
|
||||
|
||||
} // namespace CPU::CodeCache
|
||||
|
||||
#ifdef WITH_RECOMPILER
|
||||
#ifdef ENABLE_RECOMPILER
|
||||
|
||||
void CPU::Recompiler::Thunks::ResolveBranch(CodeBlock* block, void* host_pc, void* host_resolve_pc, u32 host_pc_size)
|
||||
{
|
||||
@ -1294,4 +1294,4 @@ void CPU::Recompiler::Thunks::LogPC(u32 pc)
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // WITH_RECOMPILER
|
||||
#endif // ENABLE_RECOMPILER
|
||||
|
||||
Reference in New Issue
Block a user