Improve codegen for enums.