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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/codegen/collect-info.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/codegen/collect-info.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3995, Sat Jun 18 20:00:19 2016 UTC revision 3996, Sun Jun 19 15:21:12 2016 UTC
# Line 3  Line 3 
3   * Collect information about the types and operations used in a program.  We need this   * Collect information about the types and operations used in a program.  We need this
4   * information to figure out what utility code to generate.   * information to figure out what utility code to generate.
5   *   *
6     * The types are ordered so that base types are first, followed by TensorRefTy, followed
7     * by TensorTy, followed by sequences and tuples.  Furthermore, the argument type of
8     * a sequence/
9     *
10   * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)   * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
11   *   *
12   * COPYRIGHT (c) 2016 The University of Chicago   * COPYRIGHT (c) 2016 The University of Chicago
# Line 247  Line 251 
251     *)     *)
252      val tySort = let      val tySort = let
253          (* partial ordering on types is defined by a "depth" metric *)          (* partial ordering on types is defined by a "depth" metric *)
254            fun depth (Ty.TupleTy tys) = 2 + List.foldl (fn (ty, d) => Int.max(depth ty, d)) 0 tys            fun depth (Ty.TupleTy tys) = 4 + List.foldl (fn (ty, d) => Int.max(depth ty, d)) 0 tys
255              | depth (Ty.SeqTy(ty, _)) = 2 + depth ty              | depth (Ty.SeqTy(ty, _)) = 4 + depth ty
256              | depth (Ty.TensorTy[]) = 0              | depth (Ty.TensorTy[]) = 0
257              | depth (Ty.TensorTy _) = 1              | depth (Ty.TensorRefTy _) = 1
258              | depth (Ty.ImageTy _) = 2              | depth (Ty.TensorTy _) = 2
259                | depth (Ty.ImageTy _) = 3
260              | depth _ = 0              | depth _ = 0
261            in            in
262              ListMergeSort.sort (fn ((ty1, _ : bool), (ty2, _)) => (depth ty1 > depth ty2))              ListMergeSort.sort (fn ((ty1, _ : bool), (ty2, _)) => (depth ty1 > depth ty2))

Legend:
Removed from v.3995  
changed lines
  Added in v.3996

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