-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpeeprules.vmg
296 lines (281 loc) · 10 KB
/
peeprules.vmg
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
\ Gforth superinstructions and stack caching replicas
\ Copyright (C) 2003,2004,2005,2007,2010,2012,2013,2015,2016 Free Software Foundation, Inc.
\ This file is part of Gforth.
\ Gforth is free software; you can redistribute it and/or
\ modify it under the terms of the GNU General Public License
\ as published by the Free Software Foundation, either version 3
\ of the License, or (at your option) any later version.
\ This program is distributed in the hope that it will be useful,
\ but WITHOUT ANY WARRANTY; without even the implied warranty of
\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\ GNU General Public License for more details.
\ You should have received a copy of the GNU General Public License
\ along with this program. If not, see http://www.gnu.org/licenses/.
\ taken from David Gregg's EuroForth 2001 paper; omitted some sequences
\ eliminated for gforth-native:
\ 1) sequences containing call
\ 2) sequences with immediate arguments not in the first position
\ no new prim-nums for supers and state-replicas
\E ' noop is output-c-prim-num
super1 = lit +
super2 = lit call
super3 = lit @
\ super4 = lit @ call
\ super5 = @ call
super6 = lit !
\ super7 = lit lit
\ super8 = dup lit
\ super9 = ! lit
\ super10 = lit ! lit
super11 = ! ;s
super12 = lit + @
\ super14 = dup call
super15 = useraddr @
super16 = + @
\ super17 = lit @ ?branch
super18 = lit ! ;s
super19 = lit @ and
\ super21 = lit lit !
\ super22 = @ ?branch
super23 = useraddr !
\ super24 = dup ?branch
super25 = @ ;s
super26 = lit @ +
super27 = dup @
\ super28 = lit execute \ currently not supported
super29 = o#+ @
super30 = o#+ !
\ compare-and-branch; comment them out if we take up work on gforth-native again
cb1 = 0< ?branch
cb2 = 0<= ?branch
cb3 = 0<> ?branch
cb4 = 0= ?branch
cb5 = 0> ?branch
cb6 = 0>= ?branch
cb7 = < ?branch
cb8 = <= ?branch
cb9 = <> ?branch
cb10 = = ?branch
cb11 = > ?branch
cb12 = >= ?branch
cb13 = d0= ?branch
cb14 = d< ?branch
cb15 = d= ?branch
cb16 = f< ?branch
cb17 = f= ?branch
cb18 = u< ?branch
cb19 = u<= ?branch
cb20 = u> ?branch
cb21 = u>= ?branch
cb22 = within ?branch
\ memory access combinations
cscfetch = c@ c>s
cswfetch = uw@ w>s
cslfetch = ul@ l>s
swapwfetch = uw@ w><
swaplfetch = ul@ l><
\ cswapxfatch = ux@ x>< \ only on 64 bits
csswapwfetch = uw@ w>< w>s
csswaplfetch = ul@ l>< l>s
\F 0 [if]
\ \E prim-states ;s \ 2950159
\E prim-states lit \ 2802835
\ \E prim-states call \ 2558373
\E prim-states @ \ 2244351
\E branch-states ?branch \ 1134432
\E prim-states lit@ \ 1051813
\E prim-states swap \ 737988
\E S0 S2 state-prim swap
\E S1 S2 state-prim swap
\E S2 S3 state-prim swap
\E S3 S2 state-prim swap
\E prim-states c@ \ 651406
\E prim-states = \ 590006
\E prim-states 0= \ 584487
\E prim-states dup \ 566855
\E S0 S1 state-prim dup
\E S1 S1 state-prim dup
\E prim-states + \ 566003
\E prim-states i \ 502908
\E prim-states +! \ 448925
\ \E prim-states branch \ 409561
\ \E prim-states (loop) \ 379646
\ \E prim-states lp! \ 326743
\E prim-states and \ 309427
\E prim-states useraddr \ 303254
\E prim-states over \ 283556
\E S0 S1 state-prim over
\E S1 S2 state-prim over
\E S2 S1 state-prim over
\E S3 S2 state-prim over
\E prim-states negate \ 257417
\E prim-states cells \ 254644
\E prim-states rot \ 220273
\E S3 S1 state-prim rot
\E S2 S3 state-prim rot
\E S1 S3 state-prim rot
\E S0 S3 state-prim rot
\E S4 S2 state-prim rot
\E S5 S3 state-prim rot
\E prim-states ! \ 218672
\E prim-states 2dup \ 211315
\E S0 S1 state-prim 2dup
\E S0 S2 state-prim 2dup
\E S1 S3 state-prim 2dup
\E S2 S2 state-prim 2dup
\E S3 S1 state-prim 2dup
\E S4 S4 state-prim 2dup
\E S4 S2 state-prim 2dup
\ \E branch-states lit-perform \ 188331
\E prim-states <> \ 179502
\E prim-states c! \ 179332
\E prim-states lit+ \ 179156
\E prim-states drop \ 173995
\E S0 S0 state-prim drop
\E prim-states lshift \ 164671
\E prim-states /mod \ 164670
\E prim-states >r \ 145247
\E prim-states r> \ 133792
\ \E branch-states does-exec \ 120944
\E prim-states cell+ \ 116183
\E prim-states lp+!# \ 106697 \ --
\E prim-states - \ 106245
\E prim-states unloop \ 98938 \ --
\E prim-states lp+ \ 87190 \ --
\E prim-states >= \ 80994
\E prim-states tuck \ 78696
\E S2 S2 state-prim tuck
\E S3 S3 state-prim tuck
\E prim-states /string \ 78595
\E prim-states char+ \ 77542
\E prim-states ?dup \ 76850
\E prim-states @local0 \ 75322
\E prim-states min \ 75264
\ \E prim-states compare \ 65603
\E branch-states (u+do) \ 63823
\ \E prim-states (read-line) \ 63823
\E prim-states 2>r \ 62646
\E prim-states 2r> \ 62644
\E prim-states 2r@ \ 61338
\E prim-states 2@ \ 61067
\E prim-states nip \ 54961
\E S1 S1 state-prim nip
\E S0 S1 state-prim nip
\E S2 S2 state-prim nip
\E prim-states within \ 51075
\E prim-states 1- \ 47441
\E branch-states execute \ 46674
\E prim-states lp- \ 45385
\E branch-states perform \ 38756
\E prim-states xor \ 35599
\E prim-states @local# \ 34586
\ \E prim-states pick \ 32015
\E prim-states u> \ 29373
\E prim-states -rot \ 26211
\E S3 S2 state-prim -rot
\E S1 S3 state-prim -rot
\E S4 S3 state-prim -rot
\E S2 S4 state-prim -rot
\E S3 S5 state-prim -rot
\E prim-states 2drop \ 25418
\E S0 S0 state-prim 2drop
\E S1 S0 state-prim 2drop
\ \E prim-states (tablelfind) \ 22243
\E prim-states or \ 21587
\E prim-states @local2 \ 20859
\E branch-states (+loop) \ 20006
\E prim-states 1+ \ 17944
\E prim-states rdrop \ 17902
\E branch-states (?do) \ 17348
\E prim-states max \ 16948
\E prim-states 2* \ 15606
\ \E prim-states filename-match \ 15003
\ \E prim-states (listlfind) \ 13074
\ \E prim-states sp@ \ 12741
\ \E prim-states fp@ \ 12384
\ \E prim-states um/mod \ 12288
\E prim-states 2! \ 11904
\ \E prim-states fill \ 10781
\ \E prim-states (parse-white) \ 10624
\E branch-states (do) \ 10516
\ \E prim-states (hashkey1) \ 10239
\E prim-states u< \ 9602
\ \E prim-states write-file \ 8973
\E prim-states count \ 8873
\ \E prim-states rp@ \ 8410
\E prim-states 0< \ 8380
\E prim-states < \ 7741
\E prim-states @local1 \ 7458
\ \E prim-states move \ 7050
\E prim-states u>= \ 6138
\E branch-states (+do) \ 5863
\ \E prim-states va-return-double \ 5517
\E prim-states um* \ 5342
\ \E prim-states toupper \ 3517
\ \E prim-states f@local1 \ 2907
\ \E prim-states rp! \ 2859
\ \E prim-states ?dup-?branch \ 2829
\E prim-states d+ \ 2671
\ \E prim-states ftuck \ 2636
\ \E prim-states read-file \ 2623
\ \E prim-states ms \ 2454
\ \E prim-states (s+loop) \ 2429
\ \E prim-states allocate \ 1869
\E prim-states * \ 1520
\E prim-states 0<> \ 925
\ \E prim-states noop \ 715
\E prim-states aligned \ 714
\E prim-states u<= \ 684
\E prim-states i' \ 684
\E prim-states > \ 411
\ \E prim-states (hashlfind) \ 397
\E prim-states 2swap \ 336
\E S0 S3 state-prim 2swap
\E S1 S3 state-prim 2swap
\E S2 S4 state-prim 2swap
\E S4 S2 state-prim 2swap
\E prim-states laddr# \ 335
\ \E prim-states faxpy \ 286
\ \E prim-states (next) \ 272
\ \E prim-states (-loop)-lp+!# \ 248
\E prim-states <= \ 199
\E prim-states invert \ 170
\E branch-states (-do) \ 169
\E prim-states 2over \ 165
\E S0 S2 state-prim 2over
\E S1 S3 state-prim 2over
\E S2 S4 state-prim 2over
\E S3 S5 state-prim 2over
\E S4 S2 state-prim 2over
\E S5 S3 state-prim 2over
\E S6 S4 state-prim 2over
\E prim-states under+ \ 154
\E prim-states dnegate \ 128
\E prim-states u<> \ 128
\E prim-states 0> \ 122
\ \E prim-states (loop)-lp+!# \ 118
\E prim-states j \ 117
\E prim-states float+ \ 78
\ \E prim-states (for) \ 68
\E prim-states 2rdrop \ 60 \ --
\ \E prim-states f! \ 14
\E prim-states >l \ 14
\ \E prim-states close-file \ 5
\ \E prim-states call-c \ 4
\ \E prim-states reposition-file \ 3
\E prim-states / \ 3
\ \E prim-states resize-file \ 2
\ \E prim-states free \ 2
\E prim-states 2/ \ 2
\ \E prim-states up! \ 1
\ \E prim-states stdin \ 1
\ \E prim-states key?-file \ 1
\ \E prim-states flush-icache \ 1
\ \E prim-states cmove \ 1
\ \E prim-states (system) \ 1
\E S0 S0 state-prim abi-call
\E S0 S0 state-prim ;abi-code-exec
\E ' noop is output-nextp0
\E ' noop is output-nextp1
\E gen-transitions noop
\F [ENDIF]