Skip to content

Commit

Permalink
Fix various warnings reported by clang
Browse files Browse the repository at this point in the history
- mostly remove unused variables
- rename some generic JIT identifiers
  • Loading branch information
Tilka committed Feb 28, 2014
1 parent a350882 commit 6914eca
Show file tree
Hide file tree
Showing 17 changed files with 37 additions and 54 deletions.
2 changes: 1 addition & 1 deletion Source/Core/AudioCommon/AudioCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ namespace AudioCommon
{
return true;
}
return SConfig::GetInstance().m_EnableJIT;
return SConfig::GetInstance().m_DSPEnableJIT;
}

void PauseAndLock(bool doLock, bool unpauseOnUnlock)
Expand Down
5 changes: 0 additions & 5 deletions Source/Core/Core/ARDecrypt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions Source/Core/Core/BootManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Core/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/ConfigManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_Voice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ void CUCode_Zelda::RenderVoice_AFC(ZeldaVoicePB &PB, s16 *_Buffer, int _Size)
{
PB.ReachedEnd = 0;

if ((PB.RepeatMode == 0) || (!PB.StopOnSilence == 0))
if ((PB.RepeatMode == 0) || (PB.StopOnSilence != 0))
{
PB.KeyOff = 1;
PB.RemLength = 0;
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Core/HW/WiimoteEmu/Attachment/Attachment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
1 change: 0 additions & 1 deletion Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 0 additions & 2 deletions Source/Core/Core/PowerPC/Jit64/Jit_LoadStoreFloating.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 0 additions & 2 deletions Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 3 additions & 4 deletions Source/Core/DiscIO/WbfsBlob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
5 changes: 2 additions & 3 deletions Source/Core/DolphinWX/ConfigMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/DolphinWX/NetWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
1 change: 0 additions & 1 deletion Source/Core/VideoCommon/BPFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "VideoCommon/VertexShaderManager.h"
#include "VideoCommon/VideoConfig.h"

const bool renderFog = false;
namespace BPFunctions
{
// ----------------------------------------------
Expand Down
7 changes: 0 additions & 7 deletions Source/Core/VideoCommon/TextureDecoder_x64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
28 changes: 12 additions & 16 deletions Source/Core/VideoCommon/VertexLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@

//BBox
#include "VideoCommon/XFMemory.h"
#ifndef _M_GENERIC
#ifndef __APPLE__
#define USE_JIT
#endif
#endif

#define COMPILED_CODE_SIZE 4096

Expand Down Expand Up @@ -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();
Expand All @@ -482,19 +476,20 @@ 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

}

VertexLoader::~VertexLoader()
{
#ifdef USE_JIT
#ifdef USE_VERTEX_LOADER_JIT
FreeCodeSpace();
#endif
delete m_NativeFmt;
Expand All @@ -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");

Expand All @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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));
Expand All @@ -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));
Expand All @@ -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));
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
9 changes: 8 additions & 1 deletion Source/Core/VideoCommon/VertexLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -119,9 +124,11 @@ class VertexLoader
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;

Expand Down

0 comments on commit 6914eca

Please sign in to comment.