A long-term learning algorithm for compilers, and its gcc reference implementation