else buffersize = CalcBufferSize.getConsBufSize(Layout.getNode(Layout.getTile(filter)));
else {  int maxpeek = filter.getPeekInt();  if (filter instanceof SIRTwoStageFilter && (((SIRTwoStageFilter)filter).getInitPeek() > maxpeek)) maxpeek = ((SIRTwoStageFilter)filter).getInitPeek();  buffersize = Util.nextPow2(maxpeek + remaining); }
    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;	    	    if (isSimple(filter)) {		int prepeek = 0;		if (filter instanceof SIRTwoStageFilter) 		    prepeek = ((SIRTwoStageFilter)filter).getInitPeek();				buffersize = Math.max(prepeek, filter.getPeekInt());		//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 		buffersize = CalcBufferSize.getConsBufSize(Layout.getNode(Layout.getTile(filter)));	    	    JVariableDefinition recvBufVar = 		new JVariableDefinition(null, 					at.dms.kjc.Constants.ACC_FINAL, //?????????					new CArrayType(filter.getInputType(), 						       1 /* 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));	    	    	    //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));		}	    }	}    }