1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00
llvm-mirror/test/CodeGen/PowerPC/aix-xcoff-visibility.ll
diggerlin b434098ac8 [AIX][XCOFF] change the operand of branch instruction from symbol name to qualified symbol name for function declarations
SUMMARY:

1. in the patch  , remove setting storageclass in function .getXCOFFSection and construct function of class MCSectionXCOFF
there are

XCOFF::StorageMappingClass MappingClass;
XCOFF::SymbolType Type;
XCOFF::StorageClass StorageClass;
in the MCSectionXCOFF class,
these attribute only used in the XCOFFObjectWriter, (asm path do not need the StorageClass)

we need get the value of StorageClass, Type,MappingClass before we invoke the getXCOFFSection every time.

actually , we can get the StorageClass of the MCSectionXCOFF  from it's delegated symbol.

2. we also change the oprand of branch instruction from symbol name to qualify symbol name.
for example change
bl .foo
extern .foo
to
bl .foo[PR]
extern .foo[PR]

3. and if there is reference indirect call a function bar.
we also add
  extern .bar[PR]

Reviewers:  Jason liu, Xiangling Liao

Differential Revision: https://reviews.llvm.org/D84765
2020-08-11 15:26:19 -04:00

59 lines
1.5 KiB
LLVM

; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 -mattr=-altivec < %s | \
; RUN: FileCheck %s
; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -mcpu=pwr4 -mattr=-altivec < %s |\
; RUN: FileCheck %s
@b = global i32 0, align 4
@b_h = hidden global i32 0, align 4
define void @foo() {
entry:
ret void
}
define hidden void @foo_h(i32* %ip) {
entry:
ret void
}
define protected void @foo_protected(i32* %ip) {
entry:
ret void
}
define weak hidden void @foo_weak_h() {
entry:
ret void
}
@foo_p = global void ()* @zoo_weak_extern_h, align 4
declare extern_weak hidden void @zoo_weak_extern_h()
define i32 @main() {
entry:
%call1= call i32 @bar_h(i32* @b_h)
call void @foo_weak_h()
%0 = load void ()*, void ()** @foo_p, align 4
call void %0()
ret i32 0
}
declare hidden i32 @bar_h(i32*)
; CHECK: .globl foo[DS]{{[[:space:]]*([#].*)?$}}
; CHECK: .globl .foo{{[[:space:]]*([#].*)?$}}
; CHECK: .globl foo_h[DS],hidden
; CHECK: .globl .foo_h,hidden
; CHECK: .globl foo_protected[DS],protected
; CHECK: .globl .foo_protected,protected
; CHECK: .weak foo_weak_h[DS],hidden
; CHECK: .weak .foo_weak_h,hidden
; CHECK: .globl b{{[[:space:]]*([#].*)?$}}
; CHECK: .globl b_h,hidden
; CHECK: .weak .zoo_weak_extern_h[PR],hidden
; CHECK: .weak zoo_weak_extern_h[DS],hidden
; CHECK: .extern .bar_h[PR],hidden
; CHECK: .extern bar_h[DS],hidden