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

SCM Repository

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

View of /branches/lamont/src/compiler/codegen/target-util.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1704 - (download) (annotate)
Tue Mar 6 15:44:37 2012 UTC (7 years, 7 months ago) by jhr
Original Path: branches/vis12/src/compiler/codegen/target-util.sml
File size: 1197 byte(s)
  Working on adding library support to compiler
(* 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 *)

    type target_desc = {
	exec : bool,		(* generate standalone executable? *)
	target : target,	(* target platform *)
	parallel : bool,	(* parallel components *)
	double : bool,		(* true for double-precision candidates *)
	debug : bool		(* true if debugging of the target is enabled *)
      }

  (* convert a target specification to the name of the runtime library *)
    fun runtimeName {exec, target, parallel, double, debug} = let
	  val l = if debug then ["-debug.o"] else [".o"]
	  val l = if parallel then "-par"::l else l
	  val p = if double then "-d" else "-f"
	  val t = (case target
		 of TARGET_C => "-c"
		  | TARGET_CL => "-cl"
		  | TARGET_CUDA => "-cuda"
		(* end case *))
	  val lib = if exec then "-main" else "-rt"
	  in
	    OS.Path.concat(
	      Paths.diderotLib,
	      String.concat("diderot" :: lib :: t :: p :: l))
	  end

  end

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