annotate examples/pi/add.pi @ 307:e609d5296ee9

Massive rewrite of codegenerator
author Windel Bouwman
date Thu, 12 Dec 2013 20:42:56 +0100
parents
children 68b01c8abf8a
rev   line source
307
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
1
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
2 function i32 add(i32 a, i32 b)
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
3 init:
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
4 i32 c = a + b
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
5 return c
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
6
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
7 function void test()
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
8 init:
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
9 a = 2
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
10 cjmp a > 3 L1 L2
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
11 L1:
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
12 i32 b1 = 3
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
13 jmp L3
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
14 L2:
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
15 i32 b2 = 6 + a
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
16 jmp L3
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
17 L3:
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
18 b = phi i32 [b2, L2], [b1, L1]
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
19 return b
e609d5296ee9 Massive rewrite of codegenerator
Windel Bouwman
parents:
diff changeset
20