DSPJit: Suppress offsetof conditionally-supported warnings

The DSP JIT only applies on x64, so if it doesn't work on esoteric compilers then that's not a problem.  (And if it fails to compile, then it'll still produce an error on that platform, just no warnings on other platforms)
This commit is contained in:
Pokechu22 2022-01-16 23:55:23 -08:00
parent 15f80f7234
commit 5f9e04be1d
3 changed files with 21 additions and 0 deletions

View File

@ -470,6 +470,10 @@ void DSPEmitter::CompileDispatcher()
RET();
}
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
#endif
Gen::OpArg DSPEmitter::M_SDSP_pc()
{
return MDisp(R15, static_cast<int>(offsetof(SDSP, pc)));
@ -503,5 +507,8 @@ Gen::OpArg DSPEmitter::M_SDSP_reg_stack_ptrs(size_t index)
return MDisp(R15, static_cast<int>(offsetof(SDSP, reg_stack_ptrs) +
sizeof(SDSP::reg_stack_ptrs[0]) * index));
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
} // namespace DSP::JIT::x64

View File

@ -149,7 +149,14 @@ void DSPEmitter::multiply_mulx(u8 axh0, u8 axh1)
// direct use of prod regs by AX/AXWII (look @that part of ucode).
void DSPEmitter::clrp(const UDSPInstruction opc)
{
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
#endif
int offset = static_cast<int>(offsetof(SDSP, r.prod.val));
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
// 64bit move to memory does not work. use 2 32bits
MOV(32, MDisp(R15, offset + 0 * sizeof(u32)), Imm32(0xfff00000U));
MOV(32, MDisp(R15, offset + 1 * sizeof(u32)), Imm32(0x001000ffU));

View File

@ -20,6 +20,10 @@ namespace DSP::JIT::x64
constexpr std::array<X64Reg, 15> s_allocation_order = {
{R8, R9, R10, R11, R12, R13, R14, R15, RSI, RDI, RBX, RCX, RDX, RAX, RBP}};
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
#endif
static Gen::OpArg GetRegisterPointer(size_t reg)
{
switch (reg)
@ -95,6 +99,9 @@ static Gen::OpArg GetRegisterPointer(size_t reg)
return M(static_cast<void*>(nullptr));
}
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#define STATIC_REG_ACCS
//#undef STATIC_REG_ACCS