effectiveTuple = new LinearComputationTuple(t.getPosition() - (use * linearRep.getPopCount()),
int pop = linearRep.getPopCount(); effectiveTuple = new LinearComputationTuple((t.getPosition() - pop * use),
    public JMethodDeclaration makeWork(int type,				       LinearFilterRepresentation linearRep,				       RedundancyReplacerData tupleData) {	if ((type != WORK) && (type != INITWORK)) {	    throw new IllegalArgumentException("type was not INITWORK or WORK");	}	// The new body of the function function.	JBlock body = new JBlock();	// if we are making initWork, add statements to fill up the	// state arrays all the way.	if (type == INITWORK) {	    Iterator tupleIter = tupleData.reused.iterator();	    while(tupleIter.hasNext()) {		LinearComputationTuple t = (LinearComputationTuple)tupleIter.next();		// basically, we want to store data for each use, 1-->maxUse		for (int use = 1; use<(tupleData.getMaxUse(t)+1); use++) {		    JExpression fieldAccessExpr = makeFieldAccessExpression(tupleData.getName(t));		    JExpression arrayIndex = new JIntLiteral(use);		    JExpression arrayAccessExpression = new JArrayAccessExpression(null,										   fieldAccessExpr,										   arrayIndex);		    // generate the appropriate computation expression		    LinearComputationTuple effectiveTuple;		    effectiveTuple = new LinearComputationTuple(t.getPosition() -								(use * linearRep.getPopCount()),								t.getCoefficient());		    JExpression computationExpression = makeTupleComputation(effectiveTuple);		    // make an assignment from the computation expression (eg peek*const)		    // to the field access array.		    JExpression assignExpr = new JAssignmentExpression(null,								       arrayAccessExpression,								       computationExpression);		    body.addStatement(new JExpressionStatement(null,assignExpr,null));		}	    }	}	// now, we should calculate all of the tuples for this execution	// eg for use 0 (we do this here so that it always shows up in both	// work and initWork) -- note that the array index expression is the	// tuple index.	Iterator tupleIter = tupleData.reused.iterator();	while(tupleIter.hasNext()) {	    LinearComputationTuple t = (LinearComputationTuple)tupleIter.next();	    JExpression fieldAccessExpr = makeFieldAccessExpression(tupleData.getName(t));	    JExpression arrayIndex = makeFieldAccessExpression(tupleData.getName(t)+INDEX_POSTFIX);	    // this expression is state_field[state_field_index]	    JExpression arrayAccessExpression = new JArrayAccessExpression(null,									   fieldAccessExpr,									   arrayIndex);	    // generate the appropriate computation expression for this tuple	    // note that no effective indexes need to be computed	    JExpression computationExpression = makeTupleComputation(t);	    	    // make an assignment from the computation expression (eg peek*const)	    // to the field access array.	    JExpression assignExpr = new JAssignmentExpression(null,							       arrayAccessExpression,							       computationExpression);	    body.addStatement(new JExpressionStatement(null, assignExpr, null));	}    	// now, for each column in the linear rep (eg the coefficients for each	// term we need to push out, make a list of all of the tuples	// that we need to compute. We will then process the list to generate	// the appropriate push expression	FilterMatrix A = linearRep.getA();	for (int currentCol = A.getCols()-1; currentCol >= 0; currentCol--) {	    List termList = new LinkedList();	    for (int currentRow = 0; currentRow< A.getRows(); currentRow++) {		// make a tuple for the current term		LinearComputationTuple t = new LinearComputationTuple(A.getRows() - 1 - currentRow, // index								      A.getElement(currentRow, currentCol));		// stick this term in the front of the list		termList.add(0,t);	    }	    // now, we want to go through each term that we need to make and	    // generate the appropriate calculation -- either field access	    // or computation, depending on if the tuple is in the 	    // comp map or not.	    List expressionList = new LinkedList(); // list to store JExpressions to compute terms	    Iterator termIter = termList.iterator();	    while(termIter.hasNext()) {		LinearComputationTuple t = (LinearComputationTuple)termIter.next();		// if this tuple is in comp map, we have a stoed version of it so we should use that		JExpression termExpr = null;		if (tupleData.compMap.containsKey(t)) {		    termExpr = makeTupleAccess(t,tupleData);		} else {		    termExpr = makeTupleComputation(t); // make a straightup computation		}		// if the term is not null, add it to the term list		if (termExpr != null) {		    expressionList.add(termExpr);		}	    }	    // now, we need to combine all of the terms in the term expr list into	    // a single push statement. (assuming of course, that there are terms in the expr list.	    if (expressionList.size() > 0) {		JExpression pushArg;		// if there is only one expression, we are done		if (expressionList.size() == 1) {		    pushArg = (JExpression)expressionList.get(0);		} else {		    // list is gaurenteed to have at least two elements in it		    Iterator exprIter = expressionList.iterator();		    JExpression expr1 = (JExpression)exprIter.next();		    JExpression expr2 = (JExpression)exprIter.next();		    pushArg = new JAddExpression(null, expr1, expr2);		    // iterate through the rest of the list, adding add exprs as we go		    while(exprIter.hasNext()) {			JExpression nextExpr = (JExpression)exprIter.next();			pushArg = new JAddExpression(null, pushArg, nextExpr);		    }		}		// now, add a push expression to the body of the function		JExpression pushExpr = new SIRPushExpression(pushArg, CStdType.Float);		body.addStatement(new JExpressionStatement(null,pushExpr,null));	    }	}	// finally, generate appropriate index increments for each of the	// reused tuples.	Iterator reusedIter = tupleData.reused.iterator();	while(reusedIter.hasNext()) {	    LinearComputationTuple t = (LinearComputationTuple)reusedIter.next();	    body.addStatement(makeIndexUpdateStatement(t,tupleData));	}	// and as a final nudge to correctness, put in the appropriate number	// of pop.	for (int i=0; i<linearRep.getPopCount(); i++) {	    JExpression popExpr = new SIRPopExpression(CStdType.Float);	    body.addStatement(new JExpressionStatement(null, popExpr, null));	}			      			// put together the body with all of the appropriate KOPI nonsense	String ident = (type == WORK) ? "work" : "initWork";	return new JMethodDeclaration(null,                  /* token reference */				      ACC_PUBLIC,            /* modifiers */				      CStdType.Void,         /* return type */				      ident,                 /* identifier */				      JFormalParameter.EMPTY,/* paramters */				      CClassType.EMPTY,      /* exceptions */				      body,                  /* body */				      null,                  /* java doc */				      null);                 /* java style comment */	    }