ARM, AArch64, X86: Check preserved registers for tail calls.
authorMatthias Braun <matze@braunis.de>
Mon, 4 Apr 2016 18:56:13 +0000 (18:56 +0000)
committerMatthias Braun <matze@braunis.de>
Mon, 4 Apr 2016 18:56:13 +0000 (18:56 +0000)
commit870c34f0cfe0678dedcec33770fe4304b60c2e0c
tree46113c7f1c7c847dcceddbb570c39e0262fd6f7b
parenteb3219a9c23444361172f9840f2338cc5de0152d
ARM, AArch64, X86: Check preserved registers for tail calls.

We can only perform a tail call to a callee that preserves all the
registers that the caller needs to preserve.

This situation happens with calling conventions like preserver_mostcc or
cxx_fast_tls. It was explicitely handled for fast_tls and failing for
preserve_most. This patch generalizes the check to any calling
convention.

Related to rdar://24207743

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

llvm-svn: 265329
llvm/include/llvm/Target/TargetRegisterInfo.h
llvm/lib/CodeGen/TargetRegisterInfo.cpp
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/lib/Target/ARM/ARMISelLowering.cpp
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/AArch64/tailcall-ccmismatch.ll [new file with mode: 0644]
llvm/test/CodeGen/ARM/cxx-tlscc.ll