[PATCH] D93539: [VE] Support STACKSAVE and STACKRESTORE

Kazushi Marukawa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 18 06:22:28 PST 2020


kaz7 created this revision.
kaz7 added reviewers: simoll, k-ishizaka.
kaz7 added projects: LLVM, VE.
Herald added a subscriber: hiraditya.
kaz7 requested review of this revision.
Herald added a subscriber: llvm-commits.

Change to use default expanded code.  Add regression tests also.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93539

Files:
  llvm/lib/Target/VE/VEISelLowering.cpp
  llvm/test/CodeGen/VE/Scalar/stacksave.ll


Index: llvm/test/CodeGen/VE/Scalar/stacksave.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/VE/Scalar/stacksave.ll
@@ -0,0 +1,26 @@
+; RUN: llc < %s -mtriple=ve | FileCheck %s
+
+; Function Attrs: noinline nounwind optnone
+define i8* @stacksave() {
+; CHECK-LABEL: stacksave:
+; CHECK:       .LBB{{[0-9]+}}_2:
+; CHECK-NEXT:    or %s0, 0, %s11
+; CHECK-NEXT:    or %s11, 0, %s9
+  %ret = call i8* @llvm.stacksave()
+  ret i8* %ret
+}
+
+; Function Attrs: noinline nounwind optnone
+define void @stackrestore(i8* %ptr) {
+; CHECK-LABEL: stackrestore:
+; CHECK:       .LBB{{[0-9]+}}_2:
+; CHECK-NEXT:    or %s11, 0, %s0
+; CHECK-NEXT:    or %s11, 0, %s9
+  call void @llvm.stackrestore(i8* %ptr)
+  ret void
+}
+
+; Function Attrs: nounwind
+declare i8* @llvm.stacksave()
+; Function Attrs: nounwind
+declare void @llvm.stackrestore(i8*)
Index: llvm/lib/Target/VE/VEISelLowering.cpp
===================================================================
--- llvm/lib/Target/VE/VEISelLowering.cpp
+++ llvm/lib/Target/VE/VEISelLowering.cpp
@@ -135,6 +135,10 @@
   /// Stack {
   setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i32, Custom);
   setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i64, Custom);
+
+  // Use the default implementation.
+  setOperationAction(ISD::STACKSAVE, MVT::Other, Expand);
+  setOperationAction(ISD::STACKRESTORE, MVT::Other, Expand);
   /// } Stack
 
   /// Branch {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93539.312782.patch
Type: text/x-patch
Size: 1456 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201218/0758b5b3/attachment.bin>


More information about the llvm-commits mailing list