We present EXTREMIS, a compile-time pipeline that improves energy consumption of battery-less devices by ensuring that memory operations occur at the most efficient device frequency setting. Different memory operations incur different energy consumption depending on a device's current operating frequency. Volatile memory operations, for example, are generally most efficient at the highest frequency, whereas non-volatile memory operations may require wait cycles that make lower frequency setting more energy savvy. EXTREMIS reorders the instructions without violating data dependencies and inserts instructions to change the operating frequency depending on program flow and memory access patterns, reconciling their energy overhead with the gains they possibly enable. This is achieved by solving a series of optimization problems at compile-time. Our evaluation shows that, compared to a static frequency setting, EXTREMIS reduces a program's energy consumption by up to 11%, without incurring in any extra cost.