llvm/test/Verifier/frameescape.ll
Reid Kleckner 8f32e5f0d6 Rename llvm.frameescape and llvm.framerecover to localescape and localrecover
Summary:
Initially, these intrinsics seemed like part of a family of "frame"
related intrinsics, but now I think that's more confusing than helpful.
Initially, the LangRef specified that this would create a new kind of
allocation that would be allocated at a fixed offset from the frame
pointer (EBP/RBP). We ended up dropping that design, and leaving the
stack frame layout alone.

These intrinsics are really about sharing local stack allocations, not
frame pointers. I intend to go further and add an `llvm.localaddress()`
intrinsic that returns whatever register (EBP, ESI, ESP, RBX) is being
used to address locals, which should not be confused with the frame
pointer.

Naming suggestions at this point are welcome, I'm happy to re-run sed.

Reviewers: majnemer, nicholas

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D11011

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241633 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-07 22:25:32 +00:00

70 lines
1.9 KiB
LLVM

; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
declare void @llvm.localescape(...)
declare i8* @llvm.localrecover(i8*, i8*, i32)
define internal void @f() {
%a = alloca i8
call void (...) @llvm.localescape(i8* %a)
call void (...) @llvm.localescape(i8* %a)
ret void
}
; CHECK: multiple calls to llvm.localescape in one function
define internal void @g() {
entry:
%a = alloca i8
br label %not_entry
not_entry:
call void (...) @llvm.localescape(i8* %a)
ret void
}
; CHECK: llvm.localescape used outside of entry block
define internal void @h() {
call i8* @llvm.localrecover(i8* null, i8* null, i32 0)
ret void
}
; CHECK: llvm.localrecover first argument must be function defined in this module
@global = constant i8 0
declare void @declaration()
define internal void @i() {
call i8* @llvm.localrecover(i8* @global, i8* null, i32 0)
ret void
}
; CHECK: llvm.localrecover first argument must be function defined in this module
define internal void @j() {
call i8* @llvm.localrecover(i8* bitcast(void()* @declaration to i8*), i8* null, i32 0)
ret void
}
; CHECK: llvm.localrecover first argument must be function defined in this module
define internal void @k(i32 %n) {
call i8* @llvm.localrecover(i8* bitcast(void()* @f to i8*), i8* null, i32 %n)
ret void
}
; CHECK: idx argument of llvm.localrecover must be a constant int
define internal void @l(i8* %b) {
%a = alloca i8
call void (...) @llvm.localescape(i8* %a, i8* %b)
ret void
}
; CHECK: llvm.localescape only accepts static allocas
define internal void @m() {
%a = alloca i8
call void (...) @llvm.localescape(i8* %a)
ret void
}
define internal void @n(i8* %fp) {
call i8* @llvm.localrecover(i8* bitcast(void ()* @m to i8*), i8* %fp, i32 1)
ret void
}
; CHECK: all indices passed to llvm.localrecover must be less than the number of arguments passed ot llvm.localescape in the parent function