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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
|
(*
* Functions for building an RTL.
*)
signature BUILD_RTL =
sig
structure RTL : MLTREE_RTL
type ty = int
val map : int -> ('a -> 'b) -> 'a list -> 'b list
val fetch : ty -> RTL.loc -> RTL.exp
val := : ty -> RTL.loc * RTL.exp -> RTL.action
val aggb : ty * ty -> RTL.cell -> RTL.loc
val aggl : ty * ty -> RTL.cell -> RTL.loc
val idaggr: ty -> RTL.cell -> RTL.loc
val copy : ty -> 'a * 'a -> RTL.action
val ! : ty * string * string -> RTL.exp
val $ : string * ty -> RTL.exp -> RTL.cell
val $$ : string * ty -> RTL.exp * RTL.exp -> RTL.cell
val intConst : ty -> int -> RTL.exp
val wordConst : ty -> Word32.word -> RTL.exp
val newOp : string -> RTL.exp list -> RTL.exp
val newCond : string -> RTL.exp list -> RTL.exp
val immed : ty -> RTL.exp -> RTL.exp
val operand : ty -> RTL.exp -> RTL.exp
val label : ty -> RTL.exp -> RTL.exp
val forall : ty -> RTL.exp -> RTL.exp
val ? : ty -> RTL.exp
val not : RTL.cond -> RTL.cond
val False : RTL.cond
val True : RTL.cond
val sx : ty * ty -> RTL.exp -> RTL.exp
val zx : ty * ty -> RTL.exp -> RTL.exp
val bitslice : ty -> (int * int) list -> RTL.exp -> RTL.exp
(* Integer operators *)
val ~ : ty -> RTL.exp -> RTL.exp
val + : ty -> RTL.exp * RTL.exp -> RTL.exp
val - : ty -> RTL.exp * RTL.exp -> RTL.exp
val muls : ty -> RTL.exp * RTL.exp -> RTL.exp
val mulu : ty -> RTL.exp * RTL.exp -> RTL.exp
val divs : ty -> RTL.div_rounding_mode * RTL.exp * RTL.exp -> RTL.exp
val divu : ty -> RTL.exp * RTL.exp -> RTL.exp
val rems : ty -> RTL.div_rounding_mode * RTL.exp * RTL.exp -> RTL.exp
val remu : ty -> RTL.exp * RTL.exp -> RTL.exp
val andb : ty -> RTL.exp * RTL.exp -> RTL.exp
val orb : ty -> RTL.exp * RTL.exp -> RTL.exp
val xorb : ty -> RTL.exp * RTL.exp -> RTL.exp
val eqvb : ty -> RTL.exp * RTL.exp -> RTL.exp
val notb : ty -> RTL.exp -> RTL.exp
val << : ty -> RTL.exp * RTL.exp -> RTL.exp
val >> : ty -> RTL.exp * RTL.exp -> RTL.exp
val ~>> : ty -> RTL.exp * RTL.exp -> RTL.exp
(* Trapping operators *)
val addt : ty -> RTL.exp * RTL.exp -> RTL.exp
val subt : ty -> RTL.exp * RTL.exp -> RTL.exp
val mult : ty -> RTL.exp * RTL.exp -> RTL.exp
val divt : ty -> RTL.exp * RTL.exp -> RTL.exp
val remt : ty -> RTL.exp * RTL.exp -> RTL.exp
val cond : ty -> RTL.cond * RTL.exp * RTL.exp -> RTL.exp
(* Integer comparisons *)
val == : ty -> RTL.exp * RTL.exp -> RTL.cond
val <> : ty -> RTL.exp * RTL.exp -> RTL.cond
val > : ty -> RTL.exp * RTL.exp -> RTL.cond
val < : ty -> RTL.exp * RTL.exp -> RTL.cond
val <= : ty -> RTL.exp * RTL.exp -> RTL.cond
val >= : ty -> RTL.exp * RTL.exp -> RTL.cond
val ltu : ty -> RTL.exp * RTL.exp -> RTL.cond
val leu : ty -> RTL.exp * RTL.exp -> RTL.cond
val gtu : ty -> RTL.exp * RTL.exp -> RTL.cond
val geu : ty -> RTL.exp * RTL.exp -> RTL.cond
(* Floating point operators *)
val fadd : ty -> RTL.exp * RTL.exp -> RTL.exp
val fsub : ty -> RTL.exp * RTL.exp -> RTL.exp
val fmul : ty -> RTL.exp * RTL.exp -> RTL.exp
val fdiv : ty -> RTL.exp * RTL.exp -> RTL.exp
val fabs : ty -> RTL.exp -> RTL.exp
val fneg : ty -> RTL.exp -> RTL.exp
val fsqrt : ty -> RTL.exp -> RTL.exp
(* Floating point comparisons *)
val |?| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |!<=>| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |==| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |?=| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |!<>| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |!?>=| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |<| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |?<| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |!>=| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |!?>| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |<=| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |?<=| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |!>| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |!?<=| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |>| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |?>| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |!<=| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |!?<| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |>=| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |?>=| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |!<| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |!?=| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |<>| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |!=| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |!?| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |<=>| : ty -> RTL.exp * RTL.exp -> RTL.cond
val |?<>| : ty -> RTL.exp * RTL.exp -> RTL.cond
(* Action combinators *)
val || : RTL.action * RTL.action -> RTL.action (* parallel RTL.actions *)
val Nop : RTL.action (* empty RTL.action *)
val Jmp : int -> RTL.exp -> RTL.action (* jump to address *)
val Call : int -> RTL.exp -> RTL.action (* call address *)
val Ret : RTL.action (* return *)
val If : RTL.cond * RTL.action * RTL.action -> RTL.action (* if/then/else *)
end
|