Provides effective use of architecture-specific instructions. There is
provided a compiler including: a target partial program detecting unit
for detecting, from among a partial programs of the program to be
optimized, a partial program including instructions corresponding to all
instructions included in the pattern to be replaced as a partial program
to be optimized; an instruction sequence transforming unit for
transforming, in the partial program to be optimized, instructions other
than those instructions corresponding to instructions included in the
pattern to be replaced and those instructions having execution
dependencies different from the pattern to be replaced, so that
dependencies between instructions included in the partial program to be
optimized match the pattern to be replaced; an instruction sequence
replacing unit for replacing the partial program to be optimized
transformed by the instruction sequence transforming unit with a target
instruction sequence determined in accordance with the pattern to be
replaced.