mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
57335fbdaf
Summary: (1) Function descriptor on AIX On AIX, a called routine may have 2 distinct symbols associated with it: * A function descriptor (Name) * A function entry point (.Name) The descriptor structure on AIX is the same as those in the ELF V1 ABI: * The address of the entry point of the function. * The TOC base address for the function. * The environment pointer. The descriptor symbol uses the same name as the source level function in C. The function entry point is analogous to the symbol we would generate for a function in a non-descriptor-based ABI, except that it is renamed by prepending a ".". Which symbol gets referenced depends on the context: * Taking the address of the function references the descriptor symbol. * Calling the function references the entry point symbol. (2) Speaking of implementation on AIX, for direct function call target, we create proper MCSymbol SDNode(e.g . ".foo") while constructing SDAG to replace original TargetGlobalAddress SDNode. Then down the path, we can take advantage of this MCSymbol. Patch by: Xiangling_L Reviewed by: sfertile, hubert.reinterpretcast, jasonliu, syzaara Differential Revision: https://reviews.llvm.org/D62532 llvm-svn: 362735
41 lines
1.5 KiB
LLVM
41 lines
1.5 KiB
LLVM
; RUN: llc -mtriple powerpc-ibm-aix-xcoff -stop-after=machine-cp < %s | \
|
|
; RUN: FileCheck --check-prefix=32BIT %s
|
|
|
|
; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -stop-after=machine-cp < %s | \
|
|
; RUN: FileCheck --check-prefix=64BIT %s
|
|
|
|
declare void @foo(...)
|
|
|
|
define void @test_call() {
|
|
entry:
|
|
; 32BIT: ADJCALLSTACKDOWN 56, 0, implicit-def dead $r1, implicit $r1
|
|
; 32BIT: BL_NOP <mcsymbol .foo>, csr_aix32, implicit-def dead $lr, implicit $rm, implicit $r2, implicit-def $r1
|
|
; 32BIT: ADJCALLSTACKUP 56, 0, implicit-def dead $r1, implicit $r1
|
|
|
|
; 64BIT: ADJCALLSTACKDOWN 112, 0, implicit-def dead $r1, implicit $r1
|
|
; 64BIT: BL8_NOP <mcsymbol .foo>, csr_aix64, implicit-def dead $lr8, implicit $rm, implicit $x2, implicit-def $r1
|
|
; 64BIT: ADJCALLSTACKUP 112, 0, implicit-def dead $r1, implicit $r1
|
|
|
|
call void bitcast (void (...)* @foo to void ()*)()
|
|
ret void
|
|
}
|
|
|
|
define hidden void @foo_local() {
|
|
entry:
|
|
ret void
|
|
}
|
|
|
|
define void @test_local_call() {
|
|
entry:
|
|
; 32BIT: ADJCALLSTACKDOWN 56, 0, implicit-def dead $r1, implicit $r1
|
|
; 32BIT: BL <mcsymbol .foo_local>, csr_aix32, implicit-def dead $lr, implicit $rm, implicit $r2, implicit-def $r1
|
|
; 32BIT: ADJCALLSTACKUP 56, 0, implicit-def dead $r1, implicit $r1
|
|
|
|
; 64BIT: ADJCALLSTACKDOWN 112, 0, implicit-def dead $r1, implicit $r1
|
|
; 64BIT: BL8 <mcsymbol .foo_local>, csr_aix64, implicit-def dead $lr8, implicit $rm, implicit $x2, implicit-def $r1
|
|
; 64BIT: ADJCALLSTACKUP 112, 0, implicit-def dead $r1, implicit $r1
|
|
|
|
call void @foo_local()
|
|
ret void
|
|
}
|