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

SCM Repository

[diderot] Diff of /branches/vis12/src/compiler/codegen/target-util.sml
ViewVC logotype

Diff of /branches/vis12/src/compiler/codegen/target-util.sml

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

revision 1705, Tue Mar 6 21:59:47 2012 UTC revision 1706, Wed Mar 7 12:06:48 2012 UTC
# Line 26  Line 26 
26          namespace : string option,      (* optional namespace prefix *)          namespace : string option,      (* optional namespace prefix *)
27          parallel : bool,                (* parallel components *)          parallel : bool,                (* parallel components *)
28          double : bool,                  (* true for double-precision candidates *)          double : bool,                  (* true for double-precision candidates *)
29            longint : bool,                 (* true for 64-bit integers (not currently used) *)
30          debug : bool                    (* true if debugging of the target is enabled *)          debug : bool                    (* true if debugging of the target is enabled *)
31        }        }
32    
33    (* convert a target specification to the name of the runtime library *)    (* convert a target specification to the name of the runtime library *)
34      fun runtimeName {exec, target, parallel, double, debug} = let      fun runtimeName (tgt : target_desc) = let
35            val l = if debug then ["-debug.o"] else [".o"]            val l = if #debug tgt then ["-debug.o"] else [".o"]
36            val l = if parallel then "-par"::l else l            val l = if #parallel tgt then "-par"::l else l
37            val p = if double then "-d" else "-f"            val p = if #double tgt then "-d" else "-f"
38            val t = (case target            val t = (case #target tgt
39                   of TARGET_C => "-c"                   of TARGET_C => "-c"
40                    | TARGET_CL => "-cl"                    | TARGET_CL => "-cl"
41                    | TARGET_CUDA => "-cuda"                    | TARGET_CUDA => "-cuda"
42                  (* end case *))                  (* end case *))
43            val lib = if exec then "-main" else "-rt"            val lib = if #exec tgt then "-main" else "-rt"
44            in            in
45              OS.Path.concat(              OS.Path.concat(
46                Paths.diderotLib,                Paths.diderotLib,
47                String.concat("diderot" :: lib :: t :: p :: l))                String.concat("diderot" :: lib :: t :: p :: l))
48            end            end
49    
50      (* return the CPP floating-point precision definition for the target *)
51        fun floatPrecisionDef (tgt : target_desc) = if #double tgt
52              then "DIDEROT_DOUBLE_PRECISION"
53              else "DIDEROT_SINGLE_PRECISION"
54    
55      (* return the CPP integer precision definition for the target *)
56        fun intPrecisionDef (tgt : target_desc) = if #longint tgt
57              then "DIDEROT_LONGINT"
58              else "DIDEROT_INT"
59    
60      (* return the CPP target definition for the target *)
61        fun targetDef (tgt : target_desc) = (case #target tgt
62               of TARGET_C => if #parallel tgt
63                    then "DIDEROT_TARGET_PARALLEL"
64                    else "DIDEROT_TARGET_C"
65                | TARGET_CL => "DIDEROT_TARGET_CL"
66                | TARGET_CUDA => "DIDEROT_TARGET_CUDA"
67              (* end case *))
68    
69    end    end

Legend:
Removed from v.1705  
changed lines
  Added in v.1706

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