spmd_compile: Move function creation into parser