[PATCH] D38143: Dynamic stack alignment for Thumb1

Anton Korobeynikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 22 08:03:51 PDT 2017


asl added inline comments.


================
Comment at: lib/Target/ARM/Thumb1FrameLowering.cpp:357
+    const unsigned NrBitsToZero = countTrailingZeros(MFI.getMaxAlignment());
+    // Emit the following sequence, using R4 as a temporary, since we cannot use
+    // SP as a source or destination register for the shifts:
----------------
rengolin wrote:
> hard-coding r4 here is bound to create problems. You need to make sure it's saved earlier (and popped later).
> 
> You also add four instructions to the prologue, which in Thumb1 is not great. It' better than bad codegen, of course, but you need to make sure how often the realignment will hit (from being fatal, I'm guessing not often), or if there's another way to do this (I can't think of anything).
> 
> Welcoming comments from people with more Thumb1 experience than myself.
Do we have register scavenger available here, so we could scavenge a spare register? Or it's too early to to this - before the frame is set up ?


https://reviews.llvm.org/D38143





More information about the llvm-commits mailing list