[project @ 2000-12-11 12:55:43 by sewardj]
[ghc-hetmet.git] / ghc / compiler / prelude / primops.txt
1 -----------------------------------------------------------------------
2 -- $Id: primops.txt,v 1.7 2000/12/04 12:31:19 simonmar Exp $
3 --
4 -- Primitive Operations
5 --
6 -----------------------------------------------------------------------
7
8 -- To add a new primop, you currently need to update the following files:
9 --
10 --      - this file (ghc/compiler/prelude/primops.txt), which includes
11 --        the type of the primop, and various other properties (its
12 --        strictness attributes, whether it is defined as a macro
13 --        or as out-of-line code, etc.)
14 --
15 --      - ghc/lib/std/PrelGHC.hi-boot, to declare the primop
16 --
17 --      - if the primop is inline (i.e. a macro), then:
18 --              ghc/includes/PrimOps.h
19 --              ghc/compiler/nativeGen/StixPrim.lhs
20 --
21 --      - or, for an out-of-line primop:
22 --              ghc/includes/PrimOps.h (just add the declaration)
23 --              ghc/rts/PrimOps.hc     (define it here)
24 --
25 --      - the User's Guide
26 --
27
28 -- The default attribute values which apply if you don't specify
29 -- other ones.  Attribute values can be True, False, or arbitrary
30 -- text between curly brackets.  This is a kludge to enable 
31 -- processors of this file to easily get hold of simple info
32 -- (eg, out_of_line), whilst avoiding parsing complex expressions
33 -- needed for strictness and usage info.
34
35 defaults
36    has_side_effects = False
37    out_of_line      = False
38    commutable       = False
39    needs_wrapper    = False
40    can_fail         = False
41    strictness       = { \ arity -> StrictnessInfo (replicate arity wwPrim) False }
42    usage            = { nomangle other }
43
44
45 ------------------------------------------------------------------------
46 --- Support for the metacircular interpreter                         ---
47 ------------------------------------------------------------------------
48
49 primop   IndexOffClosureOp_Ptr  "indexPtrOffClosure#"  GenPrimOp
50    a -> Int# -> (# b #)
51 primop   IndexOffClosureOp_Word "indexWordOffClosure#"  GenPrimOp
52    a -> Int# -> Word#
53
54 primop   SetOffClosureOp_Ptr  "setPtrOffClosure#"  GenPrimOp
55    a -> Int# -> b -> (# a #)
56    with strictness = { \ arity -> StrictnessInfo [wwStrict, wwPrim, wwLazy] False }
57
58 primop   SetOffClosureOp_Word "setWordOffClosure#"  GenPrimOp
59    a -> Int# -> Word# -> (# a #)
60    with strictness = { \ arity -> StrictnessInfo [wwStrict, wwPrim, wwPrim] False }
61
62 ------------------------------------------------------------------------
63 --- Addr#                                                            ---
64 ------------------------------------------------------------------------
65
66 primop   AddrGtOp  "gtAddr#"   Compare   Addr# -> Addr# -> Bool
67 primop   AddrGeOp  "geAddr#"   Compare   Addr# -> Addr# -> Bool
68 primop   AddrEqOp  "eqAddr#"   Compare   Addr# -> Addr# -> Bool
69 primop   AddrNeOp  "neAddr#"   Compare   Addr# -> Addr# -> Bool
70 primop   AddrLtOp  "ltAddr#"   Compare   Addr# -> Addr# -> Bool
71 primop   AddrLeOp  "leAddr#"   Compare   Addr# -> Addr# -> Bool
72
73 primop   Addr2IntOp  "addr2Int#"     GenPrimOp   Addr# -> Int#
74
75
76 ------------------------------------------------------------------------
77 --- Char#                                                            ---
78 ------------------------------------------------------------------------
79
80 primop   CharGtOp  "gtChar#"   Compare   Char# -> Char# -> Bool
81 primop   CharGeOp  "geChar#"   Compare   Char# -> Char# -> Bool
82
83 primop   CharEqOp  "eqChar#"   Compare
84    Char# -> Char# -> Bool
85    with commutable = True
86
87 primop   CharNeOp  "neChar#"   Compare
88    Char# -> Char# -> Bool
89    with commutable = True
90
91 primop   CharLtOp  "ltChar#"   Compare   Char# -> Char# -> Bool
92 primop   CharLeOp  "leChar#"   Compare   Char# -> Char# -> Bool
93
94 primop   OrdOp   "ord#"  GenPrimOp   Char# -> Int#
95
96 ------------------------------------------------------------------------
97 --- Double#                                                          ---
98 ------------------------------------------------------------------------
99
100 primop   DoubleGtOp ">##"   Compare   Double# -> Double# -> Bool
101 primop   DoubleGeOp ">=##"   Compare   Double# -> Double# -> Bool
102
103 primop DoubleEqOp "==##"   Compare
104    Double# -> Double# -> Bool
105    with commutable = True
106
107 primop DoubleNeOp "/=##"   Compare
108    Double# -> Double# -> Bool
109    with commutable = True
110
111 primop   DoubleLtOp "<##"   Compare   Double# -> Double# -> Bool
112 primop   DoubleLeOp "<=##"   Compare   Double# -> Double# -> Bool
113
114 primop   DoubleAddOp   "+##"   Dyadic
115    Double# -> Double# -> Double#
116    with commutable = True
117
118 primop   DoubleSubOp   "-##"   Dyadic   Double# -> Double# -> Double#
119
120 primop   DoubleMulOp   "*##"   Dyadic
121    Double# -> Double# -> Double#
122    with commutable = True
123
124 primop   DoubleDivOp   "/##"   Dyadic
125    Double# -> Double# -> Double#
126    with can_fail = True
127
128 primop   DoubleNegOp   "negateDouble#"  Monadic   Double# -> Double#
129
130 primop   Double2IntOp   "double2Int#"          GenPrimOp  Double# -> Int#
131 primop   Double2FloatOp   "double2Float#" GenPrimOp Double# -> Float#
132
133 primop   DoubleExpOp   "expDouble#"      Monadic
134    Double# -> Double#
135    with needs_wrapper = True
136
137 primop   DoubleLogOp   "logDouble#"      Monadic         
138    Double# -> Double#
139    with
140    needs_wrapper = True
141    can_fail = True
142
143 primop   DoubleSqrtOp   "sqrtDouble#"      Monadic  
144    Double# -> Double#
145    with needs_wrapper = True
146
147 primop   DoubleSinOp   "sinDouble#"      Monadic          
148    Double# -> Double#
149    with needs_wrapper = True
150
151 primop   DoubleCosOp   "cosDouble#"      Monadic          
152    Double# -> Double#
153    with needs_wrapper = True
154
155 primop   DoubleTanOp   "tanDouble#"      Monadic          
156    Double# -> Double#
157    with needs_wrapper = True
158
159 primop   DoubleAsinOp   "asinDouble#"      Monadic 
160    Double# -> Double#
161    with
162    needs_wrapper = True
163    can_fail = True
164
165 primop   DoubleAcosOp   "acosDouble#"      Monadic  
166    Double# -> Double#
167    with
168    needs_wrapper = True
169    can_fail = True
170
171 primop   DoubleAtanOp   "atanDouble#"      Monadic  
172    Double# -> Double#
173    with
174    needs_wrapper = True
175
176 primop   DoubleSinhOp   "sinhDouble#"      Monadic  
177    Double# -> Double#
178    with needs_wrapper = True
179
180 primop   DoubleCoshOp   "coshDouble#"      Monadic  
181    Double# -> Double#
182    with needs_wrapper = True
183
184 primop   DoubleTanhOp   "tanhDouble#"      Monadic  
185    Double# -> Double#
186    with needs_wrapper = True
187
188 primop   DoublePowerOp   "**##" Dyadic  
189    Double# -> Double# -> Double#
190    with needs_wrapper = True
191
192 primop   DoubleDecodeOp   "decodeDouble#" GenPrimOp    
193    Double# -> (# Int#, Int#, ByteArr# #)
194    with out_of_line = True
195
196 ------------------------------------------------------------------------
197 --- Float#                                                            ---
198 ------------------------------------------------------------------------
199
200 primop   FloatGtOp  "gtFloat#"   Compare   Float# -> Float# -> Bool
201 primop   FloatGeOp  "geFloat#"   Compare   Float# -> Float# -> Bool
202
203 primop   FloatEqOp  "eqFloat#"   Compare
204    Float# -> Float# -> Bool
205    with commutable = True
206
207 primop   FloatNeOp  "neFloat#"   Compare
208    Float# -> Float# -> Bool
209    with commutable = True
210
211 primop   FloatLtOp  "ltFloat#"   Compare   Float# -> Float# -> Bool
212 primop   FloatLeOp  "leFloat#"   Compare   Float# -> Float# -> Bool
213
214 primop   FloatAddOp   "plusFloat#"      Dyadic            
215    Float# -> Float# -> Float#
216    with commutable = True
217
218 primop   FloatSubOp   "minusFloat#"      Dyadic      Float# -> Float# -> Float#
219
220 primop   FloatMulOp   "timesFloat#"      Dyadic    
221    Float# -> Float# -> Float#
222    with commutable = True
223
224 primop   FloatDivOp   "divideFloat#"      Dyadic  
225    Float# -> Float# -> Float#
226    with can_fail = True
227
228 primop   FloatNegOp   "negateFloat#"      Monadic    Float# -> Float#
229
230 primop   Float2IntOp   "float2Int#"      GenPrimOp  Float# -> Int#
231
232 primop   FloatExpOp   "expFloat#"      Monadic          
233    Float# -> Float#
234    with needs_wrapper = True
235
236 primop   FloatLogOp   "logFloat#"      Monadic          
237    Float# -> Float#
238    with needs_wrapper = True
239         can_fail = True
240
241 primop   FloatSqrtOp   "sqrtFloat#"      Monadic          
242    Float# -> Float#
243    with needs_wrapper = True
244
245 primop   FloatSinOp   "sinFloat#"      Monadic          
246    Float# -> Float#
247    with needs_wrapper = True
248
249 primop   FloatCosOp   "cosFloat#"      Monadic          
250    Float# -> Float#
251    with needs_wrapper = True
252
253 primop   FloatTanOp   "tanFloat#"      Monadic          
254    Float# -> Float#
255    with needs_wrapper = True
256
257 primop   FloatAsinOp   "asinFloat#"      Monadic          
258    Float# -> Float#
259    with needs_wrapper = True
260         can_fail = True
261
262 primop   FloatAcosOp   "acosFloat#"      Monadic          
263    Float# -> Float#
264    with needs_wrapper = True
265         can_fail = True
266
267 primop   FloatAtanOp   "atanFloat#"      Monadic          
268    Float# -> Float#
269    with needs_wrapper = True
270
271 primop   FloatSinhOp   "sinhFloat#"      Monadic          
272    Float# -> Float#
273    with needs_wrapper = True
274
275 primop   FloatCoshOp   "coshFloat#"      Monadic          
276    Float# -> Float#
277    with needs_wrapper = True
278
279 primop   FloatTanhOp   "tanhFloat#"      Monadic          
280    Float# -> Float#
281    with needs_wrapper = True
282
283 primop   FloatPowerOp   "powerFloat#"      Dyadic   
284    Float# -> Float# -> Float#
285    with needs_wrapper = True
286
287 primop   Float2DoubleOp   "float2Double#" GenPrimOp  Float# -> Double#
288
289 primop   FloatDecodeOp   "decodeFloat#" GenPrimOp
290    Float# -> (# Int#, Int#, ByteArr# #)
291    with out_of_line = True
292
293 ------------------------------------------------------------------------
294 --- Int#                                                             ---
295 ------------------------------------------------------------------------
296
297 primop   IntAddOp    "+#"    Dyadic
298    Int# -> Int# -> Int#
299    with commutable = True
300
301 primop   IntSubOp    "-#"    Dyadic   Int# -> Int# -> Int#
302
303 primop   IntMulOp    "*#" 
304    Dyadic   Int# -> Int# -> Int#
305    with commutable = True
306
307 primop   IntQuotOp    "quotInt#"    Dyadic
308    Int# -> Int# -> Int#
309    with can_fail = True
310
311 primop   IntRemOp    "remInt#"    Dyadic
312    Int# -> Int# -> Int#
313    with can_fail = True
314
315 primop   IntGcdOp    "gcdInt#"    Dyadic   Int# -> Int# -> Int#
316 primop   IntNegOp    "negateInt#"    Monadic   Int# -> Int#
317 primop   IntAddCOp   "addIntC#"    GenPrimOp   Int# -> Int# -> (# Int#, Int# #)
318 primop   IntSubCOp   "subIntC#"    GenPrimOp   Int# -> Int# -> (# Int#, Int# #)
319 primop   IntMulCOp   "mulIntC#"    GenPrimOp   Int# -> Int# -> (# Int#, Int# #)
320 primop   IntGtOp  ">#"   Compare   Int# -> Int# -> Bool
321 primop   IntGeOp  ">=#"   Compare   Int# -> Int# -> Bool
322
323 primop   IntEqOp  "==#"   Compare
324    Int# -> Int# -> Bool
325    with commutable = True
326
327 primop   IntNeOp  "/=#"   Compare
328    Int# -> Int# -> Bool
329    with commutable = True
330
331 primop   IntLtOp  "<#"   Compare   Int# -> Int# -> Bool
332 primop   IntLeOp  "<=#"   Compare   Int# -> Int# -> Bool
333
334 primop   ChrOp   "chr#"   GenPrimOp   Int# -> Char#
335
336 primop   Int2WordOp "int2Word#" GenPrimOp Int# -> Word#
337 primop   Int2AddrOp   "int2Addr#"GenPrimOp  Int# -> Addr#
338 primop   Int2FloatOp   "int2Float#"      GenPrimOp  Int# -> Float#
339 primop   Int2DoubleOp   "int2Double#"          GenPrimOp  Int# -> Double#
340
341 primop   Int2IntegerOp    "int2Integer#"
342    GenPrimOp Int# -> (# Int#, ByteArr# #)
343    with out_of_line = True
344
345 primop   ISllOp   "iShiftL#" GenPrimOp  Int# -> Int# -> Int#
346 primop   ISraOp   "iShiftRA#" GenPrimOp Int# -> Int# -> Int#
347 primop   ISrlOp   "iShiftRL#" GenPrimOp Int# -> Int# -> Int#
348
349 ------------------------------------------------------------------------
350 --- Int64#                                                           ---
351 ------------------------------------------------------------------------
352
353 primop   Int64ToIntegerOp   "int64ToInteger#" GenPrimOp 
354    Int64# -> (# Int#, ByteArr# #)
355    with out_of_line = True
356
357
358 ------------------------------------------------------------------------
359 --- Integer#                                                         ---
360 ------------------------------------------------------------------------
361
362 primop   IntegerNegOp   "negateInteger#" GenPrimOp    
363    Int# -> ByteArr# -> (# Int#, ByteArr# #)
364
365 primop   IntegerAddOp   "plusInteger#" GenPrimOp   
366    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
367    with commutable = True
368         out_of_line = True
369
370 primop   IntegerSubOp   "minusInteger#" GenPrimOp  
371    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
372    with out_of_line = True
373
374 primop   IntegerMulOp   "timesInteger#" GenPrimOp   
375    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
376    with commutable = True
377         out_of_line = True
378
379 primop   IntegerGcdOp   "gcdInteger#" GenPrimOp    
380    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
381    with commutable = True
382         out_of_line = True
383
384 primop   IntegerIntGcdOp   "gcdIntegerInt#" GenPrimOp
385    Int# -> ByteArr# -> Int# -> Int#
386    with commutable = True
387
388 primop   IntegerDivExactOp   "divExactInteger#" GenPrimOp
389    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
390    with out_of_line = True
391
392 primop   IntegerQuotOp   "quotInteger#" GenPrimOp
393    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
394    with out_of_line = True
395
396 primop   IntegerRemOp   "remInteger#" GenPrimOp
397    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
398    with out_of_line = True
399
400 primop   IntegerCmpOp   "cmpInteger#"   GenPrimOp  
401    Int# -> ByteArr# -> Int# -> ByteArr# -> Int#
402    with needs_wrapper = True
403
404 primop   IntegerCmpIntOp   "cmpIntegerInt#" GenPrimOp
405    Int# -> ByteArr# -> Int# -> Int#
406    with needs_wrapper = True
407
408 primop   IntegerQuotRemOp   "quotRemInteger#" GenPrimOp
409    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr#, Int#, ByteArr# #)
410    with can_fail = True
411         out_of_line = True
412
413 primop   IntegerDivModOp    "divModInteger#"  GenPrimOp
414    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr#, Int#, ByteArr# #)
415    with can_fail = True
416         out_of_line = True
417
418 primop   Integer2IntOp   "integer2Int#"    GenPrimOp
419    Int# -> ByteArr# -> Int#
420    with needs_wrapper = True
421
422 primop   Integer2WordOp   "integer2Word#"   GenPrimOp
423    Int# -> ByteArr# -> Word#
424    with needs_wrapper = True
425
426 primop   IntegerToInt64Op   "integerToInt64#" GenPrimOp
427    Int# -> ByteArr# -> Int64#
428
429 primop   IntegerToWord64Op   "integerToWord64#" GenPrimOp
430    Int# -> ByteArr# -> Word64#
431
432 primop   IntegerAndOp  "andInteger#" GenPrimOp
433    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
434    with out_of_line = True
435
436 primop   IntegerOrOp  "orInteger#" GenPrimOp
437    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
438    with out_of_line = True
439
440 primop   IntegerXorOp  "xorInteger#" GenPrimOp
441    Int# -> ByteArr# -> Int# -> ByteArr# -> (# Int#, ByteArr# #)
442    with out_of_line = True
443
444 primop   IntegerComplementOp  "complementInteger#" GenPrimOp
445    Int# -> ByteArr# -> (# Int#, ByteArr# #)
446    with out_of_line = True
447
448 ------------------------------------------------------------------------
449 --- Word#                                                            ---
450 ------------------------------------------------------------------------
451
452 primop   WordQuotOp   "quotWord#" Dyadic  Word# -> Word# -> Word#
453 primop   WordRemOp   "remWord#" Dyadic          Word# -> Word# -> Word#
454
455 primop   AndOp   "and#"  Dyadic      
456    Word# -> Word# -> Word#
457    with commutable = True
458
459 primop   OrOp   "or#"          Dyadic      
460    Word# -> Word# -> Word#
461    with commutable = True
462
463 primop   XorOp   "xor#"  Dyadic      
464    Word# -> Word# -> Word#
465    with commutable = True
466
467 primop   NotOp   "not#"  Monadic        Word# -> Word#
468
469 primop   SllOp   "shiftL#" GenPrimOp  Word# -> Int# -> Word#
470 primop   SrlOp   "shiftRL#" GenPrimOp Word# -> Int# -> Word#
471
472
473 primop   Word2IntOp "word2Int#" GenPrimOp Word# -> Int#
474
475 primop   Word2IntegerOp   "word2Integer#" GenPrimOp 
476    Word# -> (# Int#, ByteArr# #)
477    with out_of_line = True
478
479 primop   WordGtOp  "gtWord#"   Compare   Word# -> Word# -> Bool
480 primop   WordGeOp  "geWord#"   Compare   Word# -> Word# -> Bool
481 primop   WordEqOp  "eqWord#"   Compare   Word# -> Word# -> Bool
482 primop   WordNeOp  "neWord#"   Compare   Word# -> Word# -> Bool
483 primop   WordLtOp  "ltWord#"   Compare   Word# -> Word# -> Bool
484 primop   WordLeOp  "leWord#"   Compare   Word# -> Word# -> Bool
485
486 ------------------------------------------------------------------------
487 --- Word64#                                                          ---
488 ------------------------------------------------------------------------
489
490 primop   Word64ToIntegerOp   "word64ToInteger#" GenPrimOp
491    Word64# -> (# Int#, ByteArr# #)
492    with out_of_line = True
493
494
495 ------------------------------------------------------------------------
496 --- Arrays                                                           ---
497 ------------------------------------------------------------------------
498
499 primop  NewByteArrayOp_Char "newCharArray#" GenPrimOp
500    Int# -> State# s -> (# State# s, MutByteArr# s #)
501    with out_of_line = True
502
503 primop  NewByteArrayOp_Int "newIntArray#" GenPrimOp
504    Int# -> State# s -> (# State# s, MutByteArr# s #)
505    with out_of_line = True
506
507 primop  NewByteArrayOp_Word "newWordArray#" GenPrimOp
508    Int# -> State# s -> (# State# s, MutByteArr# s #)
509    with out_of_line = True
510
511 primop  NewByteArrayOp_Addr "newAddrArray#" GenPrimOp
512    Int# -> State# s -> (# State# s, MutByteArr# s #)
513    with out_of_line = True
514
515 primop  NewByteArrayOp_Float "newFloatArray#" GenPrimOp
516    Int# -> State# s -> (# State# s, MutByteArr# s #)
517    with out_of_line = True
518
519 primop  NewByteArrayOp_Double "newDoubleArray#" GenPrimOp
520    Int# -> State# s -> (# State# s, MutByteArr# s #)
521    with out_of_line = True
522
523 primop  NewByteArrayOp_StablePtr "newStablePtrArray#" GenPrimOp
524    Int# -> State# s -> (# State# s, MutByteArr# s #)
525    with out_of_line = True
526
527
528
529 primop  ReadByteArrayOp_Char "readCharArray#" GenPrimOp
530    MutByteArr# s -> Int# -> State# s -> (# State# s, Char# #)
531
532 primop  ReadByteArrayOp_Int "readIntArray#" GenPrimOp
533    MutByteArr# s -> Int# -> State# s -> (# State# s, Int# #)
534
535 primop  ReadByteArrayOp_Word "readWordArray#" GenPrimOp
536    MutByteArr# s -> Int# -> State# s -> (# State# s, Word# #)
537
538 primop  ReadByteArrayOp_Addr "readAddrArray#" GenPrimOp
539    MutByteArr# s -> Int# -> State# s -> (# State# s, Addr# #)
540
541 primop  ReadByteArrayOp_Float "readFloatArray#" GenPrimOp
542    MutByteArr# s -> Int# -> State# s -> (# State# s, Float# #)
543
544 primop  ReadByteArrayOp_Double "readDoubleArray#" GenPrimOp
545    MutByteArr# s -> Int# -> State# s -> (# State# s, Double# #)
546
547 primop  ReadByteArrayOp_StablePtr "readStablePtrArray#" GenPrimOp
548    MutByteArr# s -> Int# -> State# s -> (# State# s, StablePtr# a #)
549
550 primop  ReadByteArrayOp_Int64 "readInt64Array#" GenPrimOp
551    MutByteArr# s -> Int# -> State# s -> (# State# s, Int64# #)
552
553 primop  ReadByteArrayOp_Word64 "readWord64Array#" GenPrimOp
554    MutByteArr# s -> Int# -> State# s -> (# State# s, Word64# #)
555
556
557
558 primop  WriteByteArrayOp_Char "writeCharArray#" GenPrimOp
559    MutByteArr# s -> Int# -> Char# -> State# s -> State# s
560    with has_side_effects = True
561
562 primop  WriteByteArrayOp_Int "writeIntArray#" GenPrimOp
563    MutByteArr# s -> Int# -> Int# -> State# s -> State# s
564    with has_side_effects = True
565
566 primop  WriteByteArrayOp_Word "writeWordArray#" GenPrimOp
567    MutByteArr# s -> Int# -> Word# -> State# s -> State# s
568    with has_side_effects = True
569
570 primop  WriteByteArrayOp_Addr "writeAddrArray#" GenPrimOp
571    MutByteArr# s -> Int# -> Addr# -> State# s -> State# s
572    with has_side_effects = True
573
574 primop  WriteByteArrayOp_Float "writeFloatArray#" GenPrimOp
575    MutByteArr# s -> Int# -> Float# -> State# s -> State# s
576    with has_side_effects = True
577
578 primop  WriteByteArrayOp_Double "writeDoubleArray#" GenPrimOp
579    MutByteArr# s -> Int# -> Double# -> State# s -> State# s
580    with has_side_effects = True
581
582 primop  WriteByteArrayOp_StablePtr "writeStablePtrArray#" GenPrimOp
583    MutByteArr# s -> Int# -> StablePtr# a -> State# s -> State# s
584    with has_side_effects = True
585
586 primop  WriteByteArrayOp_Int64 "writeInt64Array#" GenPrimOp
587    MutByteArr# s -> Int# -> Int64# -> State# s -> State# s
588    with has_side_effects = True
589
590 primop  WriteByteArrayOp_Word64 "writeWord64Array#" GenPrimOp
591    MutByteArr# s -> Int# -> Word64# -> State# s -> State# s
592    with has_side_effects = True
593
594
595 primop IndexByteArrayOp_Char "indexCharArray#" GenPrimOp
596    ByteArr# -> Int# -> Char#
597
598 primop IndexByteArrayOp_Int "indexIntArray#" GenPrimOp
599    ByteArr# -> Int# -> Int#
600
601 primop IndexByteArrayOp_Word "indexWordArray#" GenPrimOp
602    ByteArr# -> Int# -> Word#
603
604 primop IndexByteArrayOp_Addr "indexAddrArray#" GenPrimOp
605    ByteArr# -> Int# -> Addr#
606
607 primop IndexByteArrayOp_Float "indexFloatArray#" GenPrimOp
608    ByteArr# -> Int# -> Float#
609
610 primop IndexByteArrayOp_Double "indexDoubleArray#" GenPrimOp
611    ByteArr# -> Int# -> Double#
612
613 primop IndexByteArrayOp_StablePtr "indexStablePtrArray#" GenPrimOp
614    ByteArr# -> Int# -> StablePtr# a
615
616 primop IndexByteArrayOp_Int64 "indexInt64Array#" GenPrimOp
617    ByteArr# -> Int# -> Int64#
618
619 primop IndexByteArrayOp_Word64 "indexWord64Array#" GenPrimOp
620    ByteArr# -> Int# -> Word64#
621
622
623 primop IndexOffAddrOp_Char "indexCharOffAddr#" GenPrimOp
624    Addr# -> Int# -> Char#
625
626 primop IndexOffAddrOp_Int "indexIntOffAddr#" GenPrimOp
627    Addr# -> Int# -> Int#
628
629 primop IndexOffAddrOp_Word "indexWordOffAddr#" GenPrimOp
630    Addr# -> Int# -> Word#
631
632 primop IndexOffAddrOp_Addr "indexAddrOffAddr#" GenPrimOp
633    Addr# -> Int# -> Addr#
634
635 primop IndexOffAddrOp_Float "indexFloatOffAddr#" GenPrimOp
636    Addr# -> Int# -> Float#
637
638 primop IndexOffAddrOp_Double "indexDoubleOffAddr#" GenPrimOp
639    Addr# -> Int# -> Double#
640
641 primop IndexOffAddrOp_StablePtr "indexStablePtrOffAddr#" GenPrimOp
642    Addr# -> Int# -> StablePtr# a
643
644 primop IndexOffAddrOp_Int64 "indexInt64OffAddr#" GenPrimOp
645    Addr# -> Int# -> Int64#
646
647 primop IndexOffAddrOp_Word64 "indexWord64OffAddr#" GenPrimOp
648    Addr# -> Int# -> Word64#
649
650
651 primop IndexOffForeignObjOp_Char "indexCharOffForeignObj#" GenPrimOp
652    ForeignObj# -> Int# -> Char#
653
654 primop IndexOffForeignObjOp_Int "indexIntOffForeignObj#" GenPrimOp
655    ForeignObj# -> Int# -> Int#
656
657 primop IndexOffForeignObjOp_Word "indexWordOffForeignObj#" GenPrimOp
658    ForeignObj# -> Int# -> Word#
659
660 primop IndexOffForeignObjOp_Addr "indexAddrOffForeignObj#" GenPrimOp
661    ForeignObj# -> Int# -> Addr#
662
663 primop IndexOffForeignObjOp_Float "indexFloatOffForeignObj#" GenPrimOp
664    ForeignObj# -> Int# -> Float#
665
666 primop IndexOffForeignObjOp_Double "indexDoubleOffForeignObj#" GenPrimOp
667    ForeignObj# -> Int# -> Double#
668
669 primop IndexOffForeignObjOp_StablePtr "indexStablePtrOffForeignObj#" GenPrimOp
670    ForeignObj# -> Int# -> StablePtr# a
671
672 primop IndexOffForeignObjOp_Int64 "indexInt64OffForeignObj#" GenPrimOp
673    ForeignObj# -> Int# -> Int64#
674
675 primop IndexOffForeignObjOp_Word64 "indexWord64OffForeignObj#" GenPrimOp
676    ForeignObj# -> Int# -> Word64#
677
678
679
680 primop ReadOffAddrOp_Char "readCharOffAddr#" GenPrimOp
681    Addr# -> Int# -> State# s -> (# State# s, Char# #)
682
683 primop ReadOffAddrOp_Int "readIntOffAddr#" GenPrimOp
684    Addr# -> Int# -> State# s -> (# State# s, Int# #)
685
686 primop ReadOffAddrOp_Word "readWordOffAddr#" GenPrimOp
687    Addr# -> Int# -> State# s -> (# State# s, Word# #)
688
689 primop ReadOffAddrOp_Addr "readAddrOffAddr#" GenPrimOp
690    Addr# -> Int# -> State# s -> (# State# s, Addr# #)
691
692 primop ReadOffAddrOp_Float "readFloatOffAddr#" GenPrimOp
693    Addr# -> Int# -> State# s -> (# State# s, Float# #)
694
695 primop ReadOffAddrOp_Double "readDoubleOffAddr#" GenPrimOp
696    Addr# -> Int# -> State# s -> (# State# s, Double# #)
697
698 primop ReadOffAddrOp_StablePtr "readStablePtrOffAddr#" GenPrimOp
699    Addr# -> Int# -> State# s -> (# State# s, StablePtr# a #)
700
701 primop ReadOffAddrOp_ForeignObj "readForeignObjOffAddr#" GenPrimOp
702    Addr# -> Int# -> State# s -> (# State# s, ForeignObj# #)
703
704 primop ReadOffAddrOp_Int64 "readInt64OffAddr#" GenPrimOp
705    Addr# -> Int# -> State# s -> (# State# s, Int64# #)
706
707 primop ReadOffAddrOp_Word64 "readWord64OffAddr#" GenPrimOp
708    Addr# -> Int# -> State# s -> (# State# s, Word64# #)
709
710
711 primop  WriteOffAddrOp_Char "writeCharOffAddr#" GenPrimOp
712    Addr# -> Int# -> Char# -> State# s -> State# s
713    with has_side_effects = True
714
715 primop  WriteOffAddrOp_Int "writeIntOffAddr#" GenPrimOp
716    Addr# -> Int# -> Int# -> State# s -> State# s
717    with has_side_effects = True
718
719 primop  WriteOffAddrOp_Word "writeWordOffAddr#" GenPrimOp
720    Addr# -> Int# -> Word# -> State# s -> State# s
721    with has_side_effects = True
722
723 primop  WriteOffAddrOp_Addr "writeAddrOffAddr#" GenPrimOp
724    Addr# -> Int# -> Addr# -> State# s -> State# s
725    with has_side_effects = True
726
727 primop  WriteOffAddrOp_Float "writeFloatOffAddr#" GenPrimOp
728    Addr# -> Int# -> Float# -> State# s -> State# s
729    with has_side_effects = True
730
731 primop  WriteOffAddrOp_Double "writeDoubleOffAddr#" GenPrimOp
732    Addr# -> Int# -> Double# -> State# s -> State# s
733    with has_side_effects = True
734
735 primop  WriteOffAddrOp_StablePtr "writeStablePtrOffAddr#" GenPrimOp
736    Addr# -> Int# -> StablePtr# a -> State# s -> State# s
737    with has_side_effects = True
738
739 primop  WriteOffAddrOp_ForeignObj "writeForeignObjOffAddr#" GenPrimOp
740    Addr# -> Int# -> ForeignObj# -> State# s -> State# s
741    with has_side_effects = True
742
743 primop  WriteOffAddrOp_Int64 "writeInt64OffAddr#" GenPrimOp
744    Addr# -> Int# -> Int64# -> State# s -> State# s
745    with has_side_effects = True
746
747 primop  WriteOffAddrOp_Word64 "writeWord64OffAddr#" GenPrimOp
748    Addr# -> Int# -> Word64# -> State# s -> State# s
749    with has_side_effects = True
750
751
752
753 primop  NewArrayOp "newArray#" GenPrimOp
754    Int# -> a -> State# s -> (# State# s, MutArr# s a #)
755    with
756    strictness  = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False }
757    usage       = { mangle NewArrayOp [mkP, mkM, mkP] mkM }
758    out_of_line = True
759
760 primop  SameMutableArrayOp "sameMutableArray#" GenPrimOp
761    MutArr# s a -> MutArr# s a -> Bool
762    with
763    usage = { mangle SameMutableArrayOp [mkP, mkP] mkM }
764
765 primop  SameMutableByteArrayOp "sameMutableByteArray#" GenPrimOp
766    MutByteArr# s -> MutByteArr# s -> Bool
767
768 primop  ReadArrayOp "readArray#" GenPrimOp
769    MutArr# s a -> Int# -> State# s -> (# State# s, a #)
770    with
771    usage = { mangle ReadArrayOp [mkM, mkP, mkP] mkM }
772
773 primop  WriteArrayOp "writeArray#" GenPrimOp
774    MutArr# s a -> Int# -> a -> State# s -> State# s
775    with
776    usage            = { mangle WriteArrayOp [mkM, mkP, mkM, mkP] mkR }
777    strictness       = { \ arity -> StrictnessInfo [wwPrim, wwPrim, wwLazy, wwPrim] False }
778    has_side_effects = True
779
780 primop  IndexArrayOp "indexArray#" GenPrimOp
781    Array# a -> Int# -> (# a #)
782    with
783    usage = { mangle  IndexArrayOp [mkM, mkP] mkM }
784
785 primop  UnsafeFreezeArrayOp "unsafeFreezeArray#" GenPrimOp
786    MutArr# s a -> State# s -> (# State# s, Array# a #)
787    with
788    usage            = { mangle UnsafeFreezeArrayOp [mkM, mkP] mkM }
789    has_side_effects = True
790
791 primop  UnsafeFreezeByteArrayOp "unsafeFreezeByteArray#" GenPrimOp
792    MutByteArr# s -> State# s -> (# State# s, ByteArr# #)
793    with
794    has_side_effects = True
795
796 primop  UnsafeThawArrayOp  "unsafeThawArray#" GenPrimOp
797    Array# a -> State# s -> (# State# s, MutArr# s a #)
798    with
799    usage       = { mangle UnsafeThawArrayOp [mkM, mkP] mkM }
800    out_of_line = True
801
802 primop  SizeofByteArrayOp "sizeofByteArray#" GenPrimOp  
803    ByteArr# -> Int#
804
805 primop  SizeofMutableByteArrayOp "sizeofMutableByteArray#" GenPrimOp
806    MutByteArr# s -> Int#
807
808 ------------------------------------------------------------------------
809 --- Mutable variables                                                ---
810 ------------------------------------------------------------------------
811
812 primop  NewMutVarOp "newMutVar#" GenPrimOp
813    a -> State# s -> (# State# s, MutVar# s a #)
814    with
815    usage       = { mangle NewMutVarOp [mkM, mkP] mkM }
816    strictness  = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
817    out_of_line = True
818
819 primop  ReadMutVarOp "readMutVar#" GenPrimOp
820    MutVar# s a -> State# s -> (# State# s, a #)
821    with
822    usage = { mangle ReadMutVarOp [mkM, mkP] mkM }
823
824 primop  WriteMutVarOp "writeMutVar#"  GenPrimOp
825    MutVar# s a -> a -> State# s -> State# s
826    with
827    strictness       = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False }
828    usage            = { mangle WriteMutVarOp [mkM, mkM, mkP] mkR }
829    has_side_effects = True
830
831 primop  SameMutVarOp "sameMutVar#" GenPrimOp
832    MutVar# s a -> MutVar# s a -> Bool
833    with
834    usage = { mangle SameMutVarOp [mkP, mkP] mkM }
835
836 ------------------------------------------------------------------------
837 --- Exceptions                                                       ---
838 ------------------------------------------------------------------------
839
840 primop  CatchOp "catch#" GenPrimOp
841           (State# RealWorld -> (# State# RealWorld, a #) )
842        -> (b -> State# RealWorld -> (# State# RealWorld, a #) ) 
843        -> State# RealWorld
844        -> (# State# RealWorld, a #)
845    with
846    strictness = { \ arity -> StrictnessInfo [wwLazy, wwLazy, wwPrim] False }
847         -- Catch is actually strict in its first argument
848         -- but we don't want to tell the strictness
849         -- analyser about that!
850    usage = { mangle CatchOp [mkM, mkM . (inFun CatchOp mkM mkM), mkP] mkM }
851         --     [mkO, mkO . (inFun mkM mkO)] mkO
852         -- might use caught action multiply
853    out_of_line = True
854
855 primop  RaiseOp "raise#" GenPrimOp
856    a -> b
857    with
858    strictness  = { \ arity -> StrictnessInfo [wwLazy] True }
859       -- NB: True => result is bottom
860    usage       = { mangle RaiseOp [mkM] mkM }
861    out_of_line = True
862
863 primop  BlockAsyncExceptionsOp "blockAsyncExceptions#" GenPrimOp
864         (State# RealWorld -> (# State# RealWorld, a #))
865      -> (State# RealWorld -> (# State# RealWorld, a #))
866    with
867    strictness  = { \ arity -> StrictnessInfo [wwLazy] False }
868    out_of_line = True
869
870 primop  UnblockAsyncExceptionsOp "unblockAsyncExceptions#" GenPrimOp
871         (State# RealWorld -> (# State# RealWorld, a #))
872      -> (State# RealWorld -> (# State# RealWorld, a #))
873    with
874    strictness  = { \ arity -> StrictnessInfo [wwLazy] False }
875    out_of_line = True
876
877 ------------------------------------------------------------------------
878 --- MVars (not the same as mutable variables!)                       ---
879 ------------------------------------------------------------------------
880
881 primop  NewMVarOp "newMVar#"  GenPrimOp
882    State# s -> (# State# s, MVar# s a #)
883    with
884    usage       = { mangle NewMVarOp [mkP] mkR }
885    out_of_line = True
886
887 primop  TakeMVarOp "takeMVar#" GenPrimOp
888    MVar# s a -> State# s -> (# State# s, a #)
889    with
890    usage            = { mangle TakeMVarOp [mkM, mkP] mkM }
891    has_side_effects = True
892    out_of_line      = True
893
894 primop  PutMVarOp "putMVar#" GenPrimOp
895    MVar# s a -> a -> State# s -> State# s
896    with
897    strictness       = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False }
898    usage            = { mangle PutMVarOp [mkM, mkM, mkP] mkR }
899    has_side_effects = True
900    out_of_line      = True
901
902 primop  SameMVarOp "sameMVar#" GenPrimOp
903    MVar# s a -> MVar# s a -> Bool
904    with
905    usage = { mangle SameMVarOp [mkP, mkP] mkM }
906
907 primop  TryTakeMVarOp "tryTakeMVar#" GenPrimOp
908    MVar# s a -> State# s -> (# State# s, Int#, a #)
909    with
910    usage            = { mangle TryTakeMVarOp [mkM, mkP] mkM }
911    has_side_effects = True
912    out_of_line      = True
913
914 primop  IsEmptyMVarOp "isEmptyMVar#" GenPrimOp
915    MVar# s a -> State# s -> (# State# s, Int# #)
916    with
917    usage = { mangle IsEmptyMVarOp [mkP, mkP] mkM }
918
919
920 ------------------------------------------------------------------------
921 --- delay/wait operations                                            ---
922 ------------------------------------------------------------------------
923
924 primop  DelayOp "delay#" GenPrimOp
925    Int# -> State# s -> State# s
926    with
927    needs_wrapper    = True
928    has_side_effects = True
929    out_of_line      = True
930
931 primop  WaitReadOp "waitRead#" GenPrimOp
932    Int# -> State# s -> State# s
933    with
934    needs_wrapper    = True
935    has_side_effects = True
936    out_of_line      = True
937
938 primop  WaitWriteOp "waitWrite#" GenPrimOp
939    Int# -> State# s -> State# s
940    with
941    needs_wrapper    = True
942    has_side_effects = True
943    out_of_line      = True
944
945 ------------------------------------------------------------------------
946 --- concurrency primitives                                           ---
947 ------------------------------------------------------------------------
948
949 primop  ForkOp "fork#" GenPrimOp
950    a -> State# RealWorld -> (# State# RealWorld, ThreadId# #)
951    with
952    usage            = { mangle ForkOp [mkO, mkP] mkR }
953    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
954    has_side_effects = True
955    out_of_line      = True
956
957 primop  KillThreadOp "killThread#"  GenPrimOp
958    ThreadId# -> a -> State# RealWorld -> State# RealWorld
959    with
960    usage            = { mangle KillThreadOp [mkP, mkM, mkP] mkR }
961    has_side_effects = True
962    out_of_line      = True
963
964 primop  YieldOp "yield#" GenPrimOp
965    State# RealWorld -> State# RealWorld
966    with
967    has_side_effects = True
968    out_of_line      = True
969
970 primop  MyThreadIdOp "myThreadId#" GenPrimOp
971     State# RealWorld -> (# State# RealWorld, ThreadId# #)
972
973 ------------------------------------------------------------------------
974 --- foreign objects                                                  ---
975 ------------------------------------------------------------------------
976
977 primop  MkForeignObjOp "mkForeignObj#" GenPrimOp
978    Addr# -> State# RealWorld -> (# State# RealWorld, ForeignObj# #)
979    with
980    has_side_effects = True
981    out_of_line      = True
982
983 primop  WriteForeignObjOp "writeForeignObj#" GenPrimOp
984    ForeignObj# -> Addr# -> State# s -> State# s
985    with
986    has_side_effects = True
987
988 primop ForeignObjToAddrOp "foreignObjToAddr#" GenPrimOp
989    ForeignObj# -> Addr#
990
991 primop TouchOp "touch#" GenPrimOp
992    o -> State# RealWorld -> State# RealWorld
993    with
994    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
995
996 ------------------------------------------------------------------------
997 --- Bytecode objects                                                 ---
998 ------------------------------------------------------------------------
999
1000 primop  NewBCOOp "newBCO#" GenPrimOp
1001    Int# -> Int# -> Int# -> a -> State# RealWorld -> (# State# RealWorld, BCO# #)
1002    with
1003    has_side_effects = True
1004    out_of_line      = True
1005    strictness       = { \ arity -> StrictnessInfo 
1006                                    [wwPrim, wwPrim, wwPrim, wwLazy, wwPrim] False }
1007    usage            = { mangle NewBCOOp [mkP, mkP, mkP, mkM, mkP] mkR }
1008
1009 primop  WriteBCOPtrOp "writeBCOPtr#" GenPrimOp
1010    BCO# -> Int# -> o -> State# RealWorld -> State# RealWorld
1011    with
1012    usage            = { mangle WriteBCOPtrOp [mkP, mkP, mkM, mkP] mkR }
1013    strictness       = { \ arity -> StrictnessInfo 
1014                                    [wwPrim, wwPrim, wwLazy, wwPrim] False }
1015    has_side_effects = True
1016
1017 primop  WriteBCONonPtrOp "writeBCONonPtr#" GenPrimOp
1018    BCO# -> Int# -> Word# -> State# RealWorld -> State# RealWorld
1019    with
1020    has_side_effects = True
1021
1022 primop  WriteBCOInstrOp "writeBCOInstr#" GenPrimOp
1023    BCO# -> Int# -> Word# -> State# RealWorld -> State# RealWorld
1024    with
1025    has_side_effects = True
1026
1027 primop  ReadBCOPtrOp "readBCOPtr#"  GenPrimOp
1028    BCO# -> Int# -> State# RealWorld -> (# State# RealWorld, Word# #)
1029    with
1030    usage = { mangle ReadBCOPtrOp [mkP, mkP] mkM }
1031
1032 primop  ReadBCONonPtrOp "readBCONonPtr#"  GenPrimOp
1033    BCO# -> Int# -> State# RealWorld -> (# State# RealWorld, Word# #)
1034
1035 primop  ReadBCOInstrOp "readBCOInstr#" GenPrimOp
1036    BCO# -> Int# -> State# RealWorld -> (# State# RealWorld, Word# #)
1037
1038 primop  SameBCOOp "sameBCO#" GenPrimOp
1039    BCO# -> BCO# -> Bool
1040    with
1041    -- is this usage right?
1042    usage = { mangle SameMutableArrayOp [mkP, mkP] mkM }
1043
1044
1045 ------------------------------------------------------------------------
1046 --- Weak pointers                                                    ---
1047 ------------------------------------------------------------------------
1048
1049 -- note that tyvar "o" denoted openAlphaTyVar
1050
1051 primop  MkWeakOp "mkWeak#" GenPrimOp
1052    o -> b -> c -> State# RealWorld -> (# State# RealWorld, Weak# b #)
1053    with
1054    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwLazy, wwLazy, wwPrim] False }
1055    usage            = { mangle MkWeakOp [mkZ, mkM, mkM, mkP] mkM }
1056    has_side_effects = True
1057    out_of_line      = True
1058
1059 primop  DeRefWeakOp "deRefWeak#" GenPrimOp
1060    Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #)
1061    with
1062    usage            = { mangle DeRefWeakOp [mkM, mkP] mkM }
1063    has_side_effects = True
1064
1065 primop  FinalizeWeakOp "finalizeWeak#" GenPrimOp
1066    Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, 
1067               (State# RealWorld -> (# State# RealWorld, Unit #)) #)
1068    with
1069    usage            = { mangle FinalizeWeakOp [mkM, mkP] 
1070                                (mkR . (inUB FinalizeWeakOp 
1071                                             [id,id,inFun FinalizeWeakOp mkR mkM])) }
1072    has_side_effects = True
1073    out_of_line      = True
1074
1075
1076 ------------------------------------------------------------------------
1077 --- Stable pointers and names                                        ---
1078 ------------------------------------------------------------------------
1079
1080 primop  MakeStablePtrOp "makeStablePtr#" GenPrimOp
1081    a -> State# RealWorld -> (# State# RealWorld, StablePtr# a #)
1082    with
1083    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1084    usage            = { mangle MakeStablePtrOp [mkM, mkP] mkM }
1085    has_side_effects = True
1086
1087 primop  DeRefStablePtrOp "deRefStablePtr#" GenPrimOp
1088    StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #)
1089    with
1090    usage            = { mangle DeRefStablePtrOp [mkM, mkP] mkM }
1091    needs_wrapper    = True
1092    has_side_effects = True
1093
1094 primop  EqStablePtrOp "eqStablePtr#" GenPrimOp
1095    StablePtr# a -> StablePtr# a -> Int#
1096    with
1097    usage            = { mangle EqStablePtrOp [mkP, mkP] mkR }
1098    has_side_effects = True
1099
1100 primop  MakeStableNameOp "makeStableName#" GenPrimOp
1101    a -> State# RealWorld -> (# State# RealWorld, StableName# a #)
1102    with
1103    usage            = { mangle MakeStableNameOp [mkZ, mkP] mkR }
1104    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1105    needs_wrapper    = True
1106    has_side_effects = True
1107    out_of_line      = True
1108
1109 primop  EqStableNameOp "eqStableName#" GenPrimOp
1110    StableName# a -> StableName# a -> Int#
1111    with
1112    usage = { mangle EqStableNameOp [mkP, mkP] mkR }
1113
1114 primop  StableNameToIntOp "stableNameToInt#" GenPrimOp
1115    StableName# a -> Int#
1116    with
1117    usage = { mangle StableNameToIntOp [mkP] mkR }
1118
1119 ------------------------------------------------------------------------
1120 --- Unsafe pointer equality (#1 Bad Guy: Alistair Reid :)            ---
1121 ------------------------------------------------------------------------
1122
1123 primop  ReallyUnsafePtrEqualityOp "reallyUnsafePtrEquality#" GenPrimOp
1124    a -> a -> Int#
1125    with
1126    usage = { mangle ReallyUnsafePtrEqualityOp [mkZ, mkZ] mkR }
1127
1128 ------------------------------------------------------------------------
1129 --- Parallelism                                                      ---
1130 ------------------------------------------------------------------------
1131
1132 primop  SeqOp "seq#" GenPrimOp
1133    a -> Int#
1134    with
1135    usage            = { mangle  SeqOp [mkO] mkR }
1136    strictness       = { \ arity -> StrictnessInfo [wwStrict] False }
1137       -- Seq is strict in its argument; see notes in ConFold.lhs
1138    has_side_effects = True
1139
1140 primop  ParOp "par#" GenPrimOp
1141    a -> Int#
1142    with
1143    usage            = { mangle ParOp [mkO] mkR }
1144    strictness       = { \ arity -> StrictnessInfo [wwLazy] False }
1145       -- Note that Par is lazy to avoid that the sparked thing
1146       -- gets evaluted strictly, which it should *not* be
1147    has_side_effects = True
1148
1149 -- HWL: The first 4 Int# in all par... annotations denote:
1150 --   name, granularity info, size of result, degree of parallelism
1151 --      Same  structure as _seq_ i.e. returns Int#
1152 -- KSW: v, the second arg in parAt# and parAtForNow#, is used only to determine
1153 --   `the processor containing the expression v'; it is not evaluated
1154
1155 primop  ParGlobalOp  "parGlobal#"  GenPrimOp
1156    a -> Int# -> Int# -> Int# -> Int# -> b -> Int#
1157    with
1158    usage            = { mangle ParGlobalOp [mkO, mkP, mkP, mkP, mkP, mkM] mkM }
1159    has_side_effects = True
1160
1161 primop  ParLocalOp  "parLocal#"  GenPrimOp
1162    a -> Int# -> Int# -> Int# -> Int# -> b -> Int#
1163    with
1164    usage            = { mangle ParLocalOp [mkO, mkP, mkP, mkP, mkP, mkM] mkM }
1165    has_side_effects = True
1166
1167 primop  ParAtOp  "parAt#"  GenPrimOp
1168    b -> a -> Int# -> Int# -> Int# -> Int# -> c -> Int#
1169    with
1170    usage            = { mangle ParAtOp [mkO, mkZ, mkP, mkP, mkP, mkP, mkM] mkM }
1171    has_side_effects = True
1172
1173 primop  ParAtAbsOp  "parAtAbs#"  GenPrimOp
1174    a -> Int# -> Int# -> Int# -> Int# -> Int# -> b -> Int#
1175    with
1176    usage            = { mangle ParAtAbsOp [mkO, mkP, mkP, mkP, mkP, mkM] mkM }
1177    has_side_effects = True
1178
1179 primop  ParAtRelOp  "parAtRel#" GenPrimOp
1180    a -> Int# -> Int# -> Int# -> Int# -> Int# -> b -> Int#
1181    with
1182    usage            = { mangle ParAtRelOp [mkO, mkP, mkP, mkP, mkP, mkM] mkM }
1183    has_side_effects = True
1184
1185 primop  ParAtForNowOp  "parAtForNow#" GenPrimOp
1186    b -> a -> Int# -> Int# -> Int# -> Int# -> c -> Int#
1187    with
1188    usage            = { mangle ParAtForNowOp [mkO, mkZ, mkP, mkP, mkP, mkP, mkM] mkM }
1189    has_side_effects = True
1190
1191 primop  CopyableOp  "copyable#" GenPrimOp
1192    a -> Int#
1193    with
1194    usage            = { mangle CopyableOp [mkZ] mkR }
1195    has_side_effects = True
1196
1197 primop  NoFollowOp "noFollow#" GenPrimOp
1198    a -> Int#
1199    with
1200    usage            = { mangle NoFollowOp [mkZ] mkR }
1201    has_side_effects = True
1202
1203
1204 ------------------------------------------------------------------------
1205 --- tag to enum stuff                                                ---
1206 ------------------------------------------------------------------------
1207
1208 primop  DataToTagOp "dataToTag#" GenPrimOp
1209    a -> Int#
1210    with
1211    strictness = { \ arity -> StrictnessInfo [wwLazy] False }
1212
1213 primop  TagToEnumOp "tagToEnum#" GenPrimOp     
1214    Int# -> a
1215
1216
1217 thats_all_folks
1218
1219 ------------------------------------------------------------------------
1220 ---                                                                  ---
1221 ------------------------------------------------------------------------
1222