[Mlir-commits] [mlir] fa581f9 - [mlir] Add stacksave, stackrestore to llvm dialect
Alex Zinenko
llvmlistbot at llvm.org
Tue Feb 9 06:13:26 PST 2021
Author: Denys Shabalin
Date: 2021-02-09T15:13:16+01:00
New Revision: fa581f943887c1d1fd95b01ae5f28140e97331bf
URL: https://github.com/llvm/llvm-project/commit/fa581f943887c1d1fd95b01ae5f28140e97331bf
DIFF: https://github.com/llvm/llvm-project/commit/fa581f943887c1d1fd95b01ae5f28140e97331bf.diff
LOG: [mlir] Add stacksave, stackrestore to llvm dialect
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D96333
Added:
Modified:
mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
mlir/test/Target/llvmir-intrinsics.mlir
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
index e44dbb8f17ec..368373519ff4 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
@@ -1277,6 +1277,19 @@ def LLVM_CoroResumeOp : LLVM_IntrOp<"coro.resume", [], [], [], 0> {
let assemblyFormat = "$handle attr-dict";
}
+//
+// Stack save/restore intrinsics.
+//
+
+def LLVM_StackSaveOp : LLVM_OneResultIntrOp<"stacksave"> {
+ let assemblyFormat = "attr-dict `:` type($res)";
+}
+
+def LLVM_StackRestoreOp : LLVM_ZeroResultIntrOp<"stackrestore"> {
+ let arguments = (ins LLVM_i8Ptr:$ptr);
+ let assemblyFormat = "$ptr attr-dict";
+}
+
//
// Vector Reductions.
//
diff --git a/mlir/test/Target/llvmir-intrinsics.mlir b/mlir/test/Target/llvmir-intrinsics.mlir
index 12b470a8176b..a9fe6f692c68 100644
--- a/mlir/test/Target/llvmir-intrinsics.mlir
+++ b/mlir/test/Target/llvmir-intrinsics.mlir
@@ -405,6 +405,20 @@ llvm.func @coro_resume(%arg0: !llvm.ptr<i8>) {
llvm.return
}
+// CHECK-LABEL: @stack_save
+llvm.func @stack_save() {
+ // CHECK: call i8* @llvm.stacksave
+ %0 = llvm.intr.stacksave : !llvm.ptr<i8>
+ llvm.return
+}
+
+// CHECK-LABEL: @stack_restore
+llvm.func @stack_restore(%arg0: !llvm.ptr<i8>) {
+ // CHECK: call void @llvm.stackrestore
+ llvm.intr.stackrestore %arg0
+ llvm.return
+}
+
// Check that intrinsics are declared with appropriate types.
// CHECK-DAG: declare float @llvm.fma.f32(float, float, float)
// CHECK-DAG: declare <8 x float> @llvm.fma.v8f32(<8 x float>, <8 x float>, <8 x float>) #0
More information about the Mlir-commits
mailing list