CXX_FAST_TLS calling convention: target independent portion.
authorManman Ren <manman.ren@gmail.com>
Fri, 11 Dec 2015 18:24:30 +0000 (18:24 +0000)
committerManman Ren <manman.ren@gmail.com>
Fri, 11 Dec 2015 18:24:30 +0000 (18:24 +0000)
commit6aac92b939ff846344ae7d60bac91d03b56d8c06
treef0e2554469866d99b0df25a1520c23deeee19d1f
parent46e81ea9050adde67ebc70acf42983e533711652
CXX_FAST_TLS calling convention: target independent portion.

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 calling convention 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.

rdar://problem/23557469

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255353 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/FunctionLoweringInfo.h
include/llvm/Target/TargetLowering.h
include/llvm/Target/TargetRegisterInfo.h
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp