Skip to content

Instantly share code, notes, and snippets.

@deanberris
Created May 1, 2017 06:26
Show Gist options
  • Save deanberris/4d445308dde0099cb7fbc695847617ce to your computer and use it in GitHub Desktop.
Save deanberris/4d445308dde0099cb7fbc695847617ce to your computer and use it in GitHub Desktop.
.section __TEXT,__text,regular,pure_instructions
.globl _callee
.p2align 4, 0x90
_callee: ## @callee
.cfi_startproc
## BB#0:
.p2align 1, 0x90
Lxray_sled_0:
.ascii "\353\t"
nopw 512(%rax,%rax)
Ltmp0:
xorl %eax, %eax
.p2align 1, 0x90
Lxray_sled_1:
retq
nopw %cs:512(%rax,%rax)
.cfi_endproc
.p2align 4, 0x90
.quad Lxray_synthetic_0
.quad Lxray_fn_idx_synth_0
.section __DATA,xray_instr_map
Lxray_synthetic_0:
.quad Lxray_sled_0
.quad _callee
.byte 0
.byte 1
.space 14
.quad Lxray_sled_1
.quad _callee
.byte 1
.byte 1
.space 14
Lxray_synthetic_end0:
.section __DATA,xray_fn_idx
.p2align 4, 0x90
Lxray_fn_idx_synth_0:
.quad Lxray_synthetic_0
.quad Lxray_synthetic_end0
.section __TEXT,__text,regular,pure_instructions
.globl _caller
.p2align 4, 0x90
_caller: ## @caller
.cfi_startproc
## BB#0:
.p2align 1, 0x90
Lxray_sled_2:
.ascii "\353\t"
nopw 512(%rax,%rax)
Ltmp1:
.p2align 1, 0x90
Lxray_sled_3:
.ascii "\353\t"
nopw 512(%rax,%rax)
Ltmp2:
jmp _callee ## TAILCALL
.cfi_endproc
.p2align 4, 0x90
.quad Lxray_synthetic_1
.quad Lxray_fn_idx_synth_1
.section __DATA,xray_instr_map
Lxray_synthetic_1:
.quad Lxray_sled_2
.quad _caller
.byte 0
.byte 1
.space 14
.quad Lxray_sled_3
.quad _caller
.byte 2
.byte 1
.space 14
Lxray_synthetic_end1:
.section __DATA,xray_fn_idx
.p2align 4, 0x90
Lxray_fn_idx_synth_1:
.quad Lxray_synthetic_1
.quad Lxray_synthetic_end1
.section __TEXT,__text,regular,pure_instructions
.subsections_via_symbols
; RUN: llc -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
; RUN: llc -filetype=asm -o - -mtriple=x86_64-darwin-unknown < %s | FileCheck %s
define i32 @callee() nounwind noinline uwtable "function-instrument"="xray-always" {
; CHECK: .p2align 1, 0x90
; CHECK-LABEL: Lxray_sled_0:
; CHECK-NEXT: .ascii "\353\t"
; CHECK-NEXT: nopw 512(%rax,%rax)
; CHECK-LABEL: Ltmp0:
ret i32 0
; CHECK: .p2align 1, 0x90
; CHECK-LABEL: Lxray_sled_1:
; CHECK-NEXT: retq
; CHECK-NEXT: nopw %cs:512(%rax,%rax)
}
; CHECK: .p2align 4, 0x90
; CHECK-NEXT: .quad {{.*}}xray_synthetic_0
; CHECK-NEXT: .quad {{.*}}xray_fn_idx_synth_0
; CHECK-NEXT: .section {{.*}}xray_instr_map
; CHECK-LABEL: Lxray_synthetic_0
; CHECK: .quad {{.*}}xray_sled_0
; CHECK: .quad {{.*}}xray_sled_1
; CHECK-LABEL: Lxray_synthetic_end0
; CHECK-NEXT: .section {{.*}}xray_fn_idx
; CHECK-LABEL: Lxray_fn_idx_synth_0
; CHECK: .quad {{.*}}xray_synthetic_0
; CHECK-NEXT: .quad {{.*}}xray_synthetic_end0
define i32 @caller() nounwind noinline uwtable "function-instrument"="xray-always" {
; CHECK: .p2align 1, 0x90
; CHECK-LABEL: Lxray_sled_2:
; CHECK-NEXT: .ascii "\353\t"
; CHECK-NEXT: nopw 512(%rax,%rax)
; CHECK-LABEL: Ltmp1:
; CHECK: .p2align 1, 0x90
; CHECK-LABEL: Lxray_sled_3:
; CHECK-NEXT: .ascii "\353\t"
; CHECK-NEXT: nopw 512(%rax,%rax)
; CHECK-LABEL: Ltmp2:
%retval = tail call i32 @callee()
; CHECK: jmp {{.*}}callee {{.*}}# TAILCALL
ret i32 %retval
}
; CHECK: .p2align 4, 0x90
; CHECK-NEXT: .quad {{.*}}xray_synthetic_1
; CHECK-NEXT: .quad {{.*}}xray_fn_idx_synth_1
; CHECK-LABEL: Lxray_synthetic_1
; CHECK: .quad {{.*}}xray_sled_2
; CHECK: .quad {{.*}}xray_sled_3
; CHECK-LABEL: Lxray_synthetic_end1
; CHECK: .section {{.*}}xray_fn_idx
; CHECK-LABEL: Lxray_fn_idx_synth_1
; CHECK: .quad {{.*}}xray_synthetic_1
; CHECK: .quad {{.*}}xray_synthetic_end1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment