2015-08-15 06:41:43 +08:00
|
|
|
; RUN: llc -mtriple=x86_64-pc-windows-msvc < %s | FileCheck %s
|
|
|
|
; RUN: llc -mtriple=x86_64-pc-windows-coreclr < %s | FileCheck %s
|
2015-04-22 02:23:57 +08:00
|
|
|
|
|
|
|
; Test case based on this code:
|
|
|
|
; extern "C" unsigned long _exception_code();
|
|
|
|
; extern "C" int filt(unsigned long);
|
|
|
|
; extern "C" void g();
|
|
|
|
; extern "C" void do_except() {
|
|
|
|
; __try {
|
|
|
|
; g();
|
|
|
|
; } __except(filt(_exception_code())) {
|
|
|
|
; }
|
|
|
|
; }
|
|
|
|
|
|
|
|
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
|
|
|
|
|
|
|
|
; Function Attrs: uwtable
|
2015-06-18 04:52:32 +08:00
|
|
|
define void @do_except() #0 personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) {
|
2015-04-22 02:23:57 +08:00
|
|
|
entry:
|
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
llvm-svn: 241633
2015-07-08 06:25:32 +08:00
|
|
|
call void (...) @llvm.localescape()
|
2015-04-22 02:23:57 +08:00
|
|
|
invoke void @g() #5
|
|
|
|
to label %__try.cont unwind label %lpad1
|
|
|
|
|
|
|
|
lpad1: ; preds = %entry
|
2015-06-18 04:52:32 +08:00
|
|
|
%ehvals = landingpad { i8*, i32 }
|
2015-04-22 02:23:57 +08:00
|
|
|
catch i8* bitcast (i32 (i8*, i8*)* @"\01?filt$0@0@do_except@@" to i8*)
|
|
|
|
%recover = call i8* (...) @llvm.eh.actions(i32 1, i8* bitcast (i32 (i8*, i8*)* @"\01?filt$0@0@do_except@@" to i8*), i32 -1, i8* blockaddress(@do_except, %__try.cont))
|
|
|
|
indirectbr i8* %recover, [label %__try.cont]
|
|
|
|
|
|
|
|
__try.cont: ; preds = %lpad1, %entry
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: do_except:
|
|
|
|
; CHECK: .seh_handler __C_specific_handler
|
|
|
|
; CHECK-NOT: jmpq *
|
|
|
|
; CHECK: .seh_handlerdata
|
|
|
|
; CHECK-NEXT: .long 1
|
|
|
|
; CHECK-NEXT: .long .Ltmp{{.*}}
|
|
|
|
; CHECK-NEXT: .long .Ltmp{{.*}}
|
|
|
|
; CHECK-NEXT: .long "?filt$0@0@do_except@@"@IMGREL
|
|
|
|
; CHECK-NEXT: .long .Ltmp{{.*}}@IMGREL
|
|
|
|
|
|
|
|
; Function Attrs: noinline nounwind
|
|
|
|
define internal i32 @"\01?filt$0@0@do_except@@"(i8* nocapture readonly %exception_pointers, i8* nocapture readnone %frame_pointer) #1 {
|
|
|
|
entry:
|
|
|
|
%0 = bitcast i8* %exception_pointers to i32**
|
|
|
|
%1 = load i32*, i32** %0, align 8
|
|
|
|
%2 = load i32, i32* %1, align 4
|
|
|
|
%call = tail call i32 @filt(i32 %2) #4
|
|
|
|
ret i32 %call
|
|
|
|
}
|
|
|
|
|
|
|
|
declare i32 @filt(i32) #2
|
|
|
|
|
|
|
|
declare void @g() #2
|
|
|
|
|
|
|
|
declare i32 @__C_specific_handler(...)
|
|
|
|
|
|
|
|
; Function Attrs: nounwind readnone
|
|
|
|
declare i32 @llvm.eh.typeid.for(i8*) #3
|
|
|
|
|
|
|
|
; Function Attrs: nounwind
|
|
|
|
declare i8* @llvm.eh.actions(...) #4
|
|
|
|
|
|
|
|
; Function Attrs: nounwind
|
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
llvm-svn: 241633
2015-07-08 06:25:32 +08:00
|
|
|
declare void @llvm.localescape(...) #4
|
2015-04-22 02:23:57 +08:00
|
|
|
|
|
|
|
; Function Attrs: nounwind readnone
|
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
llvm-svn: 241633
2015-07-08 06:25:32 +08:00
|
|
|
declare i8* @llvm.localrecover(i8*, i8*, i32) #3
|
2015-04-22 02:23:57 +08:00
|
|
|
|
|
|
|
attributes #0 = { uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "unsafe-fp-math"="false" "use-soft-float"="false" "wineh-parent"="do_except" }
|
|
|
|
attributes #1 = { noinline nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
|
|
|
attributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
|
|
|
attributes #3 = { nounwind readnone }
|
|
|
|
attributes #4 = { nounwind }
|
|
|
|
attributes #5 = { noinline }
|
|
|
|
|
|
|
|
!llvm.module.flags = !{!0}
|
|
|
|
!llvm.ident = !{!1}
|
|
|
|
|
|
|
|
!0 = !{i32 1, !"PIC Level", i32 2}
|
|
|
|
!1 = !{!"clang version 3.7.0 "}
|