summaryrefslogtreecommitdiffstats
path: root/llvm/test/Verifier
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2015-01-13 00:48:10 +0000
committerReid Kleckner <reid@kleckner.net>2015-01-13 00:48:10 +0000
commite9b893187333ca069b5aed697ad784865e42f79f (patch)
treee17ad1b3279b4a6383370b0739b862f1b0635790 /llvm/test/Verifier
parent845755c4bb6c55eca84700060de706331ba77a71 (diff)
downloadbcm5719-llvm-e9b893187333ca069b5aed697ad784865e42f79f.tar.gz
bcm5719-llvm-e9b893187333ca069b5aed697ad784865e42f79f.zip
Add the llvm.frameallocate and llvm.recoverframeallocation intrinsics
These intrinsics allow multiple functions to share a single stack allocation from one function's call frame. The function with the allocation may only perform one allocation, and it must be in the entry block. Functions accessing the allocation call llvm.recoverframeallocation with the function whose frame they are accessing and a frame pointer from an active call frame of that function. These intrinsics are very difficult to inline correctly, so the intention is that they be introduced rarely, or at least very late during EH preparation. Reviewers: echristo, andrew.w.kaylor Differential Revision: http://reviews.llvm.org/D6493 llvm-svn: 225746
Diffstat (limited to 'llvm/test/Verifier')
-rw-r--r--llvm/test/Verifier/frameallocate.ll48
1 files changed, 48 insertions, 0 deletions
diff --git a/llvm/test/Verifier/frameallocate.ll b/llvm/test/Verifier/frameallocate.ll
new file mode 100644
index 00000000000..3a4258007fd
--- /dev/null
+++ b/llvm/test/Verifier/frameallocate.ll
@@ -0,0 +1,48 @@
+; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
+
+declare i8* @llvm.frameallocate(i32)
+declare i8* @llvm.recoverframeallocation(i8*, i8*)
+
+define internal void @f() {
+ call i8* @llvm.frameallocate(i32 4)
+ call i8* @llvm.frameallocate(i32 4)
+ ret void
+}
+; CHECK: multiple calls to llvm.frameallocate in one function
+
+define internal void @f_a(i32 %n) {
+ call i8* @llvm.frameallocate(i32 %n)
+ ret void
+}
+; CHECK: llvm.frameallocate argument must be constant integer size
+
+define internal void @g() {
+entry:
+ br label %not_entry
+not_entry:
+ call i8* @llvm.frameallocate(i32 4)
+ ret void
+}
+; CHECK: llvm.frameallocate used outside of entry block
+
+define internal void @h() {
+ call i8* @llvm.recoverframeallocation(i8* null, i8* null)
+ ret void
+}
+; CHECK: llvm.recoverframeallocation first argument must be function defined in this module
+
+@global = constant i8 0
+
+declare void @declaration()
+
+define internal void @i() {
+ call i8* @llvm.recoverframeallocation(i8* @global, i8* null)
+ ret void
+}
+; CHECK: llvm.recoverframeallocation first argument must be function defined in this module
+
+define internal void @j() {
+ call i8* @llvm.recoverframeallocation(i8* bitcast(void()* @declaration to i8*), i8* null)
+ ret void
+}
+; CHECK: llvm.recoverframeallocation first argument must be function defined in this module
OpenPOWER on IntegriCloud