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

SCM Repository

[smlnj] Diff of /sml/trunk/src/MLRISC/ppc/mltree/ppc.sml
ViewVC logotype

Diff of /sml/trunk/src/MLRISC/ppc/mltree/ppc.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 411, Fri Sep 3 00:25:03 1999 UTC revision 429, Wed Sep 8 09:47:00 1999 UTC
# Line 14  Line 14 
14          and type fcond         = MLTreeBasis.fcond          and type fcond         = MLTreeBasis.fcond
15          and type ext           = MLTreeBasis.ext          and type ext           = MLTreeBasis.ext
16          and type rounding_mode = MLTreeBasis.rounding_mode          and type rounding_mode = MLTreeBasis.rounding_mode
    structure Stream : INSTRUCTION_STREAM  
      where B = PPCMLTree.BNames  
        and P = PPCMLTree.PseudoOp  
17     structure PseudoInstrs : PPC_PSEUDO_INSTR     structure PseudoInstrs : PPC_PSEUDO_INSTR
18        where I = PPCInstr        where I = PPCInstr
19    
# Line 33  Line 30 
30    ) : MLTREECOMP =    ) : MLTREECOMP =
31  struct  struct
32    structure I   = PPCInstr    structure I   = PPCInstr
   structure S   = Stream  
33    structure T   = PPCMLTree    structure T   = PPCMLTree
34      structure S   = T.Stream
35    structure C   = PPCInstr.C    structure C   = PPCInstr.C
36    structure LE  = LabelExp    structure LE  = LabelExp
37    structure W32 = Word32    structure W32 = Word32
# Line 44  Line 41 
41    structure Gen = MLTreeGen    structure Gen = MLTreeGen
42      (structure T = T      (structure T = T
43       val (intTy,naturalWidths) = if bit64mode then (64,[32,64]) else (32,[32])       val (intTy,naturalWidths) = if bit64mode then (64,[32,64]) else (32,[32])
44         datatype rep = SE | ZE | NEITHER
45         val rep = NEITHER
46      )      )
47    
48    (*    (*
# Line 67  Line 66 
66      (structure I = I      (structure I = I
67       structure T = T       structure T = T
68       val intTy = 32       val intTy = 32
69       type arg  = {r1:C.register,r2:C.register,d:C.register}       type arg  = {r1:C.cell,r2:C.cell,d:C.cell}
70       type argi = {r:C.register,i:int,d:C.register}       type argi = {r:C.cell,i:int,d:C.cell}
71    
72       fun mov{r,d} = I.COPY{dst=[d],src=[r],tmp=NONE,impl=ref NONE}       fun mov{r,d} = I.COPY{dst=[d],src=[r],tmp=NONE,impl=ref NONE}
73       fun add{r1,r2,d}= I.ARITH{oper=I.ADD,ra=r1,rb=r2,rt=d,Rc=false,OE=false}       fun add{r1,r2,d}= I.ARITH{oper=I.ADD,ra=r1,rb=r2,rt=d,Rc=false,OE=false}
# Line 79  Line 78 
78    
79    structure Mulu32 = Multiply32    structure Mulu32 = Multiply32
80      (val trapping = false      (val trapping = false
      val signed   = false  
81       val multCost = multCost       val multCost = multCost
82       fun addv{r1,r2,d}=[I.ARITH{oper=I.ADD,ra=r1,rb=r2,rt=d,Rc=false,OE=false}]       fun addv{r1,r2,d}=[I.ARITH{oper=I.ADD,ra=r1,rb=r2,rt=d,Rc=false,OE=false}]
83       fun subv{r1,r2,d}=[I.ARITH{oper=I.SUBF,ra=r2,rb=r1,rt=d,Rc=false,OE=false}]       fun subv{r1,r2,d}=[I.ARITH{oper=I.SUBF,ra=r2,rb=r1,rt=d,Rc=false,OE=false}]
# Line 87  Line 85 
85       val sh2addv = NONE       val sh2addv = NONE
86       val sh3addv = NONE       val sh3addv = NONE
87      )      )
88        (val signed = false)
89    
90    structure Mult32 = Multiply32    structure Mult32 = Multiply32
91      (val trapping = true      (val trapping = true
      val signed   = true  
92       val multCost = multCost       val multCost = multCost
93       fun addv{r1,r2,d} = error "Mult32.addv"       fun addv{r1,r2,d} = error "Mult32.addv"
94       fun subv{r1,r2,d} = error "Mult32.subv"       fun subv{r1,r2,d} = error "Mult32.subv"
# Line 98  Line 96 
96       val sh2addv = NONE       val sh2addv = NONE
97       val sh3addv = NONE       val sh3addv = NONE
98      )      )
99        (val signed = true)
100    
101    fun selectInstructions    fun selectInstructions
102        (S.STREAM{emit,defineLabel,entryLabel,blockName,pseudoOp,annotation,        (S.STREAM{emit,comment,
103                  init,finish,exitBlock,...}) =                  defineLabel,entryLabel,blockName,pseudoOp,annotation,
104    let val emit = emit(fn r => r)                  beginCluster,endCluster,exitBlock,phi,alias,...}) =
105      let (* mark an instruction with annotations *)
       (* mark an instruction with annotations *)  
106        fun mark'(instr,[]) = instr        fun mark'(instr,[]) = instr
107          | mark'(instr,a::an) = mark'(I.ANNOTATION{i=instr,a=a},an)          | mark'(instr,a::an) = mark'(I.ANNOTATION{i=instr,a=a},an)
108        fun mark(instr,an) = emit(mark'(instr,an))        fun mark(instr,an) = emit(mark'(instr,an))
# Line 718  Line 716 
716    
717        and emitTrap() = emit(I.TW{to=31,ra=0,si=I.ImmedOp 0})        and emitTrap() = emit(I.TW{to=31,ra=0,si=I.ImmedOp 0})
718    
719        fun mltreeComp(T.PSEUDO_OP pOp)    = pseudoOp pOp          val beginCluster = fn _ => (trapLabel := NONE; beginCluster(0))
720          | mltreeComp(T.DEFINELABEL lab)  = defineLabel lab          val endCluster = fn a =>
         | mltreeComp(T.ENTRYLABEL lab)   = entryLabel lab  
         | mltreeComp(T.BEGINCLUSTER)     = (init(0); trapLabel := NONE)  
         | mltreeComp(T.CODE stms)        = app doStmt stms  
         | mltreeComp(T.BLOCK_NAME name)  = blockName name  
         | mltreeComp(T.BLOCK_ANNOTATION a) = annotation a  
         | mltreeComp(T.ENDCLUSTER regmap)=  
721             (case !trapLabel of             (case !trapLabel of
722                SOME label =>                SOME label =>
723                (defineLabel label; emitTrap(); trapLabel := NONE)                (defineLabel label; emitTrap(); trapLabel := NONE)
724              | NONE => ();              | NONE => ();
725             finish regmap)             endCluster a)
726          | mltreeComp(T.ESCAPEBLOCK regs) = exitBlock regs     in  S.STREAM
727          | mltreeComp _ = error "mltreeComp"         { beginCluster = beginCluster,
728     in           endCluster   = endCluster,
729         { mltreeComp = mltreeComp,           emit         = doStmt,
730           mlriscComp = doStmt,           pseudoOp     = pseudoOp,
731           emitInstr  = emit           defineLabel  = defineLabel,
732             entryLabel   = entryLabel,
733             blockName    = blockName,
734             comment      = comment,
735             annotation   = annotation,
736             exitBlock    = exitBlock,
737             alias        = alias,
738             phi          = phi
739         }         }
740     end     end
741    

Legend:
Removed from v.411  
changed lines
  Added in v.429

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