-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[PowerPC] Support -fpatchable-function-entry #92997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
; RUN: llc -mtriple=powerpc %s -o - | FileCheck %s --check-prefixes=CHECK,PPC32 | ||
; RUN: llc -mtriple=powerpc64 %s -o - | FileCheck %s --check-prefixes=CHECK,PPC64 | ||
|
||
@a = global i32 0, align 4 | ||
|
||
define void @f0() { | ||
; CHECK-LABEL: f0: | ||
; CHECK-NOT: nop | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: blr | ||
; CHECK-NOT: .section __patchable_function_entries | ||
ret void | ||
} | ||
|
||
define void @f1() "patchable-function-entry"="0" { | ||
; CHECK-LABEL: f1: | ||
; CHECK-NOT: nop | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: blr | ||
; CHECK-NOT: .section __patchable_function_entries | ||
ret void | ||
} | ||
|
||
define void @f2() "patchable-function-entry"="1" { | ||
; CHECK-LABEL: f2: | ||
; CHECK-LABEL-NEXT: .Lfunc_begin2: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: blr | ||
; CHECK: .section __patchable_function_entries | ||
; PPC32: .p2align 2, 0x0 | ||
; PPC64: .p2align 3, 0x0 | ||
; PPC32-NEXT: .long .Lfunc_begin2 | ||
; PPC64-NEXT: .quad .Lfunc_begin2 | ||
ret void | ||
} | ||
|
||
define i32 @f3() "patchable-function-entry"="1" "patchable-function-prefix"="2" { | ||
; CHECK-LABEL: .Ltmp0: | ||
; CHECK-COUNT-2: nop | ||
; CHECK-LABEL: f3: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test addis/addi, instructions at the global entry point. Per https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99888#c5 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated. |
||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: nop | ||
; PPC32: lis 3, a@ha | ||
; PPC32-NEXT: lwz 3, a@l(3) | ||
; PPC64: addis 3, 2, .LC0@toc@ha | ||
; PPC64-NEXT: ld 3, .LC0@toc@l(3) | ||
; PPC64-NEXT: lwz 3, 0(3) | ||
; CHECK: blr | ||
; CHECK: .section __patchable_function_entries | ||
; PPC32: .p2align 2, 0x0 | ||
; PPC64: .p2align 3, 0x0 | ||
; PPC32-NEXT: .long .Ltmp0 | ||
; PPC64-NEXT: .quad .Ltmp0 | ||
entry: | ||
%0 = load i32, ptr @a, align 4 | ||
ret i32 %0 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
little-endian variants (ppcle ppc64le) are omitted here.
Use
isPPC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linux little endian targets are this patch's scope. This patch tries to support -fpatchable-function-entry for big endian targets but not AIX.
If we are going to support little endian, we first need to check the possibility about removal of XRAY. (XRAY also uses backend node
PATCHABLE_FUNCTION_ENTER
)