Blame view

src/SML/backend.sig 945 Bytes
Ulrich Schoepp committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
signature MACHINE_INSTR = sig
  type t

  val use : t -> Temp.t list
  val def : t -> Temp.t list
  val jumps : t -> Label.t list
  val isFallThrough : t -> bool
  val isMoveBetweenTemps : t -> (Temp.t * Temp.t) option
  val isAssignmentToTemp : t -> Temp.t option
  val isLabel : t -> Label.t option
  val renameInstr : t -> (Temp.t -> Temp.t) -> t
end

signature MACHINE_FUN = sig
  type t

  structure I : MACHINE_INSTR

  val machineFunctionName : t -> string
  val machineFunctionBody : t -> I.t list
  val machineFunctionRename : t -> (Temp.t -> Temp.t) -> t
  val machineFunctionSpill : t -> Temp.t list -> t
end

signature MACHINE_PRG = sig
  type t

  structure F : MACHINE_FUN

  val machinePrgFunctions : t -> F.t list
  val replaceFunctions: t -> F.t list -> t
end

signature CODEGEN = sig

  structure P : MACHINE_PRG

  val codeGen : Tree.prg -> P.t
  val allRegisters : Temp.t list
  val generalPurposeRegisters : Temp.t list
end