PowerPC: Document the instruction table flags

Should make it easier for newcomers to get up to speed.
This commit is contained in:
Lioncash 2015-02-18 00:05:35 -05:00
parent 127e742992
commit 0b3a2ae4ca
1 changed files with 33 additions and 32 deletions

View File

@ -7,50 +7,51 @@
#include "Core/PowerPC/Gekko.h"
#include "Core/PowerPC/Interpreter/Interpreter.h"
// Flags that indicate what an instruction can do.
enum
{
FL_SET_CR0 = (1<<0), //
FL_SET_CR1 = (1<<1), //
FL_SET_CRn = (1<<2), //
FL_SET_CRx = FL_SET_CR0 | FL_SET_CR1 | FL_SET_CRn, //
FL_SET_CA = (1<<3), // carry
FL_READ_CA = (1<<4), // carry
FL_RC_BIT = (1<<5),
FL_RC_BIT_F = (1<<6),
FL_ENDBLOCK = (1<<7),
FL_IN_A = (1<<8),
FL_IN_A0 = (1<<9),
FL_IN_B = (1<<10),
FL_IN_C = (1<<11),
FL_IN_S = (1<<12),
FL_SET_CR0 = (1<<0), // Sets CR0.
FL_SET_CR1 = (1<<1), // Sets CR1.
FL_SET_CRn = (1<<2), // Encoding decides which CR can be set.
FL_SET_CRx = FL_SET_CR0 | FL_SET_CR1 | FL_SET_CRn,
FL_SET_CA = (1<<3), // Sets the carry flag.
FL_READ_CA = (1<<4), // Reads the carry flag.
FL_RC_BIT = (1<<5), // Sets the record bit.
FL_RC_BIT_F = (1<<6), // Sets the record bit. Used for floatig point instructions that do this.
FL_ENDBLOCK = (1<<7), // Specifies the end of a JIT block.
FL_IN_A = (1<<8), // Uses rA as an input.
FL_IN_A0 = (1<<9), // Uses rA as an input. Indicates when rA is used with an instruction, it's treated as if it has the value zero in it.
FL_IN_B = (1<<10), // Uses rB as an input.
FL_IN_C = (1<<11), // Uses rC as an input.
FL_IN_S = (1<<12), // Uses rS as an input.
FL_IN_AB = FL_IN_A | FL_IN_B,
FL_IN_AC = FL_IN_A | FL_IN_C,
FL_IN_ABC = FL_IN_A | FL_IN_B | FL_IN_C,
FL_IN_SB = FL_IN_S | FL_IN_B,
FL_IN_A0B = FL_IN_A0 | FL_IN_B,
FL_IN_A0BC = FL_IN_A0 | FL_IN_B | FL_IN_C,
FL_OUT_D = (1<<13),
FL_OUT_S = FL_OUT_D,
FL_OUT_A = (1<<14),
FL_OUT_D = (1<<13), // rD is used as a destination.
FL_OUT_S = FL_OUT_D, // rS is used as a destination.
FL_OUT_A = (1<<14), // rA is used as a destination.
FL_OUT_AD = FL_OUT_A | FL_OUT_D,
FL_TIMER = (1<<15),
FL_CHECKEXCEPTIONS = (1<<16),
FL_EVIL = (1<<17),
FL_USE_FPU = (1<<18),
FL_LOADSTORE = (1<<19),
FL_SET_FPRF = (1<<20),
FL_READ_FPRF = (1<<21),
FL_SET_OE = (1<<22),
FL_IN_FLOAT_A = (1<<23),
FL_IN_FLOAT_B = (1<<24),
FL_IN_FLOAT_C = (1<<25),
FL_IN_FLOAT_S = (1<<26),
FL_IN_FLOAT_D = (1<<27),
FL_TIMER = (1<<15), // Used only for mftb.
FL_CHECKEXCEPTIONS = (1<<16), // Used with rfi/rfid.
FL_EVIL = (1<<17), // Historically used to refer to instructions that messed up Super Monkey Ball.
FL_USE_FPU = (1<<18), // Used to indicate a floating point instruction.
FL_LOADSTORE = (1<<19), // Used to indicate a load/store instruction.
FL_SET_FPRF = (1<<20), // Sets bits in the FPRF.
FL_READ_FPRF = (1<<21), // Reads bits from the FPRF.
FL_SET_OE = (1<<22), // Sets the overflow flag.
FL_IN_FLOAT_A = (1<<23), // frA is used as an input.
FL_IN_FLOAT_B = (1<<24), // frB is used as an input.
FL_IN_FLOAT_C = (1<<25), // frC is used as an input.
FL_IN_FLOAT_S = (1<<26), // frS is used as an input.
FL_IN_FLOAT_D = (1<<27), // frD is used as an input.
FL_IN_FLOAT_AB = FL_IN_FLOAT_A | FL_IN_FLOAT_B,
FL_IN_FLOAT_AC = FL_IN_FLOAT_A | FL_IN_FLOAT_C,
FL_IN_FLOAT_ABC = FL_IN_FLOAT_A | FL_IN_FLOAT_B | FL_IN_FLOAT_C,
FL_OUT_FLOAT_D = (1<<28),
FL_OUT_FLOAT_S = (1<<29),
FL_OUT_FLOAT_D = (1<<28), // frD is used as a destination.
FL_OUT_FLOAT_S = (1<<29), // frS is used as a destination.
// Used in the case of double ops (they don't modify the top half of the output)
FL_INOUT_FLOAT_D = FL_IN_FLOAT_D | FL_OUT_FLOAT_D,
};