Mosa.Compiler.Framework.InstructionNode.Split C# (CSharp) Method

Split() public method

Splits the node list by moving the next instructions into the new block.
public Split ( BasicBlock newblock ) : void
newblock BasicBlock The newblock.
return void
        public void Split(BasicBlock newblock)
        {
            //			Debug.Assert(!IsBlockEndInstruction);

            if (Next == Block.Last)
                return;

            //Block.DebugCheck();
            //newblock.DebugCheck();

            // check that new block is empty
            Debug.Assert(newblock.First.Next == newblock.Last);
            Debug.Assert(newblock.Last.Previous == newblock.First);

            newblock.First.Next = Next;
            newblock.Last.Previous = Block.Last.Previous;
            newblock.First.Next.Previous = newblock.First;
            newblock.Last.Previous.Next = newblock.Last;

            Next = Block.Last;
            Block.Last.Previous = this;

            for (var node = newblock.First.Next; !node.IsBlockEndInstruction; node = node.Next)
            {
                node.Block = newblock;
            }

            //	Block.DebugCheck();
            //	newblock.DebugCheck();
        }

Usage Example

        /// <summary>
        /// Splits the block.
        /// </summary>
        /// <param name="node">The node.</param>
        /// <returns></returns>
        protected BasicBlock Split(InstructionNode node)
        {
            var newblock = CreateNewBlock(-1, node.Label);

            node.Split(newblock);

            return(newblock);
        }
All Usage Examples Of Mosa.Compiler.Framework.InstructionNode::Split