1%if false
2  Copyright (c) 2009 ETH Zurich.
3  All rights reserved.
4
5  This file is distributed under the terms in the attached LICENSE file.
6  If you do not find this file, copies can be found by writing to:
7  ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
8%endif
9
10%include polycode.fmt
11
12%if false
13
14> module Libbarrelfish.MemToPhys where
15
16> import Semantics
17> import Constructs
18> import PureExpressions
19> import {-# SOURCE #-} Expressions
20
21> import IL.FoF.FoF
22> import IL.FoF.Compile
23> import IL.FoF.Run
24
25%endif
26
27\section{Mem To Phys}
28
29This construct embeds the libarrelfish function @mem_to_phys@ into FoF.
30
31
32\subsection{Smart Constructors}
33
34As for |HasDescendants|, both named and anonymous function are
35provided. They are direct wrappers around the @mem_to_phys@ function.
36
37> mem_to_phys :: PureExpr -> FoFCode PureExpr
38> mem_to_phys cte = inject (MemToPhys Nothing cte return)
39>
40> mem_to_physN :: String -> PureExpr -> FoFCode PureExpr
41> mem_to_physN name cte = inject (MemToPhys (Just name) cte return)
42
43\subsection{Compile Instantiation}
44
45Compiling is straightforward: just declare a foreign function.
46
47> compileMemToPhys (MemToPhys mName arg r) binding = 
48>     let (loc, binding1) = getFreshVar binding in
49>     let name = case mName of
50>                  Just x -> Provided x
51>                  Nothing -> makeVarName Local loc in
52>     let ref = CLRef Local uint64T name in
53>     let (cont, binding2) = r ref binding1 in
54>     (FStatement (FFFICall "mem_to_phys" [ref, arg]) cont,
55>      binding2)
56
57
58\subsection{Run Instantiation}
59
60However, the semantics remains to be defined.
61
62> runMemToPhys (MemToPhys _ a r) heap = error "MemToPhys: eval not implemented"
63