if (filter.getInputType().isArrayType() || filter.getOutputType().isArrayType()) { int inputDim = 0, outputDim = 0, maxDim;  if (filter.getInputType().isArrayType()) inputDim =
if (filter.getInputType().isArrayType()) {   int inputDim =
    private void createLocalVariables(FlatNode node, JBlock block,			      LocalVariables localVariables)    {	SIRFilter filter = (SIRFilter)node.contents;	//index variable for certain for loops	JVariableDefinition exeIndexVar = 	    new JVariableDefinition(null, 				    0, 				    CStdType.Integer,				    exeIndex,				    null);	//remember the JVarDef for latter (in the raw main function)	localVariables.exeIndex = exeIndexVar;		block.addStatement	    (new JVariableDeclarationStatement(null,					       exeIndexVar,					       null));		//index variable for certain for loops	JVariableDefinition exeIndex1Var = 	    new JVariableDefinition(null, 				    0, 				    CStdType.Integer,				    exeIndex1,				    null);	localVariables.exeIndex1 = exeIndex1Var;	block.addStatement	    (new JVariableDeclarationStatement(null,					       exeIndex1Var,					       null));			//only add the receive buffer and its vars if the 	//filter receives data	if (!noBuffer(filter)) {	    //initialize the buffersize to be the size of the 	    //struct being passed over it	    int buffersize;	    	    int prepeek = 0;	    int maxpeek = filter.getPeekInt();	    if (filter instanceof SIRTwoStageFilter)		prepeek = ((SIRTwoStageFilter)filter).getInitPeek();	    //set up the maxpeek	    maxpeek = (prepeek > maxpeek) ? prepeek : maxpeek;	    	    	    if (isSimple(filter)) {		//simple filter (no remaining items)		if (KjcOptions.ratematch) {		    //System.out.println(filter.getName());		    		    int i = ((Integer)RawBackend.steadyExecutionCounts.get(node)).intValue();		    //i don't know, the prepeek could be really large, so just in case		    //include it.  Make the buffer big enough to hold 		    buffersize = 			Math.max			((((Integer)RawBackend.steadyExecutionCounts.get(node)).intValue() - 1) * 			 filter.getPopInt() + filter.getPeekInt(), prepeek);		}		else //not ratematching and we do not have a circular buffer		    buffersize = maxpeek;		//define the simple index variable		JVariableDefinition simpleIndexVar = 		    new JVariableDefinition(null, 					    0, 					    CStdType.Integer,					    simpleIndex,					    new JIntLiteral(-1));				//remember the JVarDef for latter (in the raw main function)		localVariables.simpleIndex = simpleIndexVar;				block.addStatement		    (new JVariableDeclarationStatement(null,						       simpleIndexVar,						       null));	    }	    else { //filter with remaing items on the buffer after initialization 		//see Mgordon's thesis for explanation (Code Generation Section)		if (KjcOptions.ratematch)		    buffersize = 			Util.nextPow2(Math.max((((Integer)RawBackend.steadyExecutionCounts.get(node)).intValue() - 1) * 					       filter.getPopInt() + filter.getPeekInt(), prepeek) + remaining);		else		    buffersize = Util.nextPow2(maxpeek + remaining);	    }	    	    int dim = (filter.getInputType().isArrayType()) ? 		((CArrayType)filter.getInputType()).getDims().length + 1		: 1;	    JVariableDefinition recvBufVar = 		new JVariableDefinition(null, 					at.dms.kjc.Constants.ACC_FINAL, //?????????					new CArrayType(filter.getInputType(), 						       dim /* dimension */ ),					recvBuffer,					bufferInitExp					(filter, filter.getInputType(), 					 buffersize));	    	    	    //the size of the buffer 	    JVariableDefinition recvBufferSizeVar = 		new JVariableDefinition(null, 					at.dms.kjc.Constants.ACC_FINAL, //?????????					CStdType.Integer,					recvBufferSize,					new JIntLiteral(buffersize));	    	    //the size of the buffer 	    JVariableDefinition recvBufferBitsVar = 		new JVariableDefinition(null, 					at.dms.kjc.Constants.ACC_FINAL, //?????????					CStdType.Integer,					recvBufferBits,					new JIntLiteral(buffersize - 1));	    	    //the receive buffer index (start of the buffer)	    JVariableDefinition recvBufferIndexVar = 		new JVariableDefinition(null, 					0, 					CStdType.Integer,					recvBufferIndex,					new JIntLiteral(-1));	    	    //the index to the end of the receive buffer)	    JVariableDefinition recvIndexVar = 		new JVariableDefinition(null, 					0, 					CStdType.Integer,					recvIndex,					new JIntLiteral(-1));	    JVariableDefinition[] indices = 		{		 		    recvBufferSizeVar,		    recvBufferBitsVar,		    recvBufferIndexVar,		    recvIndexVar		};	    	    localVariables.recvBuffer = recvBufVar;	    localVariables.recvBufferSize = recvBufferSizeVar;	    localVariables.recvBufferBits = recvBufferBitsVar;	    localVariables.recvBufferIndex = recvBufferIndexVar;	    localVariables.recvIndex = recvIndexVar;	    block.addStatement		(new JVariableDeclarationStatement(null,						   indices,						   null));	    block.addStatement		(new JVariableDeclarationStatement(null,						   recvBufVar, 						   null));	    	}		//if we are rate matching, create the output buffer with its 	//index	if (KjcOptions.ratematch && filter.getPushInt() > 0) {	    int steady = ((Integer)RawBackend.steadyExecutionCounts.			  get(Layout.getNode(Layout.getTile(filter)))).intValue();	    	    //define the send buffer index variable	    JVariableDefinition sendBufferIndexVar = 		new JVariableDefinition(null, 					0, 					CStdType.Integer,					sendBufferIndex,					new JIntLiteral(-1));	    	    localVariables.sendBufferIndex = sendBufferIndexVar;	    block.addStatement		(new JVariableDeclarationStatement(null,						   sendBufferIndexVar,						   null));	    //define the send buffer	    	    JExpression[] dims = new JExpression[1];	    //the size of the output array is number of executions in steady *	    // number of items pushed * size of item	    dims[0] = new JIntLiteral(steady * filter.getPushInt() * 				      Util.getTypeSize(filter.getOutputType()));	    JVariableDefinition sendBufVar = 		new JVariableDefinition(null, 					at.dms.kjc.Constants.ACC_FINAL, //?????????					new CArrayType(filter.getOutputType(), 						       1 /* dimension */ ),					sendBuffer,					new JNewArrayExpression(null,								Util.getBaseType(filter.getOutputType()),								dims, null));	    localVariables.sendBuffer = sendBufVar;	    block.addStatement		(new JVariableDeclarationStatement(null,						   sendBufVar,						   null));	}			//print the declarations for the array indices for pushing and popping	//if this filter deals with arrays	if (filter.getInputType().isArrayType() || 	    filter.getOutputType().isArrayType()) {	    int inputDim = 0, outputDim = 0, maxDim;	    //find which array has the greatest dimensionality	   	    if (filter.getInputType().isArrayType())		inputDim = 		    ((CArrayType)filter.getInputType()).getArrayBound();	    if (filter.getOutputType().isArrayType()) 		outputDim = 		    ((CArrayType)filter.getOutputType()).getArrayBound();	    maxDim = (inputDim > outputDim) ? inputDim : outputDim;	    	    localVariables.ARRAY_INDEX = new JVariableDefinition[maxDim];	    	    //create enough index vars as max dim	    for (int i = 0; i < maxDim; i++) {		JVariableDefinition arrayIndexVar = 		    new JVariableDefinition(null, 					    0, 					    CStdType.Integer,					    ARRAY_INDEX + i,					    null);		//remember the array index vars		localVariables.ARRAY_INDEX[i] = arrayIndexVar;				block.addStatement		    (new JVariableDeclarationStatement(null,						       arrayIndexVar, 						       null));	    }	}    }