aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMark Seaborn <mseaborn@chromium.org>2013-09-06 14:56:16 -0700
committerMark Seaborn <mseaborn@chromium.org>2013-09-06 14:56:16 -0700
commit68cb3f7eca7536d85301f92314dbb5db6757cd94 (patch)
tree85cfa713f9f2304e419a744eaa11fd5f519034d9 /test
parent45f9be95ab8e334e7e4b4328ee297d032e64b788 (diff)
PNaCl bitcode: Strip pointer types from intrinsic declarations' parameters
Change the writer to strip pointer types from intrinsics' argument and return types, replacing them with i32. This simplifies the PNaCl bitcode format so that pointer types don't need to be represented here. Change the reader to restore the pointer types so that the intrinsic declarations pass the LLVM and PNaCl verifiers. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3671 TEST=intrinsic tests in call-elide.ll + intrinsic-pointer-args.ll + run small_tests with bitcode v2 enabled Review URL: https://codereview.chromium.org/23793005
Diffstat (limited to 'test')
-rw-r--r--test/NaCl/Bitcode/intrinsic-pointer-args.ll55
1 files changed, 55 insertions, 0 deletions
diff --git a/test/NaCl/Bitcode/intrinsic-pointer-args.ll b/test/NaCl/Bitcode/intrinsic-pointer-args.ll
new file mode 100644
index 0000000000..0848568fd3
--- /dev/null
+++ b/test/NaCl/Bitcode/intrinsic-pointer-args.ll
@@ -0,0 +1,55 @@
+; Test that intrinsic declarations are read back correctly.
+
+; RUN: llvm-as < %s | pnacl-freeze --pnacl-version=1 | pnacl-thaw \
+; RUN: | llvm-dis - | FileCheck %s -check-prefix=TD
+
+; RUN: llvm-as < %s | pnacl-freeze --pnacl-version=2 | pnacl-thaw \
+; RUN: | llvm-dis - | FileCheck %s -check-prefix=TD
+
+
+declare i8* @llvm.stacksave()
+declare void @llvm.stackrestore(i8*)
+
+declare i8* @llvm.nacl.read.tp()
+declare void @llvm.nacl.longjmp(i8*, i32)
+declare void @llvm.nacl.setjmp(i8*)
+
+declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1)
+declare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1)
+declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1)
+
+declare i32 @llvm.nacl.atomic.load.i32(i32*, i32)
+declare i64 @llvm.nacl.atomic.load.i64(i64*, i32)
+
+declare i32 @llvm.nacl.atomic.cmpxchg.i32(i32*, i32, i32, i32, i32)
+declare i64 @llvm.nacl.atomic.cmpxchg.i64(i64*, i64, i64, i32, i32)
+
+declare void @llvm.nacl.atomic.store.i32(i32, i32*, i32)
+declare void @llvm.nacl.atomic.store.i64(i64, i64*, i32)
+
+declare i32 @llvm.nacl.atomic.rmw.i32(i32, i32*, i32, i32)
+declare i64 @llvm.nacl.atomic.rmw.i64(i32, i64*, i64, i32)
+
+
+; TD: declare i8* @llvm.stacksave()
+; TD: declare void @llvm.stackrestore(i8*)
+
+; TD: declare i8* @llvm.nacl.read.tp()
+; TD: declare void @llvm.nacl.longjmp(i8*, i32)
+; TD: declare void @llvm.nacl.setjmp(i8*)
+
+; TD: declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1)
+; TD: declare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1)
+; TD: declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1)
+
+; TD: declare i32 @llvm.nacl.atomic.load.i32(i32*, i32)
+; TD: declare i64 @llvm.nacl.atomic.load.i64(i64*, i32)
+
+; TD: declare i32 @llvm.nacl.atomic.cmpxchg.i32(i32*, i32, i32, i32, i32)
+; TD: declare i64 @llvm.nacl.atomic.cmpxchg.i64(i64*, i64, i64, i32, i32)
+
+; TD: declare void @llvm.nacl.atomic.store.i32(i32, i32*, i32)
+; TD: declare void @llvm.nacl.atomic.store.i64(i64, i64*, i32)
+
+; TD: declare i32 @llvm.nacl.atomic.rmw.i32(i32, i32*, i32, i32)
+; TD: declare i64 @llvm.nacl.atomic.rmw.i64(i32, i64*, i64, i32)