This patch handles cases where we have to save/restore the link register into the stack and and load/store instruction which use the stack are part of the outlined region. It checks that there will be no overflow introduced by the new offset and fixup these instructions accordingly.
Sorry for the big delay Yvan, I haven't really been working on LLVM recently.
How about extracting this out into ARMBaseInstrInfo? There seems to be a fair number of places in the backend where getting the NumBits and Scale comes up.
Does this mean that we can call fixupPostOutline twice on MBB? I'm confused why we're checking for saving LR here, when it looks like we'd know for sure around line 6351.
no worries ;)
Yes I was thinking of that kind of refactoring and I'll look at it, now if you are ok with that peace of code, what about committing it as it is such that we can have full version of the machine outliner in LLVM-12. And I'll propose a refactoring patch ASAP (since will touch BaseRegisterInfo, ConstantIsland, etc... I guess it will take some time to validate it properly)
we have 2 cases where LR is saved on the stack and we need to fixup its access: