void Optimize()
{
// perform some optimizations on ps.1.1 machine instructions
if ( ( activeContexts & (int)ContextKeyPattern.PS_1_1 ) > 0 )
{
// need to check last few instructions to make sure r0 is set
// ps.1.1 emulation uses r4 for r0 so last couple of instructions will probably require
// changine destination register back to r0
if ( lastInstructionPos < phase2ALU_mi.Count )
{
// first argument at mLastInstructionPos + 2 is destination register for all ps.1.1 ALU instructions
phase2ALU_mi[ lastInstructionPos + 2 ] = Gl.GL_REG_0_ATI;
// if was an alpha op only then modify second last instruction destination register
if ( ( (MachineInstruction)phase2ALU_mi[ lastInstructionPos ] == MachineInstruction.AlphaOp1 ) ||
( (MachineInstruction)phase2ALU_mi[ lastInstructionPos ] == MachineInstruction.AlphaOp2 ) ||
( (MachineInstruction)phase2ALU_mi[ lastInstructionPos ] == MachineInstruction.AlphaOp3 ) )
{
phase2ALU_mi[ secondLastInstructionPos + 2 ] = Gl.GL_REG_0_ATI;
}
}// end if (mLastInstructionPos < mMachineInstructions.size())
}// end if (mActiveContexts & ckp_PS_1_1)
}