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

SCM Repository

[diderot] View of /branches/vis15/src/compiler/target-cpu/gen-util.sml
ViewVC logotype

View of /branches/vis15/src/compiler/target-cpu/gen-util.sml

Parent Directory Parent Directory | Revision Log Revision Log

Revision 4364 - (download) (annotate)
Fri Aug 5 15:27:42 2016 UTC (3 years, 5 months ago) by jhr
File size: 1134 byte(s)
  working on merge: update FIXME list
(* gen-util.sml
 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 * COPYRIGHT (c) 2016 The University of Chicago
 * All rights reserved.

structure GenUtil : sig

  (* generate code for a block, where we optionally add a local variable that points
   * to the globals struct.
    val genBodyWithGlobPtr : CodeGenEnv.t * TreeIR.block -> CLang.stm

  end = struct

    structure IR = TreeIR
    structure Env = CodeGenEnv
    structure RN = CxxNames
    structure CL = CLang

    fun genBodyWithGlobPtr (env, IR.Block{locals, body}) = let
          fun mkBody env = let
                val stms = #2(TreeToCxx.trStms(env, body))
                val stms = if #hasGlobals(Env.target env)
                      then CL.mkDeclInit(
                          RN.globalPtrTy, RN.globalsVar,
                          CL.mkIndirect(CL.mkVar(Env.world env), "_globals")
                        ) :: stms
                      else stms
            TreeToCxx.trWithLocals (env, !locals, mkBody)


ViewVC Help
Powered by ViewVC 1.0.0