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

SCM Repository

[diderot] View of /branches/vis15/src/compiler/gen/ir/high-ir.in
ViewVC logotype

View of /branches/vis15/src/compiler/gen/ir/high-ir.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3475 - (download) (annotate)
Wed Dec 2 18:48:58 2015 UTC (3 years, 8 months ago) by jhr
File size: 1892 byte(s)
working on merge
(* high-ir.sml
 *
 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 *
 * COPYRIGHT (c) 2015 The University of Chicago
 * All rights reserved.
 *
 * High-level version of the Diderot CFG IR
 *
 * Note: this file is generated from gen/ir/high-ir.spec and gen/ir/high-ir.in.
 *)

structure HighOps =
  struct

  (* required helper functions for types *)
    type ty = HighTypes.ty
    val samety = HighTypes.same
    val hashty = HighTypes.hash
    val tyToString = HighTypes.toString

  (* required helper functions for type lists *)
    type tys = ty list
    fun sametys (tys1, tys2) = ListPair.allEq samety (tys1, tys2)
    fun hashtys tys = List.foldl (fn (ty, s) => hashty ty + 0w3 * s) 0w0 tys
    fun tysToString tys = String.concat["[", String.concatWith "," (List.map tyToString tys), "]" ]

  (* required helper functions for the int type *)
    fun sameint (i1 : int, i2) = (i1 = i2)
    fun hashint i = Word.fromInt i
    fun intToString i = Int.toString i

  (* required helper functions for the string type *)
    fun samestring (s1 : string, s2) = (s1 = s2)
    val hashstring = HashString.hashString
    fun stringToString s = String.concat["\"", s, "\""]

  (* required helper functions for the mask type *)
    type mask = bool list
    val samemask : (mask * mask -> bool) = (op =)
    fun hashmask m =
	  List.foldl (fn (false, w) => w+w | (true, w) => w+w+0w1)
	    (Word.fromInt(List.length m)) m
    fun maskToString m =
	  String.concat(List.map (fn true => "_" | false => ":") m)

  (* required helper functions for the input type *)
    type input = ty Inputs.input
    val sameinput = Inputs.same
    val hashinput = Inputs.hash
    val inputToString = Inputs.toString

@BODY@

  end

structure HighIR = SSAFn(
  val ilName = "high-ir"
  structure Ty = HighTypes
  structure Op = HighOps)

structure HighCensus = CensusFn(HighIR)

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