1. A method, in a data processing system, for optimizing code to be run in a heterogeneous data processing environment, comprising: generating a call graph for program code; identifying characteristics of procedures in the call graph; comparing the characteristics of the procedures to characteristics of processing units in the heterogeneous data processing environment; selecting, for each of the procedures, a processing unit to execute the procedure based on results of the comparison; partitioning the program code in accordance with the selection of processing units for each procedure; and generating executable program code based on the partitioned program code.