1. A method for generating a program generated by an information processing apparatus and executed by a processor including an internal memory in which the program is stored, the method comprising: executing a source program including a plurality of functions having a hierarchy structure, and sequentially selecting a function whose execution frequency is high as a selected function that is to be stored in the internal memory; allocating the selected function to a memory area of the internal memory, allocating a function that is not the selected function and is called from the selected function to an area close to the memory area of the internal memory, and generating an internal load module; and allocating a remaining function to an external memory coupled to the processor and generating an external load module.