CodeGen for user-defined types