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
|
(*
* This signature describes the internal RTL representation.
* The internal representation differs from the user representation it that
* it is lambda-lifted, i.e., instead of having references like REG(32,123),
* it has references like PARAM i, which refers to the ith parameter.
*
* This representation is chosen so that multiple instructions can
* share the same rtl template. Also, so that the templates can be
* created once before compilation begins.
*)
signature MLTREE_RTL =
sig
structure T : MLTREE
structure Util : MLTREE_UTILS
structure Rewrite : MLTREE_REWRITE
structure Fold : MLTREE_FOLD
sharing Util.T = Rewrite.T = Fold.T = T
type ty = T.ty
type var = T.var
type rtl = T.stm
type exp = T.rexp
type cond = T.ccexp
type div_rounding_mode = T.div_rounding_mode
datatype pos = IN of int | OUT of int | IO of int * int (* def/use *)
(*-----------------------------------------------------------------------
* Basic Operations
*-----------------------------------------------------------------------*)
val showRTL : {def:int->string,
use:int->string,
regionDef:T.Region.region->string,
regionUse:T.Region.region->string} -> T.printer
val rtlToString : rtl -> string
val expToString : exp -> string
val hashRTL : rtl -> word
val eqRTL : rtl * rtl -> bool
(*-----------------------------------------------------------------------
* Construction
*-----------------------------------------------------------------------*)
val newOp : {name:string, attribs:T.Basis.attribs} -> T.Basis.misc_op
val new : rtl -> rtl
val pin : rtl -> rtl
val COPY : rtl
val JMP : rtl
(*-----------------------------------------------------------------------
* Type queries
*-----------------------------------------------------------------------*)
val isConditionalBranch : rtl -> bool
val isJump : rtl -> bool
val isLooker : rtl -> bool
(*-----------------------------------------------------------------------
* Def/use queries.
*-----------------------------------------------------------------------*)
val defUse : rtl -> exp list * exp list
(*-----------------------------------------------------------------------
* Assign positions to all arguments
*-----------------------------------------------------------------------*)
val argPos : rtl -> (exp * int) list * (exp * int) list
exception NotAnArgument
val argOf : rtl -> string -> (exp * pos)
(*-----------------------------------------------------------------------
* Number of arguments that an rtl maps into
*-----------------------------------------------------------------------*)
datatype arity = ZERO | ONE | MANY
val arity : exp -> arity (* number of values *)
val nonConstArity : exp -> arity (* number of non-constant values *)
(*-----------------------------------------------------------------------
* Extract naming constraints, if any
*-----------------------------------------------------------------------*)
val namingConstraints : exp list * exp list ->
{ fixedDefs : (exp * int) list, (* these define fixed locations *)
fixedUses : (exp * int) list, (* these define fixed locations *)
twoAddress : exp list (* these are both src and dst *)
}
(*-----------------------------------------------------------------------
* Code motion queries
*-----------------------------------------------------------------------*)
val can'tMoveUp : rtl -> bool
val can'tMoveDown : rtl -> bool
val pinned : rtl -> bool
val hasSideEffect : rtl -> bool
val can'tBeRemoved : rtl -> bool
end
|