diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-08-24 17:43:23 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-08-24 17:43:23 +0000 |
commit | 75b4d546cd9d9f62a5a3466e6df5629262aef7b1 (patch) | |
tree | b141eb279efd6e78815df4a94ec3b5e5a8b1bf7f /contrib/llvm-project/llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp | |
parent | d065b3eb9ed6785a19dc7d96fb34a0050747c663 (diff) | |
parent | bdc6feb28f528ee3a365ca97577f7312ffa0dc65 (diff) | |
download | src-test2-75b4d546cd9d9f62a5a3466e6df5629262aef7b1.tar.gz src-test2-75b4d546cd9d9f62a5a3466e6df5629262aef7b1.zip |
Notes
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp index 83a488afc797..3e9c8c7b6df2 100644 --- a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp +++ b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp @@ -40,7 +40,30 @@ AArch64RegisterInfo::AArch64RegisterInfo(const Triple &TT) AArch64_MC::initLLVMToCVRegMapping(this); } -static bool hasSVEArgsOrReturn(const MachineFunction *MF) { +/// Return whether the register needs a CFI entry. Not all unwinders may know +/// about SVE registers, so we assume the lowest common denominator, i.e. the +/// callee-saves required by the base ABI. For the SVE registers z8-z15 only the +/// lower 64-bits (d8-d15) need to be saved. The lower 64-bits subreg is +/// returned in \p RegToUseForCFI. +bool AArch64RegisterInfo::regNeedsCFI(unsigned Reg, + unsigned &RegToUseForCFI) const { + if (AArch64::PPRRegClass.contains(Reg)) + return false; + + if (AArch64::ZPRRegClass.contains(Reg)) { + RegToUseForCFI = getSubReg(Reg, AArch64::dsub); + for (int I = 0; CSR_AArch64_AAPCS_SaveList[I]; ++I) { + if (CSR_AArch64_AAPCS_SaveList[I] == RegToUseForCFI) + return true; + } + return false; + } + + RegToUseForCFI = Reg; + return true; +} + +bool AArch64RegisterInfo::hasSVEArgsOrReturn(const MachineFunction *MF) { const Function &F = MF->getFunction(); return isa<ScalableVectorType>(F.getReturnType()) || any_of(F.args(), [](const Argument &Arg) { |