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

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

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

revision 788, Wed Feb 28 04:09:48 2001 UTC revision 889, Thu Jul 19 20:35:20 2001 UTC
# Line 41  Line 41 
41    structure W32 = Word32    structure W32 = Word32
42    structure P   = PseudoInstrs    structure P   = PseudoInstrs
43    structure A   = MLRiscAnnotations    structure A   = MLRiscAnnotations
44      structure CB  = CellsBasis
45    
46   (*********************************************************   (*********************************************************
47    
# Line 169  Line 170 
170    functor Multiply32 = MLTreeMult    functor Multiply32 = MLTreeMult
171      (structure I = I      (structure I = I
172       structure T = T       structure T = T
173         structure CB = CellsBasis
174    
175       val intTy = 32       val intTy = 32
176    
177       type arg  = {r1:C.cell,r2:C.cell,d:C.cell}       type arg  = {r1:CB.cell,r2:CB.cell,d:CB.cell}
178       type argi = {r:C.cell,i:int,d:C.cell}       type argi = {r:CB.cell,i:int,d:CB.cell}
179    
180       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}
181       fun add{r1,r2,d} = I.OPERATE{oper=I.ADDL,ra=r1,rb=I.REGop r2,rc=d}       fun add{r1,r2,d} = I.OPERATE{oper=I.ADDL,ra=r1,rb=I.REGop r2,rc=d}
# Line 211  Line 213 
213    functor Multiply64 = MLTreeMult    functor Multiply64 = MLTreeMult
214      (structure I = I      (structure I = I
215       structure T = T       structure T = T
216         structure CB = CellsBasis
217    
218       val intTy = 64       val intTy = 64
219    
220       type arg  = {r1:C.cell,r2:C.cell,d:C.cell}       type arg  = {r1:CB.cell, r2:CB.cell, d:CB.cell}
221       type argi = {r:C.cell,i:int,d:C.cell}       type argi = {r:CB.cell, i:int, d:CB.cell}
222    
223       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}
224       fun add{r1,r2,d}= I.OPERATE{oper=I.ADDQ,ra=r1,rb=I.REGop r2,rc=d}       fun add{r1,r2,d}= I.OPERATE{oper=I.ADDQ,ra=r1,rb=I.REGop r2,rc=d}
# Line 294  Line 297 
297    
298    fun selectInstructions    fun selectInstructions
299          (instrStream as          (instrStream as
300           S.STREAM{emit,beginCluster,endCluster,           S.STREAM{emit,beginCluster,endCluster,getAnnotations,
301                    defineLabel,entryLabel,pseudoOp,annotation,                    defineLabel,entryLabel,pseudoOp,annotation,
302                    exitBlock,comment,...}) =                    exitBlock,comment,...}) =
303    let    let
# Line 413  Line 416 
416                             [_] => NONE | _ => SOME(I.FDirect(newFreg()))},an)                             [_] => NONE | _ => SOME(I.FDirect(newFreg()))},an)
417    
418        and move(s,d,an) =        and move(s,d,an) =
419            if C.sameCell(s,d) orelse C.sameCell(d,zeroR) then () else            if CB.sameCell(s,d) orelse CB.sameCell(d,zeroR) then () else
420            mark(I.COPY{dst=[d],src=[s],impl=ref NONE,tmp=NONE},an)            mark(I.COPY{dst=[d],src=[s],impl=ref NONE,tmp=NONE},an)
421    
422        and fmove(s,d,an) =        and fmove(s,d,an) =
423            if C.sameCell(s,d) orelse C.sameCell(d,zeroFR) then () else            if CB.sameCell(s,d) orelse CB.sameCell(d,zeroFR) then () else
424            mark(I.FCOPY{dst=[d],src=[s],impl=ref NONE,tmp=NONE},an)            mark(I.FCOPY{dst=[d],src=[s],impl=ref NONE,tmp=NONE},an)
425    
426         (* emit an sign extension op *)         (* emit an sign extension op *)
# Line 468  Line 471 
471                I.IMMop(toInt(n))                I.IMMop(toInt(n))
472              else let val tmpR = newReg()              else let val tmpR = newReg()
473                   in  loadImmed(n,zeroR,tmpR,[]); I.REGop tmpR end                   in  loadImmed(n,zeroR,tmpR,[]); I.REGop tmpR end
474          | opn(e as (T.CONST _ | T.LABEL _)) = I.LABop e          | opn(e as T.CONST _) = I.LABop e
475          | opn(T.LABEXP x) = I.LABop x          | opn(T.LABEXP x) = I.LABop x
476          | opn e = I.REGop(expr e)          | opn e = I.REGop(expr e)
477    
# Line 661  Line 664 
664            | SOME 0w3 => arith(I.S8ADDQ,a,zeroT,d,an)            | SOME 0w3 => arith(I.S8ADDQ,a,zeroT,d,an)
665            | _        => arith(I.SLL,a,b,d,an)            | _        => arith(I.SLL,a,b,d,an)
666    
667        and sra32(a,b,d,an) =         (* On the alpha, all 32 bit values are already sign extended.
668            let val ra = expr a          * So no sign extension is necessary.  We do the same for
669                val rb = opn b          * sra32 and sra64
               val t  = newReg()  
           in  (* On the alpha, all 32 bit values are already sign extended.  
                * So no sign extension is necessary.  
                * signExt32(ra,t);  
                * mark(I.OPERATE{oper=I.SRA,ra=t,rb=rb,rc=d},an)  
670                 *)                 *)
671                mark(I.OPERATE{oper=I.SRA,ra=ra,rb=rb,rc=d},an)        and sra(a,b,d,an) =
           end  
   
       and sra64(a,b,d,an) =  
672            mark(I.OPERATE{oper=I.SRA,ra=expr a,rb=opn b,rc=d},an)            mark(I.OPERATE{oper=I.SRA,ra=expr a,rb=opn b,rc=d},an)
673    
674        and srl32(a,b,d,an) =        and srl32(a,b,d,an) =
# Line 966  Line 961 
961            | T.REMS(32,a,b) => pseudo(P.reml,a,b,d)            | T.REMS(32,a,b) => pseudo(P.reml,a,b,d)
962    
963            | T.SLL(32,a,b) => sll32(a,b,d,an)            | T.SLL(32,a,b) => sll32(a,b,d,an)
964            | T.SRA(32,a,b) => sra32(a,b,d,an)            | T.SRA(32,a,b) => sra(a,b,d,an)
965            | T.SRL(32,a,b) => srl32(a,b,d,an)            | T.SRL(32,a,b) => srl32(a,b,d,an)
966    
967              (* 64 bit support *)              (* 64 bit support *)
# Line 994  Line 989 
989            | T.REMS(64,a,b) => pseudo(P.remq,a,b,d)            | T.REMS(64,a,b) => pseudo(P.remq,a,b,d)
990    
991            | T.SLL(64,a,b) => sll64(a,b,d,an)            | T.SLL(64,a,b) => sll64(a,b,d,an)
992            | T.SRA(64,a,b) => sra64(a,b,d,an)            | T.SRA(64,a,b) => sra(a,b,d,an)
993            | T.SRL(64,a,b) => srl64(a,b,d,an)            | T.SRL(64,a,b) => srl64(a,b,d,an)
994    
995              (* special bit operations with complement *)              (* special bit operations with complement *)
# Line 1416  Line 1411 
1411        and goto(lab,an) = mark(I.BRANCH{b=I.BR,r=zeroR,lab=lab},an)        and goto(lab,an) = mark(I.BRANCH{b=I.BR,r=zeroR,lab=lab},an)
1412    
1413           (* generate an call instruction *)           (* generate an call instruction *)
1414        and call(ea,flow,defs,uses,mem,an) =        and call(ea,flow,defs,uses,mem,cutTo,an,0) =
1415         let val defs=cellset defs         let val defs=cellset defs
1416             val uses=cellset uses             val uses=cellset uses
1417             val instr =             val instr =
1418                 case (ea, flow) of                 case (ea, flow) of
1419                   (T.LABEL lab, [_]) =>                   (T.LABEL lab, [_]) =>
1420                     I.BSR{lab=lab,r=C.returnAddr,defs=defs,uses=uses,mem=mem}                        I.BSR{lab=lab,r=C.returnAddr,defs=defs,uses=uses,
1421                                cutsTo=cutTo,mem=mem}
1422                 | _ => I.JSR{r=C.returnAddr,b=expr ea,                 | _ => I.JSR{r=C.returnAddr,b=expr ea,
1423                              d=0,defs=defs,uses=uses,mem=mem}                                   d=0,defs=defs,uses=uses,cutsTo=cutTo,mem=mem}
1424         in  mark(instr,an)         in  mark(instr,an)
1425         end         end
1426            | call _ = error "pops<>0 not implemented"
1427    
1428        and doCCexpr(T.CC(_,r),d,an) = move(r,d,an)        and doCCexpr(T.CC(_,r),d,an) = move(r,d,an)
1429          | doCCexpr(T.FCC(_,r),d,an) = fmove(r,d,an)          | doCCexpr(T.FCC(_,r),d,an) = fmove(r,d,an)
# Line 1454  Line 1451 
1451            | T.JMP(T.LABEL lab,_) => goto(lab,an)            | T.JMP(T.LABEL lab,_) => goto(lab,an)
1452            | T.JMP(e,labs) => mark(I.JMPL({r=zeroR,b=expr e,d=0},labs),an)            | T.JMP(e,labs) => mark(I.JMPL({r=zeroR,b=expr e,d=0},labs),an)
1453            | T.BCC(cc,lab) => branch(cc,lab,an)            | T.BCC(cc,lab) => branch(cc,lab,an)
1454            | T.CALL{funct,targets,defs,uses,region,...} =>            | T.CALL{funct,targets,defs,uses,region,pops,...} =>
1455                call(funct,targets,defs,uses,region,an)                call(funct,targets,defs,uses,region,[],an,pops)
1456              | T.FLOW_TO(T.CALL{funct,targets,defs,uses,region,pops,...},cutTo) =>
1457                  call(funct,targets,defs,uses,region,cutTo,an,pops)
1458            | T.RET _ => mark(I.RET{r=zeroR,b=C.returnAddr,d=0},an)            | T.RET _ => mark(I.RET{r=zeroR,b=C.returnAddr,d=0},an)
1459            | T.STORE(8,ea,data,mem) => store8(ea,data,mem,an)            | T.STORE(8,ea,data,mem) => store8(ea,data,mem,an)
1460            | T.STORE(16,ea,data,mem) => store16(ea,data,mem,an)            | T.STORE(16,ea,data,mem) => store16(ea,data,mem,an)
# Line 1506  Line 1505 
1505             entryLabel  = entryLabel,             entryLabel  = entryLabel,
1506             comment     = comment,             comment     = comment,
1507             annotation  = annotation,             annotation  = annotation,
1508               getAnnotations = getAnnotations,
1509             exitBlock   = fn regs => exitBlock(cellset regs)             exitBlock   = fn regs => exitBlock(cellset regs)
1510           }           }
1511     in  self()     in  self()

Legend:
Removed from v.788  
changed lines
  Added in v.889

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