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/amd64.mdl
ViewVC logotype

Diff of /MLRISC/trunk/amd64/amd64.mdl

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 88  Line 88 
88        (* Note: Relative is only generated after sdi resolution *)        (* Note: Relative is only generated after sdi resolution *)
89        datatype operand =        datatype operand =
90           Immed      of Int32.int           rtl: int           Immed      of Int32.int           rtl: int
91           | Immed64    of Int64.int           rtl: int
92         | ImmedLabel of T.labexp            rtl: labexp         | ImmedLabel of T.labexp            rtl: labexp
93         | Relative   of int                 (* no semantics given *)         | Relative   of int                 (* no semantics given *)
94         | LabelEA    of T.labexp            rtl: labexp (* XXX *)         | LabelEA    of T.labexp            rtl: labexp (* XXX *)
# Line 435  Line 436 
436      immedOpnd{opnd} =      immedOpnd{opnd} =
437        (case opnd of        (case opnd of
438           I.Immed i32 => i32           I.Immed i32 => i32
439           | I.Immed i64 => i64
440         | I.ImmedLabel le => lexp le         | I.ImmedLabel le => lexp le
441         | I.LabelEA le => lexp le         | I.LabelEA le => lexp le
442         | _ => error "immedOpnd"         | _ => error "immedOpnd"
# Line 463  Line 465 
465          (I.ImmedLabel le, dst) => arith{opc1,opc2,src=I.Immed(lexp le),dst}          (I.ImmedLabel le, dst) => arith{opc1,opc2,src=I.Immed(lexp le),dst}
466        | (I.LabelEA le, dst) => arith{opc1,opc2,src=I.Immed(lexp le),dst}        | (I.LabelEA le, dst) => arith{opc1,opc2,src=I.Immed(lexp le),dst}
467        | (I.Immed i,dst) => ()        | (I.Immed i,dst) => ()
468          | (I.Immed64 i,dst) => ()
469        | (src, I.Direct (_,r)) => encodeReg{prefix=opc1+op3,reg,opnd=src}        | (src, I.Direct (_,r)) => encodeReg{prefix=opc1+op3,reg,opnd=src}
470        | (I.Direct (_,r),dst) => encodeReg{prefix=opc1+0w1,reg,opnd=dst}        | (I.Direct (_,r),dst) => encodeReg{prefix=opc1+0w1,reg,opnd=dst}
471        | _ => error "arith"        | _ => error "arith"
# Line 470  Line 473 
473    
474    structure Assembly =    structure Assembly =
475      struct      struct
476        fun emitInt32 i = let val s = Int32.toString i        fun emitInt32 i = let
477              val s = Int32.toString i
478           val s = if i >= 0 then s else "-"^String.substring(s,1,size s-1)           val s = if i >= 0 then s else "-"^String.substring(s,1,size s-1)
479           in           in
480             emit s             emit s
481           end           end
482          fun emitInt64 i = let
483              val s = Int64.toString i
484              val s = if (i >= 0) then s else "-"^String.substring(s,1,size s-1)
485              in
486                  emit s
487              end
488    
489        val {low=SToffset, ...} = C.cellRange CellsBasis.FP        val {low=SToffset, ...} = C.cellRange CellsBasis.FP
490    
# Line 484  Line 494 
494          | emitScale 3 = emit "8"          | emitScale 3 = emit "8"
495          | emitScale _ = error "emitScale"          | emitScale _ = error "emitScale"
496    
497        and eImmed(I.Immed (i)) = emitInt32 i        and eImmed(I.Immed i) = emitInt32 i
498            | eImmed(I.Immed64 i) = emitInt64 i
499          | eImmed(I.ImmedLabel lexp) = emit_labexp lexp          | eImmed(I.ImmedLabel lexp) = emit_labexp lexp
500          | eImmed _ = error "eImmed"          | eImmed _ = error "eImmed"
501    
502        and emit_operand opn = (case opn        and emit_operand opn = (case opn
503            of I.Immed i => (emit "$"; emitInt32 i)            of I.Immed i => (emit "$"; emitInt32 i)
504               | I.Immed64 i => (emit "$"; emitInt64 i)
505             | I.ImmedLabel lexp => (emit "$"; emit_labexp lexp)             | I.ImmedLabel lexp => (emit "$"; emit_labexp lexp)
506             | I.LabelEA le => emit_labexp le             | I.LabelEA le => emit_labexp le
507             | I.Relative _ => error "emit_operand"             | I.Relative _ => error "emit_operand"
# Line 516  Line 528 
528    
529        and emit_disp(I.Immed 0) = ()        and emit_disp(I.Immed 0) = ()
530          | emit_disp(I.Immed i) = emitInt32 i          | emit_disp(I.Immed i) = emitInt32 i
531            | emit_disp(I.Immed64 0) = ()
532            | emit_disp(I.Immed64 i) = emitInt64 i
533          | emit_disp(I.ImmedLabel lexp) = emit_labexp lexp          | emit_disp(I.ImmedLabel lexp) = emit_labexp lexp
534          | emit_disp _ = error "emit_disp"          | emit_disp _ = error "emit_disp"
535    

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