Changes between Version 6 and Version 7 of Commentary/PrimOps


Ignore:
Timestamp:
Sep 11, 2006 9:31:19 AM (9 years ago)
Author:
simonmar
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/PrimOps

    v6 v7  
    11
     2[[PageOutline]]
    23
    34= Primitive Operations (!PrimOps) =
     
    6263
    6364== Adding a new !PrimOp ==
     65
     66To add a new primop, you currently need to update the following files:
     67
     68 * [[GhcFile(compiler/prelude/primops.txt.pp)]], which includes the
     69   type of the primop, and various other properties.  Syntax and
     70   examples are in the file.
     71
     72 * if the primop is inline, then:
     73   [[GhcFile(compiler/codeGen/CgPrimOp.hs)]] defines the translation of
     74   the primop into {{{Cmm}}}.
     75               
     76 * for an out-of-line primop:
     77   * [[GhcFile(includes/StgMiscClosures.h)]] (just add the declaration),
     78   * [[GhcFile(rts/PrimOps.cmm)]] (implement it here)
     79   * [[GhcFile(rts/Linker.c)]] (declare the symbol for GHCi)
     80
     81See also AddingNewPrimitiveOperations, a blow-by-blow description of the process for adding a new out-of-line primop from someone who went through the process.