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