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 624, Fri Apr 21 03:06:21 2000 UTC revision 646, Tue May 16 02:52:54 2000 UTC
# Line 9  Line 9 
9                        structure Shuffle : X86SHUFFLE                        structure Shuffle : X86SHUFFLE
10                           where I = Instr                           where I = Instr
11    
12  (*#line 195.7 "x86/x86.md"*)  (*#line 242.7 "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 126  Line 126 
126       | asm_binaryOp (I.SHLB) = "shlb"       | asm_binaryOp (I.SHLB) = "shlb"
127       | asm_binaryOp (I.SARB) = "sarb"       | asm_binaryOp (I.SARB) = "sarb"
128       | asm_binaryOp (I.SHRB) = "shrb"       | asm_binaryOp (I.SHRB) = "shrb"
129         | asm_binaryOp (I.BTSW) = "btsw"
130         | asm_binaryOp (I.BTCW) = "btcw"
131         | asm_binaryOp (I.BTRW) = "btrw"
132         | asm_binaryOp (I.BTSL) = "btsl"
133         | asm_binaryOp (I.BTCL) = "btcl"
134         | asm_binaryOp (I.BTRL) = "btrl"
135         | asm_binaryOp (I.ROLW) = "rolw"
136         | asm_binaryOp (I.RORW) = "rorw"
137         | asm_binaryOp (I.ROLL) = "roll"
138         | asm_binaryOp (I.RORL) = "rorl"
139         | asm_binaryOp (I.XCHGB) = "xchgb"
140         | asm_binaryOp (I.XCHGW) = "xchgw"
141         | asm_binaryOp (I.XCHGL) = "xchgl"
142         | asm_binaryOp (I.LOCK_ADCW) = "lock\n\tadcw"
143         | asm_binaryOp (I.LOCK_ADCL) = "lock\n\tadcl"
144         | asm_binaryOp (I.LOCK_ADDW) = "lock\n\taddw"
145         | asm_binaryOp (I.LOCK_ADDL) = "lock\n\taddl"
146         | asm_binaryOp (I.LOCK_ANBW) = "lock\n\tanbw"
147         | asm_binaryOp (I.LOCK_ANBL) = "lock\n\tanbl"
148         | asm_binaryOp (I.LOCK_ANDW) = "lock\n\tandw"
149         | asm_binaryOp (I.LOCK_ANDL) = "lock\n\tandl"
150         | asm_binaryOp (I.LOCK_BTSW) = "lock\n\tbtsw"
151         | asm_binaryOp (I.LOCK_BTSL) = "lock\n\tbtsl"
152         | asm_binaryOp (I.LOCK_BTRW) = "lock\n\tbtrw"
153         | asm_binaryOp (I.LOCK_BTRL) = "lock\n\tbtrl"
154         | asm_binaryOp (I.LOCK_BTCW) = "lock\n\tbtcw"
155         | asm_binaryOp (I.LOCK_BTCL) = "lock\n\tbtcl"
156         | asm_binaryOp (I.LOCK_ORW) = "lock\n\torw"
157         | asm_binaryOp (I.LOCK_ORL) = "lock\n\torl"
158         | asm_binaryOp (I.LOCK_SBBW) = "lock\n\tsbbw"
159         | asm_binaryOp (I.LOCK_SBBL) = "lock\n\tsbbl"
160         | asm_binaryOp (I.LOCK_SUBW) = "lock\n\tsubw"
161         | asm_binaryOp (I.LOCK_SUBL) = "lock\n\tsubl"
162         | asm_binaryOp (I.LOCK_XORW) = "lock\n\txorw"
163         | asm_binaryOp (I.LOCK_XORL) = "lock\n\txorl"
164         | asm_binaryOp (I.LOCK_XCHGB) = "lock\n\txchgb"
165         | asm_binaryOp (I.LOCK_XCHGW) = "lock\n\txchgw"
166         | asm_binaryOp (I.LOCK_XCHGL) = "lock\n\txchgl"
167     and emit_binaryOp x = emit (asm_binaryOp x)     and emit_binaryOp x = emit (asm_binaryOp x)
168     and asm_multDivOp (I.MULL) = "mull"     and asm_multDivOp (I.MULL) = "mull"
169       | asm_multDivOp (I.IDIVL) = "idivl"       | asm_multDivOp (I.IDIVL) = "idivl"
# Line 137  Line 175 
175       | asm_unaryOp (I.NOTL) = "notl"       | asm_unaryOp (I.NOTL) = "notl"
176       | asm_unaryOp (I.NOTW) = "notw"       | asm_unaryOp (I.NOTW) = "notw"
177       | asm_unaryOp (I.NOTB) = "notb"       | asm_unaryOp (I.NOTB) = "notb"
178         | asm_unaryOp (I.LOCK_DECL) = "lock\n\tdecl"
179         | asm_unaryOp (I.LOCK_INCL) = "lock\n\tincl"
180         | asm_unaryOp (I.LOCK_NEGL) = "lock\n\tnegl"
181         | asm_unaryOp (I.LOCK_NOTL) = "lock\n\tnotl"
182     and emit_unaryOp x = emit (asm_unaryOp x)     and emit_unaryOp x = emit (asm_unaryOp x)
183       and asm_bitOp (I.BTW) = "btw"
184         | asm_bitOp (I.BTL) = "btl"
185         | asm_bitOp (I.LOCK_BTW) = "lock\n\tbtw"
186         | asm_bitOp (I.LOCK_BTL) = "lock\n\tbtl"
187       and emit_bitOp x = emit (asm_bitOp x)
188     and asm_move (I.MOVL) = "movl"     and asm_move (I.MOVL) = "movl"
189       | asm_move (I.MOVB) = "movb"       | asm_move (I.MOVB) = "movb"
190       | asm_move (I.MOVW) = "movw"       | asm_move (I.MOVW) = "movw"
# Line 205  Line 252 
252       | asm_fenvOp (I.FNSTENV) = "fnstenv"       | asm_fenvOp (I.FNSTENV) = "fnstenv"
253     and emit_fenvOp x = emit (asm_fenvOp x)     and emit_fenvOp x = emit (asm_fenvOp x)
254    
255  (*#line 197.6 "x86/x86.md"*)  (*#line 244.6 "x86/x86.md"*)
256     val memReg = MemRegs.memReg regmap     val memReg = MemRegs.memReg regmap
257    
258  (*#line 198.6 "x86/x86.md"*)  (*#line 245.6 "x86/x86.md"*)
259     fun emitInt32 i = let     fun emitInt32 i = let
260    
261  (*#line 199.10 "x86/x86.md"*)  (*#line 246.10 "x86/x86.md"*)
262            val s = Int32.toString i            val s = Int32.toString i
263    
264  (*#line 200.10 "x86/x86.md"*)  (*#line 247.10 "x86/x86.md"*)
265            val s = (if (i >= 0)            val s = (if (i >= 0)
266                   then s                   then s
267                   else ("-" ^ (String.substring (s, 1, (size s) - 1))))                   else ("-" ^ (String.substring (s, 1, (size s) - 1))))
# Line 222  Line 269 
269         end         end
270    
271    
272  (*#line 203.6 "x86/x86.md"*)  (*#line 250.6 "x86/x86.md"*)
273     fun emitScale 0 = emit "1"     fun emitScale 0 = emit "1"
274       | emitScale 1 = emit "2"       | emitScale 1 = emit "2"
275       | emitScale 2 = emit "4"       | emitScale 2 = emit "4"
# Line 273  Line 320 
320       | emit_disp (I.ImmedLabel lexp) = emit_labexp lexp       | emit_disp (I.ImmedLabel lexp) = emit_labexp lexp
321       | emit_disp _ = error "emit_disp"       | emit_disp _ = error "emit_disp"
322    
323  (*#line 243.7 "x86/x86.md"*)  (*#line 290.7 "x86/x86.md"*)
324     fun stupidGas (I.ImmedLabel lexp) = emit_labexp lexp     fun stupidGas (I.ImmedLabel lexp) = emit_labexp lexp
325       | stupidGas opnd =       | stupidGas opnd =
326         ( emit "*";         ( emit "*";
327         emit_operand opnd )         emit_operand opnd )
328    
329  (*#line 247.7 "x86/x86.md"*)  (*#line 294.7 "x86/x86.md"*)
330     fun isMemOpnd (I.MemReg _) = true     fun isMemOpnd (I.MemReg _) = true
331       | isMemOpnd (I.FDirect f) = true       | isMemOpnd (I.FDirect f) = true
332       | isMemOpnd (I.LabelEA _) = true       | isMemOpnd (I.LabelEA _) = true
# Line 287  Line 334 
334       | isMemOpnd (I.Indexed _) = true       | isMemOpnd (I.Indexed _) = true
335       | isMemOpnd _ = false       | isMemOpnd _ = false
336    
337  (*#line 253.7 "x86/x86.md"*)  (*#line 300.7 "x86/x86.md"*)
338     fun chop fbinOp = let     fun chop fbinOp = let
339    
340  (*#line 254.15 "x86/x86.md"*)  (*#line 301.15 "x86/x86.md"*)
341            val n = size fbinOp            val n = size fbinOp
342         in         in
343            (            (
# Line 301  Line 348 
348         end         end
349    
350    
351  (*#line 260.7 "x86/x86.md"*)  (*#line 307.7 "x86/x86.md"*)
352     val emit_dst = emit_operand     val emit_dst = emit_operand
353    
354  (*#line 261.7 "x86/x86.md"*)  (*#line 308.7 "x86/x86.md"*)
355     val emit_src = emit_operand     val emit_src = emit_operand
356    
357  (*#line 262.7 "x86/x86.md"*)  (*#line 309.7 "x86/x86.md"*)
358     val emit_opnd = emit_operand     val emit_opnd = emit_operand
359    
360  (*#line 263.7 "x86/x86.md"*)  (*#line 310.7 "x86/x86.md"*)
361     val emit_rsrc = emit_operand     val emit_rsrc = emit_operand
362    
363  (*#line 264.7 "x86/x86.md"*)  (*#line 311.7 "x86/x86.md"*)
364     val emit_lsrc = emit_operand     val emit_lsrc = emit_operand
365    
366  (*#line 265.7 "x86/x86.md"*)  (*#line 312.7 "x86/x86.md"*)
367     val emit_addr = emit_operand     val emit_addr = emit_operand
368    
369  (*#line 266.7 "x86/x86.md"*)  (*#line 313.7 "x86/x86.md"*)
370     val emit_src1 = emit_operand     val emit_src1 = emit_operand
371     fun emitInstr' instr =     fun emitInstr' instr =
372         (         (
# Line 396  Line 443 
443          emit_rsrc rsrc;          emit_rsrc rsrc;
444          emit ", ";          emit ", ";
445          emit_lsrc lsrc )          emit_lsrc lsrc )
446          | I.BITOP{bitOp, lsrc, rsrc} =>
447            ( emit_bitOp bitOp;
448            emit "\t";
449            emit_rsrc rsrc;
450            emit ", ";
451            emit_lsrc lsrc )
452        | I.BINARY{binOp, src, dst} =>        | I.BINARY{binOp, src, dst} =>
453          (          (
454           case (src, binOp) of           case (src, binOp) of

Legend:
Removed from v.624  
changed lines
  Added in v.646

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