Mosa.Compiler.Framework.Context.InsertBefore C# (CSharp) Méthode

InsertBefore() public méthode

Inserts an instruction before the current instruction.
public InsertBefore ( ) : Context
Résultat Context
        public Context InsertBefore()
        {
            Debug.Assert(!IsBlockStartInstruction);

            var node = new InstructionNode();
            node.Label = Label;

            Node.Previous.Insert(node);

            return new Context(node);
        }

Usage Example

        /// <summary>
        /// Visitation function for <see cref="IX86Visitor.Cmp"/> instructions.
        /// </summary>
        /// <param name="context">The context.</param>
        public override void Cmp(Context context)
        {
            Operand left = context.Operand1;
            Operand right = context.Operand2;

            if (left.IsConstant)
            {
                Operand ecx = AllocateVirtualRegister(left.Type);
                Context before = context.InsertBefore();

                before.AppendInstruction(X86.Mov, ecx, left);
                context.Operand1 = ecx;
            }

            if (right.IsConstant && (left.IsChar || left.IsShort || left.IsByte))
            {
                Operand edx = AllocateVirtualRegister(TypeSystem.BuiltIn.I4);
                Context before = context.InsertBefore();

                if (left.IsSigned)
                {
                    before.AppendInstruction(X86.Movsx, edx, left);
                }
                else
                {
                    before.AppendInstruction(X86.Movzx, edx, left);
                }
                context.Operand1 = edx;
            }
        }
All Usage Examples Of Mosa.Compiler.Framework.Context::InsertBefore