public static bool TryTransform(DelayedTransformations delayedTransformations, SourceRoutineSymbol routine) { if (routine.ControlFlowGraph == null) { // abstract method return(false); } // var rewriter = new TransformationRewriter(delayedTransformations, routine); var currentCFG = routine.ControlFlowGraph; var updatedCFG = (ControlFlowGraph)rewriter.VisitCFG(currentCFG); routine.ControlFlowGraph = updatedCFG; Debug.Assert((rewriter.TransformationCount != 0) == (updatedCFG != currentCFG)); // transformations <=> cfg updated // return(updatedCFG != currentCFG); }
public static bool TryTransform(DelayedTransformations delayedTransformations, SourceRoutineSymbol routine) { if (routine.ControlFlowGraph == null) { // abstract method return(false); } // var rewriter = new TransformationRewriter(delayedTransformations, routine); var currentCFG = routine.ControlFlowGraph; var updatedCFG = (ControlFlowGraph)rewriter.VisitCFG(currentCFG); rewriter.TryTransformParameters(); routine.ControlFlowGraph = updatedCFG; Debug.Assert(updatedCFG == currentCFG || rewriter.TransformationCount != 0); // cfg updated => transformations (not <= due to parameter transformations) return(updatedCFG != currentCFG); }
private TransformationVisitor(SourceRoutineSymbol routine) { _routine = routine; _rewriter = new TransformationRewriter(); }