cannam@127: (* cannam@127: * Copyright (c) 1997-1999 Massachusetts Institute of Technology cannam@127: * Copyright (c) 2003, 2007-14 Matteo Frigo cannam@127: * Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology cannam@127: * cannam@127: * This program is free software; you can redistribute it and/or modify cannam@127: * it under the terms of the GNU General Public License as published by cannam@127: * the Free Software Foundation; either version 2 of the License, or cannam@127: * (at your option) any later version. cannam@127: * cannam@127: * This program is distributed in the hope that it will be useful, cannam@127: * but WITHOUT ANY WARRANTY; without even the implied warranty of cannam@127: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the cannam@127: * GNU General Public License for more details. cannam@127: * cannam@127: * You should have received a copy of the GNU General Public License cannam@127: * along with this program; if not, write to the Free Software cannam@127: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA cannam@127: * cannam@127: *) cannam@127: cannam@127: type stride = cannam@127: | SVar of string cannam@127: | SConst of string cannam@127: | SInteger of int cannam@127: | SNeg of stride cannam@127: val array_subscript : string -> stride -> int -> string cannam@127: val varray_subscript : string -> stride -> stride -> int -> int -> string cannam@127: cannam@127: val real_of : string -> string cannam@127: val imag_of : string -> string cannam@127: cannam@127: val realtype : string cannam@127: val realtypep : string cannam@127: val constrealtype : string cannam@127: val constrealtypep : string cannam@127: val stridetype : string cannam@127: cannam@127: type c_decl = cannam@127: | Decl of string * string cannam@127: | Tdecl of string (* arbitrary text declaration *) cannam@127: cannam@127: and c_ast = cannam@127: | Asch of Annotate.annotated_schedule cannam@127: | Simd_leavefun cannam@127: | Return of c_ast cannam@127: | For of c_ast * c_ast * c_ast * c_ast cannam@127: | If of c_ast * c_ast cannam@127: | Block of (c_decl list) * (c_ast list) cannam@127: | Binop of string * c_ast * c_ast cannam@127: | Expr_assign of c_ast * c_ast cannam@127: | Stmt_assign of c_ast * c_ast cannam@127: | Comma of c_ast * c_ast cannam@127: | Integer of int cannam@127: | CVar of string cannam@127: | CCall of string * c_ast cannam@127: | CPlus of c_ast list cannam@127: | ITimes of c_ast * c_ast cannam@127: | CUminus of c_ast cannam@127: and c_fcn = | Fcn of string * string * c_decl list * c_ast cannam@127: cannam@127: val unparse_expr : Expr.expr -> string cannam@127: val unparse_assignment : Expr.assignment -> string cannam@127: val unparse_annotated : bool -> Annotate.annotated_schedule -> string cannam@127: val unparse_decl : c_decl -> string cannam@127: val unparse_ast : c_ast -> string cannam@127: val unparse_function : c_fcn -> string cannam@127: cannam@127: val flops_of : c_fcn -> string cannam@127: val print_cost : c_fcn -> string cannam@127: cannam@127: val ast_to_expr_list : c_ast -> Expr.expr list cannam@127: val extract_constants : c_ast -> c_decl list cannam@127: val ctimes : (c_ast * c_ast) -> c_ast