Optimizing whole programs for code size