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 651, Thu Jun 1 18:34:03 2000 UTC revision 744, Fri Dec 8 04:11:42 2000 UTC
# Line 146  Line 146 
146    
147    fun error msg = MLRiscErrorMsg.error("Alpha",msg)    fun error msg = MLRiscErrorMsg.error("Alpha",msg)
148    
149    type instrStream = (I.instruction,C.regmap,C.cellset) T.stream    type instrStream = (I.instruction,C.cellset) T.stream
150    type mltreeStream = (T.stm,C.regmap,T.mlrisc list) T.stream    type mltreeStream = (T.stm,T.mlrisc list) T.stream
151    
152    (*    (*
153     * This module is used to simulate operations of non-standard widths.     * This module is used to simulate operations of non-standard widths.
# Line 159  Line 159 
159                              val rep = SE                              val rep = SE
160                             )                             )
161    
162    val zeroR   = C.GPReg 31    val zeroR   = C.r31
163    val zeroOpn = I.REGop zeroR    val zeroOpn = I.REGop zeroR
164    
   
165    (*    (*
166     * Specialize the modules for multiplication/division     * Specialize the modules for multiplication/division
167     * by constant optimizations.     * by constant optimizations.
# Line 289  Line 288 
288    datatype zeroOne   = ZERO | ONE | OTHER    datatype zeroOne   = ZERO | ONE | OTHER
289    datatype commutative = COMMUTE | NOCOMMUTE    datatype commutative = COMMUTE | NOCOMMUTE
290    
291    val zeroFR = C.FPReg 31    val zeroFR = C.f31
292    val zeroEA = I.Direct zeroR    val zeroEA = I.Direct zeroR
293    val zeroT  = T.LI 0    val zeroT  = T.LI 0
294    val trapb = [I.TRAPB]    val trapb = [I.TRAPB]
# Line 299  Line 298 
298          (instrStream as          (instrStream as
299           S.STREAM{emit,beginCluster,endCluster,           S.STREAM{emit,beginCluster,endCluster,
300                    defineLabel,entryLabel,pseudoOp,annotation,                    defineLabel,entryLabel,pseudoOp,annotation,
301                    exitBlock,phi,alias,comment,...}) =                    exitBlock,comment,...}) =
302    let    let
303        infix || && << >> ~>>        infix || && << >> ~>>
304    
# Line 424  Line 423 
423                             [_] => NONE | _ => SOME(I.FDirect(newFreg()))},an)                             [_] => NONE | _ => SOME(I.FDirect(newFreg()))},an)
424    
425        and move(s,d,an) =        and move(s,d,an) =
426            if s = d orelse d = zeroR then () else            if C.sameCell(s,d) orelse C.sameCell(d,zeroR) then () else
427            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)
428    
429        and fmove(s,d,an) =        and fmove(s,d,an) =
430            if s = d orelse d = zeroFR then () else            if C.sameCell(s,d) orelse C.sameCell(d,zeroFR) then () else
431            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)
432    
433         (* emit an sign extension op *)         (* emit an sign extension op *)
# Line 929  Line 928 
928              (* On the alpha: all 32 bit values are already sign extended.              (* On the alpha: all 32 bit values are already sign extended.
929               * So no sign extension is necessary               * So no sign extension is necessary
930               *)               *)
931          | expr(T.CVTI2I(64, T.SIGN_EXTEND, 32, e)) = expr e          | expr(T.SX(64, 32, e)) = expr e
932          | expr(T.CVTI2I(64, T.ZERO_EXTEND, 32, e)) = expr e          | expr(T.ZX(64, 32, e)) = expr e
933    
934          | expr e = let val r = newReg()          | expr e = let val r = newReg()
935                     in  doExpr(e,r,[]); r end                     in  doExpr(e,r,[]); r end
# Line 1032  Line 1031 
1031            | T.NOTB(_,e) => arith(I.ORNOT,zeroT,e,d,an)            | T.NOTB(_,e) => arith(I.ORNOT,zeroT,e,d,an)
1032    
1033              (* loads *)              (* loads *)
1034            | T.CVTI2I(_,T.SIGN_EXTEND,_,T.LOAD(8,ea,mem)) => load8s(ea,d,mem,an)            | T.SX(_,_,T.LOAD(8,ea,mem)) => load8s(ea,d,mem,an)
1035            | T.CVTI2I(_,T.SIGN_EXTEND,_,T.LOAD(16,ea,mem))=> load16s(ea,d,mem,an)            | T.SX(_,_,T.LOAD(16,ea,mem))=> load16s(ea,d,mem,an)
1036            | T.CVTI2I(_,T.SIGN_EXTEND,_,T.LOAD(32,ea,mem))=> load32s(ea,d,mem,an)            | T.SX(_,_,T.LOAD(32,ea,mem))=> load32s(ea,d,mem,an)
1037            | T.CVTI2I((8|16|32|64),T.ZERO_EXTEND,_,T.LOAD(8,ea,mem)) =>            | T.ZX((8|16|32|64),_,T.LOAD(8,ea,mem)) => load8(ea,d,mem,an)
1038                 load8(ea,d,mem,an)            | T.ZX((16|32|64),_,T.LOAD(16,ea,mem))=> load16(ea,d,mem,an)
1039            | T.CVTI2I((16|32|64),T.ZERO_EXTEND,_,T.LOAD(16,ea,mem))=>            | T.ZX(64,_,T.LOAD(64,ea,mem)) => load(I.LDQ,ea,d,mem,an)
                load16(ea,d,mem,an)  
           | T.CVTI2I(64,T.ZERO_EXTEND,_,T.LOAD(64,ea,mem)) =>  
                load(I.LDQ,ea,d,mem,an)  
1040            | T.LOAD(8,ea,mem) => load8(ea,d,mem,an)            | T.LOAD(8,ea,mem) => load8(ea,d,mem,an)
1041            | T.LOAD(16,ea,mem) => load16(ea,d,mem,an)            | T.LOAD(16,ea,mem) => load16(ea,d,mem,an)
1042            | T.LOAD(32,ea,mem) => load32s(ea,d,mem,an)            | T.LOAD(32,ea,mem) => load32s(ea,d,mem,an)
# Line 1070  Line 1066 
1066              (* On the alpha: all 32 bit values are already sign extended.              (* On the alpha: all 32 bit values are already sign extended.
1067               * So no sign extension is necessary               * So no sign extension is necessary
1068               *)               *)
1069            | T.CVTI2I(64, T.SIGN_EXTEND, 32, e) => doExpr(e, d, an)            | T.SX(64, 32, e) => doExpr(e, d, an)
1070            | T.CVTI2I(64, T.ZERO_EXTEND, 32, e) => doExpr(e, d, an)            | T.ZX(64, 32, e) => doExpr(e, d, an)
1071    
1072            | T.PRED(e, c) => doExpr(e, d, A.CTRLUSE c::an)            | T.PRED(e, c) => doExpr(e, d, A.CTRLUSE c::an)
1073            | T.REXT e => ExtensionComp.compileRext (reducer()) {e=e, an=an, rd=d}            | T.REXT e => ExtensionComp.compileRext (reducer()) {e=e, an=an, rd=d}
# Line 1244  Line 1240 
1240                  | T.?<=  => bcc2(I.CMPTLESU, I.FBNE, I.CMPTUNSU, I.FBNE)                  | T.?<=  => bcc2(I.CMPTLESU, I.FBNE, I.CMPTUNSU, I.FBNE)
1241                  | T.<> => fall(I.CMPTEQSU, I.FBNE, I.CMPTUNSU, I.FBEQ)                  | T.<> => fall(I.CMPTEQSU, I.FBNE, I.CMPTUNSU, I.FBEQ)
1242                  | T.?= => bcc2(I.CMPTEQSU, I.FBNE, I.CMPTUNSU, I.FBNE)                  | T.?= => bcc2(I.CMPTEQSU, I.FBNE, I.CMPTUNSU, I.FBNE)
1243                    | _     => error "branch"
1244              end              end
1245            | e => mark(I.BRANCH{b=I.BNE,r=ccExpr e,lab=lab},an)            | e => mark(I.BRANCH{b=I.BNE,r=ccExpr e,lab=lab},an)
1246    
# Line 1279  Line 1276 
1276          | branchIt0(T.GEU,e,lab,an) = (* always true! *) goto(lab,an)          | branchIt0(T.GEU,e,lab,an) = (* always true! *) goto(lab,an)
1277          | branchIt0(T.LTU,e,lab,an) = (* always false! *) ()          | branchIt0(T.LTU,e,lab,an) = (* always false! *) ()
1278          | branchIt0(T.LEU,e,lab,an) = br(I.BEQ,e,lab,an)  (* never < 0! *)          | branchIt0(T.LEU,e,lab,an) = br(I.BEQ,e,lab,an)  (* never < 0! *)
1279            | branchIt0 _               = error "brnachIt0"
1280    
1281          (* Generate the operands for unsigned comparisons          (* Generate the operands for unsigned comparisons
1282           * Mask out high order bits whenever necessary.           * Mask out high order bits whenever necessary.
# Line 1326  Line 1324 
1324                | T.LEU => unsignedCmp(ty,I.CMPULE,I.BNE)                | T.LEU => unsignedCmp(ty,I.CMPULE,I.BNE)
1325                | T.GTU => unsignedCmp(ty,I.CMPULE,I.BEQ)                | T.GTU => unsignedCmp(ty,I.CMPULE,I.BEQ)
1326                | T.GEU => unsignedCmp(ty,I.CMPULT,I.BEQ)                | T.GEU => unsignedCmp(ty,I.CMPULT,I.BEQ)
1327                  | _     => error "branchItOther"
1328            end            end
1329    
1330           (* This function generates a conditional move:           (* This function generates a conditional move:
# Line 1370  Line 1369 
1369                  | (T.LEU,_,_)          => (I.CMOVEQ,cmp(T.GTU,a,b),x,y)                  | (T.LEU,_,_)          => (I.CMOVEQ,cmp(T.GTU,a,b),x,y)
1370                  | (T.GTU,_,_)          => (I.CMOVEQ,cmp(T.LEU,a,b),x,y)                  | (T.GTU,_,_)          => (I.CMOVEQ,cmp(T.LEU,a,b),x,y)
1371                  | (T.GEU,_,_)          => (I.CMOVEQ,cmp(T.LTU,a,b),x,y)                  | (T.GEU,_,_)          => (I.CMOVEQ,cmp(T.LTU,a,b),x,y)
1372                    | _                    => error "cmove"
1373            in  mark(I.CMOVE{oper=oper,ra=ra,rb=opn x,rc=tmp},an); (* true case *)            in  mark(I.CMOVE{oper=oper,ra=ra,rb=opn x,rc=tmp},an); (* true case *)
1374                move(tmp, d, [])                move(tmp, d, [])
1375            end            end
# Line 1415  Line 1415 
1415                | T.GEU => unsignedCmp(ty,I.CMPULE,e2,e1,d)                | T.GEU => unsignedCmp(ty,I.CMPULE,e2,e1,d)
1416                | T.LTU => unsignedCmp(ty,I.CMPULT,e1,e2,d)                | T.LTU => unsignedCmp(ty,I.CMPULT,e1,e2,d)
1417                | T.LEU => unsignedCmp(ty,I.CMPULE,e1,e2,d)                | T.LEU => unsignedCmp(ty,I.CMPULE,e1,e2,d)
1418                  | _     => error "compare"
1419            end            end
1420    
1421           (* generate an unconditional branch *)           (* generate an unconditional branch *)
# Line 1456  Line 1457 
1457            | T.CCMV(r,e) => doCCexpr(e,r,an)            | T.CCMV(r,e) => doCCexpr(e,r,an)
1458            | T.COPY(ty,dst,src) => copy(dst,src,an)            | T.COPY(ty,dst,src) => copy(dst,src,an)
1459            | T.FCOPY(ty,dst,src) => fcopy(dst,src,an)            | T.FCOPY(ty,dst,src) => fcopy(dst,src,an)
1460            | T.JMP(ctrl,T.LABEL(LE.LABEL lab),_) => goto(lab,an)            | T.JMP(T.LABEL(LE.LABEL lab),_) => goto(lab,an)
1461            | T.JMP(ctrl,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)
1462            | T.BCC(ctrl,cc,lab) => branch(cc,lab,an)            | T.BCC(cc,lab) => branch(cc,lab,an)
1463            | T.CALL{funct,targets,defs,uses,cdefs,cuses,region} =>            | T.CALL{funct,targets,defs,uses,region,...} =>
1464                call(funct,targets,defs,uses,region,an)                call(funct,targets,defs,uses,region,an)
1465            | 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)
1466            | T.STORE(8,ea,data,mem) => store8(ea,data,mem,an)            | T.STORE(8,ea,data,mem) => store8(ea,data,mem,an)
# Line 1511  Line 1512 
1512             entryLabel  = entryLabel,             entryLabel  = entryLabel,
1513             comment     = comment,             comment     = comment,
1514             annotation  = annotation,             annotation  = annotation,
1515             exitBlock   = fn regs => exitBlock(cellset regs),             exitBlock   = fn regs => exitBlock(cellset regs)
            alias       = alias,  
            phi         = phi  
1516           }           }
1517     in  self()     in  self()
1518     end     end

Legend:
Removed from v.651  
changed lines
  Added in v.744

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