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/branches/SMLNJ/src/MLRISC/x86/emit/x86Asm.sml
ViewVC logotype

Diff of /sml/branches/SMLNJ/src/MLRISC/x86/emit/x86Asm.sml

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

revision 469, Wed Nov 10 22:42:52 1999 UTC revision 498, Tue Dec 7 15:44:50 1999 UTC
# Line 9  Line 9 
9                        structure Shuffle : X86SHUFFLE                        structure Shuffle : X86SHUFFLE
10                           where I = Instr                           where I = Instr
11    
12  (*#line 140.1 "x86/x86.md"*)  (*#line 141.1 "x86/x86.md"*)
13                        structure MemRegs : MEMORY_REGISTERS where I=Instr                        structure MemRegs : MEMORY_REGISTERS where I=Instr
14                       ) : INSTRUCTION_EMITTER =                       ) : INSTRUCTION_EMITTER =
15  struct  struct
# Line 20  Line 20 
20     structure LE = LabelExp     structure LE = LabelExp
21     structure Constant = I.Constant     structure Constant = I.Constant
22    
23       val show_cellset = MLRiscControl.getFlag "asm-show-cellset"
24    
25     fun error msg = MLRiscErrorMsg.error("X86Asm",msg)     fun error msg = MLRiscErrorMsg.error("X86Asm",msg)
26    
27     fun makeStream formatAnnotations =     fun makeStream formatAnnotations =
# Line 64  Line 66 
66         ((emit (C.showGP (regmap r)));         ((emit (C.showGP (regmap r)));
67         (emitRegInfo r))         (emitRegInfo r))
68    
69           fun emit_cellset(title,cellset) =
70           if !show_cellset then
71             (nl(); comment(title^C.cellsetToString' regmap cellset))
72           else ()
73           fun emit_defs cellset = emit_cellset("defs: ",cellset)
74           fun emit_uses cellset = emit_cellset("uses: ",cellset)
75    
76     fun asm_unaryOp (I.DEC) = "dec"     fun asm_unaryOp (I.DEC) = "dec"
77       | asm_unaryOp (I.INC) = "inc"       | asm_unaryOp (I.INC) = "inc"
78       | asm_unaryOp (I.NEG) = "neg"       | asm_unaryOp (I.NEG) = "neg"
# Line 123  Line 132 
132    
133     fun emitInt32 i = let     fun emitInt32 i = let
134    
135  (*#line 144.1 "x86/x86.md"*)  (*#line 145.1 "x86/x86.md"*)
136            val s = (Int32.toString i)            val s = (Int32.toString i)
137    
138  (*#line 145.1 "x86/x86.md"*)  (*#line 146.1 "x86/x86.md"*)
139            val s = (if (i >= 0)            val s = (if (i >= 0)
140                  then s                  then s
141                  else ("-" ^ (String.substring (s, 1, ((size s) - 1)))))                  else ("-" ^ (String.substring (s, 1, ((size s) - 1)))))
# Line 162  Line 171 
171        | I.LabelEA le => (emit_labexp le)        | I.LabelEA le => (emit_labexp le)
172        | I.Relative _ => (error "emit_operand")        | I.Relative _ => (error "emit_operand")
173        | I.Direct r => (emit_GP r)        | I.Direct r => (emit_GP r)
174          | I.MemReg r => (emit_operand (memReg opn))
175        | I.FDirect f => let        | I.FDirect f => let
176    
177  (*#line 171.1 "x86/x86.md"*)  (*#line 173.1 "x86/x86.md"*)
178             val f' = (regmap f)             val f' = (regmap f)
179          in (if (f' < (32 + 8))          in (if (f' < (32 + 8))
180                then (emit_FP f')                then (emit_FP f')
# Line 233  Line 243 
243        | I.CALL(operand, cellset1, cellset2, region) =>        | I.CALL(operand, cellset1, cellset2, region) =>
244          ((emit "call\t");          ((emit "call\t");
245          (stupidGas operand);          (stupidGas operand);
246          (emit_region region))          (emit_region region);
247            (emit_defs cellset1);
248            (emit_uses cellset2))
249        | I.RET operand =>        | I.RET operand =>
250          ((emit "ret");          ((emit "ret");
251    

Legend:
Removed from v.469  
changed lines
  Added in v.498

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