当前位置: 首页>>代码示例>>C#>>正文


C# Context.Remove方法代码示例

本文整理汇总了C#中Mosa.Compiler.Framework.Context.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# Context.Remove方法的具体用法?C# Context.Remove怎么用?C# Context.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mosa.Compiler.Framework.Context的用法示例。


在下文中一共展示了Context.Remove方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Run

        // TODO:
        // 1. If first branch is to the next basic block,
        //       then swap branch condition, replace branch target with jump target, and remove jump instruction.
        //           part of code: ConditionCode = GetOppositeConditionCode(ConditionCode);
        // 2. If the basic block contains only a single jump instruction, rewrite all jumps to avoid it.
        protected override void Run()
        {
            var trace = CreateTrace();

            for (int f = 0; f < BasicBlocks.Count - 1; f++)
            {
                var from = BasicBlocks[f];
                var next = BasicBlocks[f + 1];

                Context context = new Context(InstructionSet, from, from.EndIndex);
                context.GotoPrevious();

                while (context.IsEmpty)
                {
                    context.GotoPrevious();
                }

                if (context.Instruction.FlowControl != FlowControl.UnconditionalBranch)
                    continue;

                Debug.Assert(context.Instruction.FlowControl == FlowControl.UnconditionalBranch);
                Debug.Assert(context.BranchTargets.Length == 1);

                var target = context.BranchTargets[0];

                if (next.Label != target)
                    continue;

                context.Remove();
            }
        }
开发者ID:tea,项目名称:MOSA-Project,代码行数:36,代码来源:JumpPeepholeOptimizationStage.cs

示例2:

 /// <summary>
 /// Replaces the intrinsic call site
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="typeSystem">The type system.</param>
 void IIntrinsicMethod.ReplaceIntrinsicCall(Context context, ITypeSystem typeSystem, IList<RuntimeParameter> parameters)
 {
     // TODO
     context.Remove();
 }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:10,代码来源:SpinUnlock.cs

示例3:

        /// <summary>
        /// Visitation function for SwitchInstruction.
        /// </summary>
        /// <param name="context">The context.</param>
        void IIRVisitor.Switch(Context context)
        {
            int[] targets = context.BranchTargets;
            Operand operand = context.Operand1;

            context.Remove();

            for (int i = 0; i < targets.Length - 1; ++i)
            {
                context.AppendInstruction(X86.Cmp, null, operand, Operand.CreateConstant(BuiltInSigType.IntPtr, i));
                context.AppendInstruction(X86.Branch, ConditionCode.Equal);
                context.SetBranch(targets[i]);
            }
        }
开发者ID:Expro,项目名称:MOSA-Project,代码行数:18,代码来源:IRTransformationStage.cs

示例4: EmptyBlockOfAllInstructions

        /// <summary>
        /// Empties the block of all instructions.
        /// </summary>
        /// <param name="block">The block.</param>
        protected void EmptyBlockOfAllInstructions(BasicBlock block)
        {
            var ctx = new Context(InstructionSet, block);
            Debug.Assert(ctx.IsBlockStartInstruction);
            ctx.GotoNext();

            while (!ctx.IsBlockEndInstruction)
            {
                if (!ctx.IsEmpty)
                {
                    ctx.Remove();
                }

                ctx.GotoNext();
            }
        }
开发者ID:Boddlnagg,项目名称:MOSA-Project,代码行数:20,代码来源:BaseMethodCompilerStage.cs

示例5:

        /// <summary>
        /// Visitation function for Return.
        /// </summary>
        /// <param name="context">The context.</param>
        void IIRVisitor.Return(Context context)
        {
            Debug.Assert(context.BranchTargets != null);

            if (context.Operand1 != null)
            {
                // HACK - to support test suit on windows
                //if (context.Operand1.IsR)
                //{
                //	Operand stack = methodCompiler.StackLayout.AddStackLocal(context.Operand1.Type);
                //	Context before = context.InsertBefore();
                //	architecture.InsertMoveInstruction(before, stack, context.Operand1);
                //	before.AppendInstruction(X86.Fld, null, stack);
                //}

                var returnOperand = context.Operand1;

                context.Remove();

                CallingConvention.SetReturnValue(TypeLayout, context, returnOperand);

                context.AppendInstruction(X86.Jmp);
                context.SetBranch(Int32.MaxValue);
            }
            else
            {
                context.SetInstruction(X86.Jmp);
                context.SetBranch(Int32.MaxValue);
            }
        }
开发者ID:tea,项目名称:MOSA-Project,代码行数:34,代码来源:IRTransformationStage.cs

示例6: if

        /// <summary>
        /// Visitation function for <see cref="IX86Visitor.Movzx"/> instructions.
        /// </summary>
        /// <param name="context">The context.</param>
        void IX86Visitor.Movzx(Context context)
        {
            // Movsx can not use ESI or EDI registers
            if (context.Operand1.IsCPURegister && (context.Operand1.Register == GeneralPurposeRegister.ESI || context.Operand1.Register == GeneralPurposeRegister.EDI))
            {
                Debug.Assert(context.Result.IsCPURegister);

                Operand dest = context.Result;
                Operand source = context.Operand1;

                if (source.Register != dest.Register)
                {
                    context.SetInstruction(X86.Mov, dest, source);
                }
                else
                {
                    context.Remove();
                }

                if (dest.IsShort || dest.IsChar)
                {
                    context.AppendInstruction(X86.And, dest, dest, Operand.CreateConstantUnsignedInt(TypeSystem, (uint)0xffff));
                }
                else if (dest.IsByte || dest.IsBoolean)
                {
                    context.AppendInstruction(X86.And, dest, dest, Operand.CreateConstantUnsignedInt(TypeSystem, (uint)0xff));
                }
            }
        }
开发者ID:Boddlnagg,项目名称:MOSA-Project,代码行数:33,代码来源:FinalTweakTransformationStage.cs

示例7: ConstantOperand

        /// <summary>
        /// Visitation function for SwitchInstruction.
        /// </summary>
        /// <param name="context">The context.</param>
        void IR.IIRVisitor.SwitchInstruction(Context context)
        {
            IBranch branch = context.Branch;
            Operand operand = context.Operand1;

            context.Remove();

            for (int i = 0; i < branch.Targets.Length - 1; ++i)
            {
                context.AppendInstruction(Instruction.CmpInstruction, operand, new ConstantOperand(BuiltInSigType.IntPtr, i));
                context.AppendInstruction(Instruction.BranchInstruction, IR.ConditionCode.Equal);
                context.SetBranch(branch.Targets[i]);
            }
        }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:18,代码来源:IRTransformationStage.cs

示例8: ProcessPhiInstruction

        /// <summary>
        /// Processes the phi instruction.
        /// </summary>
        /// <param name="block">The block.</param>
        /// <param name="context">The context.</param>
        private void ProcessPhiInstruction(BasicBlock block, Context context)
        {
            for (var predecessorIndex = 0; predecessorIndex < block.PreviousBlocks.Count; ++predecessorIndex)
            {
                var predecessor = block.PreviousBlocks[predecessorIndex];
                var operand = context.GetOperand(predecessorIndex);

                this.InsertCopyStatement(predecessor, context.Result, operand);
            }
            context.Remove();
        }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:16,代码来源:LeaveSSA.cs


注:本文中的Mosa.Compiler.Framework.Context.Remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。