mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-25 10:27:04 +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:
@@ -15,8 +15,8 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
define void @test() {
|
||||
%D = getelementptr %T, %T* @G, i64 0, i32 0
|
||||
%E = getelementptr %T, %T* @G, i64 0, i32 1, i64 5
|
||||
%F = getelementptr i32, i32* getelementptr (%T* @G, i64 0, i32 0), i64 0
|
||||
%X = getelementptr [10 x i8], [10 x i8]* getelementptr (%T* @G, i64 0, i32 1), i64 0, i64 5
|
||||
%F = getelementptr i32, i32* getelementptr (%T, %T* @G, i64 0, i32 0), i64 0
|
||||
%X = getelementptr [10 x i8], [10 x i8]* getelementptr (%T, %T* @G, i64 0, i32 1), i64 0, i64 5
|
||||
|
||||
ret void
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@ define i32 @_Z3fooP1A(%struct.A* %b) {
|
||||
; CHECK: %tmp7 = load
|
||||
; CHECK: ret i32 %tmp7
|
||||
entry:
|
||||
store i32 1, i32* getelementptr (%struct.B* @a, i32 0, i32 0, i32 0), align 8
|
||||
store i32 1, i32* getelementptr (%struct.B, %struct.B* @a, i32 0, i32 0, i32 0), align 8
|
||||
%tmp4 = getelementptr %struct.A, %struct.A* %b, i32 0, i32 0 ;<i32*> [#uses=1]
|
||||
store i32 0, i32* %tmp4, align 4
|
||||
%tmp7 = load i32, i32* getelementptr (%struct.B* @a, i32 0, i32 0, i32 0), align 8 ; <i32> [#uses=1]
|
||||
%tmp7 = load i32, i32* getelementptr (%struct.B, %struct.B* @a, i32 0, i32 0, i32 0), align 8 ; <i32> [#uses=1]
|
||||
ret i32 %tmp7
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ target triple = "i686-pc-linux-gnu"
|
||||
|
||||
define void @test291() nounwind {
|
||||
entry:
|
||||
store i32 1138410269, i32* getelementptr ([5 x %struct.S291]* @a291, i32 0, i32 2, i32 1)
|
||||
%tmp54 = load i32, i32* bitcast (%struct.S291* getelementptr ([5 x %struct.S291]* @a291, i32 0, i32 2) to i32*), align 4 ; <i32> [#uses=0]
|
||||
store i32 1138410269, i32* getelementptr ([5 x %struct.S291], [5 x %struct.S291]* @a291, i32 0, i32 2, i32 1)
|
||||
%tmp54 = load i32, i32* bitcast (%struct.S291* getelementptr ([5 x %struct.S291], [5 x %struct.S291]* @a291, i32 0, i32 2) to i32*), align 4 ; <i32> [#uses=0]
|
||||
unreachable
|
||||
}
|
||||
|
||||
@@ -9,11 +9,11 @@ target triple = "x86_64-apple-macosx10.8.0"
|
||||
|
||||
define i32 @main() nounwind uwtable ssp {
|
||||
entry:
|
||||
%tmp = load i8, i8* getelementptr inbounds ({ i8, i8, i8, i8, i8 }* @a, i64 0, i32 4), align 4
|
||||
%tmp = load i8, i8* getelementptr inbounds ({ i8, i8, i8, i8, i8 }, { i8, i8, i8, i8, i8 }* @a, i64 0, i32 4), align 4
|
||||
%tmp1 = or i8 %tmp, -128
|
||||
store i8 %tmp1, i8* getelementptr inbounds ({ i8, i8, i8, i8, i8 }* @a, i64 0, i32 4), align 4
|
||||
store i8 %tmp1, i8* getelementptr inbounds ({ i8, i8, i8, i8, i8 }, { i8, i8, i8, i8, i8 }* @a, i64 0, i32 4), align 4
|
||||
%tmp2 = load i64, i64* bitcast ({ i8, i8, i8, i8, i8 }* @a to i64*), align 8
|
||||
store i8 11, i8* getelementptr inbounds ({ i8, i8, i8, i8, i8 }* @a, i64 0, i32 4), align 4
|
||||
store i8 11, i8* getelementptr inbounds ({ i8, i8, i8, i8, i8 }, { i8, i8, i8, i8, i8 }* @a, i64 0, i32 4), align 4
|
||||
%tmp3 = trunc i64 %tmp2 to i32
|
||||
ret i32 %tmp3
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ define i32 @constexpr_test() {
|
||||
call void @external(i32* %X)
|
||||
|
||||
%Y = load i32, i32* %X
|
||||
store i32 5, i32* getelementptr ({ i32 }* @Global, i64 0, i32 0)
|
||||
store i32 5, i32* getelementptr ({ i32 }, { i32 }* @Global, i64 0, i32 0)
|
||||
%REMOVE = load i32, i32* %X
|
||||
%retval = sub i32 %Y, %REMOVE
|
||||
ret i32 %retval
|
||||
|
||||
@@ -14,7 +14,7 @@ for.cond2.preheader: ; preds = %for.end, %entry
|
||||
br label %for.body4
|
||||
|
||||
for.body4: ; preds = %for.body4, %for.cond2.preheader
|
||||
%lsr.iv4 = phi [16000 x double]* [ %i11, %for.body4 ], [ bitcast (double* getelementptr inbounds ([16000 x double]* @Y, i64 0, i64 8)
|
||||
%lsr.iv4 = phi [16000 x double]* [ %i11, %for.body4 ], [ bitcast (double* getelementptr inbounds ([16000 x double], [16000 x double]* @Y, i64 0, i64 8)
|
||||
to [16000 x double]*), %for.cond2.preheader ]
|
||||
%lsr.iv1 = phi [16000 x double]* [ %i10, %for.body4 ], [ @X, %for.cond2.preheader ]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user