示例#1
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);
            }

            // 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);
        }
示例#2
0
 public static void Add(BaseTransformation transformation)
 {
     lock (Transformations)
     {
         Transformations.Add(transformation);
     }
 }
示例#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}");
        }
示例#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);
        }