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/emit/x86Asm.sml
ViewVC logotype

Diff of /sml/trunk/src/MLRISC/x86/emit/x86Asm.sml

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

revision 593, Tue Apr 4 07:26:33 2000 UTC revision 594, Tue Apr 4 23:41:47 2000 UTC
# Line 22  Line 22 
22    
23     val show_cellset = MLRiscControl.getFlag "asm-show-cellset"     val show_cellset = MLRiscControl.getFlag "asm-show-cellset"
24     val show_region  = MLRiscControl.getFlag "asm-show-region"     val show_region  = MLRiscControl.getFlag "asm-show-region"
25       val indent_copies = MLRiscControl.getFlag "asm-indent-copies"
26    
27     fun error msg = MLRiscErrorMsg.error("X86AsmEmitter",msg)     fun error msg = MLRiscErrorMsg.error("X86AsmEmitter",msg)
28    
# Line 35  Line 36 
36         fun emit s = (tabbing(!tabs); tabs := 0; newline := false; emit' s)         fun emit s = (tabbing(!tabs); tabs := 0; newline := false; emit' s)
37         fun nl() = (tabs := 0; if !newline then () else (newline := true; emit' "\n"))         fun nl() = (tabs := 0; if !newline then () else (newline := true; emit' "\n"))
38         fun comma() = emit ","         fun comma() = emit ","
39         fun tab() = tabs := !tabs + 1         fun tab() = tabs := 1
40           fun indent() = tabs := 2
41         fun ms n = let val s = Int.toString n         fun ms n = let val s = Int.toString n
42                    in  if n<0 then "-"^String.substring(s,1,size s-1)                    in  if n<0 then "-"^String.substring(s,1,size s-1)
43                        else s                        else s
# Line 273  Line 275 
275    
276  (*#line 243.7 "x86/x86.md"*)  (*#line 243.7 "x86/x86.md"*)
277     fun stupidGas (I.ImmedLabel lexp) = emit_labexp lexp     fun stupidGas (I.ImmedLabel lexp) = emit_labexp lexp
278       | stupidGas (I.LabelEA _) = error "stupidGas"       | stupidGas opnd =
279       | stupidGas opnd = emit_operand opnd         ( emit "*";
280           emit_operand opnd )
281    
282  (*#line 248.7 "x86/x86.md"*)  (*#line 247.7 "x86/x86.md"*)
283     fun isMemOpnd (I.MemReg _) = true     fun isMemOpnd (I.MemReg _) = true
284       | isMemOpnd (I.FDirect f) = true       | isMemOpnd (I.FDirect f) = true
285       | isMemOpnd (I.LabelEA _) = true       | isMemOpnd (I.LabelEA _) = true
# Line 284  Line 287 
287       | isMemOpnd (I.Indexed _) = true       | isMemOpnd (I.Indexed _) = true
288       | isMemOpnd _ = false       | isMemOpnd _ = false
289    
290  (*#line 254.7 "x86/x86.md"*)  (*#line 253.7 "x86/x86.md"*)
291     fun chop fbinOp = let     fun chop fbinOp = let
292    
293  (*#line 255.15 "x86/x86.md"*)  (*#line 254.15 "x86/x86.md"*)
294            val n = size fbinOp            val n = size fbinOp
295         in         in
296            (            (
# Line 298  Line 301 
301         end         end
302    
303    
304  (*#line 261.7 "x86/x86.md"*)  (*#line 260.7 "x86/x86.md"*)
305     val emit_dst = emit_operand     val emit_dst = emit_operand
306    
307  (*#line 262.7 "x86/x86.md"*)  (*#line 261.7 "x86/x86.md"*)
308     val emit_src = emit_operand     val emit_src = emit_operand
309    
310  (*#line 263.7 "x86/x86.md"*)  (*#line 262.7 "x86/x86.md"*)
311     val emit_opnd = emit_operand     val emit_opnd = emit_operand
312    
313  (*#line 264.7 "x86/x86.md"*)  (*#line 263.7 "x86/x86.md"*)
314     val emit_rsrc = emit_operand     val emit_rsrc = emit_operand
315    
316  (*#line 265.7 "x86/x86.md"*)  (*#line 264.7 "x86/x86.md"*)
317     val emit_lsrc = emit_operand     val emit_lsrc = emit_operand
318    
319  (*#line 266.7 "x86/x86.md"*)  (*#line 265.7 "x86/x86.md"*)
320     val emit_addr = emit_operand     val emit_addr = emit_operand
321    
322  (*#line 267.7 "x86/x86.md"*)  (*#line 266.7 "x86/x86.md"*)
323     val emit_src1 = emit_operand     val emit_src1 = emit_operand
324     fun emitInstr instr =     fun emitInstr' instr =
        ( tab ();  
   
325         (         (
326          case instr of          case instr of
327          I.NOP => emit "nop"          I.NOP => emit "nop"
# Line 338  Line 339 
339          emit_region region;          emit_region region;
340          emit_defs cellset1;          emit_defs cellset1;
341          emit_uses cellset2 )          emit_uses cellset2 )
342          | I.ENTER{src1, src2} =>
343            ( emit "enter\t";
344            emit_operand src1;
345            emit ", ";
346            emit_operand src2 )
347        | I.LEAVE => emit "leave"        | I.LEAVE => emit "leave"
348        | I.RET operand =>        | I.RET operand =>
349          ( emit "ret";          ( emit "ret";
# Line 528  Line 534 
534        | I.ANNOTATION{i, a} =>        | I.ANNOTATION{i, a} =>
535          ( emitInstr i;          ( emitInstr i;
536          comment (Annotations.toString a))          comment (Annotations.toString a))
537         );         )
538         nl ())            and emitInstr i = (tab(); emitInstr' i; nl())
539            and emitInstrs [] = ()            and emitInstrIndented i = (indent(); emitInstr' i; nl())
540              | emitInstrs (i::is) =            and emitInstrs instrs =
541             (emitInstr i; app (fn i => (tab(); emitInstr i)) is)             app (if !indent_copies then emitInstrIndented
542                    else emitInstr) instrs
543        in  emitInstr end        in  emitInstr end
544    
545     in  S.STREAM{beginCluster=init,     in  S.STREAM{beginCluster=init,

Legend:
Removed from v.593  
changed lines
  Added in v.594

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