System.err.println("done.");
System.err.println("done with linear analysis.");
    public static SIRStream doLinearAnalysis(SIRStream str) {	// if someone wants to run any of the linear tools/optimizations	// we need to run linear analysis first to extract the information	// we are working with.	if (KjcOptions.linearanalysis ||	    KjcOptions.linearreplacement ||	    KjcOptions.linearpartition ||	    KjcOptions.frequencyreplacement ||	    KjcOptions.redundantreplacement) {	    // restore unroll to original value	    KjcOptions.unroll = origUnroll;	    // run the linear analysis and stores the information garnered in the lfa	    System.err.print("Running linear analysis... ");	    // only refactor linear children if we're NOT doing the linear partitioner	    LinearAnalyzer lfa = LinearAnalyzer.findLinearFilters(str,								  KjcOptions.debug,								  !KjcOptions.linearpartition);	    System.err.println("done.");	    // now, print out the graph using the LinearPrinter which colors the graph	    // nodes based on their linearity.	    LinearDot.printGraph(str, "linear.dot", lfa);	    // if we are doing linear partitioning, it will take care	    // of linear and frequency replacement automatically	    if (KjcOptions.linearpartition) {		str = new LinearPartitioner(str, lfa).toplevel();	    } else { 		// otherwise, test for linear and frequency		// replacement separately...		// if we are supposed to transform the graph		// by replacing work functions with their linear forms, do so now 		if (KjcOptions.linearreplacement) {		    System.err.print("Running linear replacement... ");		    LinearDirectReplacer.doReplace(lfa, str);		    System.err.println("done.");		    // print out the stream graph after linear replacement		    LinearDot.printGraph(str, "linear-replace.dot", lfa);		}				// and finally, if we want to run frequency analysis		// 0 means stupid implementation, 1 means nice implemenation		if (KjcOptions.frequencyreplacement) {		    System.err.print("Running frequency replacement...");		    FrequencyReplacer.doReplace(lfa, str);		    System.err.println("done.");		    LinearDot.printGraph(str, ("linear-frequency.dot"), lfa);		}	    }	    if (KjcOptions.redundantreplacement) {		System.err.print("Running redundancy analysis... ");	    		// now, run a redundancy analysis pass and print the results		LinearRedundancyAnalyzer lra = new LinearRedundancyAnalyzer(lfa);		System.err.println("done.");		// print dot graph for redundancy information		LinearDot.printGraph(str, "linear-redundant.dot", lfa, lra);				// do the redundancy replacement		System.err.print("Running anti-redundant replacement...");		LinearRedundancyReplacer.doReplace(lfa, lra, str);		System.err.println("done.");		// print out the stream graph after linear redundant replacement		LinearDot.printGraph(str, "linear-redundant-replace.dot", lfa);	    }	}	return str;    }