| 1 |
(* |
| 2 |
* Compile the machine description into an internal digestable form |
| 3 |
*) |
| 4 |
signature MDL_COMPILE = |
| 5 |
sig |
| 6 |
|
| 7 |
structure Ast : MDL_AST |
| 8 |
structure Env : MDL_ENV |
| 9 |
structure Util : MDL_AST_UTIL |
| 10 |
structure Trans : MDL_AST_TRANSLATION |
| 11 |
structure Consts : MDL_AST_CONSTANTS |
| 12 |
structure Rewriter : MDL_AST_REWRITER |
| 13 |
structure AstPP : MDL_AST_PRETTY_PRINTER |
| 14 |
structure TypeUtils : MDL_TYPE_UTILS |
| 15 |
structure Error : MDL_ERROR |
| 16 |
sharing Ast = Env.Ast = Util.Ast = Rewriter.Ast = Consts.Ast = |
| 17 |
Trans.Ast = AstPP.Ast = TypeUtils.Ast |
| 18 |
|
| 19 |
type md (* machine description *) |
| 20 |
type filename = string |
| 21 |
|
| 22 |
(* Extract info from a machine description *) |
| 23 |
val endianess : md -> Ast.endianess (* endianess *) |
| 24 |
val archKind : md -> Ast.archKind (* kind of architecture *) |
| 25 |
val asmCase : md -> Ast.assemblycase (* assembly case *) |
| 26 |
val name : md -> string (* name of description *) |
| 27 |
val filename : md -> string (* filename *) |
| 28 |
val env : md -> Env.env (* environment *) |
| 29 |
val cells : md -> Ast.storagedecl list |
| 30 |
(* |
| 31 |
val cellSets : md -> Ast.storagedecl list (* all cellkinds with cellsets *) |
| 32 |
val cellSetsAliases : md -> Ast.storagedecl list (* include all aliases *) |
| 33 |
*) |
| 34 |
val locations : md -> Ast.locbind list |
| 35 |
val formats : md -> (int option * Ast.formatbind) list |
| 36 |
val debugging : md -> string -> bool |
| 37 |
val lookupCellKind : md -> string -> Ast.storagedecl |
| 38 |
val lookupDatatype : md -> string -> Ast.datatypebind |
| 39 |
val hasCopyImpl : md -> bool |
| 40 |
|
| 41 |
val resources : md -> Ast.id list |
| 42 |
val pipelines : md -> Ast.pipelinebind list |
| 43 |
val cpus : md -> Ast.cpubind list |
| 44 |
val latencies : md -> Ast.latencybind list |
| 45 |
|
| 46 |
(* Compile an AST into a machine description *) |
| 47 |
val compile : filename * Ast.decl list -> md |
| 48 |
|
| 49 |
(* Extract info from the environment *) |
| 50 |
val declOf : md -> string -> Ast.decl (* body of structure *) |
| 51 |
val fctArgOf : md -> string -> Ast.decl (* functor argument *) |
| 52 |
val typeOf : md -> string -> Ast.decl (* type definitions *) |
| 53 |
val instructions : md -> Ast.consbind list |
| 54 |
|
| 55 |
(* Require the definitions of these things *) |
| 56 |
val require : md -> string -> {values:Ast.id list,types:Ast.id list} |
| 57 |
-> unit |
| 58 |
|
| 59 |
(* Code generation functions *) |
| 60 |
type module = string |
| 61 |
type arguments = string list |
| 62 |
type signatureName = string |
| 63 |
|
| 64 |
val mkQueryByCellKind : md -> string -> Ast.decl |
| 65 |
val forallUserCellKinds : md -> (Ast.storagedecl -> 'a) -> 'a list |
| 66 |
|
| 67 |
val errorHandler : md -> string -> Ast.decl |
| 68 |
val signame : md -> module -> string |
| 69 |
val strname : md -> module -> string |
| 70 |
val mkCode : Ast.decl list -> PP.pp |
| 71 |
val mkStr : md -> string -> signatureName -> Ast.decl list -> PP.pp |
| 72 |
val mkSig : md -> module -> Ast.decl list -> PP.pp |
| 73 |
val mkFct : md -> module -> arguments -> signatureName -> |
| 74 |
Ast.decl list -> PP.pp |
| 75 |
val mkFct' : md -> module -> Ast.decl -> signatureName -> |
| 76 |
Ast.decl list -> PP.pp |
| 77 |
val outfile : md -> module -> string -> string -> unit |
| 78 |
val pathName : md -> module -> string -> string |
| 79 |
val codegen : md -> module -> PP.pp list -> unit |
| 80 |
|
| 81 |
end |