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
ViewVC logotype

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

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

revision 1123, Thu Mar 7 19:13:25 2002 UTC revision 1124, Thu Mar 7 19:49:22 2002 UTC
# Line 27  Line 27 
27    
28    fun instrKind(I.ANNOTATION{i, ...}) = instrKind i    fun instrKind(I.ANNOTATION{i, ...}) = instrKind i
29      | instrKind(I.COPY _) = IK_COPY      | instrKind(I.COPY _) = IK_COPY
30      | instrKind(I.INSTR instr) =      | instrKind(I.INSTR instr) = let
31          (case instr          fun eqTest to = Word.andb(Word.fromInt to, 0w4) <> 0w0
32            fun trapAlways{to, ra, si} =
33              (case si
34                of I.RegOp rb =>
35                   if CellsBasis.sameColor(ra,rb) andalso eqTest(to) then IK_JUMP
36                   else IK_INSTR
37                 | I.ImmedOp 0 =>
38                   if CellsBasis.registerId ra = 0 andalso eqTest(to) then IK_JUMP
39                   else IK_INSTR
40              (*esac*))
41          in
42            case instr
43           of (I.BC _) => IK_JUMP           of (I.BC _) => IK_JUMP
44            | (I.BCLR _) => IK_JUMP            | (I.BCLR _) => IK_JUMP
45            | (I.B _) => IK_JUMP            | (I.B _) => IK_JUMP
46              | (I.TW t) => trapAlways(t)
47              | (I.TD t) => trapAlways(t)
48            | (I.ARITHI{oper=I.ORI, rt, ra, im=I.ImmedOp 0}) =>            | (I.ARITHI{oper=I.ORI, rt, ra, im=I.ImmedOp 0}) =>
49                 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
50                 else IK_INSTR                 else IK_INSTR
# Line 40  Line 53 
53            | (I.PHI _)    => IK_PHI            | (I.PHI _)    => IK_PHI
54            | (I.SOURCE _) => IK_SOURCE            | (I.SOURCE _) => IK_SOURCE
55            | (I.SINK _)   => IK_SINK            | (I.SINK _)   => IK_SINK
56            |  _ => IK_INSTR)            |  _ => IK_INSTR
57            (*esac*)
58          end
59      | instrKind _ = error "instrKind"      | instrKind _ = error "instrKind"
60    
61    fun moveInstr(I.COPY _) = true    fun moveInstr(I.COPY _) = true
# Line 79  Line 94 
94        (case labels of [] => [ESCAPES, FALLTHROUGH] | _ => map LABELLED labels)        (case labels of [] => [ESCAPES, FALLTHROUGH] | _ => map LABELLED labels)
95      | branchTargets(I.INSTR(I.B{addr=I.LabelOp(T.LABEL lab), LK})) = [LABELLED lab]      | branchTargets(I.INSTR(I.B{addr=I.LabelOp(T.LABEL lab), LK})) = [LABELLED lab]
96      | branchTargets(I.INSTR(I.CALL{cutsTo, ...})) = FALLTHROUGH::map LABELLED cutsTo      | branchTargets(I.INSTR(I.CALL{cutsTo, ...})) = FALLTHROUGH::map LABELLED cutsTo
97        | branchTargets(I.INSTR(I.TD _)) = [ESCAPES]
98        | branchTargets(I.INSTR(I.TW _)) = [ESCAPES]
99      | branchTargets(I.ANNOTATION{i,...}) = branchTargets i      | branchTargets(I.ANNOTATION{i,...}) = branchTargets i
100      | branchTargets _ = error "branchTargets"      | branchTargets _ = error "branchTargets"
101    
102      fun labelOp l = I.LabelOp(T.LABEL l)
103    
104      fun setTargets(I.INSTR(I.BC{bo as I.ALWAYS, bf, bit, addr, fall, LK}), [l]) =
105            I.bc{bo=bo, bf=bf, bit=bit, fall=fall, LK=LK, addr=labelOp l}
106        | setTargets(I.INSTR(I.BC{bo, bf, bit, addr, fall, LK}), [f,t]) =
107            I.bc{bo=bo, bf=bf, bit=bit, LK=LK, addr=labelOp t, fall=labelOp f}
108        | setTargets(I.INSTR(I.BCLR _), _) = error "setTargets BCLR"
109        | setTargets(I.INSTR(I.B{addr, LK}), [l]) =  I.b{addr=labelOp(l), LK=LK}
110        | setTargets(I.ANNOTATION{a,i}, l) = I.ANNOTATION{i=setTargets(i,l), a=a}
111        | setTargets _ = error "setTargets"
112    
113    fun jump lab = I.b{addr=I.LabelOp(T.LABEL lab), LK=false}    fun jump lab = I.b{addr=I.LabelOp(T.LABEL lab), LK=false}
114    
115      fun negateConditional(I.ANNOTATION{a,i}, l) =
116            I.ANNOTATION{a=a, i=negateConditional(i, l)}
117        | negateConditional(I.INSTR(I.BC{bo, bf, bit, addr, fall, LK}), lab) = let
118           val bo' = (case bo
119             of I.TRUE => I.FALSE
120              | I.FALSE => I.TRUE
121              | I.ALWAYS => error "negateCondtional: ALWAYS"
122              | I.COUNTER{eqZero, cond=NONE} => I.COUNTER{eqZero=not eqZero, cond=NONE}
123              | I.COUNTER{eqZero, cond=SOME b} => error "negateConditional: COUNTER"
124            (*esac*))
125          in
126              I.bc{bo=bo', bf=bf, bit=bit, addr=labelOp lab, fall=fall, LK=LK}
127          end
128        | negateConditional _ = error "negateConditional"
129    
130    val immedRange = {lo= ~32768, hi=32767}    val immedRange = {lo= ~32768, hi=32767}
131    
132    fun loadImmed{immed,t} =    fun loadImmed{immed,t} =
# Line 94  Line 137 
137    fun loadOperand{opn,t} =    fun loadOperand{opn,t} =
138         I.arithi{oper=I.ADDI, rt=t, ra=zeroR(), im=opn}         I.arithi{oper=I.ADDI, rt=t, ra=zeroR(), im=opn}
139    
   fun setTargets _ = error " setTargets"  
   
   fun negateConditional _ = error "negateConditional"  
140    
141    fun hashOpn(I.RegOp r) = CB.hashCell r    fun hashOpn(I.RegOp r) = CB.hashCell r
142      | hashOpn(I.ImmedOp i) = Word.fromInt i      | hashOpn(I.ImmedOp i) = Word.fromInt i

Legend:
Removed from v.1123  
changed lines
  Added in v.1124

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