예제 #1
0
        private void CreateMegaBlockButton_Click(object sender, EventArgs e)
        {
            var builder = new MegaBlockBuilder();

            megaInstructions = builder.Build(originalAssemblyLines, originalTracesLines);
            megaInstructions.ForEach(item => MegaBlockListBox.Items.Add(item.ToString()));
        }
        public List <string> Rearrange()
        {
            // TODO: Remove these?
            var instructions = new List <MegaInstruction>(MAX_INSTRUCTIONS_IN_PIPELINE);
            var hasCompleted = false;

            var builder          = new MegaBlockBuilder();
            var megaInstructions = builder.Build(AssemblyLines, originalTracesLines);

            for (var index = 0; index < megaInstructions.Count - 1; index++)
            {
                var megaInstructionOne = megaInstructions[index];
                var megaInstructionTwo = megaInstructions[index + 1];

                if (handledLines.Contains(megaInstructionOne.ToString()))
                {
                    continue;
                }

                if (Util.CanApplyImmediateMerging(megaInstructionOne, megaInstructionTwo))
                {
                    ApplyImmediateMerging(megaInstructionOne, megaInstructionTwo);
                    handledLines.Add(megaInstructionOne.ToString());
                }

                if (Util.CanApplyMovMerging(megaInstructionOne, megaInstructionTwo))
                {
                    // TODO: Instructiuni gardate????
                    ApplyMovMerging(megaInstructionOne, megaInstructionTwo);
                    handledLines.Add(megaInstructionOne.ToString());
                }

                if (Util.CanApplyMovReabsorption(megaInstructionOne, megaInstructionTwo))
                {
                    ApplyMovReabsorption(megaInstructionOne, megaInstructionTwo);
                    handledLines.Add(megaInstructionOne.ToString());
                }

                if (Util.CanApplyMemoryAntiAlias(megaInstructionOne, megaInstructionTwo))
                {
                    // TODO: Line 95/96 same address referenced what to do?
                    handledLines.Add(megaInstructionOne.ToString());
                }
            }

            return(AssemblyLines);
        }