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

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

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

revision 1002, Fri Nov 30 17:11:33 2001 UTC revision 1003, Fri Dec 7 02:45:32 2001 UTC
# Line 131  Line 131 
131     *)     *)
132    fun selectInstructions    fun selectInstructions
133         (instrStream as         (instrStream as
134          TS.S.STREAM{emit,defineLabel,entryLabel,pseudoOp,annotation,getAnnotations,          TS.S.STREAM{emit=emitInstruction,defineLabel,entryLabel,pseudoOp,
135                   beginCluster,endCluster,exitBlock,comment,...}) =                      annotation,getAnnotations,beginCluster,endCluster,exitBlock,comment,...}) =
136    let exception EA    let
137          val emit = emitInstruction o I.INSTR
138          exception EA
139    
140        (* label where a trap is generated -- one per cluster *)        (* label where a trap is generated -- one per cluster *)
141        val trapLabel = ref (NONE: (I.instruction * Label.label) option)        val trapLabel = ref (NONE: (I.instruction * Label.label) option)
# Line 150  Line 152 
152        let val jmp =        let val jmp =
153              case !trapLabel of              case !trapLabel of
154                NONE => let val label = Label.label "trap" ()                NONE => let val label = Label.label "trap" ()
155                            val jmp   = I.JCC{cond=I.O,                            val jmp   = I.jcc{cond=I.O,
156                                              opnd=I.ImmedLabel(T.LABEL label)}                                              opnd=I.ImmedLabel(T.LABEL label)}
157                        in  trapLabel := SOME(jmp, label); jmp end                        in  trapLabel := SOME(jmp, label); jmp end
158              | SOME(jmp, _) => jmp              | SOME(jmp, _) => jmp
159        in  emit jmp end        in  emitInstruction jmp end
160    
161        val newReg  = C.newReg        val newReg  = C.newReg
162        val newFreg = C.newFreg        val newFreg = C.newFreg
# Line 169  Line 171 
171          | mark'(i,a::an) = mark'(I.ANNOTATION{i=i,a=a},an)          | mark'(i,a::an) = mark'(I.ANNOTATION{i=i,a=a},an)
172    
173        (* annotate an expression and emit it *)        (* annotate an expression and emit it *)
174        fun mark(i,an) = emit(mark'(i,an))        fun mark(i,an) = emitInstruction(mark'(I.INSTR i,an))
175    
176        val emits = app emit        val emits = app emitInstruction
177    
178        (* emit parallel copies for integers        (* emit parallel copies for integers
179         * Translates parallel copies that involve memregs into         * Translates parallel copies that involve memregs into
# Line 182  Line 184 
184            let fun mvInstr{dst as I.MemReg rd, src as I.MemReg rs} =            let fun mvInstr{dst as I.MemReg rd, src as I.MemReg rs} =
185                    if CB.sameColor(rd,rs) then [] else                    if CB.sameColor(rd,rs) then [] else
186                    let val tmpR = I.Direct(newReg())                    let val tmpR = I.Direct(newReg())
187                    in  [I.MOVE{mvOp=I.MOVL, src=src, dst=tmpR},                    in  [I.move{mvOp=I.MOVL, src=src, dst=tmpR},
188                         I.MOVE{mvOp=I.MOVL, src=tmpR, dst=dst}]                         I.move{mvOp=I.MOVL, src=tmpR, dst=dst}]
189                    end                    end
190                  | mvInstr{dst=I.Direct rd, src=I.Direct rs} =                  | mvInstr{dst=I.Direct rd, src=I.Direct rs} =
191                      if CB.sameColor(rd,rs) then []                      if CB.sameColor(rd,rs) then []
192                      else [I.COPY{dst=[rd], src=[rs], tmp=NONE}]                      else [I.copy{dst=[rd], src=[rs], tmp=NONE}]
193                  | mvInstr{dst, src} = [I.MOVE{mvOp=I.MOVL, src=src, dst=dst}]                  | mvInstr{dst, src} = [I.move{mvOp=I.MOVL, src=src, dst=dst}]
194            in            in
195               emits (Shuffle.shuffle{mvInstr=mvInstr, ea=IntReg}               emits (Shuffle.shuffle{mvInstr=mvInstr, ea=IntReg}
196                 {tmp=SOME(I.Direct(newReg())),                 {tmp=SOME(I.Direct(newReg())),
# Line 263  Line 265 
265          | fcopy''(fty, dst, src, an) =          | fcopy''(fty, dst, src, an) =
266            if true orelse isAnyFMemReg dst orelse isAnyFMemReg src then            if true orelse isAnyFMemReg dst orelse isAnyFMemReg src then
267            let val fsize = fsize fty            let val fsize = fsize fty
268                fun mvInstr{dst, src} = [I.FMOVE{fsize=fsize, src=src, dst=dst}]                fun mvInstr{dst, src} = [I.fmove{fsize=fsize, src=src, dst=dst}]
269            in            in
270                emits (Shuffle.shuffle{mvInstr=mvInstr, ea=RealReg}                emits (Shuffle.shuffle{mvInstr=mvInstr, ea=RealReg}
271                  {tmp=case dst of                  {tmp=case dst of
# Line 1762  Line 1764 
1764                      operand       = operand,                      operand       = operand,
1765                      reduceOperand = reduceOpnd,                      reduceOperand = reduceOpnd,
1766                      addressOf     = fn e => address(e, I.Region.memory), (*XXX*)                      addressOf     = fn e => address(e, I.Region.memory), (*XXX*)
1767                      emit          = mark,                      emit          = emitInstruction o mark',
1768                      instrStream   = instrStream,                      instrStream   = instrStream,
1769                      mltreeStream  = self()                      mltreeStream  = self()
1770                     }                     }

Legend:
Removed from v.1002  
changed lines
  Added in v.1003

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