mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
65b92c4f37
update.py: import fileinput import sys import re alias_match_prefix = r"(.*(?:=|:|^)\s*(?:external |)(?:(?:private|internal|linkonce|linkonce_odr|weak|weak_odr|common|appending|extern_weak|available_externally) )?(?:default |hidden |protected )?(?:dllimport |dllexport )?(?:unnamed_addr |)(?:thread_local(?:\([a-z]*\))? )?alias" plain = re.compile(alias_match_prefix + r" (.*?))(| addrspace\(\d+\) *)\*($| *(?:%|@|null|undef|blockaddress|addrspacecast|\[\[[a-zA-Z]|\{\{).*$)") cast = re.compile(alias_match_prefix + r") ((?:bitcast|inttoptr|addrspacecast)\s*\(.* to (.*?)(| addrspace\(\d+\) *)\*\)\s*(?:;.*)?$)") gep = re.compile(alias_match_prefix + r") ((?:getelementptr)\s*(?:inbounds)?\s*\((?P<type>.*), (?P=type)(?:\s*addrspace\(\d+\)\s*)?\* .*\)\s*(?:;.*)?$)") def conv(line): m = re.match(cast, line) if m: return m.group(1) + " " + m.group(3) + ", " + m.group(2) m = re.match(gep, line) if m: return m.group(1) + " " + m.group(3) + ", " + m.group(2) m = re.match(plain, line) if m: return m.group(1) + ", " + m.group(2) + m.group(3) + "*" + m.group(4) + "\n" return line for line in sys.stdin: sys.stdout.write(conv(line)) apply.sh: for name in "$@" do python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name" rm -f "$name.tmp" done The actual commands: From llvm/src: find test/ -name *.ll | xargs ./apply.sh From llvm/src/tools/clang: find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}" From llvm/src/tools/polly: find test/ -name *.ll | xargs ./apply.sh llvm-svn: 247378
53 lines
1.2 KiB
LLVM
53 lines
1.2 KiB
LLVM
; RUN: opt < %s -internalize -internalize-public-api-list c1 -internalize-public-api-list c2 -internalize-public-api-list c3 -internalize-public-api-list c4 -S | FileCheck %s
|
|
|
|
$c1 = comdat any
|
|
$c2 = comdat any
|
|
$c3 = comdat any
|
|
$c4 = comdat any
|
|
|
|
; CHECK: @c1_c = global i32 0, comdat($c1)
|
|
@c1_c = global i32 0, comdat($c1)
|
|
|
|
; CHECK: @c2_b = internal global i32 0{{$}}
|
|
@c2_b = global i32 0, comdat($c2)
|
|
|
|
; CHECK: @c3 = global i32 0, comdat{{$}}
|
|
@c3 = global i32 0, comdat
|
|
|
|
; CHECK: @c4_a = internal global i32 0, comdat($c4)
|
|
@c4_a = internal global i32 0, comdat($c4)
|
|
|
|
; CHECK: @c1_d = alias i32, i32* @c1_c
|
|
@c1_d = alias i32, i32* @c1_c
|
|
|
|
; CHECK: @c2_c = internal alias i32, i32* @c2_b
|
|
@c2_c = alias i32, i32* @c2_b
|
|
|
|
; CHECK: @c4 = alias i32, i32* @c4_a
|
|
@c4 = alias i32, i32* @c4_a
|
|
|
|
; CHECK: define void @c1() comdat {
|
|
define void @c1() comdat {
|
|
ret void
|
|
}
|
|
|
|
; CHECK: define void @c1_a() comdat($c1) {
|
|
define void @c1_a() comdat($c1) {
|
|
ret void
|
|
}
|
|
|
|
; CHECK: define internal void @c2() {
|
|
define internal void @c2() comdat {
|
|
ret void
|
|
}
|
|
|
|
; CHECK: define internal void @c2_a() {
|
|
define void @c2_a() comdat($c2) {
|
|
ret void
|
|
}
|
|
|
|
; CHECK: define void @c3_a() comdat($c3) {
|
|
define void @c3_a() comdat($c3) {
|
|
ret void
|
|
}
|