SCM Repository
View of /branches/vis12/src/compiler/codegen/target-util.sml
Parent Directory
|
Revision Log
Revision 2078 -
(download)
(annotate)
Mon Nov 5 12:00:48 2012 UTC (8 years, 2 months ago) by jhr
File size: 2389 byte(s)
Mon Nov 5 12:00:48 2012 UTC (8 years, 2 months ago) by jhr
File size: 2389 byte(s)
added flag to force BSP semantics even when the program would allow a faster implementation
(* target-util.sml * * COPYRIGHT (c) 2012 The Diderot Project (http://diderot-language.cs.uchicago.edu) * All rights reserved. * * Utility support for target selection, etc. *) structure TargetUtil = struct datatype target = TARGET_C (* C code *) | TARGET_CL (* C + OpenCL *) | TARGET_CUDA (* C + CUDA *) (* the target descriptor collects together the information specified on the Diderot * compiler's command-line. *) type target_desc = { srcFile : string, (* source filename *) outDir : string, (* directory to put output *) outBase : string, (* basename for output or name of executable *) exec : bool, (* generate standalone executable? *) snapshot : bool, (* generate functions to get snapshot *) target : target, (* target platform *) namespace : string, (* optional namespace prefix *) parallel : bool, (* parallel components *) double : bool, (* true for double-precision candidates *) longint : bool, (* true for 64-bit integers (not currently used) *) debug : bool, (* true if debugging of the target is enabled *) bsp : bool (* true if BSP style execution should always be used *) } (* convert a target specification to the name of the runtime library *) fun runtimeName (tgt : target_desc) = let val l = if #debug tgt then ["-debug.o"] else [".o"] val l = if #parallel tgt then "-par"::l else l val p = if #double tgt then "-d" else "-f" val t = (case #target tgt of TARGET_C => "-c" | TARGET_CL => "-cl" | TARGET_CUDA => "-cuda" (* end case *)) in OS.Path.concat( Paths.diderotLib, String.concat("diderot-rt" :: t :: p :: l)) end (* return the CPP floating-point precision definition for the target *) fun floatPrecisionDef (tgt : target_desc) = if #double tgt then "DIDEROT_DOUBLE_PRECISION" else "DIDEROT_SINGLE_PRECISION" (* return the CPP integer precision definition for the target *) fun intPrecisionDef (tgt : target_desc) = if #longint tgt then "DIDEROT_LONGINT" else "DIDEROT_INT" (* return the CPP target definition for the target *) fun targetDef (tgt : target_desc) = (case #target tgt of TARGET_C => if #parallel tgt then "DIDEROT_TARGET_PARALLEL" else "DIDEROT_TARGET_C" | TARGET_CL => "DIDEROT_TARGET_CL" | TARGET_CUDA => "DIDEROT_TARGET_CUDA" (* end case *)) end
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |