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/sparc/mltree/sparc.sml
ViewVC logotype

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

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

revision 774, Wed Jan 10 12:50:56 2001 UTC revision 775, Fri Jan 12 01:17:51 2001 UTC
# Line 11  Line 11 
11    
12  functor Sparc  functor Sparc
13    (structure SparcInstr : SPARCINSTR    (structure SparcInstr : SPARCINSTR
    structure SparcMLTree : MLTREE  
14     structure PseudoInstrs : SPARC_PSEUDO_INSTR     structure PseudoInstrs : SPARC_PSEUDO_INSTR
15     structure ExtensionComp : MLTREE_EXTENSION_COMP     structure ExtensionComp : MLTREE_EXTENSION_COMP
16        where I = SparcInstr and T = SparcMLTree        where I = SparcInstr
       sharing SparcMLTree.Region = SparcInstr.Region  
       sharing SparcMLTree.LabelExp = SparcInstr.LabelExp  
17        sharing PseudoInstrs.I = SparcInstr        sharing PseudoInstrs.I = SparcInstr
18     (*     (*
19      * The client should also specify these parameters.      * The client should also specify these parameters.
# Line 41  Line 38 
38           *)           *)
39    ) : MLTREECOMP =    ) : MLTREECOMP =
40  struct  struct
   structure T  = SparcMLTree  
   structure S  = T.Stream  
   structure R  = SparcMLTree.Region  
41    structure I  = SparcInstr    structure I  = SparcInstr
42      structure T  = I.T
43      structure S  = T.Stream
44      structure R  = T.Region
45    structure C  = I.C    structure C  = I.C
46    structure LE = I.LabelExp    structure LE = I.LabelExp
47    structure W  = Word32    structure W  = Word32
# Line 362  Line 359 
359            if immed13 n then (expr e,I.IMMED(toInt n))            if immed13 n then (expr e,I.IMMED(toInt n))
360            else let val d = newReg()            else let val d = newReg()
361                 in  loadImmed(n,d,REG,[]); (d,opn e) end                 in  loadImmed(n,d,REG,[]); (d,opn e) end
362          | addr(T.ADD(_,e,T.CONST c)) = (expr e,I.LAB(LE.CONST c))          | addr(T.ADD(_,e,x as T.CONST c)) = (expr e,I.LAB x)
363          | addr(T.ADD(_,e,T.LABEL l)) = (expr e,I.LAB l)          | addr(T.ADD(_,e,x as T.LABEL l)) = (expr e,I.LAB x)
364            | addr(T.ADD(_,e,T.LABEXP x)) = (expr e,I.LAB x)
365          | addr(T.ADD(ty,i as T.LI _,e)) = addr(T.ADD(ty,e,i))          | addr(T.ADD(ty,i as T.LI _,e)) = addr(T.ADD(ty,e,i))
366          | addr(T.ADD(_,T.CONST c,e)) = (expr e,I.LAB(LE.CONST c))          | addr(T.ADD(_,x as T.CONST c,e)) = (expr e,I.LAB x)
367          | addr(T.ADD(_,T.LABEL l,e)) = (expr e,I.LAB l)          | addr(T.ADD(_,x as T.LABEL l,e)) = (expr e,I.LAB x)
368            | addr(T.ADD(_,T.LABEXP x,e)) = (expr e,I.LAB x)
369          | addr(T.ADD(_,e1,e2))       = (expr e1,I.REG(expr e2))          | addr(T.ADD(_,e1,e2))       = (expr e1,I.REG(expr e2))
370          | addr(T.SUB(ty,e,T.LI n))   = addr(T.ADD(ty,e,T.LI(T.I.NEG(32,n))))          | addr(T.SUB(ty,e,T.LI n))   = addr(T.ADD(ty,e,T.LI(T.I.NEG(32,n))))
371          | addr(T.LABEL l)            = (zeroR,I.LAB l)          | addr(x as T.LABEL l)       = (zeroR,I.LAB x)
372            | addr(T.LABEXP x)           = (zeroR,I.LAB x)
373          | addr a                     = (expr a,zeroOpn)          | addr a                     = (expr a,zeroOpn)
374    
375        (* emit an integer load *)        (* emit an integer load *)
# Line 414  Line 414 
414            val defs=cellset(defs)            val defs=cellset(defs)
415            val uses=cellset(uses)            val uses=cellset(uses)
416        in  case (C.registerId r,i) of        in  case (C.registerId r,i) of
417              (0,I.LAB(LE.LABEL l)) =>              (0,I.LAB(T.LABEL l)) =>
418               mark(I.CALL{label=l,defs=C.addReg(C.linkReg,defs),uses=uses,               mark(I.CALL{label=l,defs=C.addReg(C.linkReg,defs),uses=uses,
419                           mem=mem,nop=true},an)                           mem=mem,nop=true},an)
420            | _ => mark(I.JMPL{r=r,i=i,d=C.linkReg,defs=defs,uses=uses,mem=mem,            | _ => mark(I.JMPL{r=r,i=i,d=C.linkReg,defs=defs,uses=uses,mem=mem,
# Line 476  Line 476 
476          | stmt(T.CCMV(d,e),an) = doCCexpr(e,d,an)          | stmt(T.CCMV(d,e),an) = doCCexpr(e,d,an)
477          | stmt(T.COPY(_,dst,src),an) = copy(dst,src,an)          | stmt(T.COPY(_,dst,src),an) = copy(dst,src,an)
478          | stmt(T.FCOPY(_,dst,src),an) = fcopy(dst,src,an)          | stmt(T.FCOPY(_,dst,src),an) = fcopy(dst,src,an)
479          | stmt(T.JMP(T.LABEL(LE.LABEL l),_),an) =          | stmt(T.JMP(T.LABEL l,_),an) =
480              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)
481          | stmt(T.JMP(e,labs),an) = jmp(e,labs,an)          | stmt(T.JMP(e,labs),an) = jmp(e,labs,an)
482          | stmt(T.CALL{funct,targets,defs,uses,region,...},an) =          | stmt(T.CALL{funct,targets,defs,uses,region,...},an) =
# Line 518  Line 518 
518            case e of            case e of
519              T.REG(_,r) => (move(r,d,an); genCmp0(cc,r))              T.REG(_,r) => (move(r,d,an); genCmp0(cc,r))
520            | T.LI n     => loadImmed(n,d,cc,an)            | T.LI n     => loadImmed(n,d,cc,an)
521            | T.LABEL l  => loadLabel(l,d,cc,an)            | T.LABEL l  => loadLabel(e,d,cc,an)
522            | T.CONST c  => loadLabel(LE.CONST c,d,cc,an)            | T.CONST c  => loadLabel(e,d,cc,an)
523              | T.LABEXP x  => loadLabel(x,d,cc,an)
524    
525                  (* generic 32/64 bit support *)                  (* generic 32/64 bit support *)
526            | T.ADD(_,a,b) => arith(I.ADD,I.ADDCC,a,b,d,cc,COMMUTE,[],an)            | T.ADD(_,a,b) => arith(I.ADD,I.ADDCC,a,b,d,cc,COMMUTE,[],an)
# Line 695  Line 696 
696        and ccExpr e = let val d = newReg() in doCCexpr(e,d,[]); d end        and ccExpr e = let val d = newReg() in doCCexpr(e,d,[]); d end
697    
698            (* convert an expression into an operand *)            (* convert an expression into an operand *)
699        and opn(T.CONST c)     = I.LAB(LE.CONST c)        and opn(x as T.CONST c) = I.LAB x
700          | opn(T.LABEL l)     = I.LAB l          | opn(x as T.LABEL l) = I.LAB x
701            | opn(T.LABEXP x)     = I.LAB x
702          | opn(e as T.LI n)   =          | opn(e as T.LI n)   =
703              if T.I.isZero(n) then zeroOpn              if T.I.isZero(n) then zeroOpn
704              else if immed13 n then I.IMMED(toInt n)              else if immed13 n then I.IMMED(toInt n)

Legend:
Removed from v.774  
changed lines
  Added in v.775

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