File: simpletest.ll

package info (click to toggle)
llvm-2.7 2.7-6
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 59,992 kB
  • ctags: 49,499
  • sloc: cpp: 373,792; ansic: 16,885; sh: 12,614; asm: 6,809; ada: 3,083; ml: 2,942; python: 2,671; perl: 2,404; makefile: 1,691; pascal: 1,235; exp: 399; objc: 291; lisp: 184; csh: 117; xml: 38; f90: 36
file content (32 lines) | stat: -rw-r--r-- 826 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
; RUN: opt < %s -lowersetjmp -S | grep invoke

	%JmpBuf = type i32
@.str_1 = internal constant [13 x i8] c"returned %d\0A\00"		; <[13 x i8]*> [#uses=1]

declare void @llvm.longjmp(i32*, i32)

declare i32 @llvm.setjmp(i32*)

declare void @foo()

define i32 @simpletest() {
	%B = alloca i32		; <i32*> [#uses=2]
	%Val = call i32 @llvm.setjmp( i32* %B )		; <i32> [#uses=2]
	%V = icmp ne i32 %Val, 0		; <i1> [#uses=1]
	br i1 %V, label %LongJumped, label %Normal
Normal:		; preds = %0
	call void @foo( )
	call void @llvm.longjmp( i32* %B, i32 42 )
	ret i32 0
LongJumped:		; preds = %0
	ret i32 %Val
}

declare i32 @printf(i8*, ...)

define i32 @main() {
	%V = call i32 @simpletest( )		; <i32> [#uses=1]
	call i32 (i8*, ...)* @printf( i8* getelementptr ([13 x i8]* @.str_1, i64 0, i64 0), i32 %V )		; <i32>:1 [#uses=0]
	ret i32 0
}