[llvm] [CodeGen] @llvm.experimental.stackmap make operands immediate (PR #117932)
Guillaume DI FATTA via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 28 04:36:13 PST 2024
https://github.com/Atafid updated https://github.com/llvm/llvm-project/pull/117932
>From 4448cfe5d4b37583eee1a2658b2ef7d3696ff50d Mon Sep 17 00:00:00 2001
From: Guillaume DI FATTA <difatta.guillaume at gmail.com>
Date: Wed, 27 Nov 2024 23:12:52 +0100
Subject: [PATCH] Add immediate operands to llvm.experimental.stackmap
---
llvm/include/llvm/IR/Intrinsics.td | 2 +-
llvm/test/CodeGen/AArch64/stackmap-args.ll | 22 +++++++++++++++++++
.../CodeGen/PowerPC/ppc64-stackmap-args.ll | 22 +++++++++++++++++++
llvm/test/CodeGen/RISCV/rv64-stackmap-args.ll | 22 +++++++++++++++++++
llvm/test/CodeGen/SystemZ/stackmap-args.ll | 22 +++++++++++++++++++
llvm/test/CodeGen/X86/stackmap-args.ll | 22 +++++++++++++++++++
6 files changed, 111 insertions(+), 1 deletion(-)
create mode 100644 llvm/test/CodeGen/AArch64/stackmap-args.ll
create mode 100644 llvm/test/CodeGen/PowerPC/ppc64-stackmap-args.ll
create mode 100644 llvm/test/CodeGen/RISCV/rv64-stackmap-args.ll
create mode 100644 llvm/test/CodeGen/SystemZ/stackmap-args.ll
create mode 100644 llvm/test/CodeGen/X86/stackmap-args.ll
diff --git a/llvm/include/llvm/IR/Intrinsics.td b/llvm/include/llvm/IR/Intrinsics.td
index 1ca8c2565ab0b6..ee877349a33149 100644
--- a/llvm/include/llvm/IR/Intrinsics.td
+++ b/llvm/include/llvm/IR/Intrinsics.td
@@ -1655,7 +1655,7 @@ def int_strip_invariant_group : DefaultAttrsIntrinsic<[llvm_anyptr_ty],
//
def int_experimental_stackmap : DefaultAttrsIntrinsic<[],
[llvm_i64_ty, llvm_i32_ty, llvm_vararg_ty],
- [Throws]>;
+ [Throws, ImmArg<ArgIndex<0>>, ImmArg<ArgIndex<1>>]>;
def int_experimental_patchpoint_void : Intrinsic<[],
[llvm_i64_ty, llvm_i32_ty,
llvm_ptr_ty, llvm_i32_ty,
diff --git a/llvm/test/CodeGen/AArch64/stackmap-args.ll b/llvm/test/CodeGen/AArch64/stackmap-args.ll
new file mode 100644
index 00000000000000..04a427d7e86523
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/stackmap-args.ll
@@ -0,0 +1,22 @@
+; RUN: not llc -mtriple=arm64-linux-gnu < %s 2>&1 | FileCheck %s
+; Tests error when we pass non-immediate parameters to @llvm.experiment.stackmap
+
+define void @first_arg() {
+; CHECK: immarg operand has non-immediate parameter
+entry:
+ ; First operand should be immediate
+ %id = add i64 0, 0
+ call void (i64, i32, ...) @llvm.experimental.stackmap(i64 %id, i32 0)
+ ret void
+}
+
+define void @second_arg() {
+; CHECK: immarg operand has non-immediate parameter
+entry:
+ ; Second operand should be immediate
+ %numShadowByte = add i32 0, 0
+ call void (i64, i32, ...) @llvm.experimental.stackmap(i64 1, i32 %numShadowByte)
+ ret void
+}
+
+declare void @llvm.experimental.stackmap(i64, i32, ...)
diff --git a/llvm/test/CodeGen/PowerPC/ppc64-stackmap-args.ll b/llvm/test/CodeGen/PowerPC/ppc64-stackmap-args.ll
new file mode 100644
index 00000000000000..4e83db71793d6e
--- /dev/null
+++ b/llvm/test/CodeGen/PowerPC/ppc64-stackmap-args.ll
@@ -0,0 +1,22 @@
+; RUN: not llc -verify-machineinstrs -mcpu=ppc -mtriple=powerpc64-unknown-gnu-linux < %s 2>&1 | FileCheck %s
+; Tests error when we pass non-immediate parameters to @llvm.experiment.stackmap
+
+define void @first_arg() {
+; CHECK: immarg operand has non-immediate parameter
+entry:
+ ; First operand should be immediate
+ %id = add i64 0, 0
+ call void (i64, i32, ...) @llvm.experimental.stackmap(i64 %id, i32 0)
+ ret void
+}
+
+define void @second_arg() {
+; CHECK: immarg operand has non-immediate parameter
+entry:
+ ; Second operand should be immediate
+ %numShadowByte = add i32 0, 0
+ call void (i64, i32, ...) @llvm.experimental.stackmap(i64 1, i32 %numShadowByte)
+ ret void
+}
+
+declare void @llvm.experimental.stackmap(i64, i32, ...)
diff --git a/llvm/test/CodeGen/RISCV/rv64-stackmap-args.ll b/llvm/test/CodeGen/RISCV/rv64-stackmap-args.ll
new file mode 100644
index 00000000000000..9437ac02962b6c
--- /dev/null
+++ b/llvm/test/CodeGen/RISCV/rv64-stackmap-args.ll
@@ -0,0 +1,22 @@
+; RUN: not llc -mtriple=riscv64 < %s 2>&1 | FileCheck %s
+; Tests error when we pass non-immediate parameters to @llvm.experiment.stackmap
+
+define void @first_arg() {
+; CHECK: immarg operand has non-immediate parameter
+entry:
+ ; First operand should be immediate
+ %id = add i64 0, 0
+ call void (i64, i32, ...) @llvm.experimental.stackmap(i64 %id, i32 0)
+ ret void
+}
+
+define void @second_arg() {
+; CHECK: immarg operand has non-immediate parameter
+entry:
+ ; Second operand should be immediate
+ %numShadowByte = add i32 0, 0
+ call void (i64, i32, ...) @llvm.experimental.stackmap(i64 1, i32 %numShadowByte)
+ ret void
+}
+
+declare void @llvm.experimental.stackmap(i64, i32, ...)
diff --git a/llvm/test/CodeGen/SystemZ/stackmap-args.ll b/llvm/test/CodeGen/SystemZ/stackmap-args.ll
new file mode 100644
index 00000000000000..4c52a33c1e64ec
--- /dev/null
+++ b/llvm/test/CodeGen/SystemZ/stackmap-args.ll
@@ -0,0 +1,22 @@
+; RUN: not llc -mtriple=s390x-linux-gnu < %s 2>&1 | FileCheck %s
+; Tests error when we pass non-immediate parameters to @llvm.experiment.stackmap
+
+define void @first_arg() {
+; CHECK: immarg operand has non-immediate parameter
+entry:
+ ; First operand should be immediate
+ %id = add i64 0, 0
+ call void (i64, i32, ...) @llvm.experimental.stackmap(i64 %id, i32 0)
+ ret void
+}
+
+define void @second_arg() {
+; CHECK: immarg operand has non-immediate parameter
+entry:
+ ; Second operand should be immediate
+ %numShadowByte = add i32 0, 0
+ call void (i64, i32, ...) @llvm.experimental.stackmap(i64 1, i32 %numShadowByte)
+ ret void
+}
+
+declare void @llvm.experimental.stackmap(i64, i32, ...)
diff --git a/llvm/test/CodeGen/X86/stackmap-args.ll b/llvm/test/CodeGen/X86/stackmap-args.ll
new file mode 100644
index 00000000000000..622c41c06fb963
--- /dev/null
+++ b/llvm/test/CodeGen/X86/stackmap-args.ll
@@ -0,0 +1,22 @@
+; RUN: not llc -mtriple=x86_64-apple-darwin -mcpu=corei7 < %s 2>&1 | FileCheck %s
+; Tests error when we pass non-immediate parameters to @llvm.experiment.stackmap
+
+define void @first_arg() {
+; CHECK: immarg operand has non-immediate parameter
+entry:
+ ; First operand should be immediate
+ %id = add i64 0, 0
+ call void (i64, i32, ...) @llvm.experimental.stackmap(i64 %id, i32 0)
+ ret void
+}
+
+define void @second_arg() {
+; CHECK: immarg operand has non-immediate parameter
+entry:
+ ; Second operand should be immediate
+ %numShadowByte = add i32 0, 0
+ call void (i64, i32, ...) @llvm.experimental.stackmap(i64 1, i32 %numShadowByte)
+ ret void
+}
+
+declare void @llvm.experimental.stackmap(i64, i32, ...)
\ No newline at end of file
More information about the llvm-commits
mailing list