To collect frequencies with which processes of a program are executed at
high speed. A compiler apparatus for optimizing a program based on
frequencies with which each process is executed has a loop process
detection portion for detecting a repeatedly executed loop process of the
program, a loop process frequency collection portion for collecting loop
process frequencies with which the loop process is executed in the
program, an in-loop process frequency collection portion for collecting
in-loop process frequencies with which, as against times of execution of
loop process, each of a plurality of in-loop processes included in the
loop process is executed, an in-loop execution information generating
portion for generating in-loop execution information indicating the
frequencies with which each of the plurality of in-loop processes is
executed in the case where the program is executed, and an optimization
portion for optimizing the program based on the in-loop execution
information.