2 /*--------------------------------------------------------------------+
4 |--------------------------------------------------------------------|
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 |
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. |
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. |
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 |
32 | Clay, the Chunky Loop Alteration wizardrY |
33 | Written by Joel Poudroux, joel.poudroux@u-psud.fr |
34 +--------------------------------------------------------------------------*/
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
] =
77 "void split(array beta, uint depth)",
78 VOID_T
, clay_function_split_type
, 2
82 "void reorder(array beta_loop, array neworder)",
83 VOID_T
, clay_function_reorder_type
, 2
87 "void interchange(array beta_inner, uint depth_1, uint depth_2, bool pretty)",
88 VOID_T
, clay_function_interchange_type
, 4
92 "void reverse(ident, uint depth)",
93 VOID_T
, clay_function_reverse_type
, 2
97 "void fuse(array beta_loop)",
98 VOID_T
, clay_function_fuse_type
, 1
102 "void skew(array beta, uint depth, int coeff)",
103 VOID_T
, clay_function_skew_type
, 3
107 "void iss(array beta_loop, list inequation { ((output,) params,)) const }",
108 VOID_T
, clay_function_iss_type
, 2
112 "void stripmine(array beta, uint depth, uint size, bool pretty)",
113 VOID_T
, clay_function_stripmine_type
, 4
117 "void unroll(array beta_loop, uint factor)",
118 VOID_T
, clay_function_unroll_type
, 2
122 "void unroll_noepilog(array beta_loop, uint factor)",
123 VOID_T
, clay_function_unroll_type
, 2
127 "void tile(array beta, uint depth, uint depth_outer, uint size, bool pretty)",
128 VOID_T
, clay_function_tile_type
, 5
132 "void shift(array beta, uint depth, list vector { ((output,) (params,)) const })",
133 VOID_T
, clay_function_shift_type
, 3
137 "void peel(array beta_loop, list inequation { (params,) const })",
138 VOID_T
, clay_function_peel_type
, 2
142 "void context(array vector)",
143 VOID_T
, clay_function_context_type
, 1
147 "void dimreorder(array beta, uint #access, array neworder)",
148 VOID_T
, clay_function_dimreorder_type
, 3
152 "void dimprivatize(array beta, uint #access, uint depth)",
153 VOID_T
, clay_function_dimprivatize_type
, 3
157 "void dimcontract(array beta, uint #access, uint depth)",
158 VOID_T
, clay_function_dimcontract_type
, 3
162 "int add_array(string name)",
163 INTEGER_T
, clay_function_addarray_type
, 1
167 "array get_beta_loop(uint n >= 0)",
168 ARRAY_T
, clay_function_getbetaloop_type
, 1
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
182 "int get_array_id(string name)",
183 INTEGER_T
, clay_function_getarrayid_type
, 1
188 VOID_T
, clay_function_print_type
, 1
192 "void replace_array(uint last_id, uint new_id)",
193 VOID_T
, clay_function_replacearray_type
, 2
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
208 "void block(array beta_stmt1, beta_stmt2)",
209 VOID_T
, clay_function_block_type
, 2