00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00052 #ifndef CTRUMP_ANALYZER_DEPTEST_H
00053 #define CTRUMP_ANALYZER_DEPTEST_H
00054
00055 #include "ctrump/analyzer/var.h"
00056 #include "ctrump/ast/expr-code.h"
00057 #include "ctrump/common/mempool.h"
00058 #include <limits.h>
00059
00060
00061 #ifdef __cplusplus
00062 extern "C" {
00063 #endif
00064
00066 enum ctrump_loop_dependence_analyze_error_code {
00067 CTRUMP_LOOP_DEPENDENCE_ANALYZE_HAVE_MULTIPLE_INDEX,
00068 CTRUMP_LOOP_DEPENDENCE_ANALYZE_HAVE_WEAK_SUBSCRIPT,
00069 CTRUMP_LOOP_DEPENDENCE_ANALYZE_HAVE_MULTIPLE_LEVEL,
00070 CTRUMP_LOOP_DEPENDENCE_ANALYZE_HAVE_COMPLICATED_SUBSCRIPT,
00071 CTRUMP_LOOP_DEPENDENCE_ANALYZE_HAVE_COMPLICATED_INNER_LOOP
00072 };
00073
00077 struct ctrump_loop_dependence_have_multiple_index {
00078 struct ctrump_loop_memory_access *access;
00079 };
00080
00084 struct ctrump_loop_dependence_have_multiple_level {
00085 struct ctrump_loop_memory_access *access0;
00086 struct ctrump_loop_memory_access *access1;
00087 };
00088
00092 struct ctrump_loop_dependence_have_weak_subscript {
00093 struct ctrump_loop_subscript *sub0;
00094 struct ctrump_loop_subscript *sub1;
00095 struct ctrump_loop_memory_access *access0;
00096 struct ctrump_loop_memory_access *access1;
00097 };
00098
00099
00103 struct ctrump_loop_dependence_have_complicated_subscript {
00104 int sub_index;
00105 struct ctrump_loop_subscript *sub0;
00106 struct ctrump_loop_subscript *sub1;
00107 struct ctrump_loop_memory_access *access0;
00108 struct ctrump_loop_memory_access *access1;
00109 };
00110
00114 struct ctrump_loop_dependence_analyze_error {
00115 enum ctrump_loop_dependence_analyze_error_code code;
00116 union {
00117 struct ctrump_loop_dependence_have_multiple_index have_miv;
00118 struct ctrump_loop_dependence_have_weak_subscript have_weak;
00119 struct ctrump_loop_dependence_have_multiple_level have_multi_level;
00120 struct ctrump_loop_dependence_have_complicated_subscript have_complicated_subscript;
00121 } u ;
00122 };
00123
00127 enum ctrump_loop_depinfo_code {
00128 CTRUMP_LOOP_DEPINFO_ANALYZE_ERROR,
00129 CTRUMP_LOOP_DEPINFO_HAVE_ERROR_INNER,
00130 CTRUMP_LOOP_DEPINFO
00131 };
00132
00136 struct ctrump_loop_dependence_analyze_error_list {
00137 int num_error;
00138 struct ctrump_loop_dependence_analyze_error *errors;
00139 };
00140
00144 struct ctrump_loop_memory_access_pair {
00145 struct ctrump_loop_memory_access *store;
00146 struct ctrump_loop_memory_access *load;
00147 };
00148
00152 enum ctrump_depend_distance_code {
00153 CTRUMP_DEPEND_DISTANCE_STRONG_SIV,
00154 CTRUMP_DEPEND_DISTANCE_INVARIANT_ZIV,
00155 CTRUMP_DEPEND_DISTANCE_MEMBER_NAME_ZIV,
00156 CTRUMP_DEPEND_DISTANCE_CONSTANT_ZIV,
00157 };
00158
00162 struct ctrump_depend_distance_strong_siv {
00163 struct ctrump_loop_index index0;
00164 struct ctrump_loop_index index1;
00166 int distance;
00167 };
00168
00172 struct ctrump_depend_distance_invariant_ziv {
00173 struct ctrump_var *var;
00174 };
00175
00179 struct ctrump_depend_distance_member_name_ziv {
00180 const struct ctrump_symbol *member_name;
00181 };
00182
00186 struct ctrump_depend_distance {
00187 enum ctrump_depend_distance_code code;
00189 union {
00190 struct ctrump_depend_distance_strong_siv strong_siv;
00191 struct ctrump_depend_distance_invariant_ziv invariant;
00192 struct ctrump_depend_distance_member_name_ziv member_name;
00193 } u;
00194 };
00195
00215 struct ctrump_dependence_vector_set {
00216 struct ctrump_var *array_var;
00217 int num_subscript;
00218 int num_vector;
00220 struct ctrump_loop_memory_access_pair *accesses;
00221 struct ctrump_depend_distance *distance_vectors;
00222 };
00223
00227 struct ctrump_loop_dependence {
00228 int num_vec_set;
00229 struct ctrump_dependence_vector_set *vectors;
00230 };
00231
00235 struct ctrump_loop_depinfo {
00236 enum ctrump_loop_depinfo_code code;
00237 union {
00238 struct ctrump_loop_dependence dep_vector;
00239 struct ctrump_loop_dependence_analyze_error_list error;
00240 } u ;
00241 };
00242
00243 struct ctrump_loop_info ;
00244
00249 void ctrump_get_loop_depinfo(struct ctrump_loop_info *loop,
00250 int *id,
00251 struct ctrump_mempool *loop_alloc);
00252
00253 #ifdef __cplusplus
00254 }
00255 #endif
00256 #endif