예제 #1
0
		/// <summary>
		/// Replaces the intrinsic call site
		/// </summary>
		/// <param name="context">The context.</param>
		/// <param name="methodCompiler">The method compiler.</param>
		/// <exception cref="CompilerException"></exception>
		void IIntrinsicInternalMethod.ReplaceIntrinsicCall(Context context, MethodCompiler methodCompiler)
		{
			if (context.OperandCount == 2)
			{
				var instruction = !context.Operand2.Is64BitInteger ? (BaseInstruction)IRInstruction.StoreInt32 : IRInstruction.StoreInt64;

				if (context.Operand2.IsR4)
					instruction = IRInstruction.StoreFloatR4;
				else if (context.Operand2.IsR8)
					instruction = IRInstruction.StoreFloatR8;

				context.SetInstruction(instruction, null, context.Operand1, methodCompiler.ConstantZero, context.Operand2);
			}
			else if (context.OperandCount == 3)
			{
				var instruction = !context.Operand3.Is64BitInteger ? (BaseInstruction)IRInstruction.StoreInt32 : IRInstruction.StoreInt64;

				if (context.Operand3.IsR4)
					instruction = IRInstruction.StoreFloatR4;
				else if (context.Operand3.IsR8)
					instruction = IRInstruction.StoreFloatR8;

				context.SetInstruction(instruction, null, context.Operand1, context.Operand2, context.Operand3);
			}
			else
			{
				throw new CompilerException();
			}

			LoadStore.OrderStoreOperands(context.Node, methodCompiler);
		}
예제 #2
0
        /// <summary>
        /// Replaces the intrinsic call site
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="methodCompiler">The method compiler.</param>
        /// <exception cref="CompilerException"></exception>
        void IIntrinsicInternalMethod.ReplaceIntrinsicCall(Context context, MethodCompiler methodCompiler)
        {
            if (context.OperandCount == 2)
            {
                context.SetInstruction(IRInstruction.StoreInt8, null, context.Operand1, methodCompiler.ConstantZero, context.Operand2);
            }
            else if (context.OperandCount == 3)
            {
                context.SetInstruction(IRInstruction.StoreInt8, null, context.Operand1, context.Operand2, context.Operand3);
            }
            else
            {
                throw new CompilerException();
            }

            LoadStore.OrderStoreOperands(context.Node, methodCompiler);
        }
예제 #3
0
        private static void StoreR4(Context context, MethodCompiler methodCompiler)
        {
            if (context.OperandCount == 2)
            {
                context.SetInstruction(IRInstruction.StoreFloatR4, null, context.Operand1, methodCompiler.ConstantZero, context.Operand2);
            }
            else if (context.OperandCount == 3)
            {
                context.SetInstruction(IRInstruction.StoreFloatR4, null, context.Operand1, context.Operand2, context.Operand3);
            }
            else
            {
                throw new CompilerException();
            }

            LoadStore.OrderStoreOperands(context.Node, methodCompiler);
        }
예제 #4
0
        private static void StorePointer(Context context, MethodCompiler methodCompiler)
        {
            var instruction = methodCompiler.Architecture.Is32BitPlatform ? (BaseInstruction)IRInstruction.StoreInt32 : IRInstruction.StoreInt64;

            if (context.OperandCount == 2)
            {
                context.SetInstruction(instruction, null, context.Operand1, methodCompiler.ConstantZero, context.Operand2);
            }
            else if (context.OperandCount == 3)
            {
                context.SetInstruction(instruction, null, context.Operand1, context.Operand2, context.Operand3);
            }
            else
            {
                throw new CompilerException();
            }

            LoadStore.OrderStoreOperands(context, methodCompiler);
        }
예제 #5
0
        /// <summary>
        /// Replaces the intrinsic call site
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="methodCompiler">The method compiler.</param>
        /// <exception cref="InvalidCompilerException"></exception>
        void IIntrinsicInternalMethod.ReplaceIntrinsicCall(Context context, BaseMethodCompiler methodCompiler)
        {
            const InstructionSize size = InstructionSize.Size32;

            if (context.OperandCount == 2)
            {
                context.SetInstruction(IRInstruction.StoreInteger, size, null, context.Operand1, methodCompiler.ConstantZero, context.Operand2);
            }
            else if (context.OperandCount == 3)
            {
                context.SetInstruction(IRInstruction.StoreInteger, size, null, context.Operand1, context.Operand2, context.Operand3);
            }
            else
            {
                throw new InvalidCompilerException();
            }

            LoadStore.OrderStoreOperands(context.Node, methodCompiler);
        }
예제 #6
0
        private static void Store(Context context, MethodCompiler methodCompiler)
        {
            if (context.OperandCount == 2)
            {
                var instruction = !context.Operand2.Is64BitInteger ? (BaseInstruction)IRInstruction.StoreInt32 : IRInstruction.StoreInt64;

                if (context.Operand2.IsR4)
                {
                    instruction = IRInstruction.StoreFloatR4;
                }
                else if (context.Operand2.IsR8)
                {
                    instruction = IRInstruction.StoreFloatR8;
                }

                context.SetInstruction(instruction, null, context.Operand1, methodCompiler.ConstantZero, context.Operand2);
            }
            else if (context.OperandCount == 3)
            {
                var instruction = !context.Operand3.Is64BitInteger ? (BaseInstruction)IRInstruction.StoreInt32 : IRInstruction.StoreInt64;

                if (context.Operand3.IsR4)
                {
                    instruction = IRInstruction.StoreFloatR4;
                }
                else if (context.Operand3.IsR8)
                {
                    instruction = IRInstruction.StoreFloatR8;
                }

                context.SetInstruction(instruction, null, context.Operand1, context.Operand2, context.Operand3);
            }
            else
            {
                throw new CompilerException();
            }

            LoadStore.OrderStoreOperands(context, methodCompiler);
        }
        private void StoreInt8(Context context)
        {
            LoadStore.OrderStoreOperands(context, MethodCompiler);

            context.SetInstruction(X64.MovStore8, null, context.Operand1, context.Operand2, context.Operand3);
        }
예제 #8
0
        private void StoreInt8(InstructionNode node)
        {
            LoadStore.OrderStoreOperands(node, MethodCompiler);

            node.SetInstruction(X86.MovStore8, null, node.Operand1, node.Operand2, node.Operand3);
        }