GHC Trac Home
GHC Git Repos
Working on GHC
Mailing Lists & IRC
The GHC Team
All Feature Req's
Tickets I Created
Patches for review
New Feature Req
side by side
lines around each change
Show the changes in full context
White space changes
Sep 11, 2006 8:45:37 AM (
=== Inline !PrimOps ===
Inline !PrimOps are operations that can be compiled into a short sequence of code that never needs to allocate, block, or return to the scheduler for any reason. An inline !PrimOp is compiled directly into [wiki:Commentary/Compiler/Cmm Cmm] by the [wiki:Commentary/Compiler/CodeGen code generator]. The code for doing this is in [[GhcFile(compiler/codeGen/CgPrimOp.hs)]].
=== Out-of-line !PrimOps ===
All other !PrimOps are classified as out-of-line, and are implemented by hand-written C-- code in the file [[GhcFile(rts/PrimOps.cmm)]]. An out-of-line !PrimOp is like a Haskell function, except that
* !PrimOps cannot be partially applied. Calls to all !PrimOps are made at the correct arity; this is ensured by
the [wiki:Commentary/Compiler/CorePrep CorePrep] pass.
* Out-of-line !PrimOps have a special, fixed, [wiki:Commentary/Rts/HaskellExecution#CallingConvention calling convention]:
are in the [wiki:Commentary/Rts/HaskellExecution#Registers] registers] R1-R8. This is to make it easy to write the
C-- code for these !PrimOps: we don't have to write code for multiple calling conventions.
== Adding a new !PrimOp ==