···11+commit eb92f5a745014532b83abfba04602fce87ca8393
22+Author: Chuang-Yu Cheng <cycheng@multicorewareinc.com>
33+Date: Fri Apr 8 12:04:32 2016 +0000
44+55+ CXX_FAST_TLS calling convention: performance improvement for PPC64
66+77+ This is the same change on PPC64 as r255821 on AArch64. I have even borrowed
88+ his commit message.
99+1010+ The access function has a short entry and a short exit, the initialization
1111+ block is only run the first time. To improve the performance, we want to
1212+ have a short frame at the entry and exit.
1313+1414+ We explicitly handle most of the CSRs via copies. Only the CSRs that are not
1515+ handled via copies will be in CSR_SaveList.
1616+1717+ Frame lowering and prologue/epilogue insertion will generate a short frame
1818+ in the entry and exit according to CSR_SaveList. The majority of the CSRs will
1919+ be handled by register allcoator. Register allocator will try to spill and
2020+ reload them in the initialization block.
2121+2222+ We add CSRsViaCopy, it will be explicitly handled during lowering.
2323+2424+ 1> we first set FunctionLoweringInfo->SplitCSR if conditions are met (the target
2525+ supports it for the given machine function and the function has only return
2626+ exits). We also call TLI->initializeSplitCSR to perform initialization.
2727+ 2> we call TLI->insertCopiesSplitCSR to insert copies from CSRsViaCopy to
2828+ virtual registers at beginning of the entry block and copies from virtual
2929+ registers to CSRsViaCopy at beginning of the exit blocks.
3030+ 3> we also need to make sure the explicit copies will not be eliminated.
3131+3232+ Author: Tom Jablin (tjablin)
3333+ Reviewers: hfinkel kbarton cycheng
3434+3535+ http://reviews.llvm.org/D17533
3636+3737+ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265781 91177308-0d34-0410-b5e6-96231b3b80d8
3838+3939+diff --git a/lib/CodeGen/TargetFrameLoweringImpl.cpp b/lib/CodeGen/TargetFrameLoweringImpl.cpp
4040+index 679ade1..0a0e079 100644
4141+--- a/lib/CodeGen/TargetFrameLoweringImpl.cpp
4242++++ b/lib/CodeGen/TargetFrameLoweringImpl.cpp
4343+@@ -63,12 +63,15 @@ void TargetFrameLowering::determineCalleeSaves(MachineFunction &MF,
4444+ const TargetRegisterInfo &TRI = *MF.getSubtarget().getRegisterInfo();
4545+ const MCPhysReg *CSRegs = TRI.getCalleeSavedRegs(&MF);
4646+4747++ // Resize before the early returns. Some backends expect that
4848++ // SavedRegs.size() == TRI.getNumRegs() after this call even if there are no
4949++ // saved registers.
5050++ SavedRegs.resize(TRI.getNumRegs());
5151++
5252+ // Early exit if there are no callee saved registers.
5353+ if (!CSRegs || CSRegs[0] == 0)
5454+ return;
5555+5656+- SavedRegs.resize(TRI.getNumRegs());
5757+-
5858+ // In Naked functions we aren't going to save any registers.
5959+ if (MF.getFunction()->hasFnAttribute(Attribute::Naked))
6060+ return;