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 1002, Fri Nov 30 17:11:33 2001 UTC revision 1003, Fri Dec 7 02:45:32 2001 UTC
# Line 71  Line 71 
71       type arg  = {r1:CB.cell,r2:CB.cell,d:CB.cell}       type arg  = {r1:CB.cell,r2:CB.cell,d:CB.cell}
72       type argi = {r:CB.cell,i:int,d:CB.cell}       type argi = {r:CB.cell,i:int,d:CB.cell}
73    
74       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}
75       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}
76       fun slli{r,i,d} = [SLLI32{r=r,i=i,d=d}]       fun slli{r,i,d} = [I.INSTR(SLLI32{r=r,i=i,d=d})]
77       fun srli{r,i,d} = [SRLI32{r=r,i=i,d=d}]       fun srli{r,i,d} = [I.INSTR(SRLI32{r=r,i=i,d=d})]
78       fun srai{r,i,d} = [I.ARITHI{oper=I.SRAWI,rt=d,ra=r,im=I.ImmedOp i}]       fun srai{r,i,d} = [I.arithi{oper=I.SRAWI,rt=d,ra=r,im=I.ImmedOp i}]
79      )      )
80    
81    structure Mulu32 = Multiply32    structure Mulu32 = Multiply32
82      (val trapping = false      (val trapping = false
83       val multCost = multCost       val multCost = multCost
84       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}]
85       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}]
86       val sh1addv = NONE       val sh1addv = NONE
87       val sh2addv = NONE       val sh2addv = NONE
88       val sh3addv = NONE       val sh3addv = NONE
# Line 101  Line 101 
101      (val signed = true)      (val signed = true)
102    
103    fun selectInstructions    fun selectInstructions
104        (TS.S.STREAM{emit,comment,getAnnotations,        (TS.S.STREAM{emit=emitInstruction,comment,getAnnotations,
105                  defineLabel,entryLabel,pseudoOp,annotation,                  defineLabel,entryLabel,pseudoOp,annotation,
106                  beginCluster,endCluster,exitBlock,...}) =                  beginCluster,endCluster,exitBlock,...}) =
107    let (* mark an instruction with annotations *)    let
108          val emit = emitInstruction o I.INSTR
109    
110          (* mark an instruction with annotations *)
111        fun mark'(instr,[]) = instr        fun mark'(instr,[]) = instr
112          | mark'(instr,a::an) = mark'(I.ANNOTATION{i=instr,a=a},an)          | mark'(instr,a::an) = mark'(I.ANNOTATION{i=instr,a=a},an)
113        fun mark(instr,an) = emit(mark'(instr,an))        fun mark(instr,an) = emitInstruction(mark'(I.INSTR instr,an))
114    
115        (* Label where trap is generated.        (* Label where trap is generated.
116         * For overflow trapping instructions, we generate a branch         * For overflow trapping instructions, we generate a branch
# Line 485  Line 488 
488                    [mark'(                    [mark'(
489                       case commImmedOpnd signed16 (e1,e2) of                       case commImmedOpnd signed16 (e1,e2) of
490                         (ra,I.RegOp rb) =>                         (ra,I.RegOp rb) =>
491                           I.ARITH{oper=oper,ra=ra,rb=rb,rt=rt,OE=false,Rc=false}                           I.arith{oper=oper,ra=ra,rb=rb,rt=rt,OE=false,Rc=false}
492                       | (ra,im) => I.ARITHI{oper=operi,ra=ra,im=im,rt=rt},                       | (ra,im) => I.arithi{oper=operi,ra=ra,im=im,rt=rt},
493                       an)]                       an)]
494                fun const(e,i) =                fun const(e,i) =
495                    let val r = expr e                    let val r = expr e
# Line 498  Line 501 
501                     (_,T.LI i)   => const(e1,i)                     (_,T.LI i)   => const(e1,i)
502                   | (T.LI i,_)   => const(e2,i)                   | (T.LI i,_)   => const(e2,i)
503                   | _            => nonconst(e1,e2)                   | _            => nonconst(e1,e2)
504            in  app emit instrs end            in  app emitInstruction instrs end
505    
506        and divu32 x = Mulu32.divide{mode=T.TO_ZERO,stm=doStmt} x        and divu32 x = Mulu32.divide{mode=T.TO_ZERO,stm=doStmt} x
507    
# Line 513  Line 516 
516                    )                    )
517                fun const(e,i) =                fun const(e,i) =
518                    let val r = expr e                    let val r = expr e
519                    in  app emit (genDiv{r=r,i=toInt(i),d=rt})                    in  app emitInstruction (genDiv{r=r,i=toInt(i),d=rt})
520                        handle _ => nonconst(T.REG(ty,r),T.LI i)                        handle _ => nonconst(T.REG(ty,r),T.LI i)
521                    end                    end
522            in  case (e1,e2) of            in  case (e1,e2) of
# Line 686  Line 689 
689            | T.FMUL(64, e1, e2) => fbinary(I.FMUL, e1, e2, ft, an)            | T.FMUL(64, e1, e2) => fbinary(I.FMUL, e1, e2, ft, an)
690            | T.FDIV(64, e1, e2) => fbinary(I.FDIV, e1, e2, ft, an)            | T.FDIV(64, e1, e2) => fbinary(I.FDIV, e1, e2, ft, an)
691            | T.CVTI2F(64,_,e) =>            | T.CVTI2F(64,_,e) =>
692                 app emit (PseudoInstrs.cvti2d{reg=expr e,fd=ft})                 app emitInstruction (PseudoInstrs.cvti2d{reg=expr e,fd=ft})
693    
694              (* Single/double precision support *)              (* Single/double precision support *)
695            | T.FABS((32|64), e) => funary(I.FABS, e, ft, an)            | T.FABS((32|64), e) => funary(I.FABS, e, ft, an)

Legend:
Removed from v.1002  
changed lines
  Added in v.1003

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