1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
llvm-mirror/test/CodeGen/X86/patchable-prologue.ll
Sanjoy Das 91fd65c3a6 Introduce a "patchable-function" function attribute
Summary:
The `"patchable-function"` attribute can be used by an LLVM client to
influence LLVM's code generation in ways that makes the generated code
easily patchable at runtime (for instance, to redirect control).
Right now only one patchability scheme is supported,
`"prologue-short-redirect"`, but this can be expanded in the future.

Reviewers: joker.eph, rnk, echristo, dberris

Subscribers: joker.eph, echristo, mcrosier, llvm-commits

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

llvm-svn: 266715
2016-04-19 05:24:47 +00:00

44 lines
1.1 KiB
LLVM

; RUN: llc -filetype=obj -o - -mtriple=x86_64-apple-macosx < %s | llvm-objdump -triple x86_64-apple-macosx -disassemble - | FileCheck %s
; RUN: llc -mtriple=x86_64-apple-macosx < %s | FileCheck %s --check-prefix=CHECK-ALIGN
declare void @callee(i64*)
define void @f0() "patchable-function"="prologue-short-redirect" {
; CHECK-LABEL: _f0:
; CHECK-NEXT: 66 90 nop
; CHECK-ALIGN: .p2align 4, 0x90
; CHECK-ALIGN: _f0:
ret void
}
define void @f1() "patchable-function"="prologue-short-redirect" "no-frame-pointer-elim"="true" {
; CHECK-LABEL: _f1
; CHECK-NEXT: ff f5 pushq %rbp
; CHECK-ALIGN: .p2align 4, 0x90
; CHECK-ALIGN: _f1:
ret void
}
define void @f2() "patchable-function"="prologue-short-redirect" {
; CHECK-LABEL: _f2
; CHECK-NEXT: 48 81 ec a8 00 00 00 subq $168, %rsp
; CHECK-ALIGN: .p2align 4, 0x90
; CHECK-ALIGN: _f2:
%ptr = alloca i64, i32 20
call void @callee(i64* %ptr)
ret void
}
define void @f3() "patchable-function"="prologue-short-redirect" optsize {
; CHECK-LABEL: _f3
; CHECK-NEXT: 66 90 nop
; CHECK-ALIGN: .p2align 4, 0x90
; CHECK-ALIGN: _f3:
ret void
}