llvm-6502/test/MC/COFF
David Blaikie 198d8baafb [opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.

This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.

* This doesn't modify gep operators, only instructions (operators will be
  handled separately)

* Textual IR changes only. Bitcode (including upgrade) and changing the
  in-memory representation will be in separate changes.

* geps of vectors are transformed as:
    getelementptr <4 x float*> %x, ...
  ->getelementptr float, <4 x float*> %x, ...
  Then, once the opaque pointer type is introduced, this will ultimately look
  like:
    getelementptr float, <4 x ptr> %x
  with the unambiguous interpretation that it is a vector of pointers to float.

* address spaces remain on the pointer, not the type:
    getelementptr float addrspace(1)* %x
  ->getelementptr float, float addrspace(1)* %x
  Then, eventually:
    getelementptr float, ptr addrspace(1) %x

Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.

update.py:
import fileinput
import sys
import re

ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile(       r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")

def conv(match, line):
  if not match:
    return line
  line = match.groups()[0]
  if len(match.groups()[5]) == 0:
    line += match.groups()[2]
  line += match.groups()[3]
  line += ", "
  line += match.groups()[1]
  line += "\n"
  return line

for line in sys.stdin:
  if line.find("getelementptr ") == line.find("getelementptr inbounds"):
    if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
      line = conv(re.match(ibrep, line), line)
  elif line.find("getelementptr ") != line.find("getelementptr ("):
    line = conv(re.match(normrep, line), line)
  sys.stdout.write(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

After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).

The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.

Reviewers: rafael, dexonsmith, grosser

Differential Revision: http://reviews.llvm.org/D7636

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230786 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 19:29:02 +00:00
..
alias.s llvm-readobj: pretty-print special COFF section names 2014-09-20 00:25:06 +00:00
align-nops.s
bad-expr.s Forgot to add testcase for r198590 2014-01-21 20:39:11 +00:00
basic-coff-64.s llvm-readobj: pretty-print special COFF section names 2014-09-20 00:25:06 +00:00
basic-coff.s llvm-readobj: pretty-print special COFF section names 2014-09-20 00:25:06 +00:00
bigobj.py MC, COFF: Make bigobj test compatible with python3 2014-10-14 22:35:11 +00:00
bss_section.ll MC: Emit COFF section flags in the "proper" order 2015-02-07 08:26:40 +00:00
bss.s Fix known typos 2014-01-24 17:20:08 +00:00
comm-align.s COFF: Don't oversize COMMON symbols when targeting BFD ld 2014-10-08 06:38:53 +00:00
comm.ll MC: Support aligned COMMON symbols for COFF 2014-09-21 09:18:07 +00:00
comm.s MC: Support aligned COMMON symbols for COFF 2014-09-21 09:18:07 +00:00
const-gv-with-rel-init.ll MC: Emit COFF section flags in the "proper" order 2015-02-07 08:26:40 +00:00
diff.s MC: Calculate intra-section symbol differences correctly for COFF 2015-02-09 06:31:31 +00:00
directive-section-characteristics.ll MC, COFF: Align section contents to a four byte boundary 2015-02-11 22:22:30 +00:00
early-dce.s MC: prevent early DCE of empty sections 2014-06-06 21:40:16 +00:00
eh-frame.s
feat00.s llvm-readobj: pretty-print special COFF section names 2014-09-20 00:25:06 +00:00
file.s llvm-readobj: pretty-print special COFF section names 2014-09-20 00:25:06 +00:00
global_ctors_dtors.ll MC: Emit COFF section flags in the "proper" order 2015-02-07 08:26:40 +00:00
initialised-data.ll MC: Emit COFF section flags in the "proper" order 2015-02-07 08:26:40 +00:00
invalid-def.s MC: remove unnecessary restriction on tests 2014-05-23 02:56:51 +00:00
invalid-endef.s MC: remove unnecessary restriction on tests 2014-05-23 02:56:51 +00:00
invalid-scl-range.s MC: remove unnecessary restriction on tests 2014-05-23 02:56:51 +00:00
invalid-scl.s MC: remove unnecessary restriction on tests 2014-05-23 02:56:51 +00:00
invalid-type-range.s MC: remove unnecessary restriction on tests 2014-05-23 02:56:51 +00:00
invalid-type.s MC: remove unnecessary restriction on tests 2014-05-23 02:56:51 +00:00
ir-to-imgrel.ll MC: Use @IMGREL instead of @IMGREL32, which we can't parse 2014-09-25 02:09:18 +00:00
linker-options.ll [opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction 2015-02-27 19:29:02 +00:00
linkonce-invalid.s Fix a few issues with comdat handling on COFF. 2014-06-06 19:26:12 +00:00
linkonce.s MC: prevent early DCE of empty sections 2014-06-06 21:40:16 +00:00
lit.local.cfg Reduce verbiage of lit.local.cfg files 2014-06-09 22:42:55 +00:00
lset0.s MC: Let non-temporary COFF aliases be in symtab 2014-07-13 04:31:19 +00:00
module-asm.ll
offset.s Compute the correct section for zed = foo + 1 in COFF. 2014-05-01 13:37:57 +00:00
rdata.ll
relocation-imgrel.s
secidx-diagnostic.s Fix PR18381 - print a minimal diagnostic rather than assert on unresolved .secidx target 2014-01-30 21:13:05 +00:00
secidx.s Fix COFF section index relocation should be 16 bits, not 32 2014-10-08 18:01:49 +00:00
secrel32.s
secrel-variant.s
section-comdat-conflict2.s Fix a few issues with comdat handling on COFF. 2014-06-06 19:26:12 +00:00
section-comdat-conflict.s Fix a few issues with comdat handling on COFF. 2014-06-06 19:26:12 +00:00
section-comdat.s MC: Fix associative sections on COFF 2014-06-27 17:19:44 +00:00
section-invalid-flags.s MC: Diagnose an unexpected token in COFF .section instead of asserting 2014-08-11 18:34:43 +00:00
section-name-encoding.s WinCOFFObjectWriter: optimize the string table for common suffices 2014-09-29 22:43:20 +00:00
section-passthru-flags.s MC: Emit COFF section flags in the "proper" order 2015-02-07 08:26:40 +00:00
section.s
seh-align1.s
seh-align2.s
seh-align3.s
seh-linkonce.s MC Win64: Put unwind info for COMDAT code into the same COMDAT group 2014-09-04 17:42:03 +00:00
seh-section.s Fix Windows unwind info for functions in sections other than .text 2014-12-22 22:10:08 +00:00
seh-stackalloc-zero.s Fix .seh_stackalloc 0 2014-07-01 00:42:47 +00:00
seh.s MC: prevent early DCE of empty sections 2014-06-06 21:40:16 +00:00
simple-fixups.s MC, COFF: Use relocations for function references inside the section 2014-11-11 08:43:57 +00:00
switch-relocations.ll
symbol-alias.s Don't propagate StorageClass and ComplexType to aliases. 2014-05-01 19:02:03 +00:00
symbol-fragment-offset-64.s llvm-readobj: pretty-print special COFF section names 2014-09-20 00:25:06 +00:00
symbol-fragment-offset.s llvm-readobj: pretty-print special COFF section names 2014-09-20 00:25:06 +00:00
symbol-mangling.ll
timestamp.s
tricky-names.ll
weak.s llvm-readobj: pretty-print special COFF section names 2014-09-20 00:25:06 +00:00