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