ProblemA straightforward instantiation of traditional dataflow analysis techniques fails to provide adequate precision for aggressive optimization of interrupt-driven MCU systems. These systems contain features which either must be dealt with because they hinder the analysis, or should be leveraged because they represent an untapped potential for information. The pivotal features in interrupt-driven MCU systems are the interrupts and the microcontroller themselves.
An interrupt complicates the dataflow analysis for a given code segment because during the segment it may fire at any time, it may fire repeatedly, or it may never fire at all. To avoid unnecessary degredation of the results, an analysis must have a better coping strategy for multiple flows due to interrupts than just modeling all possible interleavings of the flows. On the other hand, interrupts also provide useful divisions between program elements. Some data and code may be only accessed inside a single interrupt, inside multiple interrupts, or outside of any interrupt. Not capitalizing on the isolation of accesses due to interrupts will unnecessarily reduce analysis precision.
Low-level systems programming on MCUs often involves inline assembly and directly accessing specific parts of the MCU. For example, the status register may be directly read, shifted and masked in order to determine the status of the interrupt bit. Naively and pessimistically analyzing all hardware accesses degrades the analysis of systems code very quickly. Leveraging the information is crucial for the success of