[PATCH] D29553: [AVR] Implement stacksave/stackrestore by expanding (PR31342)

Dylan McKay via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 5 13:47:10 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL294146: [AVR] Implement stacksave/stackrestore by expanding (PR31342) (authored by dylanmckay).

Changed prior to commit:
  https://reviews.llvm.org/D29553?vs=87141&id=87168#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29553

Files:
  llvm/trunk/lib/Target/AVR/AVRISelLowering.cpp
  llvm/trunk/test/CodeGen/AVR/intrinsics/stacksave-restore.ll


Index: llvm/trunk/lib/Target/AVR/AVRISelLowering.cpp
===================================================================
--- llvm/trunk/lib/Target/AVR/AVRISelLowering.cpp
+++ llvm/trunk/lib/Target/AVR/AVRISelLowering.cpp
@@ -48,6 +48,8 @@
   setOperationAction(ISD::GlobalAddress, MVT::i16, Custom);
   setOperationAction(ISD::BlockAddress, MVT::i16, Custom);
 
+  setOperationAction(ISD::STACKSAVE, MVT::Other, Expand);
+  setOperationAction(ISD::STACKRESTORE, MVT::Other, Expand);
   setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i8, Expand);
   setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i16, Expand);
 
Index: llvm/trunk/test/CodeGen/AVR/intrinsics/stacksave-restore.ll
===================================================================
--- llvm/trunk/test/CodeGen/AVR/intrinsics/stacksave-restore.ll
+++ llvm/trunk/test/CodeGen/AVR/intrinsics/stacksave-restore.ll
@@ -0,0 +1,27 @@
+; RUN: llc -O0 < %s -march=avr | FileCheck %s
+
+; CHECK-LABEL: foo
+define void @foo() {
+entry:
+  br label %save
+
+; CHECK-LABEL: save
+; CHECK: in [[SREG1:r[0-9]+]], 61
+; CHECK-NEXT: in [[SREG2:r[0-9]+]], 62
+save:
+  %saved = call i8* @llvm.stacksave()
+  br label %restore
+
+; CHECK-LABEL: restore
+; CHECK: in r0, 63
+; CHECK-NEXT: cli
+; CHECK-NEXT: out 62, [[SREG2]]
+; CHECK-NEXT: out 63, r0
+; CHECK-NEXT: out 61, [[SREG1]]
+restore:
+  call void @llvm.stackrestore(i8* %saved)
+  ret void
+}
+
+declare i8* @llvm.stacksave()
+declare void @llvm.stackrestore(i8* %ptr)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29553.87168.patch
Type: text/x-patch
Size: 1480 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170205/e5e72b95/attachment.bin>


More information about the llvm-commits mailing list