Split Temporary Variable
- You have a temporary variable assigned to more than once, but is not a loop variable nor a collecting temporary variable.
Make a separate temporary variable for each assignment.
eax = 1; ecx = eax*2; ... eax = 6; func(eax);
⇓
eax1 = 1; ecx = eax1*2; ... eax2 = 6; func(eax2);
Motivation
In compiled code, the registers are recurrently used as temporary variables, having more than one responsibility in the code, which is confusing to the reader. A different temporary variable should be used for each responsibility.
Mechanics
- Declare a new variable for each assignment of the specified variable.
- Rename the variable at and after each assignment, using one of the newly defined variable names.