Lines 59-64
along with GCC; see the file COPYING3. If not see
Link Here
|
59 |
#include "cloog/cloog.h" |
59 |
#include "cloog/cloog.h" |
60 |
#include "graphite.h" |
60 |
#include "graphite.h" |
61 |
|
61 |
|
|
|
62 |
#include <dlfcn.h> |
63 |
#define DYNSYMS \ |
64 |
DYNSYM (cloog_block_alloc); \ |
65 |
DYNSYM (cloog_block_list_free); \ |
66 |
DYNSYM (cloog_block_list_malloc); \ |
67 |
DYNSYM (cloog_clast_create); \ |
68 |
DYNSYM (cloog_clast_free); \ |
69 |
DYNSYM (cloog_domain_free); \ |
70 |
DYNSYM (cloog_domain_matrix2domain); \ |
71 |
DYNSYM (cloog_initialize); \ |
72 |
DYNSYM (cloog_loop_malloc); \ |
73 |
DYNSYM (cloog_matrix_alloc); \ |
74 |
DYNSYM (cloog_matrix_copy); \ |
75 |
DYNSYM (cloog_matrix_free); \ |
76 |
DYNSYM (cloog_matrix_print); \ |
77 |
DYNSYM (cloog_names_malloc); \ |
78 |
DYNSYM (cloog_names_scalarize); \ |
79 |
DYNSYM (cloog_options_free); \ |
80 |
DYNSYM (cloog_options_malloc); \ |
81 |
DYNSYM (cloog_program_dump_cloog); \ |
82 |
DYNSYM (cloog_program_extract_scalars); \ |
83 |
DYNSYM (cloog_program_free); \ |
84 |
DYNSYM (cloog_program_generate); \ |
85 |
DYNSYM (cloog_program_malloc); \ |
86 |
DYNSYM (cloog_program_print); \ |
87 |
DYNSYM (cloog_program_scatter); \ |
88 |
DYNSYM (cloog_statement_alloc); \ |
89 |
DYNSYM (ppl_finalize); \ |
90 |
DYNSYM (pprint); \ |
91 |
DYNSYM (stmt_block); \ |
92 |
DYNSYM (stmt_for); \ |
93 |
DYNSYM (stmt_guard); \ |
94 |
DYNSYM (stmt_root); \ |
95 |
DYNSYM (stmt_user); |
96 |
static struct |
97 |
{ |
98 |
bool inited; |
99 |
void *h; |
100 |
#define DYNSYM(x) __typeof (x) *p_##x |
101 |
DYNSYMS |
102 |
#undef DYNSYM |
103 |
} cloog_pointers; |
104 |
|
105 |
#define cloog_block_alloc (*cloog_pointers.p_cloog_block_alloc) |
106 |
#define cloog_block_list_free (*cloog_pointers.p_cloog_block_list_free) |
107 |
#define cloog_block_list_malloc (*cloog_pointers.p_cloog_block_list_malloc) |
108 |
#define cloog_clast_create (*cloog_pointers.p_cloog_clast_create) |
109 |
#define cloog_clast_free (*cloog_pointers.p_cloog_clast_free) |
110 |
#define cloog_domain_free (*cloog_pointers.p_cloog_domain_free) |
111 |
#define cloog_domain_matrix2domain (*cloog_pointers.p_cloog_domain_matrix2domain) |
112 |
#define cloog_initialize (*cloog_pointers.p_cloog_initialize) |
113 |
#define cloog_loop_malloc (*cloog_pointers.p_cloog_loop_malloc) |
114 |
#define cloog_matrix_alloc (*cloog_pointers.p_cloog_matrix_alloc) |
115 |
#define cloog_matrix_copy (*cloog_pointers.p_cloog_matrix_copy) |
116 |
#define cloog_matrix_free (*cloog_pointers.p_cloog_matrix_free) |
117 |
#define cloog_matrix_print (*cloog_pointers.p_cloog_matrix_print) |
118 |
#define cloog_names_malloc (*cloog_pointers.p_cloog_names_malloc) |
119 |
#define cloog_names_scalarize (*cloog_pointers.p_cloog_names_scalarize) |
120 |
#define cloog_options_free (*cloog_pointers.p_cloog_options_free) |
121 |
#define cloog_options_malloc (*cloog_pointers.p_cloog_options_malloc) |
122 |
#define cloog_program_dump_cloog (*cloog_pointers.p_cloog_program_dump_cloog) |
123 |
#define cloog_program_extract_scalars (*cloog_pointers.p_cloog_program_extract_scalars) |
124 |
#define cloog_program_free (*cloog_pointers.p_cloog_program_free) |
125 |
#define cloog_program_generate (*cloog_pointers.p_cloog_program_generate) |
126 |
#define cloog_program_malloc (*cloog_pointers.p_cloog_program_malloc) |
127 |
#define cloog_program_print (*cloog_pointers.p_cloog_program_print) |
128 |
#define cloog_program_scatter (*cloog_pointers.p_cloog_program_scatter) |
129 |
#define cloog_statement_alloc (*cloog_pointers.p_cloog_statement_alloc) |
130 |
#define ppl_finalize (*cloog_pointers.p_ppl_finalize) |
131 |
#define pprint (*cloog_pointers.p_pprint) |
132 |
#define stmt_block (*cloog_pointers.p_stmt_block) |
133 |
#define stmt_for (*cloog_pointers.p_stmt_for) |
134 |
#define stmt_guard (*cloog_pointers.p_stmt_guard) |
135 |
#define stmt_root (*cloog_pointers.p_stmt_root) |
136 |
#define stmt_user (*cloog_pointers.p_stmt_user) |
137 |
|
138 |
#define cloog_finalize (*cloog_pointers.p_ppl_finalize) |
139 |
|
140 |
static bool |
141 |
init_cloog_pointers (void) |
142 |
{ |
143 |
void *h; |
144 |
|
145 |
if (cloog_pointers.inited) |
146 |
return cloog_pointers.h != NULL; |
147 |
h = dlopen ("libcloog.so.0", RTLD_LAZY); |
148 |
cloog_pointers.h = h; |
149 |
if (h == NULL) |
150 |
return false; |
151 |
#define DYNSYM(x) \ |
152 |
do \ |
153 |
{ \ |
154 |
union { __typeof (cloog_pointers.p_##x) p; void *q; } u; \ |
155 |
u.q = dlsym (h, #x); \ |
156 |
if (u.q == NULL) \ |
157 |
return false; \ |
158 |
cloog_pointers.p_##x = u.p; \ |
159 |
} \ |
160 |
while (0) |
161 |
DYNSYMS |
162 |
#undef DYNSYM |
163 |
return true; |
164 |
} |
165 |
|
62 |
static VEC (scop_p, heap) *current_scops; |
166 |
static VEC (scop_p, heap) *current_scops; |
63 |
|
167 |
|
64 |
/* Converts a GMP constant V to a tree and returns it. */ |
168 |
/* Converts a GMP constant V to a tree and returns it. */ |
Lines 4075-4084
clast_get_body_of_loop (struct clast_stmt *stmt)
Link Here
|
4075 |
STMT. */ |
4179 |
STMT. */ |
4076 |
|
4180 |
|
4077 |
static tree |
4181 |
static tree |
4078 |
gcc_type_for_iv_of_clast_loop (struct clast_for *stmt_for) |
4182 |
gcc_type_for_iv_of_clast_loop (struct clast_for *stmt_fora) |
4079 |
{ |
4183 |
{ |
4080 |
struct clast_user_stmt *stmt = clast_get_body_of_loop ((struct clast_stmt *) stmt_for); |
4184 |
struct clast_user_stmt *stmt = clast_get_body_of_loop ((struct clast_stmt *) stmt_fora); |
4081 |
const char *cloog_iv = stmt_for->iterator; |
4185 |
const char *cloog_iv = stmt_fora->iterator; |
4082 |
CloogStatement *cs = stmt->statement; |
4186 |
CloogStatement *cs = stmt->statement; |
4083 |
graphite_bb_p gbb = (graphite_bb_p) cloog_statement_usr (cs); |
4187 |
graphite_bb_p gbb = (graphite_bb_p) cloog_statement_usr (cs); |
4084 |
|
4188 |
|
Lines 6109-6114
graphite_transform_loops (void)
Link Here
|
6109 |
if (number_of_loops () <= 1) |
6213 |
if (number_of_loops () <= 1) |
6110 |
return; |
6214 |
return; |
6111 |
|
6215 |
|
|
|
6216 |
if (!init_cloog_pointers ()) |
6217 |
{ |
6218 |
sorry ("Graphite loop optimizations cannot be used"); |
6219 |
return; |
6220 |
} |
6221 |
|
6112 |
current_scops = VEC_alloc (scop_p, heap, 3); |
6222 |
current_scops = VEC_alloc (scop_p, heap, 3); |
6113 |
recompute_all_dominators (); |
6223 |
recompute_all_dominators (); |
6114 |
|
6224 |
|