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


C# Framework.BasicBlock类代码示例

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


BasicBlock类属于Mosa.Compiler.Framework命名空间,在下文中一共展示了BasicBlock类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BlockStart

        protected override void BlockStart(BasicBlock block)
        {
            long current = codeEmitter.CurrentPosition;

            base.BlockStart(block);

            simAdapter.SimCPU.SetSymbol(block.ToString() + ":" + MethodCompiler.Method.FullName, (ulong)(sectionAddress + startPosition + current), 0);
        }
开发者ID:tea,项目名称:MOSA-Project,代码行数:8,代码来源:SimCodeGeneratorStage.cs

示例2:

        List<BasicBlock> IDominanceProvider.GetChildren(BasicBlock block)
        {
            List<BasicBlock> child;

            if (children.TryGetValue(block, out child))
                return child;
            else
                return new List<BasicBlock>(); // Empty List
        }
开发者ID:jeffreye,项目名称:MOSA-Project,代码行数:9,代码来源:SimpleFastDominance.cs

示例3: SimpleFastDominance

        /// <summary>
        /// Performs stage specific processing on the compiler context.
        /// </summary>
        public SimpleFastDominance(BasicBlocks basicBlocks, BasicBlock entryBlock)
        {
            // Blocks in reverse post order topology
            List<BasicBlock> blocks = BasicBlocks.ReversePostorder(entryBlock); //basicBlocks.GetConnectedBlocksStartingAtHead(entryBlock);

            CalculateDominance(blocks);
            CalculateChildren(blocks);
            CalculateDominanceFrontier(blocks);
        }
开发者ID:jeffreye,项目名称:MOSA-Project,代码行数:12,代码来源:SimpleFastDominance.cs

示例4: GetDominanceAnalysis

        public IDominanceAnalysis GetDominanceAnalysis(BasicBlock headBlock)
        {
            IDominanceAnalysis analysis;

            if (!blockAnalysis.TryGetValue(headBlock, out analysis))
            {
                analysis = dominanceAnalysisFactory();
                analysis.PerformAnalysis(basicBlocks, headBlock);
                blockAnalysis.Add(headBlock, analysis);
            }

            return analysis;
        }
开发者ID:tea,项目名称:MOSA-Project,代码行数:13,代码来源:DominanceAnalysis.cs

示例5: InsertCopyStatement

        /// <summary>
        /// Inserts the copy statement.
        /// </summary>
        /// <param name="predecessor">The predecessor.</param>
        /// <param name="result">The result.</param>
        /// <param name="operand">The operand.</param>
        private void InsertCopyStatement(BasicBlock predecessor, Operand result, Operand operand)
        {
            var context = new Context(this.instructionSet, predecessor);
            while (!context.EndOfInstruction && IsBranchInstruction(context))
                context.GotoNext();

            if (context.Index != -1)
                context = context.InsertBefore();

            var source = operand is SsaOperand ? (operand as SsaOperand).Operand : operand;
            var destination = result is SsaOperand ? (result as SsaOperand).Operand : result;

            Debug.Assert(!(source is SsaOperand));
            Debug.Assert(!(destination is SsaOperand));

            context.SetInstruction(IR.Instruction.MoveInstruction, destination, source);
        }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:23,代码来源:LeaveSSA.cs

示例6: InsertJumpInstruction

 /// <summary>
 /// Inserts the jump instruction.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="Destination">The destination.</param>
 public override void InsertJumpInstruction(Context context, BasicBlock Destination)
 {
     // TODO
 }
开发者ID:tea,项目名称:MOSA-Project,代码行数:9,代码来源:Architecture.cs

示例7: RemoveEmptyBlockWithSingleJump

        protected void RemoveEmptyBlockWithSingleJump(BasicBlock block)
        {
            Debug.Assert(block.NextBlocks.Count == 1);

            BasicBlock target = block.NextBlocks[0];

            foreach (var previous in block.PreviousBlocks.ToArray())
            {
                ReplaceBranchTargets(previous, block, target);
            }

            EmptyBlockOfAllInstructions(block);

            Debug.Assert(block.NextBlocks.Count == 0);
            Debug.Assert(block.PreviousBlocks.Count == 0);
        }
开发者ID:Profi-Concept,项目名称:MOSA-Project,代码行数:16,代码来源:BaseMethodCompilerStage.cs

示例8: EmptyBlockOfAllInstructions

 /// <summary>
 /// Empties the block of all instructions.
 /// </summary>
 /// <param name="block">The block.</param>
 protected void EmptyBlockOfAllInstructions(BasicBlock block)
 {
     for (var node = block.First.Next; !node.IsBlockEndInstruction; node = node.Next)
     {
         node.Empty();
     }
 }
开发者ID:Profi-Concept,项目名称:MOSA-Project,代码行数:11,代码来源:BaseMethodCompilerStage.cs

示例9: UpdatePhiList

        protected static void UpdatePhiList(BasicBlock removedBlock, BasicBlock[] nextBlocks)
        {
            foreach (var next in nextBlocks)
            {
                for (var node = next.First; !node.IsBlockEndInstruction; node = node.Next)
                {
                    if (node.IsEmpty)
                        continue;

                    if (node.Instruction != IRInstruction.Phi)
                        continue;

                    var sourceBlocks = node.PhiBlocks;

                    int index = sourceBlocks.IndexOf(removedBlock);

                    if (index < 0)
                        continue;

                    sourceBlocks.RemoveAt(index);

                    for (int i = index; index < node.OperandCount - 1; index++)
                    {
                        node.SetOperand(i, node.GetOperand(i + 1));
                    }

                    node.SetOperand(node.OperandCount - 1, null);
                    node.OperandCount--;
                }
            }
        }
开发者ID:Profi-Concept,项目名称:MOSA-Project,代码行数:31,代码来源:BaseMethodCompilerStage.cs

示例10: FindExceptionClause

        private ExceptionHandlingClause FindExceptionClause(BasicBlock block)
        {
            Context ctx = new Context(instructionSet, block);
            int label = ctx.Label;

            foreach (ExceptionHandlingClause clause in methodCompiler.ExceptionClauseHeader.Clauses)
            {
                if (clause.IsLabelWithinTry(label))
                    return clause;

                //if (clause.IsLabelWithinHandler(label))
                //    return null;
            }

            return null;
        }
开发者ID:jeffreye,项目名称:MOSA-Project,代码行数:16,代码来源:ExceptionLayoutStage.cs

示例11: FindTarget

        private bool FindTarget(BasicBlock block)
        {
            foreach (var b in branchInstructions)
            {
                if (b.BranchTargets.Contains(block))
                    return true;
            }

            return false;
        }
开发者ID:Zahovay,项目名称:MOSA-Project,代码行数:10,代码来源:BasicBlock.cs

示例12: SetInstruction

 /// <summary>
 /// Sets the instruction.
 /// </summary>
 /// <param name="instruction">The instruction.</param>
 /// <param name="condition">The condition.</param>
 /// <param name="block">The block.</param>
 public void SetInstruction(BaseInstruction instruction, ConditionCode condition, BasicBlock block)
 {
     SetInstruction(instruction);
     ConditionCode = condition;
     AddBranchTarget(block);
 }
开发者ID:Profi-Concept,项目名称:MOSA-Project,代码行数:12,代码来源:InstructionNode.cs

示例13: AddBranchTarget

        /// <summary>
        /// Sets the branch target.
        /// </summary>
        /// <param name="block">The basic block.</param>
        public void AddBranchTarget(BasicBlock block)
        {
            Debug.Assert(block != null);

            if (branchTargets == null)
            {
                branchTargets = new List<BasicBlock>(1);
            }

            branchTargets.Add(block);

            if (Block != null)
            {
                Block.AddBranchInstruction(this);
            }
        }
开发者ID:Profi-Concept,项目名称:MOSA-Project,代码行数:20,代码来源:InstructionNode.cs

示例14: InstructionNode

 /// <summary>
 /// Sets the instruction.
 /// </summary>
 /// <param name="instruction">The instruction.</param>
 /// <param name="condition">The condition.</param>
 /// <param name="block">The block.</param>
 public InstructionNode(BaseInstruction instruction, ConditionCode condition, BasicBlock block)
     : this(instruction, condition)
 {
     AddBranchTarget(block);
 }
开发者ID:Profi-Concept,项目名称:MOSA-Project,代码行数:11,代码来源:InstructionNode.cs

示例15: CollectLocalVariables

 /// <summary>
 /// Collects all local variables assignments into a list.
 /// </summary>
 /// <param name="locals">Holds all locals found by the stage.</param>
 /// <param name="block">The block.</param>
 private void CollectLocalVariables(List<StackOperand> locals, BasicBlock block)
 {
     for (Context ctx = new Context(instructionSet, block); !ctx.EndOfInstruction; ctx.GotoNext())
     {
         // Does this instruction define a new stack variable?
         foreach (Operand op in ctx.Results)
         {
             // The instruction list may not be in SSA form, so we have to check existence again here unfortunately.
             // FIXME: Allow us to detect the state of blocks
             LocalVariableOperand lvop = op as LocalVariableOperand;
             if (lvop != null && !locals.Contains(lvop))
                 locals.Add(lvop);
         }
     }
 }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:20,代码来源:StackLayoutStage.cs


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