예제 #1
0
        /// <summary>
        /// Replaces the intrinsic call site
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="methodCompiler">The method compiler.</param>
        void IIntrinsicPlatformMethod.ReplaceIntrinsicCall(Context context, BaseMethodCompiler methodCompiler)
        {
            Operand n       = context.Operand1;
            Operand d       = context.Operand2;
            Operand result  = context.Result;
            Operand result2 = methodCompiler.CreateVirtualRegister(methodCompiler.TypeSystem.BuiltIn.U4);

            methodCompiler.SplitLongOperand(n, out Operand op0L, out Operand op0H);

            context.SetInstruction2(X86.Div, result2, result, op0H, op0L, d);
        }
예제 #2
0
        /// <summary>
        /// Replaces the intrinsic call site
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="methodCompiler">The method compiler.</param>
        void IIntrinsicPlatformMethod.ReplaceIntrinsicCall(Context context, BaseMethodCompiler methodCompiler)
        {
            var result        = context.Result;
            var methodAddress = context.Operand1;
            var newESP        = context.Operand2;

            var eax = Operand.CreateCPURegister(methodCompiler.TypeSystem.BuiltIn.I4, GeneralPurposeRegister.EAX);
            var edx = Operand.CreateCPURegister(methodCompiler.TypeSystem.BuiltIn.I4, GeneralPurposeRegister.EDX);

            methodCompiler.SplitLongOperand(result, out Operand op0L, out Operand op0H);

            context.SetInstruction(X86.Call, null, methodAddress);
            context.AppendInstruction(IRInstruction.Gen, eax);
            context.AppendInstruction(IRInstruction.Gen, edx);
            context.AppendInstruction(X86.Mov, op0L, eax);
            context.AppendInstruction(X86.Mov, op0H, edx);
        }