summaryrefslogtreecommitdiff
path: root/test/CodeGen/MSP430
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2015-02-27 19:29:02 +0000
committerDavid Blaikie <dblaikie@gmail.com>2015-02-27 19:29:02 +0000
commit198d8baafbfdfcf5a5e219602a5d94ed263973b4 (patch)
tree1c76a588765bdfffb32fbce3c05cf18009be4f64 /test/CodeGen/MSP430
parent56f3b7f2fd1505ecf94bed8cae92375cdcde4efe (diff)
[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
Diffstat (limited to 'test/CodeGen/MSP430')
-rw-r--r--test/CodeGen/MSP430/2009-11-08-InvalidResNo.ll2
-rw-r--r--test/CodeGen/MSP430/2009-12-22-InlineAsm.ll2
-rw-r--r--test/CodeGen/MSP430/AddrMode-bis-rx.ll8
-rw-r--r--test/CodeGen/MSP430/AddrMode-bis-xr.ll8
-rw-r--r--test/CodeGen/MSP430/AddrMode-mov-rx.ll8
-rw-r--r--test/CodeGen/MSP430/AddrMode-mov-xr.ll8
-rw-r--r--test/CodeGen/MSP430/byval.ll2
-rw-r--r--test/CodeGen/MSP430/indirectbr.ll2
-rw-r--r--test/CodeGen/MSP430/indirectbr2.ll2
-rw-r--r--test/CodeGen/MSP430/postinc.ll10
10 files changed, 26 insertions, 26 deletions
diff --git a/test/CodeGen/MSP430/2009-11-08-InvalidResNo.ll b/test/CodeGen/MSP430/2009-11-08-InvalidResNo.ll
index d232aeae5b5..d5ff29c6ccd 100644
--- a/test/CodeGen/MSP430/2009-11-08-InvalidResNo.ll
+++ b/test/CodeGen/MSP430/2009-11-08-InvalidResNo.ll
@@ -48,7 +48,7 @@ while.cond36.i: ; preds = %while.body41.i, %wh
while.body41.i: ; preds = %while.cond36.i
%tmp43.i = load i8** @foo ; <i8*> [#uses=2]
%tmp44.i = load i8* %tmp43.i ; <i8> [#uses=1]
- %ptrincdec50.i = getelementptr inbounds i8* %tmp43.i, i16 1 ; <i8*> [#uses=1]
+ %ptrincdec50.i = getelementptr inbounds i8, i8* %tmp43.i, i16 1 ; <i8*> [#uses=1]
store i8* %ptrincdec50.i, i8** @foo
%cmp55.i = icmp eq i8 %tmp44.i, %c ; <i1> [#uses=1]
br i1 %cmp55.i, label %do.end41, label %while.cond36.i
diff --git a/test/CodeGen/MSP430/2009-12-22-InlineAsm.ll b/test/CodeGen/MSP430/2009-12-22-InlineAsm.ll
index a9df1a3e974..bc23cad6179 100644
--- a/test/CodeGen/MSP430/2009-12-22-InlineAsm.ll
+++ b/test/CodeGen/MSP430/2009-12-22-InlineAsm.ll
@@ -9,7 +9,7 @@ target triple = "msp430-unknown-unknown"
define i16 @main() noreturn nounwind {
entry:
%0 = tail call i8* asm "", "=r,0"(i8* getelementptr inbounds ([10 x i8]* @buf, i16 0, i16 0)) nounwind ; <i8*> [#uses=1]
- %sub.ptr = getelementptr inbounds i8* %0, i16 1 ; <i8*> [#uses=1]
+ %sub.ptr = getelementptr inbounds i8, i8* %0, i16 1 ; <i8*> [#uses=1]
%sub.ptr.lhs.cast = ptrtoint i8* %sub.ptr to i16 ; <i16> [#uses=1]
%sub.ptr.sub = sub i16 %sub.ptr.lhs.cast, ptrtoint ([10 x i8]* @buf to i16) ; <i16> [#uses=1]
%cmp = icmp eq i16 %sub.ptr.sub, 1 ; <i1> [#uses=1]
diff --git a/test/CodeGen/MSP430/AddrMode-bis-rx.ll b/test/CodeGen/MSP430/AddrMode-bis-rx.ll
index 44c92ebc82c..532a25cc155 100644
--- a/test/CodeGen/MSP430/AddrMode-bis-rx.ll
+++ b/test/CodeGen/MSP430/AddrMode-bis-rx.ll
@@ -23,7 +23,7 @@ define i16 @am2(i16 %x) nounwind {
@bar = internal constant [2 x i8] [ i8 32, i8 64 ]
define i8 @am3(i8 %x, i16 %n) nounwind {
- %1 = getelementptr [2 x i8]* @bar, i16 0, i16 %n
+ %1 = getelementptr [2 x i8], [2 x i8]* @bar, i16 0, i16 %n
%2 = load i8* %1
%3 = or i8 %2,%x
ret i8 %3
@@ -40,7 +40,7 @@ define i16 @am4(i16 %x) nounwind {
; CHECK: bis.w &32, r15
define i16 @am5(i16 %x, i16* %a) nounwind {
- %1 = getelementptr i16* %a, i16 2
+ %1 = getelementptr i16, i16* %a, i16 2
%2 = load i16* %1
%3 = or i16 %2,%x
ret i16 %3
@@ -63,8 +63,8 @@ define i16 @am6(i16 %x) nounwind {
@duh = internal constant %T { i16 16, [2 x i8][i8 32, i8 64 ] }
define i8 @am7(i8 %x, i16 %n) nounwind {
- %1 = getelementptr %T* @duh, i32 0, i32 1
- %2 = getelementptr [2 x i8]* %1, i16 0, i16 %n
+ %1 = getelementptr %T, %T* @duh, i32 0, i32 1
+ %2 = getelementptr [2 x i8], [2 x i8]* %1, i16 0, i16 %n
%3= load i8* %2
%4 = or i8 %3,%x
ret i8 %4
diff --git a/test/CodeGen/MSP430/AddrMode-bis-xr.ll b/test/CodeGen/MSP430/AddrMode-bis-xr.ll
index 06a3d32d8aa..c40ba1beee9 100644
--- a/test/CodeGen/MSP430/AddrMode-bis-xr.ll
+++ b/test/CodeGen/MSP430/AddrMode-bis-xr.ll
@@ -25,7 +25,7 @@ define void @am2(i16 %x) nounwind {
@bar = external global [2 x i8]
define void @am3(i16 %i, i8 %x) nounwind {
- %1 = getelementptr [2 x i8]* @bar, i16 0, i16 %i
+ %1 = getelementptr [2 x i8], [2 x i8]* @bar, i16 0, i16 %i
%2 = load i8* %1
%3 = or i8 %x, %2
store i8 %3, i8* %1
@@ -44,7 +44,7 @@ define void @am4(i16 %x) nounwind {
; CHECK: bis.w r15, &32
define void @am5(i16* %a, i16 %x) readonly {
- %1 = getelementptr inbounds i16* %a, i16 2
+ %1 = getelementptr inbounds i16, i16* %a, i16 2
%2 = load i16* %1
%3 = or i16 %x, %2
store i16 %3, i16* %1
@@ -69,8 +69,8 @@ define void @am6(i16 %x) nounwind {
@duh = external global %T
define void @am7(i16 %n, i8 %x) nounwind {
- %1 = getelementptr %T* @duh, i32 0, i32 1
- %2 = getelementptr [2 x i8]* %1, i16 0, i16 %n
+ %1 = getelementptr %T, %T* @duh, i32 0, i32 1
+ %2 = getelementptr [2 x i8], [2 x i8]* %1, i16 0, i16 %n
%3 = load i8* %2
%4 = or i8 %x, %3
store i8 %4, i8* %2
diff --git a/test/CodeGen/MSP430/AddrMode-mov-rx.ll b/test/CodeGen/MSP430/AddrMode-mov-rx.ll
index 378b7ae58ff..0c2b965bf27 100644
--- a/test/CodeGen/MSP430/AddrMode-mov-rx.ll
+++ b/test/CodeGen/MSP430/AddrMode-mov-rx.ll
@@ -21,7 +21,7 @@ define i16 @am2() nounwind {
@bar = internal constant [2 x i8] [ i8 32, i8 64 ]
define i8 @am3(i16 %n) nounwind {
- %1 = getelementptr [2 x i8]* @bar, i16 0, i16 %n
+ %1 = getelementptr [2 x i8], [2 x i8]* @bar, i16 0, i16 %n
%2 = load i8* %1
ret i8 %2
}
@@ -36,7 +36,7 @@ define i16 @am4() nounwind {
; CHECK: mov.w &32, r15
define i16 @am5(i16* %a) nounwind {
- %1 = getelementptr i16* %a, i16 2
+ %1 = getelementptr i16, i16* %a, i16 2
%2 = load i16* %1
ret i16 %2
}
@@ -57,8 +57,8 @@ define i16 @am6() nounwind {
@duh = internal constant %T { i16 16, [2 x i8][i8 32, i8 64 ] }
define i8 @am7(i16 %n) nounwind {
- %1 = getelementptr %T* @duh, i32 0, i32 1
- %2 = getelementptr [2 x i8]* %1, i16 0, i16 %n
+ %1 = getelementptr %T, %T* @duh, i32 0, i32 1
+ %2 = getelementptr [2 x i8], [2 x i8]* %1, i16 0, i16 %n
%3= load i8* %2
ret i8 %3
}
diff --git a/test/CodeGen/MSP430/AddrMode-mov-xr.ll b/test/CodeGen/MSP430/AddrMode-mov-xr.ll
index f55fd542645..37c369e7678 100644
--- a/test/CodeGen/MSP430/AddrMode-mov-xr.ll
+++ b/test/CodeGen/MSP430/AddrMode-mov-xr.ll
@@ -21,7 +21,7 @@ define void @am2(i16 %a) nounwind {
@bar = external global [2 x i8]
define void @am3(i16 %i, i8 %a) nounwind {
- %1 = getelementptr [2 x i8]* @bar, i16 0, i16 %i
+ %1 = getelementptr [2 x i8], [2 x i8]* @bar, i16 0, i16 %i
store i8 %a, i8* %1
ret void
}
@@ -36,7 +36,7 @@ define void @am4(i16 %a) nounwind {
; CHECK: mov.w r15, &32
define void @am5(i16* nocapture %p, i16 %a) nounwind readonly {
- %1 = getelementptr inbounds i16* %p, i16 2
+ %1 = getelementptr inbounds i16, i16* %p, i16 2
store i16 %a, i16* %1
ret void
}
@@ -57,8 +57,8 @@ define void @am6(i16 %a) nounwind {
@duh = external global %T
define void @am7(i16 %n, i8 %a) nounwind {
- %1 = getelementptr %T* @duh, i32 0, i32 1
- %2 = getelementptr [2 x i8]* %1, i16 0, i16 %n
+ %1 = getelementptr %T, %T* @duh, i32 0, i32 1
+ %2 = getelementptr [2 x i8], [2 x i8]* %1, i16 0, i16 %n
store i8 %a, i8* %2
ret void
}
diff --git a/test/CodeGen/MSP430/byval.ll b/test/CodeGen/MSP430/byval.ll
index bd38e95554d..3be05b56a0e 100644
--- a/test/CodeGen/MSP430/byval.ll
+++ b/test/CodeGen/MSP430/byval.ll
@@ -10,7 +10,7 @@ define i16 @callee(%struct.Foo* byval %f) nounwind {
entry:
; CHECK-LABEL: callee:
; CHECK: mov.w 2(r1), r15
- %0 = getelementptr inbounds %struct.Foo* %f, i32 0, i32 0
+ %0 = getelementptr inbounds %struct.Foo, %struct.Foo* %f, i32 0, i32 0
%1 = load i16* %0, align 2
ret i16 %1
}
diff --git a/test/CodeGen/MSP430/indirectbr.ll b/test/CodeGen/MSP430/indirectbr.ll
index 2a62c9135c6..4816c4ac3a1 100644
--- a/test/CodeGen/MSP430/indirectbr.ll
+++ b/test/CodeGen/MSP430/indirectbr.ll
@@ -14,7 +14,7 @@ bb2: ; preds = %bb3, %entry
indirectbr i8* %gotovar.4.0, [label %L5, label %L4, label %L3, label %L2, label %L1]
bb3: ; preds = %entry
- %2 = getelementptr inbounds [5 x i8*]* @C.0.2070, i16 0, i16 %i ; <i8**> [#uses=1]
+ %2 = getelementptr inbounds [5 x i8*], [5 x i8*]* @C.0.2070, i16 0, i16 %i ; <i8**> [#uses=1]
%gotovar.4.0.pre = load i8** %2, align 4 ; <i8*> [#uses=1]
br label %bb2
diff --git a/test/CodeGen/MSP430/indirectbr2.ll b/test/CodeGen/MSP430/indirectbr2.ll
index 93788b69655..796687ebe2b 100644
--- a/test/CodeGen/MSP430/indirectbr2.ll
+++ b/test/CodeGen/MSP430/indirectbr2.ll
@@ -3,7 +3,7 @@
define internal i16 @foo(i16 %i) nounwind {
entry:
- %tmp1 = getelementptr inbounds [5 x i8*]* @C.0.2070, i16 0, i16 %i ; <i8**> [#uses=1]
+ %tmp1 = getelementptr inbounds [5 x i8*], [5 x i8*]* @C.0.2070, i16 0, i16 %i ; <i8**> [#uses=1]
%gotovar.4.0 = load i8** %tmp1, align 4 ; <i8*> [#uses=1]
; CHECK: br .LC.0.2070(r12)
indirectbr i8* %gotovar.4.0, [label %L5, label %L4, label %L3, label %L2, label %L1]
diff --git a/test/CodeGen/MSP430/postinc.ll b/test/CodeGen/MSP430/postinc.ll
index 8d55fd3f803..ee5cef8cdd6 100644
--- a/test/CodeGen/MSP430/postinc.ll
+++ b/test/CodeGen/MSP430/postinc.ll
@@ -10,7 +10,7 @@ entry:
for.body: ; preds = %for.body, %entry
%i.010 = phi i16 [ 0, %entry ], [ %inc, %for.body ] ; <i16> [#uses=2]
%sum.09 = phi i16 [ 0, %entry ], [ %add, %for.body ] ; <i16> [#uses=1]
- %arrayidx = getelementptr i16* %a, i16 %i.010 ; <i16*> [#uses=1]
+ %arrayidx = getelementptr i16, i16* %a, i16 %i.010 ; <i16*> [#uses=1]
; CHECK-LABEL: add:
; CHECK: add.w @r{{[0-9]+}}+, r{{[0-9]+}}
%tmp4 = load i16* %arrayidx ; <i16> [#uses=1]
@@ -32,7 +32,7 @@ entry:
for.body: ; preds = %for.body, %entry
%i.010 = phi i16 [ 0, %entry ], [ %inc, %for.body ] ; <i16> [#uses=2]
%sum.09 = phi i16 [ 0, %entry ], [ %add, %for.body ] ; <i16> [#uses=1]
- %arrayidx = getelementptr i16* %a, i16 %i.010 ; <i16*> [#uses=1]
+ %arrayidx = getelementptr i16, i16* %a, i16 %i.010 ; <i16*> [#uses=1]
; CHECK-LABEL: sub:
; CHECK: sub.w @r{{[0-9]+}}+, r{{[0-9]+}}
%tmp4 = load i16* %arrayidx ; <i16> [#uses=1]
@@ -54,7 +54,7 @@ entry:
for.body: ; preds = %for.body, %entry
%i.010 = phi i16 [ 0, %entry ], [ %inc, %for.body ] ; <i16> [#uses=2]
%sum.09 = phi i16 [ 0, %entry ], [ %add, %for.body ] ; <i16> [#uses=1]
- %arrayidx = getelementptr i16* %a, i16 %i.010 ; <i16*> [#uses=1]
+ %arrayidx = getelementptr i16, i16* %a, i16 %i.010 ; <i16*> [#uses=1]
; CHECK-LABEL: or:
; CHECK: bis.w @r{{[0-9]+}}+, r{{[0-9]+}}
%tmp4 = load i16* %arrayidx ; <i16> [#uses=1]
@@ -76,7 +76,7 @@ entry:
for.body: ; preds = %for.body, %entry
%i.010 = phi i16 [ 0, %entry ], [ %inc, %for.body ] ; <i16> [#uses=2]
%sum.09 = phi i16 [ 0, %entry ], [ %add, %for.body ] ; <i16> [#uses=1]
- %arrayidx = getelementptr i16* %a, i16 %i.010 ; <i16*> [#uses=1]
+ %arrayidx = getelementptr i16, i16* %a, i16 %i.010 ; <i16*> [#uses=1]
; CHECK-LABEL: xor:
; CHECK: xor.w @r{{[0-9]+}}+, r{{[0-9]+}}
%tmp4 = load i16* %arrayidx ; <i16> [#uses=1]
@@ -98,7 +98,7 @@ entry:
for.body: ; preds = %for.body, %entry
%i.010 = phi i16 [ 0, %entry ], [ %inc, %for.body ] ; <i16> [#uses=2]
%sum.09 = phi i16 [ 0, %entry ], [ %add, %for.body ] ; <i16> [#uses=1]
- %arrayidx = getelementptr i16* %a, i16 %i.010 ; <i16*> [#uses=1]
+ %arrayidx = getelementptr i16, i16* %a, i16 %i.010 ; <i16*> [#uses=1]
; CHECK-LABEL: and:
; CHECK: and.w @r{{[0-9]+}}+, r{{[0-9]+}}
%tmp4 = load i16* %arrayidx ; <i16> [#uses=1]