[CSKY] Fix error of underestimated function size by save/restore R15(LR) when we...
authorZi Xuan Wu (Zeson) <zixuan.wu@linux.alibaba.com>
Wed, 1 Jun 2022 02:42:33 +0000 (10:42 +0800)
committerZi Xuan Wu <zixuan.wu@linux.alibaba.com>
Wed, 1 Jun 2022 03:05:19 +0000 (11:05 +0800)
commit80fd9f3e0a185fb285a9b597e020d60bb5dfb9a2
treed8587d93efe260b683bce44c36359e55450e2311
parent944110353b970fc99de3f012292b4c29d4d91999
[CSKY] Fix error of underestimated function size by save/restore R15(LR) when we use BSR far jump.

In CSKYConstantIslands, when fix up an unconditional branch(CSKY::BR32) whose destination is
too far away to fit in its displacement field, and if the R15(LR) register has been
spilled in the prologue, then we can use BSR to implement a far jump. So we need estimate function
size, and spill R15(LR) when the function size >= unconditional branch(CSKY::BR32) can reach.

EstimateFunctionSizeInBytes function adds up all instructions and constant pool entries(each entry is 4 bytes).
llvm/lib/Target/CSKY/CSKYFrameLowering.cpp