aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/LowerSetJmp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-05-17 22:18:33 +0000
committerChris Lattner <sabre@nondot.org>2003-05-17 22:18:33 +0000
commit9b11f4871162d911f372cef1586fdd17910ed58f (patch)
tree52b9ea2a849211e4e927f5abd17ed678660c440d /test/Transforms/LowerSetJmp
parent196850c2c49b890f5e6b21967ff2b074bc9a1124 (diff)
downloadexternal_llvm-9b11f4871162d911f372cef1586fdd17910ed58f.zip
external_llvm-9b11f4871162d911f372cef1586fdd17910ed58f.tar.gz
external_llvm-9b11f4871162d911f372cef1586fdd17910ed58f.tar.bz2
Initial test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6240 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/LowerSetJmp')
-rw-r--r--test/Transforms/LowerSetJmp/Makefile10
-rw-r--r--test/Transforms/LowerSetJmp/simpletest.ll29
2 files changed, 39 insertions, 0 deletions
diff --git a/test/Transforms/LowerSetJmp/Makefile b/test/Transforms/LowerSetJmp/Makefile
new file mode 100644
index 0000000..91acd4d
--- /dev/null
+++ b/test/Transforms/LowerSetJmp/Makefile
@@ -0,0 +1,10 @@
+
+LEVEL = ../../../..
+include $(LEVEL)/test/Makefile.tests
+
+TESTS := $(wildcard *.ll)
+
+all:: $(addprefix Output/, $(TESTS:%.ll=%.ll.out))
+
+Output/%.ll.out: %.ll Output/.dir $(LOPT)
+ -$(TESTRUNR) $<
diff --git a/test/Transforms/LowerSetJmp/simpletest.ll b/test/Transforms/LowerSetJmp/simpletest.ll
new file mode 100644
index 0000000..b5adbbe
--- /dev/null
+++ b/test/Transforms/LowerSetJmp/simpletest.ll
@@ -0,0 +1,29 @@
+; RUN: as < %s | opt -lowersetjmp | dis | grep invoke
+
+%JmpBuf = type int
+%.str_1 = internal constant [13 x sbyte] c"returned %d\0A\00"
+
+implementation
+
+declare void %llvm.longjmp(%JmpBuf *%B, int %Val)
+declare int %llvm.setjmp(%JmpBuf *%B)
+
+int %simpletest() {
+ %B = alloca %JmpBuf
+ %Val = call int %llvm.setjmp(%JmpBuf* %B)
+ %V = cast int %Val to bool
+ br bool %V, label %LongJumped, label %Normal
+Normal:
+ call void %llvm.longjmp(%JmpBuf* %B, int 42)
+ ret int 0 ;; not reached
+LongJumped:
+ ret int %Val
+}
+
+declare int %printf(sbyte*, ...)
+
+int %main() {
+ %V = call int %simpletest()
+ call int(sbyte*, ...)* %printf(sbyte* getelementptr ([13 x sbyte]* %.str_1, long 0, long 0), int %V)
+ ret int 0
+}