A method and a device for abstracting instruction sequences in a computer
program. First, a control flow graph of the program is generated and
analysed in order to detect multiple occurrences of a same instruction
sequence (504, 506). Then, a function including the longest sequence
common to at least two instruction sequences from a plurality of
sequences having a common instruction sequence of equal or shorter length
compared to the longest sequence is created (512). Finally, the original
occurrences of the instruction sequences in the plurality of sequences
with a reference to a proper position in the newly created function are
deleted and a reference to a proper position in the created function
inserted instead (514).