From 6914eca167d35b4ffb3e1979bb690b378bb8448a Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Sun, 23 Feb 2014 15:14:27 +0100 Subject: [PATCH] Fix various warnings reported by clang - mostly remove unused variables - rename some generic JIT identifiers --- Source/Core/AudioCommon/AudioCommon.cpp | 2 +- Source/Core/Core/ARDecrypt.cpp | 5 ---- Source/Core/Core/BootManager.cpp | 8 +++--- Source/Core/Core/ConfigManager.cpp | 4 +-- Source/Core/Core/ConfigManager.h | 2 +- .../HW/DSPHLE/UCodes/UCode_Zelda_Voice.cpp | 2 +- .../HW/WiimoteEmu/Attachment/Attachment.cpp | 4 +-- .../Core/PowerPC/Jit64/Jit_FloatingPoint.cpp | 1 - .../PowerPC/Jit64/Jit_LoadStoreFloating.cpp | 2 -- .../PowerPC/Jit64/Jit_LoadStorePaired.cpp | 2 -- Source/Core/DiscIO/WbfsBlob.cpp | 7 ++--- Source/Core/DolphinWX/ConfigMain.cpp | 5 ++-- Source/Core/DolphinWX/NetWindow.cpp | 2 +- Source/Core/VideoCommon/BPFunctions.cpp | 1 - .../Core/VideoCommon/TextureDecoder_x64.cpp | 7 ----- Source/Core/VideoCommon/VertexLoader.cpp | 28 ++++++++----------- Source/Core/VideoCommon/VertexLoader.h | 9 +++++- 17 files changed, 37 insertions(+), 54 deletions(-) diff --git a/Source/Core/AudioCommon/AudioCommon.cpp b/Source/Core/AudioCommon/AudioCommon.cpp index a8229b3f84..b964b6b84a 100644 --- a/Source/Core/AudioCommon/AudioCommon.cpp +++ b/Source/Core/AudioCommon/AudioCommon.cpp @@ -134,7 +134,7 @@ namespace AudioCommon { return true; } - return SConfig::GetInstance().m_EnableJIT; + return SConfig::GetInstance().m_DSPEnableJIT; } void PauseAndLock(bool doLock, bool unpauseOnUnlock) diff --git a/Source/Core/Core/ARDecrypt.cpp b/Source/Core/Core/ARDecrypt.cpp index 8a9c4c6e81..cac721aeea 100644 --- a/Source/Core/Core/ARDecrypt.cpp +++ b/Source/Core/Core/ARDecrypt.cpp @@ -22,11 +22,6 @@ const char *filter = "0123456789ABCDEFGHJKMNPQRTUVWXYZILOS"; u32 genseeds[0x20]; - -const u8 bitstringlen[0x08] = { - 0x06, 0x0A, 0x0C, 0x11, 0x11, 0x08, 0x07, 0x20, -}; - const u8 gentable0[0x38] = { 0x39, 0x31, 0x29, 0x21, 0x19, 0x11, 0x09, 0x01, 0x3A, 0x32, 0x2A, 0x22, 0x1A, 0x12, 0x0A, 0x02, diff --git a/Source/Core/Core/BootManager.cpp b/Source/Core/Core/BootManager.cpp index 35f311ba32..2417df8f27 100644 --- a/Source/Core/Core/BootManager.cpp +++ b/Source/Core/Core/BootManager.cpp @@ -109,7 +109,7 @@ bool BootCore(const std::string& _rFilename) config_cache.bDSPHLE = StartUp.bDSPHLE; config_cache.strBackend = StartUp.m_strVideoBackend; config_cache.bHLE_BS2 = StartUp.bHLE_BS2; - config_cache.m_EnableJIT = SConfig::GetInstance().m_EnableJIT; + config_cache.m_EnableJIT = SConfig::GetInstance().m_DSPEnableJIT; config_cache.bDSPThread = StartUp.bDSPThread; config_cache.Volume = SConfig::GetInstance().m_Volume; config_cache.sBackend = SConfig::GetInstance().sBackend; @@ -158,7 +158,7 @@ bool BootCore(const std::string& _rFilename) } if (game_ini.Get("DSP", "Volume", &SConfig::GetInstance().m_Volume, SConfig::GetInstance().m_Volume)) config_cache.bSetVolume = true; - game_ini.Get("DSP", "EnableJIT", &SConfig::GetInstance().m_EnableJIT, SConfig::GetInstance().m_EnableJIT); + game_ini.Get("DSP", "EnableJIT", &SConfig::GetInstance().m_DSPEnableJIT, SConfig::GetInstance().m_DSPEnableJIT); game_ini.Get("DSP", "Backend", &SConfig::GetInstance().sBackend, SConfig::GetInstance().sBackend); VideoBackend::ActivateBackend(StartUp.m_strVideoBackend); @@ -223,7 +223,7 @@ bool BootCore(const std::string& _rFilename) StartUp.bDSPHLE = g_NetPlaySettings.m_DSPHLE; StartUp.bEnableMemcardSaving = g_NetPlaySettings.m_WriteToMemcard; StartUp.iCPUCore = g_NetPlaySettings.m_CPUcore; - SConfig::GetInstance().m_EnableJIT = g_NetPlaySettings.m_DSPEnableJIT; + SConfig::GetInstance().m_DSPEnableJIT = g_NetPlaySettings.m_DSPEnableJIT; SConfig::GetInstance().m_EXIDevice[0] = g_NetPlaySettings.m_EXIDevice[0]; SConfig::GetInstance().m_EXIDevice[1] = g_NetPlaySettings.m_EXIDevice[1]; config_cache.bSetEXIDevice[0] = true; @@ -268,7 +268,7 @@ void Stop() VideoBackend::ActivateBackend(StartUp.m_strVideoBackend); StartUp.bHLE_BS2 = config_cache.bHLE_BS2; SConfig::GetInstance().sBackend = config_cache.sBackend; - SConfig::GetInstance().m_EnableJIT = config_cache.m_EnableJIT; + SConfig::GetInstance().m_DSPEnableJIT = config_cache.m_EnableJIT; // Only change these back if they were actually set by game ini, since they can be changed while a game is running. if (config_cache.bSetFramelimit) diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index 7e2d333534..8a58f1d1e6 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -267,7 +267,7 @@ void SConfig::SaveSettings() ini.Set("Movie", "Author", m_strMovieAuthor); // DSP - ini.Set("DSP", "EnableJIT", m_EnableJIT); + ini.Set("DSP", "EnableJIT", m_DSPEnableJIT); ini.Set("DSP", "DumpAudio", m_DumpAudio); ini.Set("DSP", "Backend", sBackend); ini.Set("DSP", "Volume", m_Volume); @@ -430,7 +430,7 @@ void SConfig::LoadSettings() ini.Get("Movie", "Author", &m_strMovieAuthor, ""); // DSP - ini.Get("DSP", "EnableJIT", &m_EnableJIT, true); + ini.Get("DSP", "EnableJIT", &m_DSPEnableJIT, true); ini.Get("DSP", "DumpAudio", &m_DumpAudio, false); #if defined __linux__ && HAVE_ALSA ini.Get("DSP", "Backend", &sBackend, BACKEND_ALSA); diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h index 53bf2f592a..49d5c17caa 100644 --- a/Source/Core/Core/ConfigManager.h +++ b/Source/Core/Core/ConfigManager.h @@ -79,7 +79,7 @@ struct SConfig : NonCopyable unsigned int m_FrameSkip; // DSP settings - bool m_EnableJIT; + bool m_DSPEnableJIT; bool m_DumpAudio; int m_Volume; std::string sBackend; diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_Voice.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_Voice.cpp index bd503baebd..40bd33378b 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_Voice.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_Voice.cpp @@ -296,7 +296,7 @@ restart: { PB.ReachedEnd = 0; - if ((PB.RepeatMode == 0) || (!PB.StopOnSilence == 0)) + if ((PB.RepeatMode == 0) || (PB.StopOnSilence != 0)) { PB.KeyOff = 1; PB.RemLength = 0; diff --git a/Source/Core/Core/HW/WiimoteEmu/Attachment/Attachment.cpp b/Source/Core/Core/HW/WiimoteEmu/Attachment/Attachment.cpp index cb7faafdc7..7bfa2d9d71 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Attachment/Attachment.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/Attachment/Attachment.cpp @@ -10,8 +10,8 @@ namespace WiimoteEmu // Extension device IDs to be written to the last bytes of the extension reg // The id for nothing inserted static const u8 nothing_id[] = { 0x00, 0x00, 0x00, 0x00, 0x2e, 0x2e }; -// The id for a partially inserted extension -static const u8 partially_id[] = { 0x00, 0x00, 0x00, 0x00, 0xff, 0xff }; +// The id for a partially inserted extension (currently unused) +//static const u8 partially_id[] = { 0x00, 0x00, 0x00, 0x00, 0xff, 0xff }; Attachment::Attachment( const char* const _name, WiimoteEmu::ExtensionReg& _reg ) : name( _name ), reg( _reg ) diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp index 389c29ca07..03cd753f0b 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp @@ -10,7 +10,6 @@ static const u64 GC_ALIGNED16(psSignBits2[2]) = {0x8000000000000000ULL, 0x8000000000000000ULL}; static const u64 GC_ALIGNED16(psAbsMask2[2]) = {0x7FFFFFFFFFFFFFFFULL, 0x7FFFFFFFFFFFFFFFULL}; -static const double GC_ALIGNED16(psOneOne2[2]) = {1.0, 1.0}; static const double one_const = 1.0f; void Jit64::fp_tri_op(int d, int a, int b, bool reversible, bool single, void (XEmitter::*op)(Gen::X64Reg, Gen::OpArg)) diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStoreFloating.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStoreFloating.cpp index dac3b9aad2..6d8879a722 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStoreFloating.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStoreFloating.cpp @@ -16,10 +16,8 @@ namespace { // pshufb todo: MOVQ const u8 GC_ALIGNED16(bswapShuffle1x4[16]) = {3, 2, 1, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; -const u8 GC_ALIGNED16(bswapShuffle2x4[16]) = {3, 2, 1, 0, 7, 6, 5, 4, 8, 9, 10, 11, 12, 13, 14, 15}; const u8 GC_ALIGNED16(bswapShuffle1x8[16]) = {7, 6, 5, 4, 3, 2, 1, 0, 8, 9, 10, 11, 12, 13, 14, 15}; const u8 GC_ALIGNED16(bswapShuffle1x8Dupe[16]) = {7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0}; -const u8 GC_ALIGNED16(bswapShuffle2x8[16]) = {7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8}; u64 GC_ALIGNED16(temp64); diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp index d2557d3d1b..14c5c6164a 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp @@ -12,8 +12,6 @@ #include "Core/PowerPC/Jit64/JitAsm.h" #include "Core/PowerPC/Jit64/JitRegCache.h" -const u8 GC_ALIGNED16(pbswapShuffle2x4[16]) = {3, 2, 1, 0, 7, 6, 5, 4, 8, 9, 10, 11, 12, 13, 14, 15}; - // The big problem is likely instructions that set the quantizers in the same block. // We will have to break block after quantizers are written to. void Jit64::psq_st(UGeckoInstruction inst) diff --git a/Source/Core/DiscIO/WbfsBlob.cpp b/Source/Core/DiscIO/WbfsBlob.cpp index b51c14ae9a..4e77d9e959 100644 --- a/Source/Core/DiscIO/WbfsBlob.cpp +++ b/Source/Core/DiscIO/WbfsBlob.cpp @@ -14,10 +14,9 @@ namespace DiscIO { -const u64 wii_sector_size = 0x8000; -const u64 wii_sector_count = 143432 * 2; -const u64 wii_sector_log2 = 15; -const u64 wii_disc_header_size = 256; +static const u64 wii_sector_size = 0x8000; +static const u64 wii_sector_count = 143432 * 2; +static const u64 wii_disc_header_size = 256; static inline u64 align(u64 value, u64 bounds) { diff --git a/Source/Core/DolphinWX/ConfigMain.cpp b/Source/Core/DolphinWX/ConfigMain.cpp index 716a47b93b..04c740cb55 100644 --- a/Source/Core/DolphinWX/ConfigMain.cpp +++ b/Source/Core/DolphinWX/ConfigMain.cpp @@ -368,7 +368,7 @@ void CConfigMain::InitializeGUIValues() if (startup_params.bDSPHLE) DSPEngine->SetSelection(0); else - DSPEngine->SetSelection(SConfig::GetInstance().m_EnableJIT ? 1 : 2); + DSPEngine->SetSelection(SConfig::GetInstance().m_DSPEnableJIT ? 1 : 2); // Audio VolumeSlider->Enable(SupportsVolumeChanges(SConfig::GetInstance().sBackend)); @@ -957,8 +957,7 @@ void CConfigMain::AudioSettingsChanged(wxCommandEvent& event) { case ID_DSPENGINE: SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE = DSPEngine->GetSelection() == 0; - if (!DSPEngine->GetSelection() == 0) - SConfig::GetInstance().m_EnableJIT = DSPEngine->GetSelection() == 1; + SConfig::GetInstance().m_DSPEnableJIT = DSPEngine->GetSelection() == 1; AudioCommon::UpdateSoundStream(); break; diff --git a/Source/Core/DolphinWX/NetWindow.cpp b/Source/Core/DolphinWX/NetWindow.cpp index 82f0dd4db6..72aa86f76b 100644 --- a/Source/Core/DolphinWX/NetWindow.cpp +++ b/Source/Core/DolphinWX/NetWindow.cpp @@ -442,7 +442,7 @@ void NetPlayDiag::GetNetSettings(NetSettings &settings) settings.m_CPUthread = instance.m_LocalCoreStartupParameter.bCPUThread; settings.m_CPUcore = instance.m_LocalCoreStartupParameter.iCPUCore; settings.m_DSPHLE = instance.m_LocalCoreStartupParameter.bDSPHLE; - settings.m_DSPEnableJIT = instance.m_EnableJIT; + settings.m_DSPEnableJIT = instance.m_DSPEnableJIT; settings.m_WriteToMemcard = m_memcard_write->GetValue(); settings.m_EXIDevice[0] = instance.m_EXIDevice[0]; settings.m_EXIDevice[1] = instance.m_EXIDevice[1]; diff --git a/Source/Core/VideoCommon/BPFunctions.cpp b/Source/Core/VideoCommon/BPFunctions.cpp index a3bcd3af30..1149392179 100644 --- a/Source/Core/VideoCommon/BPFunctions.cpp +++ b/Source/Core/VideoCommon/BPFunctions.cpp @@ -14,7 +14,6 @@ #include "VideoCommon/VertexShaderManager.h" #include "VideoCommon/VideoConfig.h" -const bool renderFog = false; namespace BPFunctions { // ---------------------------------------------- diff --git a/Source/Core/VideoCommon/TextureDecoder_x64.cpp b/Source/Core/VideoCommon/TextureDecoder_x64.cpp index d00a9bb454..875ba8f8e2 100644 --- a/Source/Core/VideoCommon/TextureDecoder_x64.cpp +++ b/Source/Core/VideoCommon/TextureDecoder_x64.cpp @@ -177,13 +177,6 @@ int TexDecoder_GetPaletteSize(int format) } } -static inline u32 decodeIA8(u16 val) -{ - int a = val >> 8; - int i = val & 0xFF; - return (a << 24) | (i << 16) | (i << 8) | i; -} - static inline u32 decode5A3(u16 val) { int r,g,b,a; diff --git a/Source/Core/VideoCommon/VertexLoader.cpp b/Source/Core/VideoCommon/VertexLoader.cpp index a9bdb468b8..29abdb227c 100644 --- a/Source/Core/VideoCommon/VertexLoader.cpp +++ b/Source/Core/VideoCommon/VertexLoader.cpp @@ -28,11 +28,6 @@ //BBox #include "VideoCommon/XFMemory.h" -#ifndef _M_GENERIC -#ifndef __APPLE__ -#define USE_JIT -#endif -#endif #define COMPILED_CODE_SIZE 4096 @@ -472,7 +467,6 @@ VertexLoader::VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr) m_compiledCode = NULL; m_numLoadedVertices = 0; m_VertexSize = 0; - m_numPipelineStages = 0; m_NativeFmt = 0; loop_counter = 0; VertexLoader_Normal::Init(); @@ -482,11 +476,12 @@ VertexLoader::VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr) m_VtxDesc = vtx_desc; SetVAT(vtx_attr.g0.Hex, vtx_attr.g1.Hex, vtx_attr.g2.Hex); - #ifdef USE_JIT + #ifdef USE_VERTEX_LOADER_JIT AllocCodeSpace(COMPILED_CODE_SIZE); CompileVertexTranslator(); WriteProtect(); #else + m_numPipelineStages = 0; CompileVertexTranslator(); #endif @@ -494,7 +489,7 @@ VertexLoader::VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr) VertexLoader::~VertexLoader() { - #ifdef USE_JIT + #ifdef USE_VERTEX_LOADER_JIT FreeCodeSpace(); #endif delete m_NativeFmt; @@ -505,7 +500,7 @@ void VertexLoader::CompileVertexTranslator() m_VertexSize = 0; const TVtxAttr &vtx_attr = m_VtxAttr; -#ifdef USE_JIT +#ifdef USE_VERTEX_LOADER_JIT if (m_compiledCode) PanicAlert("Trying to recompile a vertex translator"); @@ -531,6 +526,9 @@ void VertexLoader::CompileVertexTranslator() WriteSetVariable(32, &s_texmtxwrite, Imm32(0)); WriteSetVariable(32, &s_texmtxread, Imm32(0)); } +#else + // Reset pipeline + m_numPipelineStages = 0; #endif // Colors @@ -544,8 +542,6 @@ void VertexLoader::CompileVertexTranslator() m_VtxDesc.Tex4Coord, m_VtxDesc.Tex5Coord, m_VtxDesc.Tex6Coord, (const u32)((m_VtxDesc.Hex >> 31) & 3) }; - // Reset pipeline - m_numPipelineStages = 0; u32 components = 0; // Position in pc vertex format. @@ -770,7 +766,7 @@ void VertexLoader::CompileVertexTranslator() native_stride = nat_offset; vtx_decl.stride = native_stride; -#ifdef USE_JIT +#ifdef USE_VERTEX_LOADER_JIT // End loop here #ifdef _M_X64 MOV(64, R(RAX), Imm64((u64)&loop_counter)); @@ -790,7 +786,7 @@ void VertexLoader::CompileVertexTranslator() void VertexLoader::WriteCall(TPipelineFunction func) { -#ifdef USE_JIT +#ifdef USE_VERTEX_LOADER_JIT #ifdef _M_X64 MOV(64, R(RAX), Imm64((u64)func)); CALLptr(R(RAX)); @@ -805,7 +801,7 @@ void VertexLoader::WriteCall(TPipelineFunction func) #ifndef _M_GENERIC void VertexLoader::WriteGetVariable(int bits, OpArg dest, void *address) { -#ifdef USE_JIT +#ifdef USE_VERTEX_LOADER_JIT #ifdef _M_X64 MOV(64, R(RAX), Imm64((u64)address)); MOV(bits, dest, MatR(RAX)); @@ -817,7 +813,7 @@ void VertexLoader::WriteGetVariable(int bits, OpArg dest, void *address) void VertexLoader::WriteSetVariable(int bits, void *address, OpArg value) { -#ifdef USE_JIT +#ifdef USE_VERTEX_LOADER_JIT #ifdef _M_X64 MOV(64, R(RAX), Imm64((u64)address)); MOV(bits, MatR(RAX), value); @@ -870,7 +866,7 @@ void VertexLoader::SetupRunVertices(int vtx_attr_group, int primitive, int const void VertexLoader::ConvertVertices ( int count ) { -#ifdef USE_JIT +#ifdef USE_VERTEX_LOADER_JIT if (count > 0) { loop_counter = count; diff --git a/Source/Core/VideoCommon/VertexLoader.h b/Source/Core/VideoCommon/VertexLoader.h index 6b720b54aa..01c4bb0acd 100644 --- a/Source/Core/VideoCommon/VertexLoader.h +++ b/Source/Core/VideoCommon/VertexLoader.h @@ -17,6 +17,11 @@ #include "VideoCommon/DataReader.h" #include "VideoCommon/NativeVertexFormat.h" +#ifndef _M_GENERIC +#ifndef __APPLE__ +#define USE_VERTEX_LOADER_JIT +#endif +#endif class VertexLoaderUID { @@ -119,9 +124,11 @@ private: NativeVertexFormat *m_NativeFmt; int native_stride; - // Pipeline. To be JIT compiled in the future. +#ifndef USE_VERTEX_LOADER_JIT + // Pipeline. TPipelineFunction m_PipelineStages[64]; // TODO - figure out real max. it's lower. int m_numPipelineStages; +#endif const u8 *m_compiledCode;