1. A data processing system, comprising: a central processing unit (CPU) in communication with a system memory; legacy code stored in said system memory, wherein said legacy code is not optimized for said CPU; a code-optimizing coprocessor in communication with said system memory and said CPU; and control logic within said code-optimizing coprocessor that causes said code-optimizing coprocessor to generate optimized code from said legacy code while said CPU is executing said legacy code, such that said optimized code is tailored to said CPU.