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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5286 - (download) (annotate)
Thu Aug 10 17:53:04 2017 UTC (3 years, 1 month ago) by jhr
File size: 1412 byte(s)
  bug fix for "continue" in global updates.
(* exit-kind.sml
 *
 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 *
 * COPYRIGHT (c) 2017 The University of Chicago
 * All rights reserved.
 *
 * The CFG representation has different kinds of exits, depending on the
 * context and operation.
 *)

structure ExitKind =
  struct

    datatype 'var kind
      = RETURN of 'var option   (* return from function/method *)
      | ACTIVE                  (* normal return from update method *)
      | STABILIZE               (* stabilize in update method *)
      | DIE                     (* die in update method *)
      | NEXTSTEP                (* continue in global update *)
      | UNREACHABLE             (* dummy exit node that is unreachable *)

    fun map f exit = (case exit
           of RETURN NONE => RETURN NONE
            | RETURN(SOME x) => RETURN(SOME(f x))
            | ACTIVE => ACTIVE
            | STABILIZE => STABILIZE
            | DIE => DIE
            | NEXTSTEP => NEXTSTEP
            | UNREACHABLE => UNREACHABLE
          (* end case *))

    fun toString v2s exit = (case exit
           of RETURN NONE => "RETURN"
            | RETURN(SOME x) => concat["RETURN(", v2s x, ")"]
            | ACTIVE => "ACTIVE"
            | STABILIZE => "STABILIZE"
            | DIE => "DIE"
            | NEXTSTEP => "NEXTSTEP"
            | UNREACHABLE => "UNREACHABLE"
          (* end case *))

  end

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