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/Tools/MDL/mdl-gen-instr.sml
ViewVC logotype

View of /sml/trunk/src/MLRISC/Tools/MDL/mdl-gen-instr.sml

Parent Directory Parent Directory | Revision Log Revision Log

Revision 984 - (download) (annotate)
Wed Nov 21 19:00:08 2001 UTC (18 years, 7 months ago) by george
File size: 1832 byte(s)
  Implemented a complete redesign of MLRISC pseudo-ops. Now there
  ought to never be any question of incompatabilities with
  pseudo-op syntax expected by host assemblers.

  For now, only modules supporting GAS syntax are implemented
  but more should follow, such as MASM, and vendor assembler
  syntax, e.g. IBM as, Sun as, etc.
 * Generate the <arch>Instr signature and functor.
 * This structure contains the definition of the instruction set.

functor MDLGenInstr(Comp : MDL_COMPILE) : MDL_GEN_MODULE =

   structure Ast  = Comp.Ast
   structure Comp = Comp

   open Ast Comp.Util

   fun gen md =
   let (* name of the structure/signature *)
       val strName = Comp.strname md "Instr"  
       val sigName = Comp.signame md "INSTR"

       (* The datatype that defines the instruction set *)
       val instrDatatype =
             ([DATATYPE("instruction",[],Comp.instructions md)],[])

       (* Arguments to the instruction functor *)
       val args = ["T: MLTREE"] 

       (* The signature *)
       val sigBody =
          [$ ["structure C : "^Comp.signame md "CELLS",
              "structure T : MLTREE",
              "structure Constant: CONSTANT",
              "structure Region : REGION",
              "   sharing Constant = T.Constant",
              "   sharing Region = T.Region"
           Comp.typeOf md "Instruction",

       (* The functor *)
       val strBody = 
           [$ ["structure C = "^Comp.strname md "Cells",
               "structure T = T",
               "structure Region = T.Region",
               "structure Constant = T.Constant"
            Comp.declOf md "Instruction",

       val _ = Comp.require md "Instruction"
                  {types =["ea","operand", "addressing_mode"],

   in  Comp.codegen md "instructions/Instr"
         [Comp.mkSig md "INSTR" (map Comp.Trans.stripMarks sigBody),
          Comp.mkFct md "Instr" args sigName 
                (map Comp.Trans.stripMarks strBody)

ViewVC Help
Powered by ViewVC 1.0.0