Hi,
This is a follow-up on https://reviews.llvm.org/D79785.
This patch implements a heuristic to avoid lowering calls to blx if MF.getFunction().arg_size() + Outs.size() < (number of registers) - 1, since we need at least one register for holding function's address. It converts all calls to bl for the attached test-case. However it might not be able to detect cases when we need more than one register to compute arguments. For that, the approach in D79785, can catch some of these, by folding tLDRpci, tBLXr -> tBL.
Does this patch look reasonable ?
Testing with make check-llvm with -DLLVM_ENABLE_EXPENSIVE_CHECKS=ON shows no unexpected failures.
I have a couple of questions:
(a) How do we get number of available registers for subtarget in LowerCall ?
(b) I assume Outs.size() will correspond to number of arguments passed to the function ?
TargetLowering.h has following comment above LowerCall():
/// The outgoing arguments to the call are described by the Outs array, /// and the values to be returned by the call are described by the Ins
/// array.
Thanks!
clang-tidy: warning: invalid case style for variable 'nRegs' [readability-identifier-naming]
not useful