MicroC Code Generator : Code Optimizations : Inline Entering and Exiting Reactions

Inline Entering and Exiting Reactions

Inlining exiting and entering reaction on transitions is performed according to user defined criteria.

Inlining entering or exiting reactions is based on the following criteria:

Example
When having single hierarchy, -T0-> S1 –T1-> S1.S11 –T2-> S1.S11.S111 a transition entering that hierarchy will target directly S111 no having intermediate states S1 and S11.
Behavior definition (semantics): When taking a transition, the transition action is performed, then exiting reaction, from the inner most state that the transition exit to the outer most, then entering reaction is performed, from the outer most state the transition is entering to the inner most.
Without optimization, the following sequence would have been performed as follows:

Consider action Ai on transition Ti, entering reaction Ei for state Si Then:

A0, E1, A1, E11, A2, E111

After “clutching” the sequence will be:

A0, A1, A2, E1, E11, E111

The test models show a 20-30% reduction in ROM size when using those optimization flags.