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