llvm-6502/test/DebugInfo
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
..
AArch64 [opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction 2015-02-27 19:29:02 +00:00
ARM [opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction 2015-02-27 19:29:02 +00:00
COFF Modify llvm-readobj to dump symbol record bytes. 2015-02-18 19:32:05 +00:00
Inputs Refactor test to be reused across architectures 2015-01-29 20:21:24 +00:00
Mips [mips] Fix 'jumpy' debug line info around calls. 2015-01-24 14:35:11 +00:00
PDB [llvm-pdbdump] Add support for dumping global variables. 2015-02-27 09:15:18 +00:00
PowerPC Add PPC test for r227481, but XFAIL because this is actually more work than it appeared to be. 2015-01-30 23:52:19 +00:00
Sparc IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
SystemZ [opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction 2015-02-27 19:29:02 +00:00
X86 [opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction 2015-02-27 19:29:02 +00:00
2009-10-16-Phi.ll IR: Make metadata typeless in assembly 2014-12-15 19:07:53 +00:00
2009-11-03-InsertExtractValue.ll IR: Make metadata typeless in assembly 2014-12-15 19:07:53 +00:00
2009-11-05-DeadGlobalVariable.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
2009-11-06-NamelessGlobalVariable.ll IR: Make metadata typeless in assembly 2014-12-15 19:07:53 +00:00
2009-11-10-CurrentFn.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
2010-01-05-DbgScope.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
2010-03-12-llc-crash.ll IR: Make metadata typeless in assembly 2014-12-15 19:07:53 +00:00
2010-03-19-DbgDeclare.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
2010-03-24-MemberFn.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
2010-03-30-InvalidDbgInfoCrash.ll IR: Make metadata typeless in assembly 2014-12-15 19:07:53 +00:00
2010-04-06-NestedFnDbgInfo.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
2010-04-19-FramePtr.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
2010-05-03-DisableFramePtr.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
2010-05-03-OriginDIE.ll [opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction 2015-02-27 19:29:02 +00:00
2010-05-10-MultipleCU.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
2010-06-29-InlinedFnLocalVar.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
2010-07-19-Crash.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
2010-10-01-crash.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
arm-relocs.test Add support for the R_ARM_ABS32 relocation. 2014-04-03 02:27:00 +00:00
array.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
block-asan.ll [opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction 2015-02-27 19:29:02 +00:00
bug_null_debuginfo.ll IR: Make metadata typeless in assembly 2014-12-15 19:07:53 +00:00
constant-pointers.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
cross-cu-inlining.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
cross-cu-linkonce-distinct.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
cross-cu-linkonce.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
cu-range-hole.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
cu-ranges.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
dead-argument-order.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
debug-info-always-inline.ll [opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction 2015-02-27 19:29:02 +00:00
debug-info-qualifiers.ll Remove support for DIVariable's FlagIndirectVariable and expect 2015-01-19 17:57:29 +00:00
debuginfofinder-multiple-cu.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
debuglineinfo.test
dwarf-public-names.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
dwarfdump-accel.test Reapply "[dwarfdump] Add support for dumping accelerator tables." 2014-11-14 16:15:53 +00:00
dwarfdump-debug-frame-simple.test [dwarfdump] Make debug_frame dump actually useful. 2015-02-25 21:30:22 +00:00
dwarfdump-debug-loc-simple.test Spell correct (s/begining/beginning/) 2013-06-19 21:42:05 +00:00
dwarfdump-dump-flags.test
dwarfdump-line-dwo.test llvm-dwarfdump: Support for debug_line.dwo section for file names for type units under fission. 2014-02-24 23:58:54 +00:00
dwarfdump-objc.test [dwarfdump] Prettyprint DW_AT_APPLE_property_attribute bitfield values. 2014-10-10 15:51:10 +00:00
dwarfdump-pubnames.test DebugInfo: Make pubnames header printing similar to unit header printing 2013-11-01 17:53:30 +00:00
dwarfdump-ranges.test [dwarfdump] Dump DW_AT_ranges values inline in the debug_info dump. 2014-10-23 04:08:34 +00:00
dwarfdump-type-units.test llvm-dwarfdump: support for emitting only the debug_types section using -debug-dump 2013-11-19 00:29:42 +00:00
dwarfdump-zlib.test Kill symbolization functionality in llvm-dwarfdump. We have llvm-symbolizer for that. 2014-05-19 18:45:32 +00:00
empty.ll IR: Make metadata typeless in assembly 2014-12-15 19:07:53 +00:00
enum-types.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
enum.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
global.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
gmlt.test test: XFAIL the non-darwin gmlt test on darwin 2014-10-01 05:45:45 +00:00
incorrect-variable-debugloc1.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
incorrect-variable-debugloc.ll [opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction 2015-02-27 19:29:02 +00:00
inheritance.ll [opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction 2015-02-27 19:29:02 +00:00
inline-debug-info-multiret.ll DebugInfo: Use distinct inlinedAt MDLocations to avoid separate inlined calls being coalesced 2015-01-21 22:57:29 +00:00
inline-debug-info.ll DebugInfo: Use distinct inlinedAt MDLocations to avoid separate inlined calls being coalesced 2015-01-21 22:57:29 +00:00
inline-no-debug-info.ll DebugInfo: Use distinct inlinedAt MDLocations to avoid separate inlined calls being coalesced 2015-01-21 22:57:29 +00:00
inline-scopes.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
inlined-arguments.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
inlined-vars.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
llvm-symbolizer-zlib.test Kill symbolization functionality in llvm-dwarfdump. We have llvm-symbolizer for that. 2014-05-19 18:45:32 +00:00
llvm-symbolizer.test Remove "REQUIRES:shell" from tests. They work for me. 2014-11-04 13:41:33 +00:00
location-verifier.ll DebugLocs without a scope should fail the verification. 2015-01-20 22:37:25 +00:00
lto-comp-dir.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
member-order.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
member-pointers.ll IR: Make metadata typeless in assembly 2014-12-15 19:07:53 +00:00
member-pointers.o Revert "Revert "DI: Fold constant arguments into a single MDString"" 2014-10-03 20:01:09 +00:00
missing-abstract-variable.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
missing-abstract-variable.o Revert "Revert "DI: Fold constant arguments into a single MDString"" 2014-10-03 20:01:09 +00:00
multiline.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
namespace_function_definition.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
namespace_inline_function_definition.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
namespace.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
nodebug.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
piece-verifier.ll Make DIExpression::Verify() stricter by checking that the number of 2015-01-21 00:59:20 +00:00
PR20038.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
restrict.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
sugared-constants.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
template-recursive-void.ll IR: Make metadata typeless in assembly 2014-12-15 19:07:53 +00:00
tu-composite.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
tu-member-pointer.ll IR: Make metadata typeless in assembly 2014-12-15 19:07:53 +00:00
two-cus-from-same-file.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
typedef.ll IR: Make metadata typeless in assembly 2014-12-15 19:07:53 +00:00
unconditional-branch.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
varargs.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
version.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00