mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-11-04 05:17:07 +00:00 
			
		
		
		
	[opaque pointer type] Add textual IR support for explicit type parameter to gep operator
Similar to gep (r230786) and load (r230794) changes.
Similar migration script can be used to update test cases, which
successfully migrated all of LLVM and Polly, but about 4 test cases
needed manually changes in Clang.
(this script will read the contents of stdin and massage it into stdout
- wrap it in the 'apply.sh' script shown in previous commits + xargs to
apply it over a large set of test cases)
import fileinput
import sys
import re
rep = re.compile(r"(getelementptr(?:\s+inbounds)?\s*\()((<\d*\s+x\s+)?([^@]*?)(|\s*addrspace\(\d+\))\s*\*(?(3)>)\s*)(?=$|%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|zeroinitializer|<|\[\[[a-zA-Z]|\{\{)", re.MULTILINE | re.DOTALL)
def conv(match):
  line = match.group(1)
  line += match.group(4)
  line += ", "
  line += match.group(2)
  return line
line = sys.stdin.read()
off = 0
for match in re.finditer(rep, line):
  sys.stdout.write(line[off:match.start()])
  sys.stdout.write(conv(match))
  off = match.end()
sys.stdout.write(line[off:])
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232184 91177308-0d34-0410-b5e6-96231b3b80d8
			
			
This commit is contained in:
		@@ -5,5 +5,5 @@
 | 
			
		||||
; RUN: llvm-link %t.LinkTest.bc %t.bc
 | 
			
		||||
 | 
			
		||||
@work = global i32 4		; <i32*> [#uses=1]
 | 
			
		||||
@test = global i32* getelementptr (i32* @work, i64 1)		; <i32**> [#uses=0]
 | 
			
		||||
@test = global i32* getelementptr (i32, i32* @work, i64 1)		; <i32**> [#uses=0]
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -30,6 +30,6 @@ declare void @func(%struct2*)
 | 
			
		||||
 | 
			
		||||
define void @tty_init() {
 | 
			
		||||
entry:
 | 
			
		||||
	store volatile void (%struct2*)* @func, void (%struct2*)** getelementptr (%struct1* @driver1, i64 0, i32 1)
 | 
			
		||||
	store volatile void (%struct2*)* @func, void (%struct2*)** getelementptr (%struct1, %struct1* @driver1, i64 0, i32 1)
 | 
			
		||||
	ret void
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
; CHECK: [i32 7, i32 4, i32 8]
 | 
			
		||||
 | 
			
		||||
@X = appending global [2 x i32] [ i32 7, i32 4 ]		; <[2 x i32]*> [#uses=2]
 | 
			
		||||
@Y = global i32* getelementptr ([2 x i32]* @X, i64 0, i64 0)		; <i32**> [#uses=0]
 | 
			
		||||
@Y = global i32* getelementptr ([2 x i32], [2 x i32]* @X, i64 0, i64 0)		; <i32**> [#uses=0]
 | 
			
		||||
 | 
			
		||||
define void @foo(i64 %V) {
 | 
			
		||||
	%Y = getelementptr [2 x i32], [2 x i32]* @X, i64 0, i64 %V		; <i32*> [#uses=0]
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,6 @@ $foo = comdat largest
 | 
			
		||||
 | 
			
		||||
@zed = external constant i8
 | 
			
		||||
@some_name = private unnamed_addr constant [2 x i8*] [i8* @zed, i8* bitcast (void ()* @bar to i8*)], comdat($foo)
 | 
			
		||||
@foo = alias getelementptr([2 x i8*]* @some_name, i32 0, i32 1)
 | 
			
		||||
@foo = alias getelementptr([2 x i8*], [2 x i8*]* @some_name, i32 0, i32 1)
 | 
			
		||||
 | 
			
		||||
declare void @bar() unnamed_addr
 | 
			
		||||
 
 | 
			
		||||
@@ -5,6 +5,6 @@ target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
 | 
			
		||||
$foo = comdat largest
 | 
			
		||||
@foo = linkonce_odr unnamed_addr constant [1 x i8*] [i8* bitcast (void ()* @bar to i8*)], comdat($foo)
 | 
			
		||||
 | 
			
		||||
; CHECK: @foo = alias getelementptr inbounds ([2 x i8*]* @some_name, i32 0, i32 1)
 | 
			
		||||
; CHECK: @foo = alias getelementptr inbounds ([2 x i8*], [2 x i8*]* @some_name, i32 0, i32 1)
 | 
			
		||||
 | 
			
		||||
declare void @bar() unnamed_addr
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
; RUN: llvm-link %s %p/partial-type-refinement-link.ll -S | FileCheck %s
 | 
			
		||||
; PR4954
 | 
			
		||||
 | 
			
		||||
; CHECK: load %PI*, %PI** getelementptr inbounds (%"RegisterP<LowerArrayLength>"* @_ZN3mvmL1XE, i64 0, i32 0, i32 6, i32 0, i32 0, i32 0), align 16
 | 
			
		||||
; CHECK: load %PI*, %PI** getelementptr inbounds (%"RegisterP<LowerArrayLength>", %"RegisterP<LowerArrayLength>"* @_ZN3mvmL1XE, i64 0, i32 0, i32 6, i32 0, i32 0, i32 0), align 16
 | 
			
		||||
 | 
			
		||||
%AnalysisResolver = type { i8, %PMDataManager* }
 | 
			
		||||
%"DenseMap<P*,AU*>" = type { i64, %"pair<P*,AU*>"*, i64, i64 }
 | 
			
		||||
@@ -19,6 +19,6 @@
 | 
			
		||||
 | 
			
		||||
define void @__tcf_0() nounwind {
 | 
			
		||||
entry:
 | 
			
		||||
  %0 = load %PI*, %PI** getelementptr inbounds (%"RegisterP<LowerArrayLength>"* @_ZN3mvmL1XE, i64 0, i32 0, i32 6, i32 0, i32 0, i32 0), align 16
 | 
			
		||||
  %0 = load %PI*, %PI** getelementptr inbounds (%"RegisterP<LowerArrayLength>", %"RegisterP<LowerArrayLength>"* @_ZN3mvmL1XE, i64 0, i32 0, i32 6, i32 0, i32 0, i32 0), align 16
 | 
			
		||||
  ret void
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -67,7 +67,7 @@ entry:
 | 
			
		||||
  call void @llvm.dbg.declare(metadata %class.A** %this.addr, metadata !44, metadata !MDExpression()), !dbg !45
 | 
			
		||||
  %this1 = load %class.A*, %class.A** %this.addr
 | 
			
		||||
  %0 = bitcast %class.A* %this1 to i8***, !dbg !46
 | 
			
		||||
  store i8** getelementptr inbounds ([4 x i8*]* @_ZTV1A, i64 0, i64 2), i8*** %0, !dbg !46
 | 
			
		||||
  store i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @_ZTV1A, i64 0, i64 2), i8*** %0, !dbg !46
 | 
			
		||||
  ret void, !dbg !46
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,7 @@
 | 
			
		||||
@_ZTV1A = unnamed_addr constant [4 x i8*] [i8* null, i8* bitcast ({ i8*, i8* }* @_ZTI1A to i8*), i8* bitcast (void (%class.A*)* @_ZN1A6setFooEv to i8*), i8* bitcast (i32 (%class.A*)* @_ZN1A6getFooEv to i8*)]
 | 
			
		||||
@_ZTVN10__cxxabiv117__class_type_infoE = external global i8*
 | 
			
		||||
@_ZTS1A = constant [3 x i8] c"1A\00"
 | 
			
		||||
@_ZTI1A = unnamed_addr constant { i8*, i8* } { i8* bitcast (i8** getelementptr inbounds (i8** @_ZTVN10__cxxabiv117__class_type_infoE, i64 2) to i8*), i8* getelementptr inbounds ([3 x i8]* @_ZTS1A, i32 0, i32 0) }
 | 
			
		||||
@_ZTI1A = unnamed_addr constant { i8*, i8* } { i8* bitcast (i8** getelementptr inbounds (i8*, i8** @_ZTVN10__cxxabiv117__class_type_infoE, i64 2) to i8*), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @_ZTS1A, i32 0, i32 0) }
 | 
			
		||||
 | 
			
		||||
; Function Attrs: nounwind
 | 
			
		||||
define void @_ZN1A6setFooEv(%class.A* %this) unnamed_addr #0 align 2 {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user