當前位置: 首頁>>代碼示例>>C#>>正文


C# Context.SetBranch方法代碼示例

本文整理匯總了C#中Mosa.Compiler.Framework.Context.SetBranch方法的典型用法代碼示例。如果您正苦於以下問題:C# Context.SetBranch方法的具體用法?C# Context.SetBranch怎麽用?C# Context.SetBranch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Mosa.Compiler.Framework.Context的用法示例。


在下文中一共展示了Context.SetBranch方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1:

        /// <summary>
        /// Visitation function for IntegerCompareBranchInstruction.
        /// </summary>
        /// <param name="context">The context.</param>
        void IR.IIRVisitor.IntegerCompareBranch(Context context)
        {
            int target = context.BranchTargets[0];
            var condition = context.ConditionCode;
            var operand1 = context.Operand1;
            var operand2 = context.Operand2;

            context.SetInstruction(AVR32.Cp, operand1, operand2);
            context.AppendInstruction(AVR32.Branch, condition);
            context.SetBranch(target);
        }
開發者ID:toddhainsworth,項目名稱:MOSA-Project,代碼行數:15,代碼來源:IRTransformationStage.cs

示例2:

        /// <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

示例3: EmitOperandConstants

        /// <summary>
        /// Visitation function for IntegerCompareBranchInstruction.
        /// </summary>
        /// <param name="context">The context.</param>
        void IIRVisitor.IntegerCompareBranch(Context context)
        {
            EmitOperandConstants(context);

            int target = context.BranchTargets[0];
            var condition = context.ConditionCode;
            var operand1 = context.Operand1;
            var operand2 = context.Operand2;

            context.SetInstruction(X86.Cmp, null, operand1, operand2);
            context.AppendInstruction(X86.Branch, condition);
            context.SetBranch(target);
        }
開發者ID:Expro,項目名稱:MOSA-Project,代碼行數:17,代碼來源:IRTransformationStage.cs

示例4:

        /// <summary>
        /// Visitation function for IntegerCompareBranchInstruction.
        /// </summary>
        /// <param name="context">The context.</param>
        void IR.IIRVisitor.IntegerCompareBranchInstruction(Context context)
        {
            IBranch branch = context.Branch;
            var condition = context.ConditionCode;
            var operand1 = context.Operand1;
            var operand2 = context.Operand2;

            context.SetInstruction(Instruction.CpInstruction, operand1, operand2);
            context.AppendInstruction(Instruction.BranchInstruction, condition);
            context.SetBranch(branch.Targets[0]);
        }
開發者ID:GeroL,項目名稱:MOSA-Project,代碼行數:15,代碼來源:IRTransformationStage.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: CreatePrologueAndEpilogueBlocks

        private static void CreatePrologueAndEpilogueBlocks(InstructionSet instructionSet, BasicBlocks basicBlocks)
        {
            // Create the prologue block
            Context context = new Context(instructionSet);
            // Add a jump instruction to the first block from the prologue
            context.AppendInstruction(IRInstruction.Jmp);
            context.SetBranch(0);
            context.Label = BasicBlock.PrologueLabel;
            var prologue = basicBlocks.CreateBlock(BasicBlock.PrologueLabel, context.Index);
            basicBlocks.AddHeaderBlock(prologue);

            // Create the epilogue block
            context = new Context(instructionSet);
            // Add null instruction, necessary to generate a block index
            context.AppendInstruction(null);
            context.Label = BasicBlock.EpilogueLabel;
            var epilogue = basicBlocks.CreateBlock(BasicBlock.EpilogueLabel, context.Index);
        }
開發者ID:pdelprat,項目名稱:MOSA-Project,代碼行數:18,代碼來源:DelegatePatcher.cs

示例7:

        /// <summary>
        /// Visitation function for IntegerCompareBranchInstruction.
        /// </summary>
        /// <param name="context">The context.</param>
        void IIRVisitor.IntegerCompareBranch(Context context)
        {
            int target = context.BranchTargets[0];
            var condition = context.ConditionCode;
            var operand1 = context.Operand1;
            var operand2 = context.Operand2;
            Operand r9 = Operand.CreateCPURegister(operand1.Type, GeneralPurposeRegister.R9);
            Operand r10 = Operand.CreateCPURegister(operand1.Type, GeneralPurposeRegister.R10);

            context.SetInstruction(AVR32.Ld, r9, operand1);
            if (operand2.IsConstant)
            {
                context.AppendInstruction(AVR32.Cp, r9, operand2);
            }
            else
            {
                context.AppendInstruction(AVR32.Ld, r10, operand2);
                context.AppendInstruction(AVR32.Cp, r9, r10);
            }
            context.AppendInstruction(AVR32.Branch, condition);
            context.SetBranch(target);
        }
開發者ID:pdelprat,項目名稱:MOSA-Project,代碼行數:26,代碼來源:IRTransformationStage.cs

示例8: 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


注:本文中的Mosa.Compiler.Framework.Context.SetBranch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。