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/ppc/instructions/ppcProps.sml
 [smlnj] / sml / trunk / src / MLRISC / ppc / instructions / ppcProps.sml

# Diff of /sml/trunk/src/MLRISC/ppc/instructions/ppcProps.sml

revision 1008, Fri Dec 14 21:01:29 2001 UTC revision 1009, Wed Jan 9 19:44:22 2002 UTC
# Line 21  Line 21
21    fun zeroR() = C.Reg CB.GP 0    fun zeroR() = C.Reg CB.GP 0
22
23    fun instrKind(I.ANNOTATION{i, ...}) = instrKind i    fun instrKind(I.ANNOTATION{i, ...}) = instrKind i
24        | instrKind(I.COPY _) = IK_COPY
25      | instrKind(I.INSTR instr) =      | instrKind(I.INSTR instr) =
26          (case instr          (case instr
27           of (I.BC _) => IK_JUMP           of (I.BC _) => IK_JUMP
# Line 29  Line 30
30            | (I.ARITHI{oper=I.ORI, rt, ra, im=I.ImmedOp 0}) =>            | (I.ARITHI{oper=I.ORI, rt, ra, im=I.ImmedOp 0}) =>
31                 if CB.registerId rt = 0 andalso CB.registerId ra = 0 then IK_NOP                 if CB.registerId rt = 0 andalso CB.registerId ra = 0 then IK_NOP
32                 else IK_INSTR                 else IK_INSTR
| (I.COPY _) => IK_COPY
| (I.FCOPY _)                 => IK_COPY
33            | (I.CALL{cutsTo=_::_,...}) => IK_CALL_WITH_CUTS            | (I.CALL{cutsTo=_::_,...}) => IK_CALL_WITH_CUTS
34            | (I.CALL _) => IK_CALL            | (I.CALL _) => IK_CALL
35            | (I.PHI _)    => IK_PHI            | (I.PHI _)    => IK_PHI
# Line 39  Line 38
38            |  _ => IK_INSTR)            |  _ => IK_INSTR)
39      | instrKind _ = error "instrKind"      | instrKind _ = error "instrKind"
40
41    fun moveInstr(I.INSTR(I.COPY _)) = true    fun moveInstr(I.COPY _) = true
| moveInstr(I.INSTR(I.FCOPY _)) = true
| moveInstr(I.LIVE _) = false
| moveInstr(I.KILL _) = false
42      | moveInstr(I.ANNOTATION{i,...}) = moveInstr i      | moveInstr(I.ANNOTATION{i,...}) = moveInstr i
43      | moveInstr  _ = false      | moveInstr  _ = false
44
45    fun nop () = I.arithi{oper=I.ORI, rt=zeroR(), ra=zeroR(), im=I.ImmedOp 0}    fun nop () = I.arithi{oper=I.ORI, rt=zeroR(), ra=zeroR(), im=I.ImmedOp 0}
46
47    fun moveTmpR(I.INSTR(I.COPY{tmp as SOME(I.Direct r), ...})) = SOME r    fun moveTmpR(I.COPY{tmp, ...}) =
48      | moveTmpR(I.INSTR(I.FCOPY{tmp as SOME(I.FDirect f), ...})) = SOME f        (case tmp
49            of SOME(I.Direct r) => SOME r
50             | SOME(I.FDirect f) => SOME f
51             | _ => NONE
52          (*esac*))
53      | moveTmpR(I.ANNOTATION{i,...}) = moveTmpR i      | moveTmpR(I.ANNOTATION{i,...}) = moveTmpR i
54      | moveTmpR _ = NONE      | moveTmpR _ = NONE
55
56    fun moveDstSrc(I.INSTR(I.COPY{src, dst, ...})) = (dst, src)    fun moveDstSrc(I.COPY{dst,src,...}) = (dst,src)
| moveDstSrc(I.INSTR(I.FCOPY{src, dst, ...})) = (dst, src)
57      | moveDstSrc(I.ANNOTATION{i,...}) = moveDstSrc i      | moveDstSrc(I.ANNOTATION{i,...}) = moveDstSrc i
58      | moveDstSrc _ = error "moveDstSrc"      | moveDstSrc _ = error "moveDstSrc"
59
60
63          of I.LabelOp(T.LABEL lab) => [LABELLED lab]          of I.LabelOp(T.LABEL lab) => [LABELLED lab]
# Line 122  Line 122
122         | I.TW{to, ra, si} => ([], operand(si,[ra]))         | I.TW{to, ra, si} => ([], operand(si,[ra]))
123         | I.TD{to, ra, si} => ([], operand(si,[ra]))         | I.TD{to, ra, si} => ([], operand(si,[ra]))
124         | I.CALL{def, use, ...} => (C.getReg def, C.getReg use)         | I.CALL{def, use, ...} => (C.getReg def, C.getReg use)
| I.COPY{dst, src, tmp, ...} =>
(case tmp
of NONE => (dst, src)
| SOME(I.Direct r) => (r::dst, src)
(* | SOME(I.Displace{base, disp}) => (dst, base::src) *)
(*esac*))
125         | _ => ([], [])         | _ => ([], [])
126      end      end
127    in    in
# Line 136  Line 130
130        | I.LIVE{regs, ...} => ([], C.getReg regs)        | I.LIVE{regs, ...} => ([], C.getReg regs)
131        | I.KILL{regs, ...} => (C.getReg regs, [])        | I.KILL{regs, ...} => (C.getReg regs, [])
132        | I.INSTR(i) => ppcDU(i)        | I.INSTR(i) => ppcDU(i)
133        | _ => error "defUseR"        | I.COPY{k, dst, src, tmp, ...} => let
134               val (d,u) = case k of CB.GP => (dst, src) | _ => ([], [])
135             in
136                 case tmp
137                 of SOME(I.Direct r) => (r::d, u)
138                  | SOME(I.Displace{base, ...}) => (d, base::u)
139                  | _ => (d,u)
140             end
141    end    end
142
143    fun defUseF instr = let    fun defUseF instr = let
# Line 149  Line 150
150         | I.FARITH{ft, fa, fb, ...}  => ([ft], [fa, fb])         | I.FARITH{ft, fa, fb, ...}  => ([ft], [fa, fb])
151         | I.FARITH3{ft, fa, fb, fc, ...}  => ([ft], [fa, fb, fc])         | I.FARITH3{ft, fa, fb, fc, ...}  => ([ft], [fa, fb, fc])
152         | I.CALL{def, use, ...} => (C.getFreg def,C.getFreg use)         | I.CALL{def, use, ...} => (C.getFreg def,C.getFreg use)
| I.FCOPY{dst, src, tmp, ...} =>
(case tmp
of SOME(I.FDirect f) => (f::dst, src)
| _ => (dst, src)
(*esac*))
153         | _ => ([], [])         | _ => ([], [])
154        (*esac*))        (*esac*))
155    in    in
# Line 162  Line 158
158        | I.LIVE{regs, ...} => ([], C.getFreg regs)        | I.LIVE{regs, ...} => ([], C.getFreg regs)
159        | I.KILL{regs, ...} => (C.getFreg regs, [])        | I.KILL{regs, ...} => (C.getFreg regs, [])
160        | I.INSTR(i) => ppcDU(i)        | I.INSTR(i) => ppcDU(i)
161        | _ => error "defUseF"        | I.COPY{k, dst, src, tmp, ...} => let
162               val (d, u) = case k of CB.FP => (dst, src) | _ => ([],[])
163             in
164                 case tmp
165                  of SOME(I.FDirect f) => (f::d, u)
166                   | _ => (d, u)
167             end
168    end    end
169    fun defUseCC instr = error "defUseCC: not implemented"    fun defUseCC instr = error "defUseCC: not implemented"
170
# Line 184  Line 185
185     *  Replicate an instruction     *  Replicate an instruction
186     *========================================================================*)     *========================================================================*)
187    fun replicate(I.ANNOTATION{i,a}) = I.ANNOTATION{i=replicate i,a=a}    fun replicate(I.ANNOTATION{i,a}) = I.ANNOTATION{i=replicate i,a=a}
188      | replicate(I.INSTR(I.COPY{tmp=SOME _, dst, src, impl})) =      | replicate(I.COPY{k, sz, tmp=SOME _, dst, src}) =
189          I.copy{tmp=SOME(I.Direct(C.newReg())), dst=dst, src=src, impl=ref NONE}          I.COPY{k=k, sz=sz, tmp=SOME(I.Direct(C.newReg())), dst=dst, src=src}
| replicate(I.INSTR(I.FCOPY{tmp=SOME _, dst, src, impl})) =
I.fcopy{tmp=SOME(I.FDirect(C.newFreg())),
dst=dst, src=src, impl=ref NONE}
190      | replicate i = i      | replicate i = i
191  end  end
192

Legend:
 Removed from v.1008 changed lines Added in v.1009