Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add lowering support for llvm.experimental.deoptimize
Summary: Only adds support for "naked" calls to llvm.experimental.deoptimize. Support for round-tripping through RewriteStatepointsForGC will come as a separate patch (should be simpler than this one). Reviewers: reames Subscribers: sanjoy, mcrosier, llvm-commits Differential Revision: http://reviews.llvm.org/D18429 llvm-svn: 264329
- Loading branch information
Showing
7 changed files
with
137 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
; RUN: llc < %s | FileCheck %s | ||
; RUN: llc -debug-only=stackmaps < %s 2>&1 | FileCheck --check-prefix=STACKMAPS %s | ||
; REQUIRES: asserts | ||
|
||
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" | ||
target triple = "x86_64-apple-macosx10.11.0" | ||
|
||
declare i32 @llvm.experimental.deoptimize.i32(...) | ||
declare i8 @llvm.experimental.deoptimize.i8(...) | ||
|
||
define i32 @caller_0() { | ||
; CHECK-LABEL: _caller_0: | ||
; CHECK-NEXT: {{.+cfi.+}} | ||
; CHECK-NEXT: ##{{.+}} | ||
; CHECK-NEXT: pushq %rax | ||
; CHECK-NEXT: {{Ltmp[0-9]+}}: | ||
; CHECK-NEXT: {{.+cfi.+}} | ||
; CHECK-NEXT: callq ___llvm_deoptimize | ||
; CHECK-NEXT: {{Ltmp[0-9]+}}: | ||
; CHECK-NEXT: popq %rcx | ||
; CHECK-NEXT: retq | ||
entry: | ||
%v = call i32(...) @llvm.experimental.deoptimize.i32() [ "deopt"(i32 0) ] | ||
ret i32 %v | ||
} | ||
|
||
define i8 @caller_1() { | ||
; CHECK-LABEL: _caller_1: | ||
; CHECK-NEXT: {{.+cfi.+}} | ||
; CHECK-NEXT: ##{{.+}} | ||
; CHECK-NEXT: pushq %rax | ||
; CHECK-NEXT: {{Ltmp[0-9]+}}: | ||
; CHECK-NEXT: {{.+cfi.+}} | ||
; CHECK-NEXT: movss {{[a-zA-Z0-9_]+}}(%rip), %xmm0 ## xmm0 = mem[0],zero,zero,zero | ||
; CHECK-NEXT: movl $42, %edi | ||
; CHECK-NEXT: callq ___llvm_deoptimize | ||
; CHECK-NEXT: {{Ltmp[0-9]+}}: | ||
; CHECK-NEXT: popq %rcx | ||
; CHECK-NEXT: retq | ||
|
||
entry: | ||
%v = call i8(...) @llvm.experimental.deoptimize.i8(i32 42, float 500.0) [ "deopt"(i32 1) ] | ||
ret i8 %v | ||
} | ||
|
||
define i8 @caller_2() { | ||
; CHECK-LABEL: _caller_2: | ||
; CHECK-NEXT: {{.+cfi.+}} | ||
; CHECK-NEXT: ##{{.+}} | ||
; CHECK-NEXT: pushq %rax | ||
; CHECK-NEXT: {{Ltmp[0-9]+}}: | ||
; CHECK-NEXT: {{.+cfi.+}} | ||
; CHECK-NEXT: movl $1140457472, (%rsp) ## imm = 0x43FA0000 | ||
; CHECK-NEXT: movl $42, %eax | ||
; CHECK-NEXT: callq ___llvm_deoptimize | ||
; CHECK-NEXT: {{Ltmp[0-9]+}}: | ||
; CHECK-NEXT: popq %rcx | ||
; CHECK-NEXT: retq | ||
|
||
entry: | ||
%v = call webkit_jscc i8(...) @llvm.experimental.deoptimize.i8(i32 42, float 500.0) [ "deopt"(i32 3) ] | ||
ret i8 %v | ||
} | ||
|
||
; STACKMAPS: Stack Maps: callsites: | ||
; STACKMAPS-NEXT: Stack Maps: callsite 2882400015 | ||
; STACKMAPS-NEXT: Stack Maps: has 4 locations | ||
; STACKMAPS-NEXT: Stack Maps: Loc 0: Constant 0 [encoding: .byte 4, .byte 8, .short 0, .int 0] | ||
; STACKMAPS-NEXT: Stack Maps: Loc 1: Constant 0 [encoding: .byte 4, .byte 8, .short 0, .int 0] | ||
; STACKMAPS-NEXT: Stack Maps: Loc 2: Constant 1 [encoding: .byte 4, .byte 8, .short 0, .int 1] | ||
; STACKMAPS-NEXT: Stack Maps: Loc 3: Constant 0 [encoding: .byte 4, .byte 8, .short 0, .int 0] | ||
; STACKMAPS-NEXT: Stack Maps: has 0 live-out registers | ||
; STACKMAPS-NEXT: Stack Maps: callsite 2882400015 | ||
; STACKMAPS-NEXT: Stack Maps: has 4 locations | ||
; STACKMAPS-NEXT: Stack Maps: Loc 0: Constant 0 [encoding: .byte 4, .byte 8, .short 0, .int 0] | ||
; STACKMAPS-NEXT: Stack Maps: Loc 1: Constant 0 [encoding: .byte 4, .byte 8, .short 0, .int 0] | ||
; STACKMAPS-NEXT: Stack Maps: Loc 2: Constant 1 [encoding: .byte 4, .byte 8, .short 0, .int 1] | ||
; STACKMAPS-NEXT: Stack Maps: Loc 3: Constant 1 [encoding: .byte 4, .byte 8, .short 0, .int 1] | ||
; STACKMAPS-NEXT: Stack Maps: has 0 live-out registers | ||
; STACKMAPS-NEXT: Stack Maps: callsite 2882400015 | ||
; STACKMAPS-NEXT: Stack Maps: has 4 locations | ||
; STACKMAPS-NEXT: Stack Maps: Loc 0: Constant 12 [encoding: .byte 4, .byte 8, .short 0, .int 12] | ||
; STACKMAPS-NEXT: Stack Maps: Loc 1: Constant 0 [encoding: .byte 4, .byte 8, .short 0, .int 0] | ||
; STACKMAPS-NEXT: Stack Maps: Loc 2: Constant 1 [encoding: .byte 4, .byte 8, .short 0, .int 1] | ||
; STACKMAPS-NEXT: Stack Maps: Loc 3: Constant 3 [encoding: .byte 4, .byte 8, .short 0, .int 3] | ||
; STACKMAPS-NEXT: Stack Maps: has 0 live-out registers |