34 |
val sizeOf = Endian.sizeOf |
val sizeOf = Endian.sizeOf |
35 |
val emitValue = Endian.emitValue |
val emitValue = Endian.emitValue |
36 |
|
|
37 |
|
val labelToString = Label.fmt {gPrefix="", aPrefix="L"} |
38 |
|
|
39 |
fun prIntInf i = |
fun prIntInf i = |
40 |
if IntInf.sign i < 0 then "-"^IntInf.toString(IntInf.~ i) |
if IntInf.sign i < 0 then "-"^IntInf.toString(IntInf.~ i) |
41 |
else IntInf.toString i |
else IntInf.toString i |
54 |
|
|
55 |
fun lexpToString le = toStr(le, 0) |
fun lexpToString le = toStr(le, 0) |
56 |
|
|
57 |
and toStr(T.LABEL lab, _) = Label.fmt labFmt lab |
and toStr(T.LABEL lab, _) = labelToString lab |
58 |
| toStr(T.LABEXP le, p) = toStr(le, p) |
| toStr(T.LABEXP le, p) = toStr(le, p) |
59 |
| toStr(T.CONST c, _) = |
| toStr(T.CONST c, _) = |
60 |
(prInt(T.Constant.valueOf c) handle _ => T.Constant.toString c) |
(prInt(T.Constant.valueOf c) handle _ => T.Constant.toString c) |
81 |
| toString(PB.ALIGN_ENTRY) = "\t.align\t4" (* 16 byte boundary *) |
| toString(PB.ALIGN_ENTRY) = "\t.align\t4" (* 16 byte boundary *) |
82 |
| toString(PB.ALIGN_LABEL) = "\t.align\t2" |
| toString(PB.ALIGN_LABEL) = "\t.align\t2" |
83 |
|
|
84 |
| toString(PB.DATA_LABEL lab) = Label.fmt labFmt lab ^ ":" |
| toString(PB.DATA_LABEL lab) = labelToString lab ^ ":" |
85 |
| toString(PB.DATA_READ_ONLY) = "\t.const_data" |
| toString(PB.DATA_READ_ONLY) = "\t.const_data" |
86 |
| toString(PB.DATA) = "\t.data" |
| toString(PB.DATA) = "\t.data" |
87 |
| toString(PB.BSS) = "\t.section\t__DATA,__BSS" |
| toString(PB.BSS) = "\t.section\t__DATA,__BSS" |
123 |
| toString(PB.COMMENT txt) = Fmt.format "; %s" [Fmt.STR txt] |
| toString(PB.COMMENT txt) = Fmt.format "; %s" [Fmt.STR txt] |
124 |
| toString(PB.EXT _) = error "EXT" |
| toString(PB.EXT _) = error "EXT" |
125 |
|
|
126 |
fun defineLabel lab = Label.fmt labFmt lab ^ ":" |
fun defineLabel lab = labelToString lab ^ ":" |
127 |
|
|
128 |
end |
end |