e86a5cadd5bb074301feffe8dc16371018fde2a7
[ghc-hetmet.git] / ghc / compiler / prelude / primops.txt
1 -----------------------------------------------------------------------
2 -- $Id: primops.txt,v 1.19 2001/03/22 03:51:08 hwloidl 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 bytecode interpreter and linker                  ---
47 ------------------------------------------------------------------------
48
49 -- Convert an Addr# to a followable type
50 primop   AddrToHValueOp "addrToHValue#" GenPrimOp
51    Addr# -> (# a #)
52
53 primop   MkApUpd0_Op "mkApUpd0#" GenPrimOp
54    a -> (# a #)
55    with
56    out_of_line = True
57
58 primop  NewBCOOp "newBCO#" GenPrimOp
59    ByteArr# -> ByteArr# -> Array# a -> ByteArr# -> State# s -> (# State# s, BCO# #)
60    with
61    has_side_effects = True
62    out_of_line      = True
63
64
65 ------------------------------------------------------------------------
66 --- Addr#                                                            ---
67 ------------------------------------------------------------------------
68
69 primop   AddrGtOp  "gtAddr#"   Compare   Addr# -> Addr# -> Bool
70 primop   AddrGeOp  "geAddr#"   Compare   Addr# -> Addr# -> Bool
71 primop   AddrEqOp  "eqAddr#"   Compare   Addr# -> Addr# -> Bool
72 primop   AddrNeOp  "neAddr#"   Compare   Addr# -> Addr# -> Bool
73 primop   AddrLtOp  "ltAddr#"   Compare   Addr# -> Addr# -> Bool
74 primop   AddrLeOp  "leAddr#"   Compare   Addr# -> Addr# -> Bool
75
76 primop   Addr2IntOp  "addr2Int#"     GenPrimOp   Addr# -> Int#
77
78
79 ------------------------------------------------------------------------
80 --- Char#                                                            ---
81 ------------------------------------------------------------------------
82
83 primop   CharGtOp  "gtChar#"   Compare   Char# -> Char# -> Bool
84 primop   CharGeOp  "geChar#"   Compare   Char# -> Char# -> Bool
85
86 primop   CharEqOp  "eqChar#"   Compare
87    Char# -> Char# -> Bool
88    with commutable = True
89
90 primop   CharNeOp  "neChar#"   Compare
91    Char# -> Char# -> Bool
92    with commutable = True
93
94 primop   CharLtOp  "ltChar#"   Compare   Char# -> Char# -> Bool
95 primop   CharLeOp  "leChar#"   Compare   Char# -> Char# -> Bool
96
97 primop   OrdOp   "ord#"  GenPrimOp   Char# -> Int#
98
99 ------------------------------------------------------------------------
100 --- Double#                                                          ---
101 ------------------------------------------------------------------------
102
103 primop   DoubleGtOp ">##"   Compare   Double# -> Double# -> Bool
104 primop   DoubleGeOp ">=##"   Compare   Double# -> Double# -> Bool
105
106 primop DoubleEqOp "==##"   Compare
107    Double# -> Double# -> Bool
108    with commutable = True
109
110 primop DoubleNeOp "/=##"   Compare
111    Double# -> Double# -> Bool
112    with commutable = True
113
114 primop   DoubleLtOp "<##"   Compare   Double# -> Double# -> Bool
115 primop   DoubleLeOp "<=##"   Compare   Double# -> Double# -> Bool
116
117 primop   DoubleAddOp   "+##"   Dyadic
118    Double# -> Double# -> Double#
119    with commutable = True
120
121 primop   DoubleSubOp   "-##"   Dyadic   Double# -> Double# -> Double#
122
123 primop   DoubleMulOp   "*##"   Dyadic
124    Double# -> Double# -> Double#
125    with commutable = True
126
127 primop   DoubleDivOp   "/##"   Dyadic
128    Double# -> Double# -> Double#
129    with can_fail = True
130
131 primop   DoubleNegOp   "negateDouble#"  Monadic   Double# -> Double#
132
133 primop   Double2IntOp   "double2Int#"          GenPrimOp  Double# -> Int#
134 primop   Double2FloatOp   "double2Float#" GenPrimOp Double# -> Float#
135
136 primop   DoubleExpOp   "expDouble#"      Monadic
137    Double# -> Double#
138    with needs_wrapper = True
139
140 primop   DoubleLogOp   "logDouble#"      Monadic         
141    Double# -> Double#
142    with
143    needs_wrapper = True
144    can_fail = True
145
146 primop   DoubleSqrtOp   "sqrtDouble#"      Monadic  
147    Double# -> Double#
148    with needs_wrapper = True
149
150 primop   DoubleSinOp   "sinDouble#"      Monadic          
151    Double# -> Double#
152    with needs_wrapper = True
153
154 primop   DoubleCosOp   "cosDouble#"      Monadic          
155    Double# -> Double#
156    with needs_wrapper = True
157
158 primop   DoubleTanOp   "tanDouble#"      Monadic          
159    Double# -> Double#
160    with needs_wrapper = True
161
162 primop   DoubleAsinOp   "asinDouble#"      Monadic 
163    Double# -> Double#
164    with
165    needs_wrapper = True
166    can_fail = True
167
168 primop   DoubleAcosOp   "acosDouble#"      Monadic  
169    Double# -> Double#
170    with
171    needs_wrapper = True
172    can_fail = True
173
174 primop   DoubleAtanOp   "atanDouble#"      Monadic  
175    Double# -> Double#
176    with
177    needs_wrapper = True
178
179 primop   DoubleSinhOp   "sinhDouble#"      Monadic  
180    Double# -> Double#
181    with needs_wrapper = True
182
183 primop   DoubleCoshOp   "coshDouble#"      Monadic  
184    Double# -> Double#
185    with needs_wrapper = True
186
187 primop   DoubleTanhOp   "tanhDouble#"      Monadic  
188    Double# -> Double#
189    with needs_wrapper = True
190
191 primop   DoublePowerOp   "**##" Dyadic  
192    Double# -> Double# -> Double#
193    with needs_wrapper = True
194
195 primop   DoubleDecodeOp   "decodeDouble#" GenPrimOp    
196    Double# -> (# Int#, Int#, ByteArr# #)
197    with out_of_line = True
198
199 ------------------------------------------------------------------------
200 --- Float#                                                            ---
201 ------------------------------------------------------------------------
202
203 primop   FloatGtOp  "gtFloat#"   Compare   Float# -> Float# -> Bool
204 primop   FloatGeOp  "geFloat#"   Compare   Float# -> Float# -> Bool
205
206 primop   FloatEqOp  "eqFloat#"   Compare
207    Float# -> Float# -> Bool
208    with commutable = True
209
210 primop   FloatNeOp  "neFloat#"   Compare
211    Float# -> Float# -> Bool
212    with commutable = True
213
214 primop   FloatLtOp  "ltFloat#"   Compare   Float# -> Float# -> Bool
215 primop   FloatLeOp  "leFloat#"   Compare   Float# -> Float# -> Bool
216
217 primop   FloatAddOp   "plusFloat#"      Dyadic            
218    Float# -> Float# -> Float#
219    with commutable = True
220
221 primop   FloatSubOp   "minusFloat#"      Dyadic      Float# -> Float# -> Float#
222
223 primop   FloatMulOp   "timesFloat#"      Dyadic    
224    Float# -> Float# -> Float#
225    with commutable = True
226
227 primop   FloatDivOp   "divideFloat#"      Dyadic  
228    Float# -> Float# -> Float#
229    with can_fail = True
230
231 primop   FloatNegOp   "negateFloat#"      Monadic    Float# -> Float#
232
233 primop   Float2IntOp   "float2Int#"      GenPrimOp  Float# -> Int#
234
235 primop   FloatExpOp   "expFloat#"      Monadic          
236    Float# -> Float#
237    with needs_wrapper = True
238
239 primop   FloatLogOp   "logFloat#"      Monadic          
240    Float# -> Float#
241    with needs_wrapper = True
242         can_fail = True
243
244 primop   FloatSqrtOp   "sqrtFloat#"      Monadic          
245    Float# -> Float#
246    with needs_wrapper = True
247
248 primop   FloatSinOp   "sinFloat#"      Monadic          
249    Float# -> Float#
250    with needs_wrapper = True
251
252 primop   FloatCosOp   "cosFloat#"      Monadic          
253    Float# -> Float#
254    with needs_wrapper = True
255
256 primop   FloatTanOp   "tanFloat#"      Monadic          
257    Float# -> Float#
258    with needs_wrapper = True
259
260 primop   FloatAsinOp   "asinFloat#"      Monadic          
261    Float# -> Float#
262    with needs_wrapper = True
263         can_fail = True
264
265 primop   FloatAcosOp   "acosFloat#"      Monadic          
266    Float# -> Float#
267    with needs_wrapper = True
268         can_fail = True
269
270 primop   FloatAtanOp   "atanFloat#"      Monadic          
271    Float# -> Float#
272    with needs_wrapper = True
273
274 primop   FloatSinhOp   "sinhFloat#"      Monadic          
275    Float# -> Float#
276    with needs_wrapper = True
277
278 primop   FloatCoshOp   "coshFloat#"      Monadic          
279    Float# -> Float#
280    with needs_wrapper = True
281
282 primop   FloatTanhOp   "tanhFloat#"      Monadic          
283    Float# -> Float#
284    with needs_wrapper = True
285
286 primop   FloatPowerOp   "powerFloat#"      Dyadic   
287    Float# -> Float# -> Float#
288    with needs_wrapper = True
289
290 primop   Float2DoubleOp   "float2Double#" GenPrimOp  Float# -> Double#
291
292 primop   FloatDecodeOp   "decodeFloat#" GenPrimOp
293    Float# -> (# Int#, Int#, ByteArr# #)
294    with out_of_line = True
295
296 ------------------------------------------------------------------------
297 --- Int#                                                             ---
298 ------------------------------------------------------------------------
299
300 primop   IntAddOp    "+#"    Dyadic
301    Int# -> Int# -> Int#
302    with commutable = True
303
304 primop   IntSubOp    "-#"    Dyadic   Int# -> Int# -> Int#
305
306 primop   IntMulOp    "*#" 
307    Dyadic   Int# -> Int# -> Int#
308    with commutable = True
309
310 primop   IntQuotOp    "quotInt#"    Dyadic
311    Int# -> Int# -> Int#
312    with can_fail = True
313
314 primop   IntRemOp    "remInt#"    Dyadic
315    Int# -> Int# -> Int#
316    with can_fail = True
317
318 primop   IntGcdOp    "gcdInt#"    Dyadic   Int# -> Int# -> Int#
319 primop   IntNegOp    "negateInt#"    Monadic   Int# -> Int#
320 primop   IntAddCOp   "addIntC#"    GenPrimOp   Int# -> Int# -> (# Int#, Int# #)
321 primop   IntSubCOp   "subIntC#"    GenPrimOp   Int# -> Int# -> (# Int#, Int# #)
322 primop   IntMulCOp   "mulIntC#"    GenPrimOp   Int# -> Int# -> (# Int#, Int# #)
323 primop   IntGtOp  ">#"   Compare   Int# -> Int# -> Bool
324 primop   IntGeOp  ">=#"   Compare   Int# -> Int# -> Bool
325
326 primop   IntEqOp  "==#"   Compare
327    Int# -> Int# -> Bool
328    with commutable = True
329
330 primop   IntNeOp  "/=#"   Compare
331    Int# -> Int# -> Bool
332    with commutable = True
333
334 primop   IntLtOp  "<#"   Compare   Int# -> Int# -> Bool
335 primop   IntLeOp  "<=#"   Compare   Int# -> Int# -> Bool
336
337 primop   ChrOp   "chr#"   GenPrimOp   Int# -> Char#
338
339 primop   Int2WordOp "int2Word#" GenPrimOp Int# -> Word#
340 primop   Int2AddrOp   "int2Addr#"GenPrimOp  Int# -> Addr#
341 primop   Int2FloatOp   "int2Float#"      GenPrimOp  Int# -> Float#
342 primop   Int2DoubleOp   "int2Double#"          GenPrimOp  Int# -> Double#
343
344 primop   Int2IntegerOp    "int2Integer#"
345    GenPrimOp Int# -> (# Int#, ByteArr# #)
346    with out_of_line = True
347
348 primop   ISllOp   "iShiftL#" GenPrimOp  Int# -> Int# -> Int#
349 primop   ISraOp   "iShiftRA#" GenPrimOp Int# -> Int# -> Int#
350 primop   ISrlOp   "iShiftRL#" GenPrimOp Int# -> Int# -> Int#
351
352 ------------------------------------------------------------------------
353 --- Int64#                                                           ---
354 ------------------------------------------------------------------------
355
356 primop   Int64ToIntegerOp   "int64ToInteger#" GenPrimOp 
357    Int64# -> (# Int#, ByteArr# #)
358    with out_of_line = True
359
360
361 ------------------------------------------------------------------------
362 --- Integer#                                                         ---
363 ------------------------------------------------------------------------
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   WordAddOp   "plusWord#"   Dyadic   Word# -> Word# -> Word#
453    with commutable = True
454
455 primop   WordSubOp   "minusWord#"   Dyadic   Word# -> Word# -> Word#
456
457 primop   WordMulOp   "timesWord#"   Dyadic   Word# -> Word# -> Word#
458    with commutable = True
459
460 primop   WordQuotOp   "quotWord#"   Dyadic   Word# -> Word# -> Word#
461    with can_fail = True
462
463 primop   WordRemOp   "remWord#"   Dyadic   Word# -> Word# -> Word#
464    with can_fail = True
465
466 primop   AndOp   "and#"   Dyadic   Word# -> Word# -> Word#
467    with commutable = True
468
469 primop   OrOp   "or#"   Dyadic   Word# -> Word# -> Word#
470    with commutable = True
471
472 primop   XorOp   "xor#"   Dyadic   Word# -> Word# -> Word#
473    with commutable = True
474
475 primop   NotOp   "not#"   Monadic   Word# -> Word#
476
477 primop   SllOp   "shiftL#"   GenPrimOp   Word# -> Int# -> Word#
478
479 primop   SrlOp   "shiftRL#"   GenPrimOp   Word# -> Int# -> Word#
480
481 primop   Word2IntOp   "word2Int#"   GenPrimOp   Word# -> Int#
482
483 primop   Word2IntegerOp   "word2Integer#"   GenPrimOp 
484    Word# -> (# Int#, ByteArr# #)
485    with out_of_line = True
486
487 primop   WordGtOp   "gtWord#"   Compare   Word# -> Word# -> Bool
488 primop   WordGeOp   "geWord#"   Compare   Word# -> Word# -> Bool
489 primop   WordEqOp   "eqWord#"   Compare   Word# -> Word# -> Bool
490 primop   WordNeOp   "neWord#"   Compare   Word# -> Word# -> Bool
491 primop   WordLtOp   "ltWord#"   Compare   Word# -> Word# -> Bool
492 primop   WordLeOp   "leWord#"   Compare   Word# -> Word# -> Bool
493
494 ------------------------------------------------------------------------
495 --- Word64#                                                          ---
496 ------------------------------------------------------------------------
497
498 primop   Word64ToIntegerOp   "word64ToInteger#" GenPrimOp
499    Word64# -> (# Int#, ByteArr# #)
500    with out_of_line = True
501
502 ------------------------------------------------------------------------
503 --- Explicitly sized Int# and Word#                                  ---
504 ------------------------------------------------------------------------
505
506 primop   IntToInt8Op       "intToInt8#"       Monadic   Int# -> Int#
507 primop   IntToInt16Op      "intToInt16#"      Monadic   Int# -> Int#
508 primop   IntToInt32Op      "intToInt32#"      Monadic   Int# -> Int#
509 primop   WordToWord8Op     "wordToWord8#"     Monadic   Word# -> Word#
510 primop   WordToWord16Op    "wordToWord16#"    Monadic   Word# -> Word#
511 primop   WordToWord32Op    "wordToWord32#"    Monadic   Word# -> Word#
512
513 ------------------------------------------------------------------------
514 --- Arrays                                                           ---
515 ------------------------------------------------------------------------
516
517 primop  NewArrayOp "newArray#" GenPrimOp
518    Int# -> a -> State# s -> (# State# s, MutArr# s a #)
519    with
520    strictness  = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False }
521    usage       = { mangle NewArrayOp [mkP, mkM, mkP] mkM }
522    out_of_line = True
523
524 primop  NewByteArrayOp_Char "newByteArray#" GenPrimOp
525    Int# -> State# s -> (# State# s, MutByteArr# s #)
526    with out_of_line = True
527
528
529 primop IndexByteArrayOp_Char "indexCharArray#" GenPrimOp
530    ByteArr# -> Int# -> Char#
531
532 primop IndexByteArrayOp_WideChar "indexWideCharArray#" GenPrimOp
533    ByteArr# -> Int# -> Char#
534
535 primop IndexByteArrayOp_Int "indexIntArray#" GenPrimOp
536    ByteArr# -> Int# -> Int#
537
538 primop IndexByteArrayOp_Word "indexWordArray#" GenPrimOp
539    ByteArr# -> Int# -> Word#
540
541 primop IndexByteArrayOp_Addr "indexAddrArray#" GenPrimOp
542    ByteArr# -> Int# -> Addr#
543
544 primop IndexByteArrayOp_Float "indexFloatArray#" GenPrimOp
545    ByteArr# -> Int# -> Float#
546
547 primop IndexByteArrayOp_Double "indexDoubleArray#" GenPrimOp
548    ByteArr# -> Int# -> Double#
549
550 primop IndexByteArrayOp_StablePtr "indexStablePtrArray#" GenPrimOp
551    ByteArr# -> Int# -> StablePtr# a
552
553 primop IndexByteArrayOp_Int8 "indexInt8Array#" GenPrimOp
554    ByteArr# -> Int# -> Int#
555
556 primop IndexByteArrayOp_Int16 "indexInt16Array#" GenPrimOp
557    ByteArr# -> Int# -> Int#
558
559 primop IndexByteArrayOp_Int32 "indexInt32Array#" GenPrimOp
560    ByteArr# -> Int# -> Int#
561
562 primop IndexByteArrayOp_Int64 "indexInt64Array#" GenPrimOp
563    ByteArr# -> Int# -> Int64#
564
565 primop IndexByteArrayOp_Word8 "indexWord8Array#" GenPrimOp
566    ByteArr# -> Int# -> Word#
567
568 primop IndexByteArrayOp_Word16 "indexWord16Array#" GenPrimOp
569    ByteArr# -> Int# -> Word#
570
571 primop IndexByteArrayOp_Word32 "indexWord32Array#" GenPrimOp
572    ByteArr# -> Int# -> Word#
573
574 primop IndexByteArrayOp_Word64 "indexWord64Array#" GenPrimOp
575    ByteArr# -> Int# -> Word64#
576
577
578 primop  ReadByteArrayOp_Char "readCharArray#" GenPrimOp
579    MutByteArr# s -> Int# -> State# s -> (# State# s, Char# #)
580
581 primop  ReadByteArrayOp_WideChar "readWideCharArray#" GenPrimOp
582    MutByteArr# s -> Int# -> State# s -> (# State# s, Char# #)
583
584 primop  ReadByteArrayOp_Int "readIntArray#" GenPrimOp
585    MutByteArr# s -> Int# -> State# s -> (# State# s, Int# #)
586
587 primop  ReadByteArrayOp_Word "readWordArray#" GenPrimOp
588    MutByteArr# s -> Int# -> State# s -> (# State# s, Word# #)
589
590 primop  ReadByteArrayOp_Addr "readAddrArray#" GenPrimOp
591    MutByteArr# s -> Int# -> State# s -> (# State# s, Addr# #)
592
593 primop  ReadByteArrayOp_Float "readFloatArray#" GenPrimOp
594    MutByteArr# s -> Int# -> State# s -> (# State# s, Float# #)
595
596 primop  ReadByteArrayOp_Double "readDoubleArray#" GenPrimOp
597    MutByteArr# s -> Int# -> State# s -> (# State# s, Double# #)
598
599 primop  ReadByteArrayOp_StablePtr "readStablePtrArray#" GenPrimOp
600    MutByteArr# s -> Int# -> State# s -> (# State# s, StablePtr# a #)
601
602 primop  ReadByteArrayOp_Int8 "readInt8Array#" GenPrimOp
603    MutByteArr# s -> Int# -> State# s -> (# State# s, Int# #)
604
605 primop  ReadByteArrayOp_Int16 "readInt16Array#" GenPrimOp
606    MutByteArr# s -> Int# -> State# s -> (# State# s, Int# #)
607
608 primop  ReadByteArrayOp_Int32 "readInt32Array#" GenPrimOp
609    MutByteArr# s -> Int# -> State# s -> (# State# s, Int# #)
610
611 primop  ReadByteArrayOp_Int64 "readInt64Array#" GenPrimOp
612    MutByteArr# s -> Int# -> State# s -> (# State# s, Int64# #)
613
614 primop  ReadByteArrayOp_Word8 "readWord8Array#" GenPrimOp
615    MutByteArr# s -> Int# -> State# s -> (# State# s, Word# #)
616
617 primop  ReadByteArrayOp_Word16 "readWord16Array#" GenPrimOp
618    MutByteArr# s -> Int# -> State# s -> (# State# s, Word# #)
619
620 primop  ReadByteArrayOp_Word32 "readWord32Array#" GenPrimOp
621    MutByteArr# s -> Int# -> State# s -> (# State# s, Word# #)
622
623 primop  ReadByteArrayOp_Word64 "readWord64Array#" GenPrimOp
624    MutByteArr# s -> Int# -> State# s -> (# State# s, Word64# #)
625
626
627
628 primop  WriteByteArrayOp_Char "writeCharArray#" GenPrimOp
629    MutByteArr# s -> Int# -> Char# -> State# s -> State# s
630    with has_side_effects = True
631
632 primop  WriteByteArrayOp_WideChar "writeWideCharArray#" GenPrimOp
633    MutByteArr# s -> Int# -> Char# -> State# s -> State# s
634    with has_side_effects = True
635
636 primop  WriteByteArrayOp_Int "writeIntArray#" GenPrimOp
637    MutByteArr# s -> Int# -> Int# -> State# s -> State# s
638    with has_side_effects = True
639
640 primop  WriteByteArrayOp_Word "writeWordArray#" GenPrimOp
641    MutByteArr# s -> Int# -> Word# -> State# s -> State# s
642    with has_side_effects = True
643
644 primop  WriteByteArrayOp_Addr "writeAddrArray#" GenPrimOp
645    MutByteArr# s -> Int# -> Addr# -> State# s -> State# s
646    with has_side_effects = True
647
648 primop  WriteByteArrayOp_Float "writeFloatArray#" GenPrimOp
649    MutByteArr# s -> Int# -> Float# -> State# s -> State# s
650    with has_side_effects = True
651
652 primop  WriteByteArrayOp_Double "writeDoubleArray#" GenPrimOp
653    MutByteArr# s -> Int# -> Double# -> State# s -> State# s
654    with has_side_effects = True
655
656 primop  WriteByteArrayOp_StablePtr "writeStablePtrArray#" GenPrimOp
657    MutByteArr# s -> Int# -> StablePtr# a -> State# s -> State# s
658    with has_side_effects = True
659
660 primop  WriteByteArrayOp_Int8 "writeInt8Array#" GenPrimOp
661    MutByteArr# s -> Int# -> Int# -> State# s -> State# s
662    with has_side_effects = True
663
664 primop  WriteByteArrayOp_Int16 "writeInt16Array#" GenPrimOp
665    MutByteArr# s -> Int# -> Int# -> State# s -> State# s
666    with has_side_effects = True
667
668 primop  WriteByteArrayOp_Int32 "writeInt32Array#" GenPrimOp
669    MutByteArr# s -> Int# -> Int# -> State# s -> State# s
670    with has_side_effects = True
671
672 primop  WriteByteArrayOp_Int64 "writeInt64Array#" GenPrimOp
673    MutByteArr# s -> Int# -> Int64# -> State# s -> State# s
674    with has_side_effects = True
675
676 primop  WriteByteArrayOp_Word8 "writeWord8Array#" GenPrimOp
677    MutByteArr# s -> Int# -> Word# -> State# s -> State# s
678    with has_side_effects = True
679
680 primop  WriteByteArrayOp_Word16 "writeWord16Array#" GenPrimOp
681    MutByteArr# s -> Int# -> Word# -> State# s -> State# s
682    with has_side_effects = True
683
684 primop  WriteByteArrayOp_Word32 "writeWord32Array#" GenPrimOp
685    MutByteArr# s -> Int# -> Word# -> State# s -> State# s
686    with has_side_effects = True
687
688 primop  WriteByteArrayOp_Word64 "writeWord64Array#" GenPrimOp
689    MutByteArr# s -> Int# -> Word64# -> State# s -> State# s
690    with has_side_effects = True
691
692
693 primop IndexOffAddrOp_Char "indexCharOffAddr#" GenPrimOp
694    Addr# -> Int# -> Char#
695
696 primop IndexOffAddrOp_WideChar "indexWideCharOffAddr#" GenPrimOp
697    Addr# -> Int# -> Char#
698
699 primop IndexOffAddrOp_Int "indexIntOffAddr#" GenPrimOp
700    Addr# -> Int# -> Int#
701
702 primop IndexOffAddrOp_Word "indexWordOffAddr#" GenPrimOp
703    Addr# -> Int# -> Word#
704
705 primop IndexOffAddrOp_Addr "indexAddrOffAddr#" GenPrimOp
706    Addr# -> Int# -> Addr#
707
708 primop IndexOffAddrOp_Float "indexFloatOffAddr#" GenPrimOp
709    Addr# -> Int# -> Float#
710
711 primop IndexOffAddrOp_Double "indexDoubleOffAddr#" GenPrimOp
712    Addr# -> Int# -> Double#
713
714 primop IndexOffAddrOp_StablePtr "indexStablePtrOffAddr#" GenPrimOp
715    Addr# -> Int# -> StablePtr# a
716
717 primop IndexOffAddrOp_Int8 "indexInt8OffAddr#" GenPrimOp
718    Addr# -> Int# -> Int#
719
720 primop IndexOffAddrOp_Int16 "indexInt16OffAddr#" GenPrimOp
721    Addr# -> Int# -> Int#
722
723 primop IndexOffAddrOp_Int32 "indexInt32OffAddr#" GenPrimOp
724    Addr# -> Int# -> Int#
725
726 primop IndexOffAddrOp_Int64 "indexInt64OffAddr#" GenPrimOp
727    Addr# -> Int# -> Int64#
728
729 primop IndexOffAddrOp_Word8 "indexWord8OffAddr#" GenPrimOp
730    Addr# -> Int# -> Word#
731
732 primop IndexOffAddrOp_Word16 "indexWord16OffAddr#" GenPrimOp
733    Addr# -> Int# -> Word#
734
735 primop IndexOffAddrOp_Word32 "indexWord32OffAddr#" GenPrimOp
736    Addr# -> Int# -> Word#
737
738 primop IndexOffAddrOp_Word64 "indexWord64OffAddr#" GenPrimOp
739    Addr# -> Int# -> Word64#
740
741
742 primop IndexOffForeignObjOp_Char "indexCharOffForeignObj#" GenPrimOp
743    ForeignObj# -> Int# -> Char#
744
745 primop IndexOffForeignObjOp_WideChar "indexWideCharOffForeignObj#" GenPrimOp
746    ForeignObj# -> Int# -> Char#
747
748 primop IndexOffForeignObjOp_Int "indexIntOffForeignObj#" GenPrimOp
749    ForeignObj# -> Int# -> Int#
750
751 primop IndexOffForeignObjOp_Word "indexWordOffForeignObj#" GenPrimOp
752    ForeignObj# -> Int# -> Word#
753
754 primop IndexOffForeignObjOp_Addr "indexAddrOffForeignObj#" GenPrimOp
755    ForeignObj# -> Int# -> Addr#
756
757 primop IndexOffForeignObjOp_Float "indexFloatOffForeignObj#" GenPrimOp
758    ForeignObj# -> Int# -> Float#
759
760 primop IndexOffForeignObjOp_Double "indexDoubleOffForeignObj#" GenPrimOp
761    ForeignObj# -> Int# -> Double#
762
763 primop IndexOffForeignObjOp_StablePtr "indexStablePtrOffForeignObj#" GenPrimOp
764    ForeignObj# -> Int# -> StablePtr# a
765
766 primop IndexOffForeignObjOp_Int8 "indexInt8OffForeignObj#" GenPrimOp
767    ForeignObj# -> Int# -> Int#
768
769 primop IndexOffForeignObjOp_Int16 "indexInt16OffForeignObj#" GenPrimOp
770    ForeignObj# -> Int# -> Int#
771
772 primop IndexOffForeignObjOp_Int32 "indexInt32OffForeignObj#" GenPrimOp
773    ForeignObj# -> Int# -> Int#
774
775 primop IndexOffForeignObjOp_Int64 "indexInt64OffForeignObj#" GenPrimOp
776    ForeignObj# -> Int# -> Int64#
777
778 primop IndexOffForeignObjOp_Word8 "indexWord8OffForeignObj#" GenPrimOp
779    ForeignObj# -> Int# -> Word#
780
781 primop IndexOffForeignObjOp_Word16 "indexWord16OffForeignObj#" GenPrimOp
782    ForeignObj# -> Int# -> Word#
783
784 primop IndexOffForeignObjOp_Word32 "indexWord32OffForeignObj#" GenPrimOp
785    ForeignObj# -> Int# -> Word#
786
787 primop IndexOffForeignObjOp_Word64 "indexWord64OffForeignObj#" GenPrimOp
788    ForeignObj# -> Int# -> Word64#
789
790 primop ReadOffAddrOp_Char "readCharOffAddr#" GenPrimOp
791    Addr# -> Int# -> State# s -> (# State# s, Char# #)
792
793 primop ReadOffAddrOp_WideChar "readWideCharOffAddr#" GenPrimOp
794    Addr# -> Int# -> State# s -> (# State# s, Char# #)
795
796 primop ReadOffAddrOp_Int "readIntOffAddr#" GenPrimOp
797    Addr# -> Int# -> State# s -> (# State# s, Int# #)
798
799 primop ReadOffAddrOp_Word "readWordOffAddr#" GenPrimOp
800    Addr# -> Int# -> State# s -> (# State# s, Word# #)
801
802 primop ReadOffAddrOp_Addr "readAddrOffAddr#" GenPrimOp
803    Addr# -> Int# -> State# s -> (# State# s, Addr# #)
804
805 primop ReadOffAddrOp_Float "readFloatOffAddr#" GenPrimOp
806    Addr# -> Int# -> State# s -> (# State# s, Float# #)
807
808 primop ReadOffAddrOp_Double "readDoubleOffAddr#" GenPrimOp
809    Addr# -> Int# -> State# s -> (# State# s, Double# #)
810
811 primop ReadOffAddrOp_StablePtr "readStablePtrOffAddr#" GenPrimOp
812    Addr# -> Int# -> State# s -> (# State# s, StablePtr# a #)
813
814 primop ReadOffAddrOp_Int8 "readInt8OffAddr#" GenPrimOp
815    Addr# -> Int# -> State# s -> (# State# s, Int# #)
816
817 primop ReadOffAddrOp_Int16 "readInt16OffAddr#" GenPrimOp
818    Addr# -> Int# -> State# s -> (# State# s, Int# #)
819
820 primop ReadOffAddrOp_Int32 "readInt32OffAddr#" GenPrimOp
821    Addr# -> Int# -> State# s -> (# State# s, Int# #)
822
823 primop ReadOffAddrOp_Int64 "readInt64OffAddr#" GenPrimOp
824    Addr# -> Int# -> State# s -> (# State# s, Int64# #)
825
826 primop ReadOffAddrOp_Word8 "readWord8OffAddr#" GenPrimOp
827    Addr# -> Int# -> State# s -> (# State# s, Word# #)
828
829 primop ReadOffAddrOp_Word16 "readWord16OffAddr#" GenPrimOp
830    Addr# -> Int# -> State# s -> (# State# s, Word# #)
831
832 primop ReadOffAddrOp_Word32 "readWord32OffAddr#" GenPrimOp
833    Addr# -> Int# -> State# s -> (# State# s, Word# #)
834
835 primop ReadOffAddrOp_Word64 "readWord64OffAddr#" GenPrimOp
836    Addr# -> Int# -> State# s -> (# State# s, Word64# #)
837
838
839 primop  WriteOffAddrOp_Char "writeCharOffAddr#" GenPrimOp
840    Addr# -> Int# -> Char# -> State# s -> State# s
841    with has_side_effects = True
842
843 primop  WriteOffAddrOp_WideChar "writeWideCharOffAddr#" GenPrimOp
844    Addr# -> Int# -> Char# -> State# s -> State# s
845    with has_side_effects = True
846
847 primop  WriteOffAddrOp_Int "writeIntOffAddr#" GenPrimOp
848    Addr# -> Int# -> Int# -> State# s -> State# s
849    with has_side_effects = True
850
851 primop  WriteOffAddrOp_Word "writeWordOffAddr#" GenPrimOp
852    Addr# -> Int# -> Word# -> State# s -> State# s
853    with has_side_effects = True
854
855 primop  WriteOffAddrOp_Addr "writeAddrOffAddr#" GenPrimOp
856    Addr# -> Int# -> Addr# -> State# s -> State# s
857    with has_side_effects = True
858
859 primop  WriteOffAddrOp_ForeignObj "writeForeignObjOffAddr#" GenPrimOp
860    Addr# -> Int# -> ForeignObj# -> State# s -> State# s
861    with has_side_effects = True
862
863 primop  WriteOffAddrOp_Float "writeFloatOffAddr#" GenPrimOp
864    Addr# -> Int# -> Float# -> State# s -> State# s
865    with has_side_effects = True
866
867 primop  WriteOffAddrOp_Double "writeDoubleOffAddr#" GenPrimOp
868    Addr# -> Int# -> Double# -> State# s -> State# s
869    with has_side_effects = True
870
871 primop  WriteOffAddrOp_StablePtr "writeStablePtrOffAddr#" GenPrimOp
872    Addr# -> Int# -> StablePtr# a -> State# s -> State# s
873    with has_side_effects = True
874
875 primop  WriteOffAddrOp_Int8 "writeInt8OffAddr#" GenPrimOp
876    Addr# -> Int# -> Int# -> State# s -> State# s
877    with has_side_effects = True
878
879 primop  WriteOffAddrOp_Int16 "writeInt16OffAddr#" GenPrimOp
880    Addr# -> Int# -> Int# -> State# s -> State# s
881    with has_side_effects = True
882
883 primop  WriteOffAddrOp_Int32 "writeInt32OffAddr#" GenPrimOp
884    Addr# -> Int# -> Int# -> State# s -> State# s
885    with has_side_effects = True
886
887 primop  WriteOffAddrOp_Int64 "writeInt64OffAddr#" GenPrimOp
888    Addr# -> Int# -> Int64# -> State# s -> State# s
889    with has_side_effects = True
890
891 primop  WriteOffAddrOp_Word8 "writeWord8OffAddr#" GenPrimOp
892    Addr# -> Int# -> Word# -> State# s -> State# s
893    with has_side_effects = True
894
895 primop  WriteOffAddrOp_Word16 "writeWord16OffAddr#" GenPrimOp
896    Addr# -> Int# -> Word# -> State# s -> State# s
897    with has_side_effects = True
898
899 primop  WriteOffAddrOp_Word32 "writeWord32OffAddr#" GenPrimOp
900    Addr# -> Int# -> Word# -> State# s -> State# s
901    with has_side_effects = True
902
903 primop  WriteOffAddrOp_Word64 "writeWord64OffAddr#" GenPrimOp
904    Addr# -> Int# -> Word64# -> State# s -> State# s
905    with has_side_effects = True
906
907
908
909 primop  SameMutableArrayOp "sameMutableArray#" GenPrimOp
910    MutArr# s a -> MutArr# s a -> Bool
911    with
912    usage = { mangle SameMutableArrayOp [mkP, mkP] mkM }
913
914 primop  SameMutableByteArrayOp "sameMutableByteArray#" GenPrimOp
915    MutByteArr# s -> MutByteArr# s -> Bool
916
917 primop  ReadArrayOp "readArray#" GenPrimOp
918    MutArr# s a -> Int# -> State# s -> (# State# s, a #)
919    with
920    usage = { mangle ReadArrayOp [mkM, mkP, mkP] mkM }
921
922 primop  WriteArrayOp "writeArray#" GenPrimOp
923    MutArr# s a -> Int# -> a -> State# s -> State# s
924    with
925    usage            = { mangle WriteArrayOp [mkM, mkP, mkM, mkP] mkR }
926    strictness       = { \ arity -> StrictnessInfo [wwPrim, wwPrim, wwLazy, wwPrim] False }
927    has_side_effects = True
928
929 primop  IndexArrayOp "indexArray#" GenPrimOp
930    Array# a -> Int# -> (# a #)
931    with
932    usage = { mangle  IndexArrayOp [mkM, mkP] mkM }
933
934 primop  UnsafeFreezeArrayOp "unsafeFreezeArray#" GenPrimOp
935    MutArr# s a -> State# s -> (# State# s, Array# a #)
936    with
937    usage            = { mangle UnsafeFreezeArrayOp [mkM, mkP] mkM }
938    has_side_effects = True
939
940 primop  UnsafeFreezeByteArrayOp "unsafeFreezeByteArray#" GenPrimOp
941    MutByteArr# s -> State# s -> (# State# s, ByteArr# #)
942    with
943    has_side_effects = True
944
945 primop  UnsafeThawArrayOp  "unsafeThawArray#" GenPrimOp
946    Array# a -> State# s -> (# State# s, MutArr# s a #)
947    with
948    usage       = { mangle UnsafeThawArrayOp [mkM, mkP] mkM }
949    out_of_line = True
950
951 primop  SizeofByteArrayOp "sizeofByteArray#" GenPrimOp  
952    ByteArr# -> Int#
953
954 primop  SizeofMutableByteArrayOp "sizeofMutableByteArray#" GenPrimOp
955    MutByteArr# s -> Int#
956
957 ------------------------------------------------------------------------
958 --- Mutable variables                                                ---
959 ------------------------------------------------------------------------
960
961 primop  NewMutVarOp "newMutVar#" GenPrimOp
962    a -> State# s -> (# State# s, MutVar# s a #)
963    with
964    usage       = { mangle NewMutVarOp [mkM, mkP] mkM }
965    strictness  = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
966    out_of_line = True
967
968 primop  ReadMutVarOp "readMutVar#" GenPrimOp
969    MutVar# s a -> State# s -> (# State# s, a #)
970    with
971    usage = { mangle ReadMutVarOp [mkM, mkP] mkM }
972
973 primop  WriteMutVarOp "writeMutVar#"  GenPrimOp
974    MutVar# s a -> a -> State# s -> State# s
975    with
976    strictness       = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False }
977    usage            = { mangle WriteMutVarOp [mkM, mkM, mkP] mkR }
978    has_side_effects = True
979
980 primop  SameMutVarOp "sameMutVar#" GenPrimOp
981    MutVar# s a -> MutVar# s a -> Bool
982    with
983    usage = { mangle SameMutVarOp [mkP, mkP] mkM }
984
985 ------------------------------------------------------------------------
986 --- Exceptions                                                       ---
987 ------------------------------------------------------------------------
988
989 primop  CatchOp "catch#" GenPrimOp
990           (State# RealWorld -> (# State# RealWorld, a #) )
991        -> (b -> State# RealWorld -> (# State# RealWorld, a #) ) 
992        -> State# RealWorld
993        -> (# State# RealWorld, a #)
994    with
995    strictness = { \ arity -> StrictnessInfo [wwLazy, wwLazy, wwPrim] False }
996         -- Catch is actually strict in its first argument
997         -- but we don't want to tell the strictness
998         -- analyser about that!
999    usage = { mangle CatchOp [mkM, mkM . (inFun CatchOp mkM mkM), mkP] mkM }
1000         --     [mkO, mkO . (inFun mkM mkO)] mkO
1001         -- might use caught action multiply
1002    out_of_line = True
1003
1004 primop  RaiseOp "raise#" GenPrimOp
1005    a -> b
1006    with
1007    strictness  = { \ arity -> StrictnessInfo [wwLazy] True }
1008       -- NB: True => result is bottom
1009    usage       = { mangle RaiseOp [mkM] mkM }
1010    out_of_line = True
1011
1012 primop  BlockAsyncExceptionsOp "blockAsyncExceptions#" GenPrimOp
1013         (State# RealWorld -> (# State# RealWorld, a #))
1014      -> (State# RealWorld -> (# State# RealWorld, a #))
1015    with
1016    strictness  = { \ arity -> StrictnessInfo [wwLazy] False }
1017    out_of_line = True
1018
1019 primop  UnblockAsyncExceptionsOp "unblockAsyncExceptions#" GenPrimOp
1020         (State# RealWorld -> (# State# RealWorld, a #))
1021      -> (State# RealWorld -> (# State# RealWorld, a #))
1022    with
1023    strictness  = { \ arity -> StrictnessInfo [wwLazy] False }
1024    out_of_line = True
1025
1026 ------------------------------------------------------------------------
1027 --- MVars (not the same as mutable variables!)                       ---
1028 ------------------------------------------------------------------------
1029
1030 primop  NewMVarOp "newMVar#"  GenPrimOp
1031    State# s -> (# State# s, MVar# s a #)
1032    with
1033    usage       = { mangle NewMVarOp [mkP] mkR }
1034    out_of_line = True
1035
1036 primop  TakeMVarOp "takeMVar#" GenPrimOp
1037    MVar# s a -> State# s -> (# State# s, a #)
1038    with
1039    usage            = { mangle TakeMVarOp [mkM, mkP] mkM }
1040    has_side_effects = True
1041    out_of_line      = True
1042
1043 primop  TryTakeMVarOp "tryTakeMVar#" GenPrimOp
1044    MVar# s a -> State# s -> (# State# s, Int#, a #)
1045    with
1046    usage            = { mangle TryTakeMVarOp [mkM, mkP] mkM }
1047    has_side_effects = True
1048    out_of_line      = True
1049
1050 primop  PutMVarOp "putMVar#" GenPrimOp
1051    MVar# s a -> a -> State# s -> State# s
1052    with
1053    strictness       = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False }
1054    usage            = { mangle PutMVarOp [mkM, mkM, mkP] mkR }
1055    has_side_effects = True
1056    out_of_line      = True
1057
1058 primop  TryPutMVarOp "tryPutMVar#" GenPrimOp
1059    MVar# s a -> a -> State# s -> (# State# s, Int# #)
1060    with
1061    strictness       = { \ arity -> StrictnessInfo [wwPrim, wwLazy, wwPrim] False }
1062    usage            = { mangle TryPutMVarOp [mkM, mkM, mkP] mkR }
1063    has_side_effects = True
1064    out_of_line      = True
1065
1066 primop  SameMVarOp "sameMVar#" GenPrimOp
1067    MVar# s a -> MVar# s a -> Bool
1068    with
1069    usage = { mangle SameMVarOp [mkP, mkP] mkM }
1070
1071 primop  IsEmptyMVarOp "isEmptyMVar#" GenPrimOp
1072    MVar# s a -> State# s -> (# State# s, Int# #)
1073    with
1074    usage = { mangle IsEmptyMVarOp [mkP, mkP] mkM }
1075
1076
1077 ------------------------------------------------------------------------
1078 --- delay/wait operations                                            ---
1079 ------------------------------------------------------------------------
1080
1081 primop  DelayOp "delay#" GenPrimOp
1082    Int# -> State# s -> State# s
1083    with
1084    needs_wrapper    = True
1085    has_side_effects = True
1086    out_of_line      = True
1087
1088 primop  WaitReadOp "waitRead#" GenPrimOp
1089    Int# -> State# s -> State# s
1090    with
1091    needs_wrapper    = True
1092    has_side_effects = True
1093    out_of_line      = True
1094
1095 primop  WaitWriteOp "waitWrite#" GenPrimOp
1096    Int# -> State# s -> State# s
1097    with
1098    needs_wrapper    = True
1099    has_side_effects = True
1100    out_of_line      = True
1101
1102 ------------------------------------------------------------------------
1103 --- concurrency primitives                                           ---
1104 ------------------------------------------------------------------------
1105
1106 primop  ForkOp "fork#" GenPrimOp
1107    a -> State# RealWorld -> (# State# RealWorld, ThreadId# #)
1108    with
1109    usage            = { mangle ForkOp [mkO, mkP] mkR }
1110    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1111    has_side_effects = True
1112    out_of_line      = True
1113
1114 primop  KillThreadOp "killThread#"  GenPrimOp
1115    ThreadId# -> a -> State# RealWorld -> State# RealWorld
1116    with
1117    usage            = { mangle KillThreadOp [mkP, mkM, mkP] mkR }
1118    has_side_effects = True
1119    out_of_line      = True
1120
1121 primop  YieldOp "yield#" GenPrimOp
1122    State# RealWorld -> State# RealWorld
1123    with
1124    has_side_effects = True
1125    out_of_line      = True
1126
1127 primop  MyThreadIdOp "myThreadId#" GenPrimOp
1128     State# RealWorld -> (# State# RealWorld, ThreadId# #)
1129
1130 ------------------------------------------------------------------------
1131 --- foreign objects                                                  ---
1132 ------------------------------------------------------------------------
1133
1134 primop  MkForeignObjOp "mkForeignObj#" GenPrimOp
1135    Addr# -> State# RealWorld -> (# State# RealWorld, ForeignObj# #)
1136    with
1137    has_side_effects = True
1138    out_of_line      = True
1139
1140 primop  WriteForeignObjOp "writeForeignObj#" GenPrimOp
1141    ForeignObj# -> Addr# -> State# s -> State# s
1142    with
1143    has_side_effects = True
1144
1145 primop ForeignObjToAddrOp "foreignObjToAddr#" GenPrimOp
1146    ForeignObj# -> Addr#
1147
1148 primop TouchOp "touch#" GenPrimOp
1149    o -> State# RealWorld -> State# RealWorld
1150    with
1151    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1152
1153 ------------------------------------------------------------------------
1154 --- Weak pointers                                                    ---
1155 ------------------------------------------------------------------------
1156
1157 -- note that tyvar "o" denotes openAlphaTyVar
1158
1159 primop  MkWeakOp "mkWeak#" GenPrimOp
1160    o -> b -> c -> State# RealWorld -> (# State# RealWorld, Weak# b #)
1161    with
1162    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwLazy, wwLazy, wwPrim] False }
1163    usage            = { mangle MkWeakOp [mkZ, mkM, mkM, mkP] mkM }
1164    has_side_effects = True
1165    out_of_line      = True
1166
1167 primop  DeRefWeakOp "deRefWeak#" GenPrimOp
1168    Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #)
1169    with
1170    usage            = { mangle DeRefWeakOp [mkM, mkP] mkM }
1171    has_side_effects = True
1172
1173 primop  FinalizeWeakOp "finalizeWeak#" GenPrimOp
1174    Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, 
1175               (State# RealWorld -> (# State# RealWorld, Unit #)) #)
1176    with
1177    usage            = { mangle FinalizeWeakOp [mkM, mkP] 
1178                                (mkR . (inUB FinalizeWeakOp 
1179                                             [id,id,inFun FinalizeWeakOp mkR mkM])) }
1180    has_side_effects = True
1181    out_of_line      = True
1182
1183 ------------------------------------------------------------------------
1184 --- Stable pointers and names                                        ---
1185 ------------------------------------------------------------------------
1186
1187 primop  MakeStablePtrOp "makeStablePtr#" GenPrimOp
1188    a -> State# RealWorld -> (# State# RealWorld, StablePtr# a #)
1189    with
1190    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1191    usage            = { mangle MakeStablePtrOp [mkM, mkP] mkM }
1192    has_side_effects = True
1193
1194 primop  DeRefStablePtrOp "deRefStablePtr#" GenPrimOp
1195    StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #)
1196    with
1197    usage            = { mangle DeRefStablePtrOp [mkM, mkP] mkM }
1198    needs_wrapper    = True
1199    has_side_effects = True
1200
1201 primop  EqStablePtrOp "eqStablePtr#" GenPrimOp
1202    StablePtr# a -> StablePtr# a -> Int#
1203    with
1204    usage            = { mangle EqStablePtrOp [mkP, mkP] mkR }
1205    has_side_effects = True
1206
1207 primop  MakeStableNameOp "makeStableName#" GenPrimOp
1208    a -> State# RealWorld -> (# State# RealWorld, StableName# a #)
1209    with
1210    usage            = { mangle MakeStableNameOp [mkZ, mkP] mkR }
1211    strictness       = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
1212    needs_wrapper    = True
1213    has_side_effects = True
1214    out_of_line      = True
1215
1216 primop  EqStableNameOp "eqStableName#" GenPrimOp
1217    StableName# a -> StableName# a -> Int#
1218    with
1219    usage = { mangle EqStableNameOp [mkP, mkP] mkR }
1220
1221 primop  StableNameToIntOp "stableNameToInt#" GenPrimOp
1222    StableName# a -> Int#
1223    with
1224    usage = { mangle StableNameToIntOp [mkP] mkR }
1225
1226 ------------------------------------------------------------------------
1227 --- Unsafe pointer equality (#1 Bad Guy: Alistair Reid :)            ---
1228 ------------------------------------------------------------------------
1229
1230 primop  ReallyUnsafePtrEqualityOp "reallyUnsafePtrEquality#" GenPrimOp
1231    a -> a -> Int#
1232    with
1233    usage = { mangle ReallyUnsafePtrEqualityOp [mkZ, mkZ] mkR }
1234
1235 ------------------------------------------------------------------------
1236 --- Parallelism                                                      ---
1237 ------------------------------------------------------------------------
1238
1239 primop  SeqOp "seq#" GenPrimOp
1240    a -> Int#
1241    with
1242    usage            = { mangle  SeqOp [mkO] mkR }
1243    strictness       = { \ arity -> StrictnessInfo [wwStrict] False }
1244       -- Seq is strict in its argument; see notes in ConFold.lhs
1245    has_side_effects = True
1246
1247 primop  ParOp "par#" GenPrimOp
1248    a -> Int#
1249    with
1250    usage            = { mangle ParOp [mkO] mkR }
1251    strictness       = { \ arity -> StrictnessInfo [wwLazy] False }
1252       -- Note that Par is lazy to avoid that the sparked thing
1253       -- gets evaluted strictly, which it should *not* be
1254    has_side_effects = True
1255
1256 -- HWL: The first 4 Int# in all par... annotations denote:
1257 --   name, granularity info, size of result, degree of parallelism
1258 --      Same  structure as _seq_ i.e. returns Int#
1259 -- KSW: v, the second arg in parAt# and parAtForNow#, is used only to determine
1260 --   `the processor containing the expression v'; it is not evaluated
1261
1262 primop  ParGlobalOp  "parGlobal#"  GenPrimOp
1263    a -> Int# -> Int# -> Int# -> Int# -> b -> Int#
1264    with
1265    usage            = { mangle ParGlobalOp [mkO, mkP, mkP, mkP, mkP, mkM] mkM }
1266    has_side_effects = True
1267
1268 primop  ParLocalOp  "parLocal#"  GenPrimOp
1269    a -> Int# -> Int# -> Int# -> Int# -> b -> Int#
1270    with
1271    usage            = { mangle ParLocalOp [mkO, mkP, mkP, mkP, mkP, mkM] mkM }
1272    has_side_effects = True
1273
1274 primop  ParAtOp  "parAt#"  GenPrimOp
1275    b -> a -> Int# -> Int# -> Int# -> Int# -> c -> Int#
1276    with
1277    usage            = { mangle ParAtOp [mkO, mkZ, mkP, mkP, mkP, mkP, mkM] mkM }
1278    has_side_effects = True
1279
1280 primop  ParAtAbsOp  "parAtAbs#"  GenPrimOp
1281    a -> Int# -> Int# -> Int# -> Int# -> Int# -> b -> Int#
1282    with
1283    usage            = { mangle ParAtAbsOp [mkO, mkP, mkP, mkP, mkP, mkM] mkM }
1284    has_side_effects = True
1285
1286 primop  ParAtRelOp  "parAtRel#" GenPrimOp
1287    a -> Int# -> Int# -> Int# -> Int# -> Int# -> b -> Int#
1288    with
1289    usage            = { mangle ParAtRelOp [mkO, mkP, mkP, mkP, mkP, mkM] mkM }
1290    has_side_effects = True
1291
1292 primop  ParAtForNowOp  "parAtForNow#" GenPrimOp
1293    b -> a -> Int# -> Int# -> Int# -> Int# -> c -> Int#
1294    with
1295    usage            = { mangle ParAtForNowOp [mkO, mkZ, mkP, mkP, mkP, mkP, mkM] mkM }
1296    has_side_effects = True
1297
1298 -- copyable# and noFollow# have no corresponding entry in
1299 -- PrelGHC.hi-boot, so I don't know whether they should still
1300 -- be here or not.  JRS, 15 Jan 01
1301 -- not implemented; please, keep the comment as reminder -- HWL 12/3/01
1302 --
1303 --primop  CopyableOp  "copyable#" GenPrimOp
1304 --   a -> Int#
1305 --   with
1306 --   usage            = { mangle CopyableOp [mkZ] mkR }
1307 --   has_side_effects = True
1308 --
1309 --primop  NoFollowOp "noFollow#" GenPrimOp
1310 --   a -> Int#
1311 --   with
1312 --   usage            = { mangle NoFollowOp [mkZ] mkR }
1313 --   has_side_effects = True
1314
1315
1316 ------------------------------------------------------------------------
1317 --- tag to enum stuff                                                ---
1318 ------------------------------------------------------------------------
1319
1320 primop  DataToTagOp "dataToTag#" GenPrimOp
1321    a -> Int#
1322    with
1323    strictness = { \ arity -> StrictnessInfo [wwLazy] False }
1324
1325 primop  TagToEnumOp "tagToEnum#" GenPrimOp     
1326    Int# -> a
1327
1328
1329 thats_all_folks
1330
1331 ------------------------------------------------------------------------
1332 ---                                                                  ---
1333 ------------------------------------------------------------------------
1334