mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Initial test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6240 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
196850c2c4
commit
9b11f48711
10
test/Transforms/LowerSetJmp/Makefile
Normal file
10
test/Transforms/LowerSetJmp/Makefile
Normal file
@ -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) $<
|
29
test/Transforms/LowerSetJmp/simpletest.ll
Normal file
29
test/Transforms/LowerSetJmp/simpletest.ll
Normal file
@ -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
|
||||
}
|
Loading…
Reference in New Issue
Block a user