CXX_FAST_TLS calling convention: performance improvement for AArch64.
authorManman Ren <manman.ren@gmail.com>
Wed, 16 Dec 2015 21:04:19 +0000 (21:04 +0000)
committerManman Ren <manman.ren@gmail.com>
Wed, 16 Dec 2015 21:04:19 +0000 (21:04 +0000)
commit3559ef2a366e0003693c5f980d160a82c0d45601
tree07ffd6be1adfc83007c9a510170ffe0e597e2993
parentf2677d0fc2df01f081f341a12c1221b89503c0ed
CXX_FAST_TLS calling convention: performance improvement for AArch64.

The access function has a short entry and a short exit, the initialization
block is only run the first time. To improve the performance, we want to
have a short frame at the entry and exit.

We explicitly handle most of the CSRs via copies. Only the CSRs that are not
handled via copies will be in CSR_SaveList.

Frame lowering and prologue/epilogue insertion will generate a short frame
in the entry and exit according to CSR_SaveList. The majority of the CSRs will
be handled by register allcoator. Register allocator will try to spill and
reload them in the initialization block.

We add CSRsViaCopy, it will be explicitly handled during lowering.

1> we first set FunctionLoweringInfo->SplitCSR if conditions are met (the target
   supports it for the given machine function and the function has only return
   exits). We also call TLI->initializeSplitCSR to perform initialization.
2> we call TLI->insertCopiesSplitCSR to insert copies from CSRsViaCopy to
   virtual registers at beginning of the entry block and copies from virtual
   registers to CSRsViaCopy at beginning of the exit blocks.
3> we also need to make sure the explicit copies will not be eliminated.

The target independent portion was committed as r255353.
rdar://problem/23557469

Differential Revision: http://reviews.llvm.org/D15341

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255821 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/AArch64/AArch64CallingConvention.td
lib/Target/AArch64/AArch64FastISel.cpp
lib/Target/AArch64/AArch64ISelLowering.cpp
lib/Target/AArch64/AArch64ISelLowering.h
lib/Target/AArch64/AArch64MachineFunctionInfo.h
lib/Target/AArch64/AArch64RegisterInfo.cpp
lib/Target/AArch64/AArch64RegisterInfo.h
test/CodeGen/AArch64/cxx-tlscc.ll