Compact Code Generation and Throughput Optimization for Coarse-Grained Reconfigurable Arrays