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

SCM Repository

[diderot] Diff of /branches/pure-cfg/src/compiler/c-target/runtime-names.sml
ViewVC logotype

Diff of /branches/pure-cfg/src/compiler/c-target/runtime-names.sml

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

revision 832, Sun Apr 17 19:54:58 2011 UTC revision 833, Sun Apr 17 20:00:11 2011 UTC
# Line 8  Line 8 
8    struct    struct
9    
10      local      local
11          structure Ty = TreeIL.Ty
12        structure F = Format        structure F = Format
13      in      in
14    
# Line 38  Line 39 
39              gIntSuffix := "i";              gIntSuffix := "i";
40              gIntFormat := "%d")              gIntFormat := "%d")
41    
42        fun addRealSuffix stem = stem ^ !gRealSuffix
43      fun addVecSuffix stem n = concat[stem, Int.toString n, !gRealSuffix]      fun addVecSuffix stem n = concat[stem, Int.toString n, !gRealSuffix]
44      fun addIVecSuffix stem n = concat[stem, Int.toString n, !gIntSuffix]      fun addIVecSuffix stem n = concat[stem, Int.toString n, !gIntSuffix]
45    
46      fun addTySuffix (stem, TargetTy.T_Real) = stem ^ !gRealSuffix      fun addTySuffix (stem, 0) = stem ^ !gRealSuffix
47        | addTySuffix (stem, TargetTy.T_Vec n) = addVecSuffix stem n        | addTySuffix (stem, n) = addVecSuffix stem n
       | addTySuffix (stem, ty) = raise Fail(concat["invalid type ", TargetTy.toString ty, " for ", stem])  
48    
49      fun vecTy n = concat["vec", Int.toString n, !gRealSuffix, "_t"]      fun vecTy n = concat["vec", Int.toString n, !gRealSuffix, "_t"]
50      fun ivecTy n = concat["vec", Int.toString n, !gIntSuffix, "_t"]      fun ivecTy n = concat["vec", Int.toString n, !gIntSuffix, "_t"]
# Line 60  Line 61 
61      val strands = "Diderot_Strands"      val strands = "Diderot_Strands"
62    
63    (* scalar math functions *)    (* scalar math functions *)
64      fun max ty = addTySuffix ("max", ty)      fun max () = addRealSuffix "max"
65      fun min ty = addTySuffix ("min", ty)      fun min () = addRealSuffix "min"
66        fun fabs () = addRealSuffix "fabs"
67    
68    (* lerp *)    (* lerp *)
69      fun lerp 0 = "lerp" ^ !gRealSuffix      fun lerp n = addTySuffix("lerp", n)
       | lerp n = concat["lerp", Int.toString n, !gRealSuffix]  
70    
71    (* vector math functions *)    (* vector math functions *)
72      val mkVec = addVecSuffix "vec"      val mkVec = addVecSuffix "vec"
# Line 104  Line 105 
105      val inState = "Diderot_InState"      val inState = "Diderot_InState"
106    
107      fun input ty = (case ty      fun input ty = (case ty
108             of TargetTy.T_String => "Diderot_InputString"             of Ty.StringTy => "Diderot_InputString"
109              | TargetTy.T_Real => "Diderot_Input" ^ !gRealSuffix              | Ty.TensorTy[] => "Diderot_Input" ^ !gRealSuffix
110              | TargetTy.T_Vec 3 => "Diderot_InputVec3" ^ !gRealSuffix              | Ty.TensorTy[3] => "Diderot_InputVec3" ^ !gRealSuffix
111              | ty => raise Fail("unsupported input type " ^ TargetTy.toString ty)              | ty => raise Fail("unsupported input type " ^ Ty.toString ty)
112            (* end case *))            (* end case *))
113    
114      end (* local *)      end (* local *)

Legend:
Removed from v.832  
changed lines
  Added in v.833

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