summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorDylan McKay <me@dylanmckay.io>2017-05-03 11:56:01 +0000
committerDylan McKay <me@dylanmckay.io>2017-05-03 11:56:01 +0000
commit4aedb8a6b77b72d7cf858020ffc87c553e29da1f (patch)
tree7f7ea17dfe90e9a4b92d04164612b6ded84e9fd1 /llvm/lib/Target
parentb6a513d1b25fd7a8a960075df63f93b4ef409644 (diff)
downloadbcm5719-llvm-4aedb8a6b77b72d7cf858020ffc87c553e29da1f.tar.gz
bcm5719-llvm-4aedb8a6b77b72d7cf858020ffc87c553e29da1f.zip
[AVR] Reserve the Y register in all functions
llvm-svn: 302017
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/AVR/AVRRegisterInfo.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/llvm/lib/Target/AVR/AVRRegisterInfo.cpp b/llvm/lib/Target/AVR/AVRRegisterInfo.cpp
index 5cc7eaf8add..2813e24d2ac 100644
--- a/llvm/lib/Target/AVR/AVRRegisterInfo.cpp
+++ b/llvm/lib/Target/AVR/AVRRegisterInfo.cpp
@@ -65,12 +65,18 @@ BitVector AVRRegisterInfo::getReservedRegs(const MachineFunction &MF) const {
Reserved.set(AVR::SPH);
Reserved.set(AVR::SP);
- // Reserve the frame pointer registers r28 and r29 if the function requires one.
- if (TFI->hasFP(MF)) {
- Reserved.set(AVR::R28);
- Reserved.set(AVR::R29);
- Reserved.set(AVR::R29R28);
- }
+ // We tenatively reserve the frame pointer register r29:r28 because the
+ // function may require one, but we cannot tell until register allocation
+ // is complete, which can be too late.
+ //
+ // Instead we just unconditionally reserve the Y register.
+ //
+ // TODO: Write a pass to enumerate functions which reserved the Y register
+ // but didn't end up needing a frame pointer. In these, we can
+ // convert one or two of the spills inside to use the Y register.
+ Reserved.set(AVR::R28);
+ Reserved.set(AVR::R29);
+ Reserved.set(AVR::R29R28);
return Reserved;
}
OpenPOWER on IntegriCloud