diff options
author | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2016-02-18 13:41:05 +0000 |
---|---|---|
committer | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2016-02-18 13:41:05 +0000 |
commit | 39686cf98e39036721aaf6944f2a703d82907664 (patch) | |
tree | 5ae25464bf3db24d0a68f34f640ac27c57095f2b | |
parent | e593094a1524789330f70a12f38405c27c75ceec (diff) | |
download | bcm5719-llvm-39686cf98e39036721aaf6944f2a703d82907664.tar.gz bcm5719-llvm-39686cf98e39036721aaf6944f2a703d82907664.zip |
[Hexagon] Update the callee-saved register set for EH-aware functions
llvm-svn: 261208
-rw-r--r-- | llvm/lib/Target/Hexagon/HexagonRegisterInfo.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/llvm/lib/Target/Hexagon/HexagonRegisterInfo.cpp b/llvm/lib/Target/Hexagon/HexagonRegisterInfo.cpp index d0be2855ce3..fbec687372d 100644 --- a/llvm/lib/Target/Hexagon/HexagonRegisterInfo.cpp +++ b/llvm/lib/Target/Hexagon/HexagonRegisterInfo.cpp @@ -62,8 +62,7 @@ HexagonRegisterInfo::getCallerSavedRegs(const MachineFunction *MF) const { Hexagon::R15, 0 }; - auto &HST = static_cast<const HexagonSubtarget&>(MF->getSubtarget()); - switch (HST.getHexagonArchVersion()) { + switch (MF->getSubtarget<HexagonSubtarget>().getHexagonArchVersion()) { case HexagonSubtarget::V4: case HexagonSubtarget::V5: case HexagonSubtarget::V55: @@ -83,17 +82,30 @@ HexagonRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const { Hexagon::R24, Hexagon::R25, Hexagon::R26, Hexagon::R27, 0 }; + // Functions that contain a call to __builtin_eh_return also save the first 4 + // parameter registers. + static const MCPhysReg CalleeSavedRegsV3EHReturn[] = { + Hexagon::R0, Hexagon::R1, Hexagon::R2, Hexagon::R3, + Hexagon::R16, Hexagon::R17, Hexagon::R18, Hexagon::R19, + Hexagon::R20, Hexagon::R21, Hexagon::R22, Hexagon::R23, + Hexagon::R24, Hexagon::R25, Hexagon::R26, Hexagon::R27, 0 + }; + + bool HasEHReturn = MF->getInfo<HexagonMachineFunctionInfo>()->hasEHReturn(); + switch (MF->getSubtarget<HexagonSubtarget>().getHexagonArchVersion()) { case HexagonSubtarget::V4: case HexagonSubtarget::V5: case HexagonSubtarget::V55: case HexagonSubtarget::V60: - return CalleeSavedRegsV3; + return HasEHReturn ? CalleeSavedRegsV3EHReturn : CalleeSavedRegsV3; } + llvm_unreachable("Callee saved registers requested for unknown architecture " "version"); } + BitVector HexagonRegisterInfo::getReservedRegs(const MachineFunction &MF) const { BitVector Reserved(getNumRegs()); |