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 /MLRISC/trunk/amd64/emit/amd64Asm.sml
ViewVC logotype

Diff of /MLRISC/trunk/amd64/emit/amd64Asm.sml

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

revision 2927, Thu Jan 17 00:46:52 2008 UTC revision 2928, Fri Jan 18 00:50:49 2008 UTC
# Line 266  Line 266 
266       | asm_isize (I.I64) = "64"       | asm_isize (I.I64) = "64"
267     and emit_isize x = emit (asm_isize x)     and emit_isize x = emit (asm_isize x)
268    
269  (*#line 473.7 "amd64/amd64.mdl"*)  (*#line 476.7 "amd64/amd64.mdl"*)
270     fun emitInt32 i =     fun emitInt32 i =
271         let         let
272  (*#line 473.29 "amd64/amd64.mdl"*)  (*#line 477.11 "amd64/amd64.mdl"*)
273             val s = Int32.toString i             val s = Int32.toString i
274    
275  (*#line 474.10 "amd64/amd64.mdl"*)  (*#line 478.11 "amd64/amd64.mdl"*)
276             val s = (if (i >= 0)             val s = (if (i >= 0)
277                    then s                    then s
278                    else ("-" ^ (String.substring (s, 1, (size s) - 1))))                    else ("-" ^ (String.substring (s, 1, (size s) - 1))))
279         in emit s         in emit s
280         end         end
281    
282  (*#line 479.7 "amd64/amd64.mdl"*)  (*#line 482.7 "amd64/amd64.mdl"*)
283       fun emitInt64 i =
284           let
285    (*#line 483.11 "amd64/amd64.mdl"*)
286               val s = Int64.toString i
287    
288    (*#line 484.11 "amd64/amd64.mdl"*)
289               val s = (if (i >= 0)
290                      then s
291                      else ("-" ^ (String.substring (s, 1, (size s) - 1))))
292           in emit s
293           end
294    
295    (*#line 489.7 "amd64/amd64.mdl"*)
296     val {low=SToffset, ...} = C.cellRange CellsBasis.FP     val {low=SToffset, ...} = C.cellRange CellsBasis.FP
297    
298  (*#line 481.7 "amd64/amd64.mdl"*)  (*#line 491.7 "amd64/amd64.mdl"*)
299     fun emitScale 0 = emit "1"     fun emitScale 0 = emit "1"
300       | emitScale 1 = emit "2"       | emitScale 1 = emit "2"
301       | emitScale 2 = emit "4"       | emitScale 2 = emit "4"
302       | emitScale 3 = emit "8"       | emitScale 3 = emit "8"
303       | emitScale _ = error "emitScale"       | emitScale _ = error "emitScale"
304     and eImmed (I.Immed i) = emitInt32 i     and eImmed (I.Immed i) = emitInt32 i
305         | eImmed (I.Immed64 i) = emitInt64 i
306       | eImmed (I.ImmedLabel lexp) = emit_labexp lexp       | eImmed (I.ImmedLabel lexp) = emit_labexp lexp
307       | eImmed _ = error "eImmed"       | eImmed _ = error "eImmed"
308     and emit_operand opn =     and emit_operand opn =
# Line 296  Line 310 
310           I.Immed i =>           I.Immed i =>
311           ( emit "$";           ( emit "$";
312             emitInt32 i )             emitInt32 i )
313           | I.Immed64 i =>
314             ( emit "$";
315               emitInt64 i )
316         | I.ImmedLabel lexp =>         | I.ImmedLabel lexp =>
317           ( emit "$";           ( emit "$";
318             emit_labexp lexp )             emit_labexp lexp )
# Line 330  Line 347 
347     and emit_cell (r, sz) = emit (CellsBasis.toStringWithSize (r, sz))     and emit_cell (r, sz) = emit (CellsBasis.toStringWithSize (r, sz))
348     and emit_disp (I.Immed 0) = ()     and emit_disp (I.Immed 0) = ()
349       | emit_disp (I.Immed i) = emitInt32 i       | emit_disp (I.Immed i) = emitInt32 i
350         | emit_disp (I.Immed64 0) = ()
351         | emit_disp (I.Immed64 i) = emitInt64 i
352       | emit_disp (I.ImmedLabel lexp) = emit_labexp lexp       | emit_disp (I.ImmedLabel lexp) = emit_labexp lexp
353       | emit_disp _ = error "emit_disp"       | emit_disp _ = error "emit_disp"
354    
355  (*#line 525.7 "amd64/amd64.mdl"*)  (*#line 539.7 "amd64/amd64.mdl"*)
356     fun stupidGas (I.ImmedLabel lexp) = emit_labexp lexp     fun stupidGas (I.ImmedLabel lexp) = emit_labexp lexp
357       | stupidGas opnd =       | stupidGas opnd =
358         ( emit "*";         ( emit "*";
359           emit_operand opnd )           emit_operand opnd )
360    
361  (*#line 529.7 "amd64/amd64.mdl"*)  (*#line 543.7 "amd64/amd64.mdl"*)
362     fun isMemOpnd (I.FDirect f) = true     fun isMemOpnd (I.FDirect f) = true
363       | isMemOpnd (I.LabelEA _) = true       | isMemOpnd (I.LabelEA _) = true
364       | isMemOpnd (I.Displace _) = true       | isMemOpnd (I.Displace _) = true
365       | isMemOpnd (I.Indexed _) = true       | isMemOpnd (I.Indexed _) = true
366       | isMemOpnd _ = false       | isMemOpnd _ = false
367    
368  (*#line 534.7 "amd64/amd64.mdl"*)  (*#line 548.7 "amd64/amd64.mdl"*)
369     fun chop fbinOp =     fun chop fbinOp =
370         let         let
371  (*#line 535.15 "amd64/amd64.mdl"*)  (*#line 549.15 "amd64/amd64.mdl"*)
372             val n = size fbinOp             val n = size fbinOp
373         in         in
374            (case Char.toLower (String.sub (fbinOp, n - 1)) of            (case Char.toLower (String.sub (fbinOp, n - 1)) of
# Line 358  Line 377 
377            )            )
378         end         end
379    
380  (*#line 541.7 "amd64/amd64.mdl"*)  (*#line 555.7 "amd64/amd64.mdl"*)
381     val emit_dst = emit_operand     val emit_dst = emit_operand
382    
383  (*#line 542.7 "amd64/amd64.mdl"*)  (*#line 556.7 "amd64/amd64.mdl"*)
384     val emit_src = emit_operand     val emit_src = emit_operand
385    
386  (*#line 543.7 "amd64/amd64.mdl"*)  (*#line 557.7 "amd64/amd64.mdl"*)
387     val emit_opnd = emit_operand     val emit_opnd = emit_operand
388    
389  (*#line 544.7 "amd64/amd64.mdl"*)  (*#line 558.7 "amd64/amd64.mdl"*)
390     val emit_opnd8 = emit_operand8     val emit_opnd8 = emit_operand8
391    
392  (*#line 545.7 "amd64/amd64.mdl"*)  (*#line 559.7 "amd64/amd64.mdl"*)
393     val emit_rsrc = emit_operand     val emit_rsrc = emit_operand
394    
395  (*#line 546.7 "amd64/amd64.mdl"*)  (*#line 560.7 "amd64/amd64.mdl"*)
396     val emit_lsrc = emit_operand     val emit_lsrc = emit_operand
397    
398  (*#line 547.7 "amd64/amd64.mdl"*)  (*#line 561.7 "amd64/amd64.mdl"*)
399     val emit_addr = emit_operand     val emit_addr = emit_operand
400    
401  (*#line 548.7 "amd64/amd64.mdl"*)  (*#line 562.7 "amd64/amd64.mdl"*)
402     val emit_src1 = emit_operand     val emit_src1 = emit_operand
403    
404  (*#line 549.7 "amd64/amd64.mdl"*)  (*#line 563.7 "amd64/amd64.mdl"*)
405     val emit_ea = emit_operand     val emit_ea = emit_operand
406    
407  (*#line 550.7 "amd64/amd64.mdl"*)  (*#line 564.7 "amd64/amd64.mdl"*)
408     val emit_count = emit_operand     val emit_count = emit_operand
409     fun emitInstr' instr =     fun emitInstr' instr =
410         (case instr of         (case instr of

Legend:
Removed from v.2927  
changed lines
  Added in v.2928

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