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