diff options
author | Derek Schuff <dschuff@chromium.org> | 2013-01-18 14:41:11 -0800 |
---|---|---|
committer | Derek Schuff <dschuff@chromium.org> | 2013-01-18 14:41:11 -0800 |
commit | 958cd97d295ba41736615e33c4a1aa641989133e (patch) | |
tree | 3c47d5f6482709973da6136e84181e3546145c4a /test/NaCl | |
parent | afd5ec31850faae645dabe3f83f869643cd7b0c5 (diff) |
Move ABI verifier pass declaration to lib/Analysis and add tests
This fixes the move of the verifier passes from lib/Transforms to
lib/Analysis, and adds tests of the current verifier checks.
No new functionality.
R=jvoung@chromium.org,eliben@chromium.org,mseaborn@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=2196
Review URL: https://codereview.chromium.org/12017019
Diffstat (limited to 'test/NaCl')
-rw-r--r-- | test/NaCl/PNaClABI/instructions.ll | 20 | ||||
-rw-r--r-- | test/NaCl/PNaClABI/linkagetypes.ll | 37 | ||||
-rw-r--r-- | test/NaCl/PNaClABI/lit.local.cfg | 1 |
3 files changed, 58 insertions, 0 deletions
diff --git a/test/NaCl/PNaClABI/instructions.ll b/test/NaCl/PNaClABI/instructions.ll new file mode 100644 index 0000000000..2a8ccbdaca --- /dev/null +++ b/test/NaCl/PNaClABI/instructions.ll @@ -0,0 +1,20 @@ +; RUN: opt -verify-pnaclabi-functions -analyze < %s |& FileCheck %s +; Test instruction opcodes allowed by PNaCl ABI + +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32" +target triple = "le32-unknown-nacl" + +define i32 @terminators() nounwind { +; Terminator instructions +terminators: + ret i32 0 + br i1 0, label %next2, label %next +next: + switch i32 1, label %next2 [i32 0, label %next] +next2: + unreachable + resume i8 0 + indirectbr i8* undef, [label %next, label %next2] +; CHECK-NOT: disallowed +; CHECK: Function terminators has disallowed instruction: indirectbr +}
\ No newline at end of file diff --git a/test/NaCl/PNaClABI/linkagetypes.ll b/test/NaCl/PNaClABI/linkagetypes.ll new file mode 100644 index 0000000000..477b7d6d91 --- /dev/null +++ b/test/NaCl/PNaClABI/linkagetypes.ll @@ -0,0 +1,37 @@ +; RUN: opt -verify-pnaclabi-module -analyze < %s |& FileCheck %s +; Test linkage types allowed by PNaCl ABI + +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32" +target triple = "le32-unknown-nacl" + + +@gv_external = external global i8 +@gv_private = private global i8 0 +@gv_linker_private = linker_private global i32 0 +; CHECK-NOT: disallowed +; CHECK: gv_linker_private has disallowed linkage type: linker_private +@gv_linker_private_weak = linker_private_weak global i32 0 +; CHECK: gv_linker_private_weak has disallowed linkage type: linker_private_weak +@gv_internal = internal global i8 0 +@gv_linkonce = linkonce global i8 0 +; CHECK-NOT: disallowed +; CHECK: gv_linkonce has disallowed linkage type: linkonce +@gv_linkonce_odr = linkonce_odr global i8 0 +; CHECK: gv_linkonce_odr has disallowed linkage type: linkonce_odr +@gv_linkonce_odr_auto_hide = linkonce_odr_auto_hide global i8 0 +; CHECK: gv_linkonce_odr_auto_hide has disallowed linkage type: linkonce_odr_auto_hide +@gv_weak = weak global i8 0 +; CHECK: gv_weak has disallowed linkage type: weak +@gv_weak_odr = weak_odr global i8 0 +; CHECK: gv_weak_odr has disallowed linkage type: weak_odr +@gv_common = common global i8 0 +; CHECK: gv_common has disallowed linkage type: common +@gv_appending = appending global [1 x i8] zeroinitializer +; CHECK: gv_appending has disallowed linkage type: appending +@gv_dllimport = dllimport global i8 +; CHECK: gv_dllimport has disallowed linkage type: dllimport +@gv_dllexport = dllexport global i8 0 +; CHECK: gv_dllexport has disallowed linkage type: dllexport +@gv_extern_weak = extern_weak global i8 +; CHECK: gv_extern_weak has disallowed linkage type: extern_weak +@gv_avilable_externally = available_externally global i8 0 diff --git a/test/NaCl/PNaClABI/lit.local.cfg b/test/NaCl/PNaClABI/lit.local.cfg new file mode 100644 index 0000000000..c6106e4746 --- /dev/null +++ b/test/NaCl/PNaClABI/lit.local.cfg @@ -0,0 +1 @@ +config.suffixes = ['.ll'] |