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 /MLRISC/trunk/sparc/instructions/sparccomp-instr-ext.sml
ViewVC logotype

View of /MLRISC/trunk/sparc/instructions/sparccomp-instr-ext.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3185 - (download) (annotate)
Tue Aug 5 22:40:13 2008 UTC (10 years, 7 months ago) by mrainey
File size: 1593 byte(s)
  Added synthetic instructions: save and restore.
(* sparccomp-instr-ext.sml
 *
 * COPYRIGHT (c) 2001 Bell Labs, Lucent Technologies
 *
 * compiling a trivial extensions to the Sparc instruction set
 * (UNIMP instruction)
 *)
signature SPARCCOMP_INSTR_EXT = sig
    structure T : MLTREE
    structure I : SPARCINSTR
    		where T = T
    structure TS : MLTREE_STREAM
		where T = I.T
    structure CFG : CONTROL_FLOW_GRAPH 
    		where I = I 


    type reducer =
	 (I.instruction, I.C.cellset, I.operand, I.addressing_mode, CFG.cfg) TS.reducer

    val compileSext :
	reducer
	-> { stm: (T.stm, T.rexp, T.fexp, T.ccexp) SparcInstrExt.sext,
	     an: T.an list }
	-> unit
end

functor SparcCompInstrExt 
  (structure I   : SPARCINSTR
   structure TS  : MLTREE_STREAM
		where T = I.T
   structure CFG : CONTROL_FLOW_GRAPH 
   		where I = I
                  and P = TS.S.P
  ) : SPARCCOMP_INSTR_EXT = 
struct
    structure CFG = CFG
    structure T = TS.T
    structure TS = TS
    structure I = I
    structure C = I.C
    structure X = SparcInstrExt

    type stm = (T.stm, T.rexp, T.fexp, T.ccexp) X.sext

    type reducer =
	 (I.instruction, I.C.cellset, I.operand, I.addressing_mode, CFG.cfg) TS.reducer

    fun compileSext reducer { stm: stm, an: T.an list } = let
	val TS.REDUCER { emit, operand, reduceOperand, ... } = reducer
    in
	case stm 
	 of X.UNIMP i => emit (I.unimp {const22 = i}, an)
	  | X.SAVE (r, i, d) => emit(I.save{r=reduceOperand(operand r), i=operand i, d=reduceOperand(operand d)}, an)
	  | X.RESTORE (r, i, d) => emit(I.restore{r=reduceOperand(operand r), i=operand i, d=reduceOperand(operand d)}, an)
    end
end

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