Mercurial > repos > rhope
annotate kernelbase.rhope @ 169:fd06fb07762a
Basic inlining of arithmetic and comparison operations on integer types
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 08 May 2011 01:37:44 -0700 |
parents | fc3815b7462f |
children |
rev | line source |
---|---|
136
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1 |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
2 Val[in:out] |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 { |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
4 out <- in |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
5 } |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
6 |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
7 Blueprint Int32 |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
8 { |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
9 Num(Int32,Naked) |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
10 } |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
11 |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
12 If@Int32[num:yes,no] |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
13 { |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
14 yes,no <- If[[num]!=[0i32]] |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
15 } |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
16 |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
17 Trunc UInt8@UInt8[in:out] |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
18 { |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
19 out <- in |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
20 } |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
21 |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
22 Blueprint UInt32 |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
23 { |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
24 Num(UInt32,Naked) |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
25 } |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
26 |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
27 If@UInt32[num:yes,no] |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
28 { |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
29 yes,no <- If[[num]!=[0u32]] |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
30 } |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
31 |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
32 Blueprint UInt8 |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
33 { |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
34 Num(UInt8,Naked) |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
35 } |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
36 |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
37 If@UInt8[num:yes,no] |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
38 { |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
39 yes,no <- If[[num]!=[0u8]] |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
40 } |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
41 |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
42 Abs@Int32[num:out] |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
43 { |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
44 If[[num]<[0i32]] |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
45 { out <- [0i32]-[num] } |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
46 { out <- num } |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
47 } |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
48 |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
49 Mod[a,b:out] |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
50 { |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
51 out <- [a]-[[[a]/[b]]*[b]] |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
52 } |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
53 |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
54 And[left,right:out] |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
55 { |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
56 ,out <- If[left] |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
57 { |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
58 out,out <- If[right] |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
59 } |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
60 } |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
61 |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
62 Or[left,right:out] |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
63 { |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
64 out <- If[left] {} |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
65 { |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
66 out <- right |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
67 } |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
68 } |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
69 |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
70 Min[a,b:out] |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
71 { |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
72 If[[a]<[b]] |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
73 { |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
74 out <- a |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
75 }{ |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
76 out <- b |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
77 } |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
78 } |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
79 |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
80 Max[a,b:out] |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
81 { |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
82 If[[a]>[b]] |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
83 { |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
84 out <- a |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
85 }{ |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
86 out <- b |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
87 } |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
88 } |
fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
89 |