Debian Codegraph @

llvm/test/CodeGen/MSP430/interrupt.ll

raw
1 ; RUN: llc < %s | FileCheck %s
2
3 target datalayout = "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16"
4 target triple = "msp430-generic-generic"
5
6 @llvm.used = appending global [1 x ptr] [ptr @ISR], section "llvm.metadata"
7
8 ; MSP430 EABI p. 3.9
9 ; Interrupt functions must save all the registers that are used, even those
10 ; that are normally considered callee-saved.
11
12 ; To return from an interrupt function, the function must execute the special
13 ; instruction RETI, which restores the SR register and branches to the PC where
14 ; the interrupt occurred.
15
16 ; CHECK: .section __interrupt_vector_2,"ax",@progbits
17 ; CHECK-NEXT: .short ISR
18
19 @g = global float 0.0
20
21 define msp430_intrcc void @ISR() #0 {
22 entry:
23 ; CHECK-LABEL: ISR:
24 ; CHECK: push r4
25 ; CHECK: push r5
26 ; CHECK: push r6
27 ; CHECK: push r7
28 ; CHECK: push r8
29 ; CHECK: push r9
30 ; CHECK: push r10
31 ; CHECK: push r11
32 ; CHECK: push r12
33 ; CHECK: push r13
34 ; CHECK: push r14
35 ; CHECK: push r15
36 %t1 = load volatile float, ptr @g
37 %t2 = load volatile float, ptr @g
38 %t3 = load volatile float, ptr @g
39 %t4 = load volatile float, ptr @g
40 %t5 = load volatile float, ptr @g
41 %t6 = load volatile float, ptr @g
42 %t7 = load volatile float, ptr @g
43 store volatile float %t1, ptr @g
44 store volatile float %t2, ptr @g
45 store volatile float %t3, ptr @g
46 store volatile float %t4, ptr @g
47 store volatile float %t5, ptr @g
48 store volatile float %t6, ptr @g
49 ; CHECK: reti
50 ret void
51 }
52
53 ; Functions without 'interrupt' attribute don't get a vector section.
54 ; CHECK-NOT: __interrupt_vector
55 ; CHECK-LABEL: NMI:
56 ; CHECK: reti
57 define msp430_intrcc void @NMI() #1 {
58 ret void
59 }
60
61 attributes #0 = { noinline nounwind optnone "interrupt"="2" }
62 attributes #1 = { noinline nounwind optnone }