Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Annotation of /branches/vis15/src/compiler/cfg-ir/exit-kind.sml
ViewVC logotype

Annotation of /branches/vis15/src/compiler/cfg-ir/exit-kind.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5286 - (view) (download)

1 : jhr 3470 (* exit-kind.sml
2 :     *
3 :     * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
4 :     *
5 : jhr 5286 * COPYRIGHT (c) 2017 The University of Chicago
6 : jhr 3470 * All rights reserved.
7 :     *
8 :     * The CFG representation has different kinds of exits, depending on the
9 :     * context and operation.
10 :     *)
11 :    
12 :     structure ExitKind =
13 :     struct
14 :    
15 : jhr 4164 datatype 'var kind
16 :     = RETURN of 'var option (* return from function/method *)
17 : jhr 3470 | ACTIVE (* normal return from update method *)
18 :     | STABILIZE (* stabilize in update method *)
19 :     | DIE (* die in update method *)
20 : jhr 5286 | NEXTSTEP (* continue in global update *)
21 : jhr 3470 | UNREACHABLE (* dummy exit node that is unreachable *)
22 :    
23 : jhr 4164 fun map f exit = (case exit
24 : jhr 4317 of RETURN NONE => RETURN NONE
25 :     | RETURN(SOME x) => RETURN(SOME(f x))
26 :     | ACTIVE => ACTIVE
27 :     | STABILIZE => STABILIZE
28 :     | DIE => DIE
29 : jhr 5286 | NEXTSTEP => NEXTSTEP
30 : jhr 4317 | UNREACHABLE => UNREACHABLE
31 :     (* end case *))
32 : jhr 3470
33 : jhr 4164 fun toString v2s exit = (case exit
34 : jhr 4317 of RETURN NONE => "RETURN"
35 :     | RETURN(SOME x) => concat["RETURN(", v2s x, ")"]
36 :     | ACTIVE => "ACTIVE"
37 :     | STABILIZE => "STABILIZE"
38 :     | DIE => "DIE"
39 : jhr 5286 | NEXTSTEP => "NEXTSTEP"
40 : jhr 4317 | UNREACHABLE => "UNREACHABLE"
41 :     (* end case *))
42 : jhr 4164
43 : jhr 3470 end

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0