[PATCH] D87136: [ARM][MachineOutliner] Add calls default handling.

Yvan Roux via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 8 06:41:05 PDT 2020


yroux added inline comments.


================
Comment at: llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp:5845
+                      [](const MachineInstr &MI) { return MI.isCall(); }))
+        NumBytesToCreateFrame += Costs.FrameDefault;
+
----------------
yroux wrote:
> samparker wrote:
> > I've forgotten what FrameDefault represents, but is this right considering that NumBytesToCreateFrame is also initialised to this?
> Ah right, the logic here is that NumBytesToCreateFrame is initialised to the costs in byte of adding a "bx lr" to the outlined code (2 or 4 bytes if we are in T2 or  ARM) then if we are in a taillcall or thunk case it is set to 0 since the nothing is added to the code, and here we check if there is a call in the outlined chunk, which means that we need to insert a save and restore of the link register, thus we need to increase NumBytesToCreateFrame by the cost of a CallDefault and not FrameDefault, and it is the same in the test below.  I'll update the patch.
well, since CallDefault cost contains the cost of the branch it will not be accurate, I'll add a proper cost for save/restore lr


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87136/new/

https://reviews.llvm.org/D87136



More information about the llvm-commits mailing list