diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2009-07-16 14:23:01 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2009-07-16 14:23:01 +0000 |
commit | b106b60456d2c5075c89634b6774a63a51c33e74 (patch) | |
tree | 58b7379a5833935913057bd17a76899be24e9d45 /llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp | |
parent | 871784ba88e2056e0abc63639cc6b14a091265d3 (diff) | |
download | bcm5719-llvm-b106b60456d2c5075c89634b6774a63a51c33e74.tar.gz bcm5719-llvm-b106b60456d2c5075c89634b6774a63a51c33e74.zip |
Handle FP callee-saved regs
llvm-svn: 76029
Diffstat (limited to 'llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp')
-rw-r--r-- | llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp b/llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp index ee9c9292290..ab92ebb89e8 100644 --- a/llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp +++ b/llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp @@ -39,7 +39,8 @@ SystemZRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const { SystemZ::R6D, SystemZ::R7D, SystemZ::R8D, SystemZ::R9D, SystemZ::R10D, SystemZ::R11D, SystemZ::R12D, SystemZ::R13D, SystemZ::R14D, SystemZ::R15D, - SystemZ::F1L, SystemZ::F3L, SystemZ::F5L, SystemZ::F7L, + SystemZ::F8L, SystemZ::F9L, SystemZ::F10L, SystemZ::F11L, + SystemZ::F12L, SystemZ::F13L, SystemZ::F14L, SystemZ::F15L, 0 }; @@ -55,6 +56,8 @@ SystemZRegisterInfo::getCalleeSavedRegClasses(const MachineFunction *MF) const { &SystemZ::GR64RegClass, &SystemZ::GR64RegClass, &SystemZ::GR64RegClass, &SystemZ::GR64RegClass, &SystemZ::FP64RegClass, &SystemZ::FP64RegClass, + &SystemZ::FP64RegClass, &SystemZ::FP64RegClass, + &SystemZ::FP64RegClass, &SystemZ::FP64RegClass, &SystemZ::FP64RegClass, &SystemZ::FP64RegClass, 0 }; return CalleeSavedRegClasses; @@ -142,18 +145,33 @@ SystemZRegisterInfo::processFunctionBeforeCalleeSavedScan(MachineFunction &MF, // Determine whether R15/R14 will ever be clobbered inside the function. And // if yes - mark it as 'callee' saved. MachineFrameInfo *FFI = MF.getFrameInfo(); + MachineRegisterInfo &MRI = MF.getRegInfo(); + + // Check whether high FPRs are ever used, if yes - we need to save R15 as + // well. + static const unsigned HighFPRs[] = { + SystemZ::F8L, SystemZ::F9L, SystemZ::F10L, SystemZ::F11L, + SystemZ::F12L, SystemZ::F13L, SystemZ::F14L, SystemZ::F15L, + SystemZ::F8S, SystemZ::F9S, SystemZ::F10S, SystemZ::F11S, + SystemZ::F12S, SystemZ::F13S, SystemZ::F14S, SystemZ::F15S, + }; + + bool HighFPRsUsed = false; + for (unsigned i = 0, e = array_lengthof(HighFPRs); i != e; ++i) + HighFPRsUsed |= MRI.isPhysRegUsed(HighFPRs[i]); if (FFI->hasCalls()) /* FIXME: function is varargs */ /* FIXME: function grabs RA */ /* FIXME: function calls eh_return */ - MF.getRegInfo().setPhysRegUsed(SystemZ::R14D); + MRI.setPhysRegUsed(SystemZ::R14D); - if (FFI->hasCalls() || + if (HighFPRsUsed || + FFI->hasCalls() || FFI->getObjectIndexEnd() != 0 || // Contains automatic variables FFI->hasVarSizedObjects() // Function calls dynamic alloca's /* FIXME: function is varargs */) - MF.getRegInfo().setPhysRegUsed(SystemZ::R15D); + MRI.setPhysRegUsed(SystemZ::R15D); } /// emitSPUpdate - Emit a series of instructions to increment / decrement the |