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