Fix function pointer tail calls in armv8-M.base
authorPablo Barrio <pablo.barrio@arm.com>
Mon, 4 Dec 2017 16:55:49 +0000 (16:55 +0000)
committerPablo Barrio <pablo.barrio@arm.com>
Mon, 4 Dec 2017 16:55:49 +0000 (16:55 +0000)
commit2b4385846c86078e0012e7bfb2e8dc6476ae8dd0
tree92da7bef7c42566026d201d446d44bf0adfd02b7
parentf2fdc183b7bb771acd44bc9433557f36479fff79
Fix function pointer tail calls in armv8-M.base

Summary:
The compiler fails with the following error message:

fatal error: error in backend: ran out of registers during
register allocation

Tail call optimization for Armv8-M.base fails to meet all the required
constraints when handling calls to function pointers where the
arguments take up r0-r3. This is because the pointer to the
function to be called can only be stored in r0-r3, but these are
all occupied by arguments. This patch makes sure that tail call
optimization does not try to handle this type of calls.

Reviewers: chill, MatzeB, olista01, rengolin, efriedma

Reviewed By: olista01, efriedma

Subscribers: efriedma, aemerson, javed.absar, llvm-commits, kristof.beyls

Differential Revision: https://reviews.llvm.org/D40706

llvm-svn: 319664
llvm/lib/Target/ARM/ARMISelLowering.cpp
llvm/test/CodeGen/ARM/v8m-tail-call.ll