ddc-core-salt-0.4.2.1: Disciplined Disciple Compiler C code generator.

Safe HaskellNone
LanguageHaskell98

DDC.Core.Salt.Transfer

Synopsis

Documentation

transferModule :: Module (AnTEC a Name) Name -> Either (Error (AnTEC a Name)) (Module (AnTEC a Name) Name) Source

Add control transfer primops to function bodies. For example:

     fun [x : Int32#] : Int32#
        = case ... of
                ...      -> add# [Int32] ...
                ...      -> fun x

  => fun [x : Int32#] : Int32#
        = case ... of
                ...      -> return# [Int32#] (add# [Int32] ...)
                ...      -> tailcall1# [Int32#] [Int32#] fun x
 

The control primops return tell us how to transfer control after we've finished with the current function.