MachineOutliner support was previously added for Thumb2 and ARM modes.
Thumb1 support was left out, because there is no simple way to push
the LR onto the stack and then restore it back into the LR. Such an
idiom is required when:
- A repeated sequence contains a call, which requires the LR to be saved and restored at the frame site.
- MachineOutlinerDefault, where the LR needs to be saved and restored at the call site.
Besides the two situations described above, Thumb1 machine outlining
should be able to reuse all of the code introduced for machine
outlining in Thumb2, since all instructions generated fall in the
Thumb1 subset.
This patch enables Thumb1 support for the outliner, and introduces an
idiom for saving and restoring the LR. The LR can only be saved and
restored if there is an unused register in a repeated sequence. If
this is the case, then the machine outliner can generate this sequence
of instructions to save the LR:
PUSH R4 ;; Free up an auxilary register PUSH LR ;; LR must go on the top of the stack ...... ;; Original sequence of instructions POP R4 ;; Pop LR off the stack into R4 ;; (Cannot be directly popped into LR) MOV LR, R4 ;; Move LR into the correct register POP R4 ;; Pop the original value of R4 into R4
clang-tidy: warning: 'true' and 'false' expressions are equivalent [misc-redundant-expression]
not useful