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/backpatch/alphaJumps.sml
ViewVC logotype

Diff of /sml/trunk/src/MLRISC/alpha/backpatch/alphaJumps.sml

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

revision 983, Wed Nov 21 18:44:55 2001 UTC revision 984, Wed Nov 21 19:00:08 2001 UTC
# Line 6  Line 6 
6  functor AlphaJumps  functor AlphaJumps
7    (structure Instr : ALPHAINSTR    (structure Instr : ALPHAINSTR
8     structure Shuffle : ALPHASHUFFLE     structure Shuffle : ALPHASHUFFLE
9        sharing Shuffle.I = Instr) : SDI_JUMPS =                             where I = Instr
10       structure MLTreeEval : MLTREE_EVAL
11                               where T = Instr.T
12      ) : SDI_JUMPS =
13  struct  struct
14    structure I = Instr    structure I = Instr
15    structure C = I.C    structure C = I.C
16    structure Const = I.Constant    structure Const = I.Constant
17    structure LE = I.LabelExp    structure Eval = MLTreeEval
18    
19    fun error msg = MLRiscErrorMsg.error("AlphaJumps",msg)    fun error msg = MLRiscErrorMsg.error("AlphaJumps",msg)
20    
# Line 42  Line 45 
45    
46    fun immed16 n =  ~32768 <= n andalso n < 32768    fun immed16 n =  ~32768 <= n andalso n < 32768
47    fun im16load n = if immed16 n then 4 else 8    fun im16load n = if immed16 n then 4 else 8
48    fun im16Oper le = if immed16 (LE.valueOf le) then 4 else 12    fun im16Oper le = if immed16 (Eval.valueOf le) then 4 else 12
49    
50    fun immed8 n = n >= 0 andalso n < 256    fun immed8 n = n >= 0 andalso n < 256
51    fun im8Oper le = if immed8 (LE.valueOf le) then 4 else 12    fun im8Oper le = if immed8 (Eval.valueOf le) then 4 else 12
52    
53    fun sdiSize(I.DEFFREG _, _, _) = 0    fun sdiSize(I.DEFFREG _, _, _) = 0
54      | sdiSize(I.LDA{d=I.LABop le, ...}, _, _) = im16load(LE.valueOf le)      | sdiSize(I.LDA{d=I.LABop le, ...}, _, _) = im16load(Eval.valueOf le)
55      | sdiSize(I.LOAD{d=I.LABop le, ...}, _, _) = im16Oper le      | sdiSize(I.LOAD{d=I.LABop le, ...}, _, _) = im16Oper le
56      | sdiSize(I.STORE{d=I.LABop le, ...}, _, _) = im16Oper le      | sdiSize(I.STORE{d=I.LABop le, ...}, _, _) = im16Oper le
57      | sdiSize(I.FLOAD{d=I.LABop le, ...}, _, _) = im16Oper le      | sdiSize(I.FLOAD{d=I.LABop le, ...}, _, _) = im16Oper le
# Line 78  Line 81 
81    fun expand(instr, size, pos) = let    fun expand(instr, size, pos) = let
82      fun load(ldClass, ldOp, r, b, d as I.LABop le, mem) =      fun load(ldClass, ldOp, r, b, d as I.LABop le, mem) =
83        (case size        (case size
84         of 4 => [ldClass{ldOp=ldOp, r=r, b=b, d=I.IMMop(LE.valueOf le), mem=mem}]         of 4 => [ldClass{ldOp=ldOp, r=r, b=b, d=I.IMMop(Eval.valueOf le), mem=mem}]
85          | 12 => let          | 12 => let
86              val instrs = expand(I.LDA{r=r, b=b, d=d}, 8, pos)              val instrs = expand(I.LDA{r=r, b=b, d=d}, 8, pos)
87            in instrs @ [ldClass{ldOp=ldOp, r=r, b=r, d=I.IMMop 0, mem=mem}]            in instrs @ [ldClass{ldOp=ldOp, r=r, b=r, d=I.IMMop 0, mem=mem}]
# Line 86  Line 89 
89    
90      fun store(stClass, stOp, r, b, d as I.LABop le, mem) =      fun store(stClass, stOp, r, b, d as I.LABop le, mem) =
91        (case size        (case size
92         of 4 => [stClass{stOp=stOp, r=r, b=b, d=I.IMMop(LE.valueOf le), mem=mem}]         of 4 => [stClass{stOp=stOp, r=r, b=b, d=I.IMMop(Eval.valueOf le), mem=mem}]
93          | 12 => let          | 12 => let
94              val instrs = expand(I.LDA{r=C.asmTmpR, b=b, d=d}, 8, pos)              val instrs = expand(I.LDA{r=C.asmTmpR, b=b, d=d}, 8, pos)
95            in instrs @ [stClass{stOp=stOp, r=r, b=C.asmTmpR, d=I.IMMop 0, mem=mem}]            in instrs @ [stClass{stOp=stOp, r=r, b=C.asmTmpR, d=I.IMMop 0, mem=mem}]
# Line 94  Line 97 
97    
98      fun operate(opClass, oper, ra, rb as I.LABop le, rc) =      fun operate(opClass, oper, ra, rb as I.LABop le, rc) =
99        (case size        (case size
100         of 4 => [opClass{oper=oper, ra=ra, rb=I.IMMop(LE.valueOf le), rc=rc}]         of 4 => [opClass{oper=oper, ra=ra, rb=I.IMMop(Eval.valueOf le), rc=rc}]
101          | 12 => let          | 12 => let
102              val instrs = expand(I.LDA{r=C.asmTmpR, b=zeroR, d=rb}, 8, pos)              val instrs = expand(I.LDA{r=C.asmTmpR, b=zeroR, d=rb}, 8, pos)
103            in instrs @ [opClass{oper=oper, ra=ra, rb=I.REGop C.asmTmpR, rc=rc}]            in instrs @ [opClass{oper=oper, ra=ra, rb=I.REGop C.asmTmpR, rc=rc}]

Legend:
Removed from v.983  
changed lines
  Added in v.984

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