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

SetInstruction() public méthode

Sets the instruction.
public SetInstruction ( BaseInstruction instruction, InstructionSize size, Operand result, Operand operand1, Operand operand2, Operand operand3 ) : void
instruction BaseInstruction The instruction.
size InstructionSize The size.
result Operand The result.
operand1 Operand The operand1.
operand2 Operand The operand2.
operand3 Operand The operand3.
Résultat void
        public void SetInstruction(BaseInstruction instruction, InstructionSize size, Operand result, Operand operand1, Operand operand2, Operand operand3)
        {
            Node.SetInstruction(instruction, size, result, operand1, operand2, operand3);
        }

Same methods

Context::SetInstruction ( BaseInstruction instruction ) : void
Context::SetInstruction ( BaseInstruction instruction, BasicBlock block ) : void
Context::SetInstruction ( BaseInstruction instruction, ConditionCode condition ) : void
Context::SetInstruction ( BaseInstruction instruction, ConditionCode condition, BasicBlock block ) : void
Context::SetInstruction ( BaseInstruction instruction, ConditionCode condition, Operand result, Operand operand1 ) : void
Context::SetInstruction ( BaseInstruction instruction, ConditionCode condition, Operand result, Operand operand1, Operand operand2 ) : void
Context::SetInstruction ( BaseInstruction instruction, ConditionCode condition, Operand result, Operand operand1, Operand operand2, BasicBlock block ) : void
Context::SetInstruction ( BaseInstruction instruction, ConditionCode condition, bool updateStatus, Operand result, Operand operand1 ) : void
Context::SetInstruction ( BaseInstruction instruction, ConditionCode condition, bool updateStatus, Operand result, Operand operand1, Operand operand2 ) : void
Context::SetInstruction ( BaseInstruction instruction, InstructionSize size, Operand result, Operand operand1 ) : void
Context::SetInstruction ( BaseInstruction instruction, InstructionSize size, Operand result, Operand operand1, Operand operand2 ) : void
Context::SetInstruction ( BaseInstruction instruction, MosaMethod target ) : void
Context::SetInstruction ( BaseInstruction instruction, Operand result ) : void
Context::SetInstruction ( BaseInstruction instruction, Operand result, Operand operand1 ) : void
Context::SetInstruction ( BaseInstruction instruction, Operand result, Operand operand1, Operand operand2 ) : void
Context::SetInstruction ( BaseInstruction instruction, Operand result, Operand operand1, Operand operand2, Operand operand3 ) : void
Context::SetInstruction ( BaseInstruction instruction, bool updateStatus, Operand result ) : void
Context::SetInstruction ( BaseInstruction instruction, bool updateStatus, Operand result, Operand operand1 ) : void
Context::SetInstruction ( BaseInstruction instruction, bool updateStatus, Operand result, Operand operand1, Operand operand2 ) : void
Context::SetInstruction ( BaseInstruction instruction, int operandCount, byte resultCount ) : void

Usage Example

        /// <summary>
        /// Replaces the intrinsic call site
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="typeSystem">The type system.</param>
        void IIntrinsicPlatformMethod.ReplaceIntrinsicCall(Context context, ITypeSystem typeSystem, IList<RuntimeParameter> parameters)
        {
            var result = context.Result;
            var op1 = context.Operand1;
            var op2 = context.Operand2;
            var constant = Operand.CreateConstant(BuiltInSigType.IntPtr, parameters.Count * 4);

            var eax = Operand.CreateCPURegister(BuiltInSigType.IntPtr, GeneralPurposeRegister.EAX); // FIXME - need access to virtual register allocator
            var edx = Operand.CreateCPURegister(BuiltInSigType.IntPtr, GeneralPurposeRegister.EDX); // FIXME - need access to virtual register allocator
            var esp = Operand.CreateCPURegister(BuiltInSigType.IntPtr, GeneralPurposeRegister.ESP); // FIXME - need access to virtual register allocator
            var ebp = Operand.CreateCPURegister(BuiltInSigType.IntPtr, GeneralPurposeRegister.EBP); // FIXME - need access to virtual register allocator
            context.SetInstruction(X86.Sub, esp, constant);
            context.AppendInstruction(X86.Mov, edx, esp);

            var size = parameters.Count * 4 + 4;
            foreach (var parameter in parameters)
            {
                context.AppendInstruction(X86.Mov, Operand.CreateMemoryAddress(BuiltInSigType.IntPtr, edx, new IntPtr(size - 4)), Operand.CreateMemoryAddress(BuiltInSigType.IntPtr, ebp, new IntPtr(size + 4)));
                size -= 4;
            }
            context.AppendInstruction(X86.Mov, Operand.CreateMemoryAddress(BuiltInSigType.IntPtr, edx, new IntPtr(size - 4)), op1);

            context.AppendInstruction(X86.Mov, eax, op2);
            context.AppendInstruction(X86.Call, null, eax);
            context.AppendInstruction(X86.Add, esp, constant);
            context.AppendInstruction(X86.Mov, result, Operand.CreateCPURegister(result.Type, GeneralPurposeRegister.EAX)); // FIXME - need access to virtual register allocator
        }
All Usage Examples Of Mosa.Compiler.Framework.Context::SetInstruction