public bool ApplyTransform(Context context, BaseTransformation transformation, List <Operand> virtualRegisters = null)
        {
            if (!transformation.Match(context, this))
            {
                return(false);
            }

            TraceBefore(context, transformation);

            if (virtualRegisters != null)
            {
                CollectVirtualRegisters(context, virtualRegisters);
            }

            // TODO: note last virtual register #
            // TODO: note the node

            transformation.Transform(context, this);

            // TODO: add all NEW virtual register to the collection

            TraceAfter(context);

            return(true);
        }
Exemple #2
0
 public static void Add(BaseTransformation transformation)
 {
     lock (Transformations)
     {
         Transformations.Add(transformation);
     }
 }
Exemple #3
0
        public void TraceBefore(Context context, BaseTransformation transformation)
        {
            if (transformation.Name != null)
            {
                TraceLog?.Log($"*** {transformation.Name}");
            }

            if (transformation.Log)
            {
                SpecialTraceLog?.Log($"{transformation.Name}\t{MethodCompiler.Method.FullName} at {context}");
            }

            TraceLog?.Log($"BEFORE:\t{context}");
        }
Exemple #4
0
        public bool ApplyTransform(Context context, BaseTransformation transformation, List <Operand> virtualRegisters = null)
        {
            if (!transformation.Match(context, this))
            {
                return(false);
            }

            TraceBefore(context, transformation);

            if (virtualRegisters != null)
            {
                CollectVirtualRegisters(context, virtualRegisters);
            }

            transformation.Transform(context, this);

            TraceAfter(context);

            return(true);
        }