1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00
llvm-mirror/test/CodeGen/X86/coff-comdat.ll
David Blaikie 65b92c4f37 [opaque pointer type] Add textual IR support for explicit type parameter for global aliases
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
2015-09-11 03:22:04 +00:00

93 lines
2.4 KiB
LLVM

; RUN: llc -mtriple i386-pc-win32 < %s | FileCheck %s
$f1 = comdat any
@v1 = global i32 0, comdat($f1)
define void @f1() comdat($f1) {
ret void
}
$f2 = comdat exactmatch
@v2 = global i32 0, comdat($f2)
define void @f2() comdat($f2) {
ret void
}
$f3 = comdat largest
@v3 = global i32 0, comdat($f3)
define void @f3() comdat($f3) {
ret void
}
$f4 = comdat noduplicates
@v4 = global i32 0, comdat($f4)
define void @f4() comdat($f4) {
ret void
}
$f5 = comdat samesize
@v5 = global i32 0, comdat($f5)
define void @f5() comdat($f5) {
ret void
}
$f6 = comdat samesize
@v6 = global i32 0, comdat($f6)
@f6 = global i32 0, comdat($f6)
$"\01@f7@0" = comdat any
define x86_fastcallcc void @"\01@v7@0"() comdat($"\01@f7@0") {
ret void
}
define x86_fastcallcc void @"\01@f7@0"() comdat($"\01@f7@0") {
ret void
}
$f8 = comdat any
define x86_fastcallcc void @v8() comdat($f8) {
ret void
}
define x86_fastcallcc void @f8() comdat($f8) {
ret void
}
$vftable = comdat largest
@some_name = private unnamed_addr constant [2 x i8*] zeroinitializer, comdat($vftable)
@vftable = alias i8*, getelementptr([2 x i8*], [2 x i8*]* @some_name, i32 0, i32 1)
; CHECK: .section .text,"xr",discard,_f1
; CHECK: .globl _f1
; CHECK: .section .text,"xr",same_contents,_f2
; CHECK: .globl _f2
; CHECK: .section .text,"xr",largest,_f3
; CHECK: .globl _f3
; CHECK: .section .text,"xr",one_only,_f4
; CHECK: .globl _f4
; CHECK: .section .text,"xr",same_size,_f5
; CHECK: .globl _f5
; CHECK: .section .text,"xr",associative,@f7@0
; CHECK: .globl @v7@0
; CHECK: .section .text,"xr",discard,@f7@0
; CHECK: .globl @f7@0
; CHECK: .section .text,"xr",associative,@f8@0
; CHECK: .globl @v8@0
; CHECK: .section .text,"xr",discard,@f8@0
; CHECK: .globl @f8@0
; CHECK: .section .bss,"bw",associative,_f1
; CHECK: .globl _v1
; CHECK: .section .bss,"bw",associative,_f2
; CHECK: .globl _v2
; CHECK: .section .bss,"bw",associative,_f3
; CHECK: .globl _v3
; CHECK: .section .bss,"bw",associative,_f4
; CHECK: .globl _v4
; CHECK: .section .bss,"bw",associative,_f5
; CHECK: .globl _v5
; CHECK: .section .bss,"bw",associative,_f6
; CHECK: .globl _v6
; CHECK: .section .bss,"bw",same_size,_f6
; CHECK: .globl _f6
; CHECK: .section .rdata,"dr",largest,_vftable
; CHECK: .globl _vftable
; CHECK: _vftable = L_some_name+4