MachineOutliner support was previously added for Thumb2 and ARM modes, but.
Thumb1 support was left out, asbecause there is no idiomaticsimple way to push the LR ontoh
the LR onto the stack and then restore it back into the LR,LR. which is required forSuch an
MachineOutlinerDefault andidiom is required when:
- A repeated sequences that have calls in them. contains a call, Thewhich requires the LR to be
saved and restored at the frame site.
other outlining strategies can be done in the same manner as Thumb2- MachineOutlinerDefault, becausewhere the LR needs to be saved and restored
they all use Thumb1 instructions at the call site.
This patch enables Thumb1 support for the outlinerBesides the two situations described above, and introduces an idiom forThumb1 machine outlining
saving and restoring the LR under certain circumstances. If there is an unusedshould be able to reuse all of the code introduced for machine
register in a repeated sequenceoutlining in Thumb2, then saving the LR is possible by thissince all instructions generated fall in the
sequence of instructions: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