osl_relation_remove_column already updates the nb_columns
[clay.git] / source / functions.c
blob1cf8e056ac8da81068f2b9bf9bcb866d682bf26c
2 /*--------------------------------------------------------------------+
3 | Clay |
4 |--------------------------------------------------------------------|
5 | functions.c |
6 |--------------------------------------------------------------------|
7 | First version: 03/04/2012 |
8 +--------------------------------------------------------------------+
10 +--------------------------------------------------------------------------+
11 | / __)( ) /__\ ( \/ ) |
12 | ( (__ )(__ /(__)\ \ / Chunky Loop Alteration wizardrY |
13 | \___)(____)(__)(__)(__) |
14 +--------------------------------------------------------------------------+
15 | Copyright (C) 2012 University of Paris-Sud |
16 | |
17 | This library is free software; you can redistribute it and/or modify it |
18 | under the terms of the GNU Lesser General Public License as published by |
19 | the Free Software Foundation; either version 2.1 of the License, or |
20 | (at your option) any later version. |
21 | |
22 | This library is distributed in the hope that it will be useful but |
23 | WITHOUT ANY WARRANTY; without even the implied warranty of |
24 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser |
25 | General Public License for more details. |
26 | |
27 | You should have received a copy of the GNU Lesser General Public License |
28 | along with this software; if not, write to the Free Software Foundation, |
29 | Inc., 51 Franklin Street, Fifth Floor, |
30 | Boston, MA 02110-1301 USA |
31 | |
32 | Clay, the Chunky Loop Alteration wizardrY |
33 | Written by Joel Poudroux, joel.poudroux@u-psud.fr |
34 +--------------------------------------------------------------------------*/
37 #include <stdlib.h>
38 #include <clay/functions.h>
39 #include <clay/data.h>
42 // Authorized functions in Clay
45 int clay_function_split_type[] = {ARRAY_T, INTEGER_T};
46 int clay_function_reorder_type[] = {ARRAY_T, ARRAY_T};
47 int clay_function_interchange_type[] = {ARRAY_T, INTEGER_T, INTEGER_T, INTEGER_T};
48 int clay_function_reverse_type[] = {ARRAY_T, INTEGER_T};
49 int clay_function_fuse_type[] = {ARRAY_T};
50 int clay_function_skew_type[] = {ARRAY_T, INTEGER_T, INTEGER_T};
51 int clay_function_iss_type[] = {ARRAY_T, LIST_T};
52 int clay_function_stripmine_type[] = {ARRAY_T, INTEGER_T, INTEGER_T, INTEGER_T};
53 int clay_function_unroll_type[] = {ARRAY_T, INTEGER_T};
54 int clay_function_tile_type[] = {ARRAY_T, INTEGER_T, INTEGER_T, INTEGER_T, INTEGER_T};
55 int clay_function_shift_type[] = {ARRAY_T, INTEGER_T, LIST_T};
56 int clay_function_peel_type[] = {ARRAY_T, LIST_T};
57 int clay_function_context_type[] = {ARRAY_T};
58 int clay_function_dimreorder_type[] = {ARRAY_T, INTEGER_T, ARRAY_T};
59 int clay_function_dimprivatize_type[] = {ARRAY_T, INTEGER_T, INTEGER_T};
60 int clay_function_dimcontract_type[] = {ARRAY_T, INTEGER_T, INTEGER_T};
61 int clay_function_addarray_type[] = {STRING_T};
62 int clay_function_getbetaloop_type[] = {INTEGER_T};
63 int clay_function_getbetastmt_type[] = {INTEGER_T};
64 int clay_function_getbetaloopbyname_type[] = {STRING_T};
65 int clay_function_getarrayid_type[] = {STRING_T};
66 int clay_function_print_type[] = {MULTI_T};
67 int clay_function_replacearray_type[] = {INTEGER_T, INTEGER_T};
68 int clay_function_datacopy_type[] = {INTEGER_T, INTEGER_T, ARRAY_T, INTEGER_T, ARRAY_T};
69 int clay_function_block_type[] = {ARRAY_T, ARRAY_T};
72 // That is just the prototype of each functions, so there are no data for args
73 const clay_prototype_t functions[CLAY_FUNCTIONS_TOTAL] =
76 "split",
77 "void split(array beta, uint depth)",
78 VOID_T, clay_function_split_type, 2
81 "reorder",
82 "void reorder(array beta_loop, array neworder)",
83 VOID_T, clay_function_reorder_type, 2
86 "interchange",
87 "void interchange(array beta_inner, uint depth_1, uint depth_2, bool pretty)",
88 VOID_T, clay_function_interchange_type, 4
91 "reverse",
92 "void reverse(ident, uint depth)",
93 VOID_T, clay_function_reverse_type, 2
96 "fuse",
97 "void fuse(array beta_loop)",
98 VOID_T, clay_function_fuse_type, 1
101 "skew",
102 "void skew(array beta, uint depth, int coeff)",
103 VOID_T, clay_function_skew_type, 3
106 "iss",
107 "void iss(array beta_loop, list inequation { ((output,) params,)) const }",
108 VOID_T, clay_function_iss_type, 2
111 "stripmine",
112 "void stripmine(array beta, uint depth, uint size, bool pretty)",
113 VOID_T, clay_function_stripmine_type, 4
116 "unroll",
117 "void unroll(array beta_loop, uint factor)",
118 VOID_T, clay_function_unroll_type, 2
121 "unroll_noepilog",
122 "void unroll_noepilog(array beta_loop, uint factor)",
123 VOID_T, clay_function_unroll_type, 2
126 "tile",
127 "void tile(array beta, uint depth, uint depth_outer, uint size, bool pretty)",
128 VOID_T, clay_function_tile_type, 5
131 "shift",
132 "void shift(array beta, uint depth, list vector { ((output,) (params,)) const })",
133 VOID_T, clay_function_shift_type, 3
136 "peel",
137 "void peel(array beta_loop, list inequation { (params,) const })",
138 VOID_T, clay_function_peel_type, 2
141 "context",
142 "void context(array vector)",
143 VOID_T, clay_function_context_type, 1
146 "dimreorder",
147 "void dimreorder(array beta, uint #access, array neworder)",
148 VOID_T, clay_function_dimreorder_type, 3
151 "dimprivatize",
152 "void dimprivatize(array beta, uint #access, uint depth)",
153 VOID_T, clay_function_dimprivatize_type, 3
156 "dimcontract",
157 "void dimcontract(array beta, uint #access, uint depth)",
158 VOID_T, clay_function_dimcontract_type, 3
161 "add_array",
162 "int add_array(string name)",
163 INTEGER_T, clay_function_addarray_type, 1
166 "get_beta_loop",
167 "array get_beta_loop(uint n >= 0)",
168 ARRAY_T, clay_function_getbetaloop_type, 1
171 "get_beta_stmt",
172 "array get_beta_stmt(uint n >= 0)",
173 ARRAY_T, clay_function_getbetastmt_type, 1
176 "get_beta_loop_by_name",
177 "array get_beta_loop_by_name(string iterator)",
178 ARRAY_T, clay_function_getbetaloopbyname_type, 1
181 "get_array_id",
182 "int get_array_id(string name)",
183 INTEGER_T, clay_function_getarrayid_type, 1
186 "print",
187 "void print(multi)",
188 VOID_T, clay_function_print_type, 1
191 "replace_array",
192 "void replace_array(uint last_id, uint new_id)",
193 VOID_T, clay_function_replacearray_type, 2
196 "datacopy",
197 "void datacopy(uint id_copy, uint id_orig, array beta_insert,\n"
198 " bool before, array beta_get_domain)",
199 VOID_T, clay_function_datacopy_type, 5
202 "break",
203 "void break()",
204 VOID_T, NULL, 0
207 "block",
208 "void block(array beta_stmt1, beta_stmt2)",
209 VOID_T, clay_function_block_type, 2