Mosa.Compiler.Framework.Context.AppendInstruction2 C# (CSharp) Method

AppendInstruction2() public method

Appends the instruction.
public AppendInstruction2 ( BaseInstruction instruction, Operand result, Operand result2 ) : void
instruction BaseInstruction The instruction.
result Operand The result.
result2 Operand The result2.
return void
        public void AppendInstruction2(BaseInstruction instruction, Operand result, Operand result2)
        {
            AppendInstruction();
            Node.SetInstruction2(instruction, result, result2);
        }

Same methods

Context::AppendInstruction2 ( BaseInstruction instruction, Operand result, Operand result2, Operand operand1 ) : void
Context::AppendInstruction2 ( BaseInstruction instruction, Operand result, Operand result2, Operand operand1, Operand operand2 ) : void
Context::AppendInstruction2 ( BaseInstruction instruction, Operand result, Operand result2, Operand operand1, Operand operand2, Operand operand3 ) : void

Usage Example

        /// <summary>
        /// Visitation function for <see cref="IX86Visitor.Div"/> instructions.
        /// </summary>
        /// <param name="context">The context.</param>
        public void Div(Context context)
        {
            if (context.Result.IsCPURegister && context.Result2.IsCPURegister && context.Operand1.IsCPURegister)
                if (context.Result.Register == GeneralPurposeRegister.EDX &&
                    context.Result2.Register == GeneralPurposeRegister.EAX &&
                    context.Operand1.Register == GeneralPurposeRegister.EDX &&
                    context.Operand2.Register == GeneralPurposeRegister.EAX)
                    return;

            Operand operand1 = context.Operand1;
            Operand operand2 = context.Operand2;
            Operand operand3 = context.Operand3;
            Operand result = context.Result;
            Operand result2 = context.Result2;

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

            context.SetInstruction(X86.Mov, EDX, operand1);
            context.AppendInstruction(X86.Mov, EAX, operand2);

            if (operand3.IsCPURegister)
            {
                context.AppendInstruction2(X86.Div, EDX, EAX, EDX, EAX, operand3);
            }
            else
            {
                Operand v3 = AllocateVirtualRegister(TypeSystem.BuiltIn.I4);
                context.AppendInstruction(X86.Mov, v3, operand3);
                context.AppendInstruction2(X86.Div, EDX, EAX, EDX, EAX, v3);
            }

            context.AppendInstruction(X86.Mov, result2, EAX);
            context.AppendInstruction(X86.Mov, result, EDX);
        }
All Usage Examples Of Mosa.Compiler.Framework.Context::AppendInstruction2