Code generation for channel pipelining