| 1 |
(* |
| 2 |
* This is a generic instruction stream datatype. |
| 3 |
* Components such as assemblers, machine code emitters, instruction |
| 4 |
* selection modules communicate with each via this interface. |
| 5 |
* |
| 6 |
* -- Allen |
| 7 |
*) |
| 8 |
|
| 9 |
functor InstructionStream(P : PSEUDO_OPS) : INSTRUCTION_STREAM = |
| 10 |
struct |
| 11 |
|
| 12 |
structure P = P |
| 13 |
|
| 14 |
datatype ('a,'b,'c,'d) stream = |
| 15 |
STREAM of |
| 16 |
{ beginCluster: int -> unit, (* start new compilation unit *) |
| 17 |
endCluster : 'b -> 'd, (* end compilation unit *) |
| 18 |
emit : 'a -> unit, (* emit instruction *) |
| 19 |
pseudoOp : P.pseudo_op -> unit, (* emit a pseudo op *) |
| 20 |
defineLabel : Label.label -> unit, (* define a local label *) |
| 21 |
entryLabel : Label.label -> unit, (* define an external label *) |
| 22 |
comment : string -> unit, (* emit comment *) |
| 23 |
annotation : Annotations.annotation -> unit, (* add annotation *) |
| 24 |
getAnnotations : unit -> Annotations.propList ref, (* get annotations*) |
| 25 |
exitBlock : 'c -> unit (* mark the end of a procedure *) |
| 26 |
} |
| 27 |
|
| 28 |
end |