add code-gen for prim