/// <summary>
        /// Visitation function for <see cref="IX86Visitor.Call"/> instructions.
        /// </summary>
        /// <param name="context">The context.</param>
        void IX86Visitor.Call(Context context)
        {
            if (context.Operand1 == null)
                return;

            if (!context.Operand1.IsCPURegister)
                return;

            var before = context.Previous;

            if (!before.Result.IsCPURegister)
                return;

            if (context.Operand1.Register != before.Result.Register)
                return;

            before.SetInstruction(X86.Call, null, before.Operand1);
            context.Delete(false);
        }
 /// <summary>
 /// Visitation function for <see cref="IX86Visitor.Nop"/> instructions.
 /// </summary>
 /// <param name="context">The context.</param>
 void IX86Visitor.Nop(Context context)
 {
     context.Delete(false);
 }
        /// <summary>
        /// Visitation function for <see cref="IX86Visitor.Call"/> instructions.
        /// </summary>
        /// <param name="context">The context.</param>
        void IX86Visitor.Call(Context context)
        {
            if (context.Operand1 == null)
                return;

            if (!context.Operand1.IsCPURegister)
                return;

            var before = context.Previous;

            while (before.IsEmpty && !before.IsBlockStartInstruction)
            {
                before = before.Previous;
            }

            if (before == null || before.IsBlockStartInstruction)
                return;

            if (!before.Result.IsCPURegister)
                return;

            if (context.Operand1.Register != before.Result.Register)
                return;

            before.SetInstruction(X86.Call, null, before.Operand1);
            context.Delete(false);
        }
        /// <summary>
        /// Visitation function for <see cref="IX86Visitor.Mov"/> instructions.
        /// </summary>
        /// <param name="context">The context.</param>
        void IX86Visitor.Mov(Context context)
        {
            if (context.Result.IsCPURegister && context.Operand1.IsCPURegister && context.Result.Register == context.Operand1.Register)
            {
                context.Delete(false);
                return;
            }

            // Mov can not use ESI or EDI registers with 8 or 16 bit memory or register
            if (context.Operand1.IsCPURegister && (context.Result.IsMemoryAddress || context.Result.IsCPURegister)
                && (context.Result.IsByte || context.Result.IsShort || context.Result.IsChar || context.Result.IsBoolean)
                && (context.Operand1.Register == GeneralPurposeRegister.ESI || context.Operand1.Register == GeneralPurposeRegister.EDI))
            {
                Operand source = context.Operand1;
                Operand dest = context.Result;

                Operand EAX = Operand.CreateCPURegister(TypeSystem.BuiltIn.I4, GeneralPurposeRegister.EAX);

                context.SetInstruction2(X86.Xchg, EAX, source, source, EAX);
                context.AppendInstruction(X86.Mov, dest, EAX);
                context.AppendInstruction2(X86.Xchg, source, EAX, EAX, source);
            }
        }