2023-12-22 11:57:49 +00:00
|
|
|
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
|
|
|
|
// SPDX-License-Identifier: LGPL-3.0+
|
2009-07-03 00:49:40 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2016-11-12 15:28:37 +00:00
|
|
|
namespace x86Emitter
|
|
|
|
{
|
2009-07-03 00:49:40 +00:00
|
|
|
|
2009-11-06 21:45:30 +00:00
|
|
|
// helpermess is currently broken >_<
|
2009-07-03 00:49:40 +00:00
|
|
|
|
2009-11-06 21:45:30 +00:00
|
|
|
#if 0
|
2009-07-03 00:49:40 +00:00
|
|
|
|
|
|
|
template< typename xImpl, typename T >
|
2009-11-06 21:45:30 +00:00
|
|
|
void _DoI_helpermess( const xImpl& helpme, const xDirectOrIndirect& to, const xImmReg<T>& immOrReg )
|
2009-07-03 00:49:40 +00:00
|
|
|
{
|
|
|
|
if( to.IsDirect() )
|
|
|
|
{
|
|
|
|
if( immOrReg.IsReg() )
|
|
|
|
helpme( to.GetReg(), immOrReg.GetReg() );
|
|
|
|
else
|
|
|
|
helpme( to.GetReg(), immOrReg.GetImm() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( immOrReg.IsReg() )
|
|
|
|
helpme( to.GetMem(), immOrReg.GetReg() );
|
|
|
|
else
|
|
|
|
helpme( to.GetMem(), immOrReg.GetImm() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template< typename xImpl, typename T >
|
|
|
|
void _DoI_helpermess( const xImpl& helpme, const ModSibBase& to, const xImmReg<T>& immOrReg )
|
|
|
|
{
|
|
|
|
if( immOrReg.IsReg() )
|
|
|
|
helpme( to, immOrReg.GetReg() );
|
|
|
|
else
|
2009-11-06 21:45:30 +00:00
|
|
|
helpme( (ModSibStrict)to, immOrReg.GetImm() );
|
2009-07-03 00:49:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template< typename xImpl, typename T >
|
|
|
|
void _DoI_helpermess( const xImpl& helpme, const xDirectOrIndirect<T>& to, int imm )
|
|
|
|
{
|
|
|
|
if( to.IsDirect() )
|
|
|
|
helpme( to.GetReg(), imm );
|
|
|
|
else
|
|
|
|
helpme( to.GetMem(), imm );
|
|
|
|
}
|
|
|
|
|
|
|
|
template< typename xImpl, typename T >
|
|
|
|
void _DoI_helpermess( const xImpl& helpme, const xDirectOrIndirect<T>& parm )
|
|
|
|
{
|
|
|
|
if( parm.IsDirect() )
|
|
|
|
helpme( parm.GetReg() );
|
2010-04-25 00:31:27 +00:00
|
|
|
else
|
2009-07-03 00:49:40 +00:00
|
|
|
helpme( parm.GetMem() );
|
|
|
|
}
|
|
|
|
|
|
|
|
template< typename xImpl, typename T >
|
|
|
|
void _DoI_helpermess( const xImpl& helpme, const xDirectOrIndirect<T>& to, const xDirectOrIndirect<T>& from )
|
|
|
|
{
|
|
|
|
if( to.IsDirect() && from.IsDirect() )
|
|
|
|
helpme( to.GetReg(), from.GetReg() );
|
|
|
|
|
|
|
|
else if( to.IsDirect() )
|
|
|
|
helpme( to.GetReg(), from.GetMem() );
|
|
|
|
|
|
|
|
else if( from.IsDirect() )
|
|
|
|
helpme( to.GetMem(), from.GetReg() );
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
// One of the fields needs to be direct, or else we cannot complete the operation.
|
|
|
|
// (intel doesn't support indirects in both fields)
|
|
|
|
|
2009-10-04 15:34:40 +00:00
|
|
|
pxFailDev( "Invalid asm instruction: Both operands are indirect memory addresses." );
|
2009-07-03 00:49:40 +00:00
|
|
|
}
|
2009-11-06 21:45:30 +00:00
|
|
|
#endif
|
|
|
|
|
2016-11-12 15:28:37 +00:00
|
|
|
} // End namespace x86Emitter
|