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/branches/SMLNJ/src/MLRISC/sparc/mltree/sparc.sml
ViewVC logotype

Diff of /sml/branches/SMLNJ/src/MLRISC/sparc/mltree/sparc.sml

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

revision 474, Wed Nov 10 22:59:58 1999 UTC revision 475, Wed Nov 10 22:59:58 1999 UTC
# Line 12  Line 12 
12  functor Sparc  functor Sparc
13    (structure SparcInstr : SPARCINSTR    (structure SparcInstr : SPARCINSTR
14     structure SparcMLTree : MLTREE     structure SparcMLTree : MLTREE
       where Region = SparcInstr.Region  
         and Constant = SparcInstr.Constant  
         and type cond = MLTreeBasis.cond  
         and type fcond = MLTreeBasis.fcond  
         and type rounding_mode = MLTreeBasis.rounding_mode  
15     structure PseudoInstrs : SPARC_PSEUDO_INSTR     structure PseudoInstrs : SPARC_PSEUDO_INSTR
16        where I = SparcInstr        sharing SparcMLTree.Region = SparcInstr.Region
17          sharing SparcMLTree.Constant = SparcInstr.Constant
18          sharing PseudoInstrs.I = SparcInstr
19     (*     (*
20      * The client should also specify these parameters.      * The client should also specify these parameters.
21      * These are the estimated cost of these instructions.      * These are the estimated cost of these instructions.
# Line 203  Line 200 
200          | fcond T.?<= = I.FBULE          | fcond T.?<= = I.FBULE
201          | fcond T.<>  = I.FBLG          | fcond T.<>  = I.FBLG
202          | fcond T.?=  = I.FBUE          | fcond T.?=  = I.FBUE
203          | fcond fc = error("fcond "^MLTreeUtil.fcondToString fc)          | fcond fc = error("fcond "^T.Util.fcondToString fc)
204    
205        fun mark'(i,[]) = i        fun mark'(i,[]) = i
206          | mark'(i,a::an) = mark'(I.ANNOTATION{i=i,a=a},an)          | mark'(i,a::an) = mark'(I.ANNOTATION{i=i,a=a},an)
# Line 236  Line 233 
233        fun fmoved(s,d,an) =        fun fmoved(s,d,an) =
234            if s = d then ()            if s = d then ()
235            else mark(I.FCOPY{dst=[d],src=[s],tmp=NONE,impl=ref NONE},an)            else mark(I.FCOPY{dst=[d],src=[s],tmp=NONE,impl=ref NONE},an)
236        fun fmoves(s,d,an) = error "fmoves"        fun fmoves(s,d,an) = fmoved(s,d,an) (* error "fmoves" for now!!! XXX *)
237        fun fmoveq(s,d,an) = error "fmoveq"        fun fmoveq(s,d,an) = error "fmoveq"
238    
239        (* load word constant *)        (* load word constant *)
# Line 420  Line 417 
417        and call(a,defs,uses,mem,an) =        and call(a,defs,uses,mem,an) =
418        let val (r,i) = addr a        let val (r,i) = addr a
419            fun live([],acc) = acc            fun live([],acc) = acc
420              | live(T.GPR(T.REG(32,r))::regs,acc) = live(regs, C.addReg(r,acc))              | live(T.GPR(T.REG(_,r))::regs,acc) = live(regs, C.addReg(r,acc))
421              | live(T.FPR(T.FREG(64,f))::regs,acc) = live(regs, C.addFreg(f,acc))              | live(T.FPR(T.FREG(_,f))::regs,acc) = live(regs, C.addFreg(f,acc))
422              | live(T.CCR(T.CC 65)::regs,acc) = live(regs, C.addPSR(65,acc))              | live(T.CCR(T.CC 65)::regs,acc) = live(regs, C.addPSR(65,acc))
423              | live(T.CCR(T.CC cc)::regs,acc) = live(regs, C.addReg(cc,acc))              | live(T.CCR(T.CC cc)::regs,acc) = live(regs, C.addReg(cc,acc))
424              | live(T.GPR _::_,_) = error "live:GPR"              | live(T.GPR _::_,_) = error "live:GPR"
# Line 442  Line 439 
439            let val (cond,a,b) =            let val (cond,a,b) =
440                    case a of                    case a of
441                      (T.LI _ | T.LI32 _ | T.CONST _ | T.LABEL _) =>                      (T.LI _ | T.LI32 _ | T.CONST _ | T.LABEL _) =>
442                        (MLTreeUtil.swapCond cond,b,a)                        (T.Util.swapCond cond,b,a)
443                    | _ => (cond,a,b)                    | _ => (cond,a,b)
444            in  if V9 then            in  if V9 then
445                   branchV9(cond,a,b,lab,an)                   branchV9(cond,a,b,lab,an)
# Line 493  Line 490 
490          | stmt(T.FMV(_,d,e),an) = doFexpr(e,d,an)          | stmt(T.FMV(_,d,e),an) = doFexpr(e,d,an)
491          | stmt(T.CCMV(d,e),an) = doCCexpr(e,d,an)          | stmt(T.CCMV(d,e),an) = doCCexpr(e,d,an)
492          | stmt(T.COPY(_,dst,src),an) = copy(dst,src,an)          | stmt(T.COPY(_,dst,src),an) = copy(dst,src,an)
493          | stmt(T.FCOPY(64,dst,src),an) = fcopy(dst,src,an)          | stmt(T.FCOPY(_,dst,src),an) = fcopy(dst,src,an)
494          | stmt(T.JMP(T.LABEL(LE.LABEL l),_),an) =          | stmt(T.JMP(T.LABEL(LE.LABEL l),_),an) =
495              mark(I.Bicc{b=I.BA,a=true,label=l,nop=false},an)              mark(I.Bicc{b=I.BA,a=true,label=l,nop=false},an)
496          | stmt(T.JMP(e,labs),an) = jmp(e,labs,an)          | stmt(T.JMP(e,labs),an) = jmp(e,labs,an)
# Line 589  Line 586 
586    
587                (* loads *)                (* loads *)
588            | T.LOAD(8,a,mem) => load(I.LDUB,a,d,mem,cc,an)            | T.LOAD(8,a,mem) => load(I.LDUB,a,d,mem,cc,an)
589            | T.CVTI2I(_,T.SIGN_EXTEND,T.LOAD(8,a,mem)) =>            | T.CVTI2I(_,T.SIGN_EXTEND,_,T.LOAD(8,a,mem)) =>
590                 load(I.LDSB,a,d,mem,cc,an)                 load(I.LDSB,a,d,mem,cc,an)
591            | T.LOAD(16,a,mem) => load(I.LDUH,a,d,mem,cc,an)            | T.LOAD(16,a,mem) => load(I.LDUH,a,d,mem,cc,an)
592            | T.CVTI2I(_,T.SIGN_EXTEND,T.LOAD(16,a,mem)) =>            | T.CVTI2I(_,T.SIGN_EXTEND,_,T.LOAD(16,a,mem)) =>
593                 load(I.LDSH,a,d,mem,cc,an)                 load(I.LDSH,a,d,mem,cc,an)
594            | T.LOAD(32,a,mem) => load(I.LD,a,d,mem,cc,an)            | T.LOAD(32,a,mem) => load(I.LD,a,d,mem,cc,an)
595            | T.LOAD(64,a,mem) => load(if V9 then I.LDX else I.LDD,a,d,mem,cc,an)            | T.LOAD(64,a,mem) => load(if V9 then I.LDX else I.LDD,a,d,mem,cc,an)
# Line 653  Line 650 
650            | T.FSQRT(128,a)  => funary(I.FSQRTq,a,d,an)            | T.FSQRT(128,a)  => funary(I.FSQRTq,a,d,an)
651    
652              (* floating point to floating point *)              (* floating point to floating point *)
653            | T.CVTF2F(ty,_,e) =>            | T.CVTF2F(ty,_,ty',e) =>
654                (case (ty,Gen.fsize e) of                (case (ty,ty') of
655                   (32,32) =>  doFexpr(e,d,an)                   (32,32) =>  doFexpr(e,d,an)
656                 | (64,32) =>  funary(I.FsTOd,e,d,an)                 | (64,32) =>  funary(I.FsTOd,e,d,an)
657                 | (128,32) => funary(I.FsTOq,e,d,an)                 | (128,32) => funary(I.FsTOq,e,d,an)
# Line 668  Line 665 
665                )                )
666    
667              (* integer to floating point *)              (* integer to floating point *)
668            | T.CVTI2F(32,T.SIGN_EXTEND,e) =>            | T.CVTI2F(32,T.SIGN_EXTEND,_,e) =>
669                 app emit (P.cvti2s({i=opn e,d=d},reduceOpn))                 app emit (P.cvti2s({i=opn e,d=d},reduceOpn))
670            | T.CVTI2F(64,T.SIGN_EXTEND,e) =>            | T.CVTI2F(64,T.SIGN_EXTEND,_,e) =>
671                 app emit (P.cvti2d({i=opn e,d=d},reduceOpn))                 app emit (P.cvti2d({i=opn e,d=d},reduceOpn))
672            | T.CVTI2F(128,T.SIGN_EXTEND,e) =>            | T.CVTI2F(128,T.SIGN_EXTEND,_,e) =>
673                 app emit (P.cvti2q({i=opn e,d=d},reduceOpn))                 app emit (P.cvti2q({i=opn e,d=d},reduceOpn))
674    
675            | T.FSEQ(s,e)     => (doStmt s; doFexpr(e,d,an))            | T.FSEQ(s,e)     => (doStmt s; doFexpr(e,d,an))

Legend:
Removed from v.474  
changed lines
  Added in v.475

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