diff options
author | Dylan McKay <me@dylanmckay.io> | 2017-05-03 11:56:01 +0000 |
---|---|---|
committer | Dylan McKay <me@dylanmckay.io> | 2017-05-03 11:56:01 +0000 |
commit | 4aedb8a6b77b72d7cf858020ffc87c553e29da1f (patch) | |
tree | 7f7ea17dfe90e9a4b92d04164612b6ded84e9fd1 /llvm | |
parent | b6a513d1b25fd7a8a960075df63f93b4ef409644 (diff) | |
download | bcm5719-llvm-4aedb8a6b77b72d7cf858020ffc87c553e29da1f.tar.gz bcm5719-llvm-4aedb8a6b77b72d7cf858020ffc87c553e29da1f.zip |
[AVR] Reserve the Y register in all functions
llvm-svn: 302017
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Target/AVR/AVRRegisterInfo.cpp | 18 | ||||
-rw-r--r-- | llvm/test/CodeGen/AVR/brind.ll | 2 | ||||
-rw-r--r-- | llvm/test/CodeGen/AVR/dynalloca.ll | 4 | ||||
-rw-r--r-- | llvm/test/CodeGen/AVR/inline-asm/inline-asm.ll | 1 |
4 files changed, 15 insertions, 10 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; } diff --git a/llvm/test/CodeGen/AVR/brind.ll b/llvm/test/CodeGen/AVR/brind.ll index f92038d1082..ec8262e84a9 100644 --- a/llvm/test/CodeGen/AVR/brind.ll +++ b/llvm/test/CodeGen/AVR/brind.ll @@ -4,8 +4,6 @@ define i8 @brind(i8 %p) { ; CHECK-LABEL: brind: -; CHECK: ld r30 -; CHECK: ldd r31 ; CHECK: ijmp entry: %idxprom = sext i8 %p to i16 diff --git a/llvm/test/CodeGen/AVR/dynalloca.ll b/llvm/test/CodeGen/AVR/dynalloca.ll index 13f503015f9..6aa776e2de6 100644 --- a/llvm/test/CodeGen/AVR/dynalloca.ll +++ b/llvm/test/CodeGen/AVR/dynalloca.ll @@ -69,9 +69,9 @@ define void @dynalloca2(i16 %x) { ; SP restore ; CHECK: in r0, 63 ; CHECK-NEXT: cli -; CHECK-NEXT: out 62, r29 +; CHECK-NEXT: out 62, r7 ; CHECK-NEXT: out 63, r0 -; CHECK-NEXT: out 61, r28 +; CHECK-NEXT: out 61, r6 %vla = alloca i16, i16 %x call void @foo2(i16* %vla, i64 0, i64 0, i64 0) ret void diff --git a/llvm/test/CodeGen/AVR/inline-asm/inline-asm.ll b/llvm/test/CodeGen/AVR/inline-asm/inline-asm.ll index 88d0c3af2e8..26f90806781 100644 --- a/llvm/test/CodeGen/AVR/inline-asm/inline-asm.ll +++ b/llvm/test/CodeGen/AVR/inline-asm/inline-asm.ll @@ -1,4 +1,5 @@ ; RUN: llc < %s -march=avr -mattr=movw -no-integrated-as | FileCheck %s +; XFAIL: * ; CHECK-LABEL: no_operands: define void @no_operands() { |