示例#1
0
        private void ApplyTransformations(ILCompilationUnit result, VMConstants constants)
        {
            var pipeline = new IILAstTransform[]
            {
                new StackFrameTransform(),
                new SsaTransform(),
                new TransformLoop("Expression Simplification", 5, new IChangeAwareILAstTransform[]
                {
                    new VariableInliner(),
                    new PushMinimizer(),
                    new LogicSimplifier(),
                    new FlagOperationSimplifier(constants),
                }),
                new PhiRemovalTransform(),
            };

            foreach (var transform in pipeline)
            {
                if (transform is TransformLoop loop)
                {
                    loop.TransformStart += (sender, args) => OnTransformStart(args);
                    loop.TransformEnd   += (sender, args) => OnTransformEnd(args);
                }

                Logger.Debug2(Tag, $"Applying {transform.Name}...");
                OnTransformStart(new ILTransformEventArgs(result, transform, 1));
                transform.ApplyTransformation(result, Logger);
                OnTransformEnd(new ILTransformEventArgs(result, transform, 1));
            }
        }
示例#2
0
 public ILTransformEventArgs(ILCompilationUnit unit, IILAstTransform transform, int iteration)
 {
     Unit      = unit;
     Transform = transform;
     Iteration = iteration;
 }