[project @ 2000-08-21 13:34:06 by simonmar]
authorsimonmar <unknown>
Mon, 21 Aug 2000 13:34:06 +0000 (13:34 +0000)
committersimonmar <unknown>
Mon, 21 Aug 2000 13:34:06 +0000 (13:34 +0000)
- Add touch# and foreignObjToAddr#.

- Add a long comment to the beginning of this file listing the files
  that need to be updated when adding a new primop.

ghc/compiler/prelude/primops.txt

index 64e7864..8e505c8 100644 (file)
@@ -1,3 +1,29 @@
+-----------------------------------------------------------------------
+-- $Id: primops.txt,v 1.2 2000/08/21 13:34:06 simonmar Exp $
+--
+-- Primitive Operations
+--
+-----------------------------------------------------------------------
+
+-- To add a new primop, you currently need to update the following files:
+--
+--     - this file (ghc/compiler/prelude/primops.txt), which includes
+--       the type of the primop, and various other properties (its
+--       strictness attributes, whether it is defined as a macro
+--       or as out-of-line code, etc.)
+--
+--     - ghc/lib/std/PrelGHC.hi-boot, to declare the primop
+--
+--     - if the primop is inline (i.e. a macro), then:
+--             ghc/includes/PrimOps.h
+--             ghc/compiler/nativeGen/StixPrim.lhs
+--
+--     - or, for an out-of-line primop:
+--             ghc/includes/PrimOps.h (just add the declaration)
+--             ghc/rts/PrimOps.hc     (define it here)
+--
+--     - the User's Guide
+--
 
 -- The default attribute values which apply if you don't specify
 -- other ones.  Attribute values can be True, False, or arbitrary
@@ -15,7 +41,6 @@ defaults
    strictness       = { \ arity -> StrictnessInfo (replicate arity wwPrim) False }
    usage            = { nomangle other }
 
-
 ------------------------------------------------------------------------
 --- Addr#                                                            ---
 ------------------------------------------------------------------------
@@ -930,6 +955,14 @@ primop  WriteForeignObjOp "writeForeignObj#" GenPrimOp
    with
    has_side_effects = True
 
+primop ForeignObjToAddrOp "foreignObjToAddr#" GenPrimOp
+   ForeignObj# -> Addr#
+
+primop TouchOp "touch#" GenPrimOp
+   o -> State# RealWorld -> State# RealWorld
+   with
+   strictness       = { \ arity -> StrictnessInfo [wwLazy, wwPrim] False }
+
 ------------------------------------------------------------------------
 --- Bytecode objects                                                 ---
 ------------------------------------------------------------------------