Automatic dependency analysis and fusion of kernel-based codes during compilation