annotate examples/pi/add.pi @ 357:818be710e13d

Added acceptance function to burg
author Windel Bouwman
date Fri, 14 Mar 2014 15:14:29 +0100
parents 68b01c8abf8a
children
rev   line source
309
68b01c8abf8a Added start of ir read and write
Windel Bouwman
parents: 307
diff changeset
1
68b01c8abf8a Added start of ir read and write
Windel Bouwman
parents: 307
diff changeset
2 module addmod
307
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
3
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
4 function i32 add(i32 a, i32 b)
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
5 init:
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
6 i32 c = a + b
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
7 return c
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
8
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
9 function void test()
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
10 init:
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
11 a = 2
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
12 cjmp a > 3 L1 L2
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
13 L1:
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
14 i32 b1 = 3
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
15 jmp L3
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
16 L2:
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
17 i32 b2 = 6 + a
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
18 jmp L3
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
19 L3:
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
20 b = phi i32 [b2, L2], [b1, L1]
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
21 return b
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
22