private bool InstructionTransformationPass()
        {
            if (!EnableTransformationOptimizations)
            {
                return(false);
            }

            if (TransformContext == null)
            {
                specialTrace = new TraceLog(TraceType.GlobalDebug, null, null, "Special Optimizations");

                TransformContext = new TransformContext(MethodCompiler);
                TransformContext.SetLogs(trace, specialTrace);

                CustomizeTransformation();
            }

            var context = new Context(BasicBlocks.PrologueBlock);

            var changed = false;

            for (int i = 0; i < BasicBlocks.Count; i++)
            {
                for (var node = BasicBlocks[i].AfterFirst; !node.IsBlockEndInstruction; node = node.Next)
                {
                    context.Node = node;

                    var updated = Process(context);
                    changed = changed || updated;
                }
            }

            return(changed);
        }
Beispiel #2
0
        protected override void Run()
        {
            trace        = CreateTraceLog(5);
            specialTrace = new TraceLog(TraceType.GlobalDebug, null, null, "Special Optimizations");

            TransformContext = new TransformContext(MethodCompiler);
            TransformContext.SetLogs(trace, specialTrace);

            IsInSSAForm = MethodCompiler.IsInSSAForm;

            Optimize();

            if (CompilerSettings.FullCheckMode)
            {
                CheckAllPhiInstructions();
            }
        }