Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /sml/trunk/src/MLRISC/IR/mlrisc-cfg-gen2.sml
ViewVC logotype

View of /sml/trunk/src/MLRISC/IR/mlrisc-cfg-gen2.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 651 - (download) (annotate)
Thu Jun 1 18:34:03 2000 UTC (19 years, 3 months ago) by monnier
File size: 1863 byte(s)
bring revisions from the vendor branch to the trunk
(*
 * This module builds a CFG from a stream of instructions.
 * We use the FLOWGRPAH_GEN interface here, which is the 
 * default interface used by the core MLRISC.
 *
 * -- Allen
 *)

functor CFGGen
  (structure CFG : CONTROL_FLOW_GRAPH
   structure InsnProps : INSN_PROPERTIES
   structure MLTree : MLTREE
     sharing CFG.I = InsnProps.I
     sharing MLTree.Constant = InsnProps.I.Constant
     sharing MLTree.PseudoOp = CFG.P 
  ) : FLOWGRAPH_GEN =
struct

   structure I = CFG.I
   structure C = I.C
   structure S = MLTree.Stream
   structure T = MLTree
   structure P = CFG.P
   structure Builder = ControlFlowGraphGen
     (structure CFG = CFG
      structure Stream = S
      structure InsnProps = InsnProps
     )

   type flowgraph = CFG.cfg

   fun newStream{compile,flowgraph} =
   let val cfg = ref(case flowgraph of
                       NONE => CFG.new(I.C.regmap())
                     | SOME cfg => cfg
                    )
       val {stream,next} = Builder.builder(!cfg)
       val S.STREAM{beginCluster,endCluster,pseudoOp,emit,exitBlock,
                    comment,annotation,defineLabel,entryLabel,alias,phi,...} 
                      = stream
       fun endCFG a = 
       let val _      = endCluster a
           val oldCFG = !cfg
           val newCFG = CFG.new(I.C.regmap())
       in  cfg := newCFG;
           next newCFG;
           compile oldCFG
       end 

   in  S.STREAM{beginCluster= beginCluster,
                endCluster  = endCFG,
                pseudoOp    = pseudoOp,
                emit        = emit,
                exitBlock   = exitBlock,
                comment     = comment,
                annotation  = annotation,
                defineLabel = defineLabel,
                entryLabel  = entryLabel,
                alias       = alias,
                phi         = phi
               }
   end

end


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