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/mid-ir.in
ViewVC logotype

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3886 - (download) (annotate)
Fri May 20 15:10:11 2016 UTC (5 years, 1 month ago) by jhr
File size: 1761 byte(s)
working on merge
(* mid-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.
 *
 * Middle-level version of the Diderot CFG IR
 *
 * Note: this file is generated from gen/ir/mid-ir.spec and gen/ir/mid-ir.in.
 *)

structure MidOps =
  struct

  (* required helper functions for types *)
    type ty = MidTypes.ty
    val samety = MidTypes.same
    val hashty = MidTypes.hash
    val tyToString = MidTypes.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.concatWithMap "," 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 shape type *)
    type shape = TensorShape.t
    val sameshape = TensorShape.same
    val hashshape = TensorShape.hash
    val shapeToString = TensorShape.toString

  (* required helper functions for the index control type type *)
    type idxctl = IndexCtl.t
    val sameidxctl = IndexCtl.same
    val hashidxctl = IndexCtl.hash
    val idxctlToString = IndexCtl.toString

@BODY@

  end

structure MidIR = SSAFn(
  val irName = "mid-ir"
  structure Ty = MidTypes
  structure Op = MidOps)

structure MidCensus = CensusFn(MidIR)

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