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

SCM Repository

[diderot] View of /trunk/src/compiler/mid-il/mid-il-types.sml
ViewVC logotype

View of /trunk/src/compiler/mid-il/mid-il-types.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 435 - (download) (annotate)
Tue Oct 19 13:14:20 2010 UTC (8 years, 9 months ago) by jhr
File size: 1048 byte(s)
  Upated URL in header to diderot-language.cs.uchicago.edu
(* mid-il-types.sml
 *
 * COPYRIGHT (c) 2010 The Diderot Project (http://diderot-language.cs.uchicago.edu)
 * All rights reserved.
 *
 * Types for the MidIL.
 *)

structure MidILTypes =
  struct

    datatype ty
      = BoolTy | StringTy
      | IVecTy of int		(* integers; both scalars and vectors *)
      | VecTy of int		(* reals; both scalars and vectors *)
      | AddrTy			(* voxel address *)
      | ImageTy

    val intTy = IVecTy 1
    val realTy = VecTy 1

    fun same (ty1 : ty, ty2) = (ty1 = ty2)

    fun hash BoolTy = 0w1
      | hash StringTy = 0w2
      | hash (IVecTy d) = 0w7 * Word.fromInt d + 0w3
      | hash (VecTy d) = 0w11 * Word.fromInt d + 0w4
      | hash AddrTy = 0w5
      | hash ImageTy = 0w6

    fun toString BoolTy = "bool"
      | toString StringTy = "string"
      | toString (IVecTy 1) = "int"
      | toString (IVecTy d) = "int" ^ Int.toString d
      | toString (VecTy 1) = "real"
      | toString (VecTy d) = "real" ^ Int.toString d
      | toString AddrTy = "addr"
      | toString ImageTy = "image"

  end

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