blob: 362166886c55c0260f07f950d1e7b7aa7cf9514d [file] [log] [blame]
Tobias Grosser75805372011-04-29 06:27:02 +00001//===--------- ScopInfo.cpp - Create Scops from LLVM IR ------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// Create a polyhedral description for a static control flow region.
11//
12// The pass creates a polyhedral description of the Scops detected by the Scop
13// detection derived from their LLVM-IR code.
14//
15// This represantation is shared among several tools in the polyhedral
16// community, which are e.g. Cloog, Pluto, Loopo, Graphite.
17//
18//===----------------------------------------------------------------------===//
19
20#include "polly/ScopInfo.h"
21
22#include "polly/TempScopInfo.h"
23#include "polly/LinkAllPasses.h"
24#include "polly/Support/GICHelper.h"
25#include "polly/Support/ScopHelper.h"
26
27#include "llvm/Analysis/LoopInfo.h"
28#include "llvm/Analysis/ScalarEvolutionExpressions.h"
29#include "llvm/Analysis/RegionIterator.h"
30#include "llvm/Assembly/Writer.h"
31#include "llvm/ADT/Statistic.h"
32#include "llvm/ADT/SetVector.h"
33#include "llvm/Support/CommandLine.h"
34
35#define DEBUG_TYPE "polly-scops"
36#include "llvm/Support/Debug.h"
37
38#include "isl/constraint.h"
39#include "isl/set.h"
40#include "isl/map.h"
Tobias Grosser33ba62ad2011-08-18 06:31:50 +000041#include "isl/aff.h"
42#include "isl/printer.h"
Tobias Grosser75805372011-04-29 06:27:02 +000043#include <sstream>
44#include <string>
45#include <vector>
46
47using namespace llvm;
48using namespace polly;
49
50STATISTIC(ScopFound, "Number of valid Scops");
51STATISTIC(RichScopFound, "Number of Scops containing a loop");
52
Tobias Grosser33ba62ad2011-08-18 06:31:50 +000053/// Convert an int into a string.
54static std::string convertInt(int number)
55{
56 if (number == 0)
57 return "0";
58 std::string temp = "";
59 std::string returnvalue = "";
60 while (number > 0)
61 {
62 temp += number % 10 + 48;
63 number /= 10;
64 }
65 for (unsigned i = 0; i < temp.length(); i++)
66 returnvalue+=temp[temp.length() - i - 1];
67 return returnvalue;
Tobias Grosser75805372011-04-29 06:27:02 +000068}
69
Tobias Grosser30b8a092011-08-18 07:51:37 +000070static isl_set *set_remove_dim_ids(isl_set *set) {
71 isl_ctx *ctx = isl_set_get_ctx(set);
72 int numParams = isl_set_n_param(set);
73 isl_printer *p = isl_printer_to_str(ctx);
74 isl_set *new_set;
75 char *str;
76 const char *name = isl_set_get_tuple_name(set);
77
78 p = isl_printer_set_output_format (p, ISL_FORMAT_EXT_POLYLIB);
79 p = isl_printer_print_set(p, set);
80
81 str = isl_printer_get_str (p);
82 new_set = isl_set_read_from_str (ctx, str, numParams);
83 new_set = isl_set_set_tuple_name(new_set, name);
84 free (str);
85 isl_set_free (set);
86 isl_printer_free (p);
87 return new_set;
88}
89
Tobias Grosser33ba62ad2011-08-18 06:31:50 +000090static isl_map *map_remove_dim_ids(isl_map *map) {
91 isl_ctx *ctx = isl_map_get_ctx(map);
92 int numParams = isl_map_n_param(map);
93 isl_printer *p = isl_printer_to_str(ctx);
94 char *str;
Tobias Grosser30b8a092011-08-18 07:51:37 +000095 isl_map *new_map;
96 const char *name_in = isl_map_get_tuple_name(map, isl_dim_in);
97 const char *name_out = isl_map_get_tuple_name(map, isl_dim_out);
Tobias Grosser33ba62ad2011-08-18 06:31:50 +000098
99 p = isl_printer_set_output_format (p, ISL_FORMAT_EXT_POLYLIB);
100 p = isl_printer_print_map(p, map);
Tobias Grosser33ba62ad2011-08-18 06:31:50 +0000101
102 str = isl_printer_get_str (p);
Tobias Grosser30b8a092011-08-18 07:51:37 +0000103 new_map = isl_map_read_from_str (ctx, str, numParams);
104 new_map = isl_map_set_tuple_name(new_map, isl_dim_in, name_in);
105 new_map = isl_map_set_tuple_name(new_map, isl_dim_out, name_out);
106 isl_map_free (map);
Tobias Grosser33ba62ad2011-08-18 06:31:50 +0000107 free (str);
108 isl_printer_free (p);
Tobias Grosser30b8a092011-08-18 07:51:37 +0000109 return new_map;
Tobias Grosser33ba62ad2011-08-18 06:31:50 +0000110}
111
112/// Translate a SCEVExpression into an isl_pw_aff object.
113struct SCEVAffinator : public SCEVVisitor<SCEVAffinator, isl_pw_aff*> {
114private:
115 isl_ctx *ctx;
116 int NbLoopDims;
117 const Scop *scop;
118
119 /// baseAdress is set if we analyze a memory access. It holds the base address
120 /// of this memory access.
121 const Value *baseAddress;
122
123public:
124 static isl_pw_aff *getPwAff(const ScopStmt *stmt, const SCEV *scev,
125 const Value *baseAddress) {
126 SCEVAffinator Affinator(stmt, baseAddress);
127 return Affinator.visit(scev);
128 }
129
130 isl_pw_aff *visit(const SCEV *scev) {
131 // In case the scev is contained in our list of parameters, we do not
132 // further analyze this expression, but create a new parameter in the
133 // isl_pw_aff. This allows us to treat subexpressions that we cannot
134 // translate into an piecewise affine expression, as constant parameters of
135 // the piecewise affine expression.
136 int i = 0;
137 for (Scop::const_param_iterator PI = scop->param_begin(),
138 PE = scop->param_end(); PI != PE; ++PI) {
139 if (*PI == scev) {
140 isl_id *ID = isl_id_alloc(ctx, ("p" + convertInt(i)).c_str(),
141 (void *) scev);
142 isl_dim *Dim = isl_dim_set_alloc(ctx, 1, NbLoopDims);
143 Dim = isl_dim_set_dim_id(Dim, isl_dim_param, 0, ID);
144
145 isl_set *Domain = isl_set_universe(isl_dim_copy(Dim));
146 isl_aff *Affine = isl_aff_zero(isl_local_space_from_dim(Dim));
147 Affine = isl_aff_add_coefficient_si(Affine, isl_dim_param, 0, 1);
148
149 return isl_pw_aff_alloc(Domain, Affine);
150 }
151 i++;
152 }
153
154 return SCEVVisitor<SCEVAffinator, isl_pw_aff*>::visit(scev);
155 }
156
157 SCEVAffinator(const ScopStmt *stmt, const Value *baseAddress) :
158 ctx(stmt->getParent()->getCtx()),
159 NbLoopDims(stmt->getNumIterators()),
160 scop(stmt->getParent()),
161 baseAddress(baseAddress) {};
162
163 __isl_give isl_pw_aff *visitConstant(const SCEVConstant *Constant) {
164 ConstantInt *Value = Constant->getValue();
165 isl_int v;
166 isl_int_init(v);
167
168 // LLVM does not define if an integer value is interpreted as a signed or
169 // unsigned value. Hence, without further information, it is unknown how
170 // this value needs to be converted to GMP. At the moment, we only support
171 // signed operations. So we just interpret it as signed. Later, there are
172 // two options:
173 //
174 // 1. We always interpret any value as signed and convert the values on
175 // demand.
176 // 2. We pass down the signedness of the calculation and use it to interpret
177 // this constant correctly.
178 MPZ_from_APInt(v, Value->getValue(), /* isSigned */ true);
179
180 isl_dim *dim = isl_dim_set_alloc(ctx, 0, NbLoopDims);
181 isl_local_space *ls = isl_local_space_from_dim(isl_dim_copy(dim));
182 isl_aff *Affine = isl_aff_zero(ls);
183 isl_set *Domain = isl_set_universe(dim);
184
185 Affine = isl_aff_add_constant(Affine, v);
186 isl_int_clear(v);
187
188 return isl_pw_aff_alloc(Domain, Affine);
189 }
190
191 __isl_give isl_pw_aff *visitTruncateExpr(const SCEVTruncateExpr* Expr) {
192 assert(0 && "Not yet supported");
193 }
194
195 __isl_give isl_pw_aff *visitZeroExtendExpr(const SCEVZeroExtendExpr * Expr) {
196 assert(0 && "Not yet supported");
197 }
198
199 __isl_give isl_pw_aff *visitSignExtendExpr(const SCEVSignExtendExpr* Expr) {
200 // Assuming the value is signed, a sign extension is basically a noop.
201 // TODO: Reconsider this as soon as we support unsigned values.
202 return visit(Expr->getOperand());
203 }
204
205 __isl_give isl_pw_aff *visitAddExpr(const SCEVAddExpr* Expr) {
206 isl_pw_aff *Sum = visit(Expr->getOperand(0));
207
208 for (int i = 1, e = Expr->getNumOperands(); i < e; ++i) {
209 isl_pw_aff *NextSummand = visit(Expr->getOperand(i));
210 Sum = isl_pw_aff_add(Sum, NextSummand);
211 }
212
213 // TODO: Check for NSW and NUW.
214
215 return Sum;
216 }
217
218 __isl_give isl_pw_aff *visitMulExpr(const SCEVMulExpr* Expr) {
219 isl_pw_aff *Product = visit(Expr->getOperand(0));
220
221 for (int i = 1, e = Expr->getNumOperands(); i < e; ++i) {
222 isl_pw_aff *NextOperand = visit(Expr->getOperand(i));
223
224 if (!isl_pw_aff_is_cst(Product) && !isl_pw_aff_is_cst(NextOperand)) {
225 isl_pw_aff_free(Product);
226 isl_pw_aff_free(NextOperand);
227 return NULL;
228 }
229
230 Product = isl_pw_aff_mul(Product, NextOperand);
231 }
232
233 // TODO: Check for NSW and NUW.
234 return Product;
235 }
236
237 __isl_give isl_pw_aff *visitUDivExpr(const SCEVUDivExpr* Expr) {
238 assert(0 && "Not yet supported");
239 }
240
241 int getLoopDepth(const Loop *L) {
242 Loop *outerLoop =
243 scop->getRegion().outermostLoopInRegion(const_cast<Loop*>(L));
244 return L->getLoopDepth() - outerLoop->getLoopDepth();
245 }
246
247 __isl_give isl_pw_aff *visitAddRecExpr(const SCEVAddRecExpr* Expr) {
248 assert(Expr->isAffine() && "Only affine AddRecurrences allowed");
249
250 isl_pw_aff *Start = visit(Expr->getStart());
251 isl_pw_aff *Step = visit(Expr->getOperand(1));
252 isl_dim *Dim = isl_dim_set_alloc (ctx, 0, NbLoopDims);
253 isl_local_space *LocalSpace = isl_local_space_from_dim (Dim);
254
255 int loopDimension = getLoopDepth(Expr->getLoop());
256
257 isl_aff *LAff = isl_aff_set_coefficient_si (isl_aff_zero (LocalSpace),
258 isl_dim_set, loopDimension, 1);
259 isl_pw_aff *LPwAff = isl_pw_aff_from_aff(LAff);
260
261 // TODO: Do we need to check for NSW and NUW?
262 return isl_pw_aff_add(Start, isl_pw_aff_mul(Step, LPwAff));
263 }
264
265 __isl_give isl_pw_aff *visitSMaxExpr(const SCEVSMaxExpr* Expr) {
266 isl_pw_aff *Max = visit(Expr->getOperand(0));
267
268 for (int i = 1, e = Expr->getNumOperands(); i < e; ++i) {
269 isl_pw_aff *NextOperand = visit(Expr->getOperand(i));
270 Max = isl_pw_aff_max(Max, NextOperand);
271 }
272
273 return Max;
274 }
275
276 __isl_give isl_pw_aff *visitUMaxExpr(const SCEVUMaxExpr* Expr) {
277 assert(0 && "Not yet supported");
278 }
279
280 __isl_give isl_pw_aff *visitUnknown(const SCEVUnknown* Expr) {
281 Value *Value = Expr->getValue();
282
283 isl_dim *Dim;
284
285 /// If baseAddress is set, we ignore its Value object in the scev and do not
286 /// add it to the isl_pw_aff. This is because it is regarded as defining the
287 /// name of an array, in contrast to its array subscript.
288 if (baseAddress != Value) {
289 isl_id *ID = isl_id_alloc(ctx, Value->getNameStr().c_str(), Value);
290 Dim = isl_dim_set_alloc(ctx, 1, NbLoopDims);
291 Dim = isl_dim_set_dim_id(Dim, isl_dim_param, 0, ID);
292 } else {
293 Dim = isl_dim_set_alloc(ctx, 0, NbLoopDims);
294 }
295
296 isl_set *Domain = isl_set_universe(isl_dim_copy(Dim));
297 isl_aff *Affine = isl_aff_zero(isl_local_space_from_dim(Dim));
298
299 if (baseAddress != Value)
300 Affine = isl_aff_add_coefficient_si(Affine, isl_dim_param, 0, 1);
301
302 return isl_pw_aff_alloc(Domain, Affine);
303 }
304};
305
Tobias Grosser75805372011-04-29 06:27:02 +0000306//===----------------------------------------------------------------------===//
307
308MemoryAccess::~MemoryAccess() {
Tobias Grosser54a86e62011-08-18 06:31:46 +0000309 isl_map_free(AccessRelation);
Raghesh Aloor129e8672011-08-15 02:33:39 +0000310 isl_map_free(newAccessRelation);
Tobias Grosser75805372011-04-29 06:27:02 +0000311}
312
313static void replace(std::string& str, const std::string& find,
314 const std::string& replace) {
315 size_t pos = 0;
316 while((pos = str.find(find, pos)) != std::string::npos)
317 {
318 str.replace(pos, find.length(), replace);
319 pos += replace.length();
320 }
321}
322
323static void makeIslCompatible(std::string& str) {
324 replace(str, ".", "_");
Tobias Grosser3b660f82011-08-03 00:12:11 +0000325 replace(str, "\"", "_");
Tobias Grosser75805372011-04-29 06:27:02 +0000326}
327
328void MemoryAccess::setBaseName() {
329 raw_string_ostream OS(BaseName);
330 WriteAsOperand(OS, getBaseAddr(), false);
331 BaseName = OS.str();
332
333 // Remove the % in the name. This is not supported by isl.
334 BaseName.erase(0,1);
335 makeIslCompatible(BaseName);
336 BaseName = "MemRef_" + BaseName;
337}
338
339std::string MemoryAccess::getAccessFunctionStr() const {
340 return stringFromIslObj(getAccessFunction());
341}
342
343isl_basic_map *MemoryAccess::createBasicAccessMap(ScopStmt *Statement) {
344 isl_dim *dim = isl_dim_alloc(Statement->getIslContext(),
345 Statement->getNumParams(),
346 Statement->getNumIterators(), 1);
347 setBaseName();
348
349 dim = isl_dim_set_tuple_name(dim, isl_dim_out, getBaseName().c_str());
350 dim = isl_dim_set_tuple_name(dim, isl_dim_in, Statement->getBaseName());
351
352 return isl_basic_map_universe(dim);
353}
354
355MemoryAccess::MemoryAccess(const SCEVAffFunc &AffFunc, ScopStmt *Statement) {
Raghesh Aloor3cb66282011-07-12 17:14:03 +0000356 newAccessRelation = NULL;
Tobias Grosser75805372011-04-29 06:27:02 +0000357 BaseAddr = AffFunc.getBaseAddr();
358 Type = AffFunc.isRead() ? Read : Write;
359 statement = Statement;
360
361 setBaseName();
362
Tobias Grosser7d4cee42011-08-19 23:34:28 +0000363 isl_pw_aff *Affine = SCEVAffinator::getPwAff(Statement, AffFunc.OriginalSCEV,
364 AffFunc.getBaseAddr());
Tobias Grosser75805372011-04-29 06:27:02 +0000365
Tobias Grosser7d4cee42011-08-19 23:34:28 +0000366 // Devide the access function by the size of the elements in the array.
367 //
368 // A stride one array access in C expressed as A[i] is expressed in LLVM-IR
369 // as something like A[i * elementsize]. This hides the fact that two
370 // subsequent values of 'i' index two values that are stored next to each
371 // other in memory. By this devision we make this characteristic obvious
372 // again.
Tobias Grosser75805372011-04-29 06:27:02 +0000373 isl_int v;
374 isl_int_init(v);
Tobias Grosser75805372011-04-29 06:27:02 +0000375 isl_int_set_si(v, AffFunc.getElemSizeInBytes());
Tobias Grosser7d4cee42011-08-19 23:34:28 +0000376 Affine = isl_pw_aff_scale_down(Affine, v);
377 isl_int_clear(v);
Tobias Grosser75805372011-04-29 06:27:02 +0000378
Tobias Grosser7d4cee42011-08-19 23:34:28 +0000379 AccessRelation = isl_map_from_pw_aff(Affine);
380 AccessRelation = isl_map_set_tuple_name(AccessRelation, isl_dim_in,
381 Statement->getBaseName());
Tobias Grosser75805372011-04-29 06:27:02 +0000382 AccessRelation = isl_map_set_tuple_name(AccessRelation, isl_dim_out,
383 getBaseName().c_str());
Tobias Grosser30b8a092011-08-18 07:51:37 +0000384
Tobias Grosser7d4cee42011-08-19 23:34:28 +0000385 isl_dim *Model = isl_set_get_dim(Statement->getParent()->getContext());
386 AccessRelation = isl_map_align_params(AccessRelation, Model);
387
Tobias Grosser30b8a092011-08-18 07:51:37 +0000388 // FIXME: Temporarily remove dimension ids.
389 AccessRelation = map_remove_dim_ids(AccessRelation);
Tobias Grosser75805372011-04-29 06:27:02 +0000390}
391
392MemoryAccess::MemoryAccess(const Value *BaseAddress, ScopStmt *Statement) {
Raghesh Aloor3cb66282011-07-12 17:14:03 +0000393 newAccessRelation = NULL;
Tobias Grosser75805372011-04-29 06:27:02 +0000394 BaseAddr = BaseAddress;
395 Type = Read;
396 statement = Statement;
397
398 isl_basic_map *BasicAccessMap = createBasicAccessMap(Statement);
399 AccessRelation = isl_map_from_basic_map(BasicAccessMap);
400}
401
402void MemoryAccess::print(raw_ostream &OS) const {
403 OS.indent(12) << (isRead() ? "Read" : "Write") << "Access := \n";
404 OS.indent(16) << getAccessFunctionStr() << ";\n";
405}
406
407void MemoryAccess::dump() const {
408 print(errs());
409}
410
411// Create a map in the size of the provided set domain, that maps from the
412// one element of the provided set domain to another element of the provided
413// set domain.
414// The mapping is limited to all points that are equal in all but the last
415// dimension and for which the last dimension of the input is strict smaller
416// than the last dimension of the output.
417//
418// getEqualAndLarger(set[i0, i1, ..., iX]):
419//
420// set[i0, i1, ..., iX] -> set[o0, o1, ..., oX]
421// : i0 = o0, i1 = o1, ..., i(X-1) = o(X-1), iX < oX
422//
423static isl_map *getEqualAndLarger(isl_dim *setDomain) {
424 isl_dim *mapDomain = isl_dim_map_from_set(setDomain);
425 isl_basic_map *bmap = isl_basic_map_universe(mapDomain);
426
427 // Set all but the last dimension to be equal for the input and output
428 //
429 // input[i0, i1, ..., iX] -> output[o0, o1, ..., oX]
430 // : i0 = o0, i1 = o1, ..., i(X-1) = o(X-1)
431 for (unsigned i = 0; i < isl_basic_map_n_in(bmap) - 1; ++i) {
432 isl_int v;
433 isl_int_init(v);
434 isl_constraint *c = isl_equality_alloc(isl_basic_map_get_dim(bmap));
435
436 isl_int_set_si(v, 1);
437 isl_constraint_set_coefficient(c, isl_dim_in, i, v);
438 isl_int_set_si(v, -1);
439 isl_constraint_set_coefficient(c, isl_dim_out, i, v);
440
441 bmap = isl_basic_map_add_constraint(bmap, c);
442
443 isl_int_clear(v);
444 }
445
446 // Set the last dimension of the input to be strict smaller than the
447 // last dimension of the output.
448 //
449 // input[?,?,?,...,iX] -> output[?,?,?,...,oX] : iX < oX
450 //
451 unsigned lastDimension = isl_basic_map_n_in(bmap) - 1;
452 isl_int v;
453 isl_int_init(v);
454 isl_constraint *c = isl_inequality_alloc(isl_basic_map_get_dim(bmap));
455 isl_int_set_si(v, -1);
456 isl_constraint_set_coefficient(c, isl_dim_in, lastDimension, v);
457 isl_int_set_si(v, 1);
458 isl_constraint_set_coefficient(c, isl_dim_out, lastDimension, v);
459 isl_int_set_si(v, -1);
460 isl_constraint_set_constant(c, v);
461 isl_int_clear(v);
462
463 bmap = isl_basic_map_add_constraint(bmap, c);
464
465 return isl_map_from_basic_map(bmap);
466}
467
468isl_set *MemoryAccess::getStride(const isl_set *domainSubset) const {
469 isl_map *accessRelation = isl_map_copy(getAccessFunction());
470 isl_set *scatteringDomain = isl_set_copy(const_cast<isl_set*>(domainSubset));
471 isl_map *scattering = isl_map_copy(getStatement()->getScattering());
472
473 scattering = isl_map_reverse(scattering);
474 int difference = isl_map_n_in(scattering) - isl_set_n_dim(scatteringDomain);
475 scattering = isl_map_project_out(scattering, isl_dim_in,
476 isl_set_n_dim(scatteringDomain),
477 difference);
478
479 // Remove all names of the scattering dimensions, as the names may be lost
480 // anyways during the project. This leads to consistent results.
481 scattering = isl_map_set_tuple_name(scattering, isl_dim_in, "");
482 scatteringDomain = isl_set_set_tuple_name(scatteringDomain, "");
483
484 isl_map *nextScatt = getEqualAndLarger(isl_set_get_dim(scatteringDomain));
485 nextScatt = isl_map_lexmin(nextScatt);
486
487 scattering = isl_map_intersect_domain(scattering, scatteringDomain);
488
489 nextScatt = isl_map_apply_range(nextScatt, isl_map_copy(scattering));
490 nextScatt = isl_map_apply_range(nextScatt, isl_map_copy(accessRelation));
491 nextScatt = isl_map_apply_domain(nextScatt, scattering);
492 nextScatt = isl_map_apply_domain(nextScatt, accessRelation);
493
494 return isl_map_deltas(nextScatt);
495}
496
497bool MemoryAccess::isStrideZero(const isl_set *domainSubset) const {
498 isl_set *stride = getStride(domainSubset);
499 isl_constraint *c = isl_equality_alloc(isl_set_get_dim(stride));
500
501 isl_int v;
502 isl_int_init(v);
503 isl_int_set_si(v, 1);
504 isl_constraint_set_coefficient(c, isl_dim_set, 0, v);
505 isl_int_set_si(v, 0);
506 isl_constraint_set_constant(c, v);
507 isl_int_clear(v);
508
509 isl_basic_set *bset = isl_basic_set_universe(isl_set_get_dim(stride));
510
511 bset = isl_basic_set_add_constraint(bset, c);
512 isl_set *strideZero = isl_set_from_basic_set(bset);
513
514 return isl_set_is_equal(stride, strideZero);
515}
516
517bool MemoryAccess::isStrideOne(const isl_set *domainSubset) const {
518 isl_set *stride = getStride(domainSubset);
519 isl_constraint *c = isl_equality_alloc(isl_set_get_dim(stride));
520
521 isl_int v;
522 isl_int_init(v);
523 isl_int_set_si(v, 1);
524 isl_constraint_set_coefficient(c, isl_dim_set, 0, v);
525 isl_int_set_si(v, -1);
526 isl_constraint_set_constant(c, v);
527 isl_int_clear(v);
528
529 isl_basic_set *bset = isl_basic_set_universe(isl_set_get_dim(stride));
530
531 bset = isl_basic_set_add_constraint(bset, c);
532 isl_set *strideZero = isl_set_from_basic_set(bset);
533
534 return isl_set_is_equal(stride, strideZero);
535}
536
Raghesh Aloor7a04f4f2011-08-03 13:47:59 +0000537void MemoryAccess::setNewAccessFunction(isl_map *newAccess) {
538 newAccessRelation = newAccess;
Raghesh Aloor3cb66282011-07-12 17:14:03 +0000539}
Tobias Grosser75805372011-04-29 06:27:02 +0000540
541//===----------------------------------------------------------------------===//
542void ScopStmt::buildScattering(SmallVectorImpl<unsigned> &Scatter) {
543 unsigned NumberOfIterators = getNumIterators();
544 unsigned ScatDim = Parent.getMaxLoopDepth() * 2 + 1;
545 isl_dim *dim = isl_dim_alloc(Parent.getCtx(), Parent.getNumParams(),
546 NumberOfIterators, ScatDim);
547 dim = isl_dim_set_tuple_name(dim, isl_dim_out, "scattering");
548 dim = isl_dim_set_tuple_name(dim, isl_dim_in, getBaseName());
549 isl_basic_map *bmap = isl_basic_map_universe(isl_dim_copy(dim));
550 isl_int v;
551 isl_int_init(v);
552
553 // Loop dimensions.
554 for (unsigned i = 0; i < NumberOfIterators; ++i) {
555 isl_constraint *c = isl_equality_alloc(isl_dim_copy(dim));
556 isl_int_set_si(v, 1);
557 isl_constraint_set_coefficient(c, isl_dim_out, 2 * i + 1, v);
558 isl_int_set_si(v, -1);
559 isl_constraint_set_coefficient(c, isl_dim_in, i, v);
560
561 bmap = isl_basic_map_add_constraint(bmap, c);
562 }
563
564 // Constant dimensions
565 for (unsigned i = 0; i < NumberOfIterators + 1; ++i) {
566 isl_constraint *c = isl_equality_alloc(isl_dim_copy(dim));
567 isl_int_set_si(v, -1);
568 isl_constraint_set_coefficient(c, isl_dim_out, 2 * i, v);
569 isl_int_set_si(v, Scatter[i]);
570 isl_constraint_set_constant(c, v);
571
572 bmap = isl_basic_map_add_constraint(bmap, c);
573 }
574
575 // Fill scattering dimensions.
576 for (unsigned i = 2 * NumberOfIterators + 1; i < ScatDim ; ++i) {
577 isl_constraint *c = isl_equality_alloc(isl_dim_copy(dim));
578 isl_int_set_si(v, 1);
579 isl_constraint_set_coefficient(c, isl_dim_out, i, v);
580 isl_int_set_si(v, 0);
581 isl_constraint_set_constant(c, v);
582
583 bmap = isl_basic_map_add_constraint(bmap, c);
584 }
585
586 isl_int_clear(v);
587 isl_dim_free(dim);
588 Scattering = isl_map_from_basic_map(bmap);
589}
590
591void ScopStmt::buildAccesses(TempScop &tempScop, const Region &CurRegion) {
592 const AccFuncSetType *AccFuncs = tempScop.getAccessFunctions(BB);
593
594 for (AccFuncSetType::const_iterator I = AccFuncs->begin(),
595 E = AccFuncs->end(); I != E; ++I) {
596 MemAccs.push_back(new MemoryAccess(I->first, this));
597 InstructionToAccess[I->second] = MemAccs.back();
598 }
599}
600
Tobias Grosserd2795d02011-08-18 07:51:40 +0000601isl_set *ScopStmt::toConditionSet(const Comparison &Comp, isl_dim *dim) const {
602 isl_pw_aff *LHS = SCEVAffinator::getPwAff(this, Comp.getLHS()->OriginalSCEV,
603 0);
604 isl_pw_aff *RHS = SCEVAffinator::getPwAff(this, Comp.getRHS()->OriginalSCEV,
605 0);
Tobias Grosser75805372011-04-29 06:27:02 +0000606
Tobias Grosserd2795d02011-08-18 07:51:40 +0000607 isl_set *set;
Tobias Grosser75805372011-04-29 06:27:02 +0000608
Tobias Grosserd2795d02011-08-18 07:51:40 +0000609 switch (Comp.getPred()) {
Tobias Grosser75805372011-04-29 06:27:02 +0000610 case ICmpInst::ICMP_EQ:
Tobias Grosserd2795d02011-08-18 07:51:40 +0000611 set = isl_pw_aff_eq_set(LHS, RHS);
Tobias Grosser75805372011-04-29 06:27:02 +0000612 break;
613 case ICmpInst::ICMP_NE:
Tobias Grosserd2795d02011-08-18 07:51:40 +0000614 set = isl_pw_aff_ne_set(LHS, RHS);
Tobias Grosser75805372011-04-29 06:27:02 +0000615 break;
616 case ICmpInst::ICMP_SLT:
Tobias Grosserd2795d02011-08-18 07:51:40 +0000617 set = isl_pw_aff_lt_set(LHS, RHS);
Tobias Grosser75805372011-04-29 06:27:02 +0000618 break;
619 case ICmpInst::ICMP_SLE:
Tobias Grosserd2795d02011-08-18 07:51:40 +0000620 set = isl_pw_aff_le_set(LHS, RHS);
Tobias Grosser75805372011-04-29 06:27:02 +0000621 break;
Tobias Grosserd2795d02011-08-18 07:51:40 +0000622 case ICmpInst::ICMP_SGT:
623 set = isl_pw_aff_gt_set(LHS, RHS);
Tobias Grosser75805372011-04-29 06:27:02 +0000624 break;
625 case ICmpInst::ICMP_SGE:
Tobias Grosserd2795d02011-08-18 07:51:40 +0000626 set = isl_pw_aff_ge_set(LHS, RHS);
Tobias Grosser75805372011-04-29 06:27:02 +0000627 break;
Tobias Grosserd2795d02011-08-18 07:51:40 +0000628 case ICmpInst::ICMP_ULT:
629 case ICmpInst::ICMP_UGT:
630 case ICmpInst::ICMP_ULE:
Tobias Grosser75805372011-04-29 06:27:02 +0000631 case ICmpInst::ICMP_UGE:
Tobias Grosserd2795d02011-08-18 07:51:40 +0000632 llvm_unreachable("Unsigned comparisons not yet supported");
Tobias Grosser75805372011-04-29 06:27:02 +0000633 default:
634 llvm_unreachable("Non integer predicate not supported");
635 }
636
Tobias Grosserd2795d02011-08-18 07:51:40 +0000637 set = isl_set_set_tuple_name(set, isl_dim_get_tuple_name(dim, isl_dim_set));
638
639 return set;
Tobias Grosser75805372011-04-29 06:27:02 +0000640}
641
Tobias Grosserd2795d02011-08-18 07:51:40 +0000642isl_set *ScopStmt::toUpperLoopBound(const SCEVAffFunc &UpperBound, isl_dim *Dim,
Tobias Grosser75805372011-04-29 06:27:02 +0000643 unsigned BoundedDimension) const {
Tobias Grosserd2795d02011-08-18 07:51:40 +0000644 // FIXME: We should choose a consistent scheme of when to name the dimensions.
645 isl_dim *UnnamedDim = isl_dim_copy(Dim);
646 UnnamedDim = isl_dim_set_tuple_name(UnnamedDim, isl_dim_set, 0);
647 isl_local_space *LocalSpace = isl_local_space_from_dim (UnnamedDim);
648 isl_aff *LAff = isl_aff_set_coefficient_si (isl_aff_zero (LocalSpace),
649 isl_dim_set, BoundedDimension, 1);
650 isl_pw_aff *BoundedDim = isl_pw_aff_from_aff(LAff);
651 isl_pw_aff *Bound = SCEVAffinator::getPwAff(this, UpperBound.OriginalSCEV, 0);
652 isl_set *set = isl_pw_aff_le_set(BoundedDim, Bound);
653 set = isl_set_set_tuple_name(set, isl_dim_get_tuple_name(Dim, isl_dim_set));
654 return set;
Tobias Grosser75805372011-04-29 06:27:02 +0000655}
656
657void ScopStmt::buildIterationDomainFromLoops(TempScop &tempScop) {
Tobias Grosser30b8a092011-08-18 07:51:37 +0000658 isl_dim *dim = isl_dim_set_alloc(Parent.getCtx(), 0,
Tobias Grosser75805372011-04-29 06:27:02 +0000659 getNumIterators());
660 dim = isl_dim_set_tuple_name(dim, isl_dim_set, getBaseName());
661
662 Domain = isl_set_universe(isl_dim_copy(dim));
Tobias Grosser30b8a092011-08-18 07:51:37 +0000663 Domain = isl_set_align_params(Domain, isl_set_get_dim(Parent.getContext()));
Tobias Grosser75805372011-04-29 06:27:02 +0000664
665 isl_int v;
666 isl_int_init(v);
667
668 for (int i = 0, e = getNumIterators(); i != e; ++i) {
669 // Lower bound: IV >= 0.
670 isl_basic_set *bset = isl_basic_set_universe(isl_dim_copy(dim));
671 isl_constraint *c = isl_inequality_alloc(isl_dim_copy(dim));
672 isl_int_set_si(v, 1);
673 isl_constraint_set_coefficient(c, isl_dim_set, i, v);
674 bset = isl_basic_set_add_constraint(bset, c);
675 Domain = isl_set_intersect(Domain, isl_set_from_basic_set(bset));
676
677 // Upper bound: IV <= NumberOfIterations.
Hongbin Zheng27f3afb2011-04-30 03:26:51 +0000678 const Loop *L = getLoopForDimension(i);
Tobias Grosser75805372011-04-29 06:27:02 +0000679 const SCEVAffFunc &UpperBound = tempScop.getLoopBound(L);
680 isl_set *UpperBoundSet = toUpperLoopBound(UpperBound, isl_dim_copy(dim), i);
681 Domain = isl_set_intersect(Domain, UpperBoundSet);
682 }
683
684 isl_int_clear(v);
685}
686
687void ScopStmt::addConditionsToDomain(TempScop &tempScop,
688 const Region &CurRegion) {
689 isl_dim *dim = isl_set_get_dim(Domain);
690 const Region *TopR = tempScop.getMaxRegion().getParent(),
691 *CurR = &CurRegion;
692 const BasicBlock *CurEntry = BB;
693
694 // Build BB condition constrains, by traveling up the region tree.
695 do {
696 assert(CurR && "We exceed the top region?");
697 // Skip when multiple regions share the same entry.
698 if (CurEntry != CurR->getEntry()) {
699 if (const BBCond *Cnd = tempScop.getBBCond(CurEntry))
700 for (BBCond::const_iterator I = Cnd->begin(), E = Cnd->end();
701 I != E; ++I) {
702 isl_set *c = toConditionSet(*I, dim);
703 Domain = isl_set_intersect(Domain, c);
704 }
705 }
706 CurEntry = CurR->getEntry();
707 CurR = CurR->getParent();
708 } while (TopR != CurR);
709
710 isl_dim_free(dim);
711}
712
713void ScopStmt::buildIterationDomain(TempScop &tempScop, const Region &CurRegion)
714{
715 buildIterationDomainFromLoops(tempScop);
716 addConditionsToDomain(tempScop, CurRegion);
717}
718
719ScopStmt::ScopStmt(Scop &parent, TempScop &tempScop,
720 const Region &CurRegion, BasicBlock &bb,
721 SmallVectorImpl<Loop*> &NestLoops,
722 SmallVectorImpl<unsigned> &Scatter)
723 : Parent(parent), BB(&bb), IVS(NestLoops.size()) {
724 // Setup the induction variables.
725 for (unsigned i = 0, e = NestLoops.size(); i < e; ++i) {
726 PHINode *PN = NestLoops[i]->getCanonicalInductionVariable();
727 assert(PN && "Non canonical IV in Scop!");
Hongbin Zheng27f3afb2011-04-30 03:26:51 +0000728 IVS[i] = std::make_pair(PN, NestLoops[i]);
Tobias Grosser75805372011-04-29 06:27:02 +0000729 }
730
731 raw_string_ostream OS(BaseName);
732 WriteAsOperand(OS, &bb, false);
733 BaseName = OS.str();
734
735 // Remove the % in the name. This is not supported by isl.
736 BaseName.erase(0, 1);
737 makeIslCompatible(BaseName);
738 BaseName = "Stmt_" + BaseName;
739
740 buildIterationDomain(tempScop, CurRegion);
741 buildScattering(Scatter);
742 buildAccesses(tempScop, CurRegion);
743
744 IsReduction = tempScop.is_Reduction(*BB);
Tobias Grosser30b8a092011-08-18 07:51:37 +0000745
746 // FIXME: Temporarily remove dimension ids.
747 Scattering = map_remove_dim_ids(Scattering);
748 Domain = set_remove_dim_ids(Domain);
Tobias Grosser75805372011-04-29 06:27:02 +0000749}
750
751ScopStmt::ScopStmt(Scop &parent, SmallVectorImpl<unsigned> &Scatter)
752 : Parent(parent), BB(NULL), IVS(0) {
753
754 BaseName = "FinalRead";
755
756 // Build iteration domain.
757 std::string IterationDomainString = "{[i0] : i0 = 0}";
758 Domain = isl_set_read_from_str(Parent.getCtx(), IterationDomainString.c_str(),
759 -1);
760 Domain = isl_set_add_dims(Domain, isl_dim_param, Parent.getNumParams());
761 Domain = isl_set_set_tuple_name(Domain, getBaseName());
762
763 // Build scattering.
764 unsigned ScatDim = Parent.getMaxLoopDepth() * 2 + 1;
765 isl_dim *dim = isl_dim_alloc(Parent.getCtx(), Parent.getNumParams(), 1,
766 ScatDim);
767 dim = isl_dim_set_tuple_name(dim, isl_dim_out, "scattering");
768 dim = isl_dim_set_tuple_name(dim, isl_dim_in, getBaseName());
769 isl_basic_map *bmap = isl_basic_map_universe(isl_dim_copy(dim));
770 isl_int v;
771 isl_int_init(v);
772
773 isl_constraint *c = isl_equality_alloc(dim);
774 isl_int_set_si(v, -1);
775 isl_constraint_set_coefficient(c, isl_dim_out, 0, v);
776
777 // TODO: This is incorrect. We should not use a very large number to ensure
778 // that this statement is executed last.
779 isl_int_set_si(v, 200000000);
780 isl_constraint_set_constant(c, v);
781
782 bmap = isl_basic_map_add_constraint(bmap, c);
783 isl_int_clear(v);
784 Scattering = isl_map_from_basic_map(bmap);
785
786 // Build memory accesses, use SetVector to keep the order of memory accesses
787 // and prevent the same memory access inserted more than once.
788 SetVector<const Value*> BaseAddressSet;
789
790 for (Scop::const_iterator SI = Parent.begin(), SE = Parent.end(); SI != SE;
791 ++SI) {
792 ScopStmt *Stmt = *SI;
793
794 for (MemoryAccessVec::const_iterator I = Stmt->memacc_begin(),
795 E = Stmt->memacc_end(); I != E; ++I)
796 BaseAddressSet.insert((*I)->getBaseAddr());
797 }
798
799 for (SetVector<const Value*>::iterator BI = BaseAddressSet.begin(),
800 BE = BaseAddressSet.end(); BI != BE; ++BI)
801 MemAccs.push_back(new MemoryAccess(*BI, this));
802
803 IsReduction = false;
804}
805
806std::string ScopStmt::getDomainStr() const {
Tobias Grosserd5a7bfc2011-05-06 19:52:19 +0000807 isl_set *domain = getDomain();
808 std::string string = stringFromIslObj(domain);
809 isl_set_free(domain);
810 return string;
Tobias Grosser75805372011-04-29 06:27:02 +0000811}
812
813std::string ScopStmt::getScatteringStr() const {
814 return stringFromIslObj(getScattering());
815}
816
817unsigned ScopStmt::getNumParams() const {
818 return Parent.getNumParams();
819}
820
821unsigned ScopStmt::getNumIterators() const {
822 // The final read has one dimension with one element.
823 if (!BB)
824 return 1;
825
826 return IVS.size();
827}
828
829unsigned ScopStmt::getNumScattering() const {
830 return isl_map_dim(Scattering, isl_dim_out);
831}
832
833const char *ScopStmt::getBaseName() const { return BaseName.c_str(); }
834
835const PHINode *ScopStmt::getInductionVariableForDimension(unsigned Dimension)
836 const {
Hongbin Zheng27f3afb2011-04-30 03:26:51 +0000837 return IVS[Dimension].first;
838}
839
840const Loop *ScopStmt::getLoopForDimension(unsigned Dimension) const {
841 return IVS[Dimension].second;
Tobias Grosser75805372011-04-29 06:27:02 +0000842}
843
844const SCEVAddRecExpr *ScopStmt::getSCEVForDimension(unsigned Dimension)
845 const {
Hongbin Zheng27f3afb2011-04-30 03:26:51 +0000846 PHINode *PN =
847 const_cast<PHINode*>(getInductionVariableForDimension(Dimension));
Tobias Grosser75805372011-04-29 06:27:02 +0000848 return cast<SCEVAddRecExpr>(getParent()->getSE()->getSCEV(PN));
849}
850
851isl_ctx *ScopStmt::getIslContext() {
852 return Parent.getCtx();
853}
854
Tobias Grosserd5a7bfc2011-05-06 19:52:19 +0000855isl_set *ScopStmt::getDomain() const {
856 return isl_set_copy(Domain);
857}
858
Tobias Grosser75805372011-04-29 06:27:02 +0000859ScopStmt::~ScopStmt() {
860 while (!MemAccs.empty()) {
861 delete MemAccs.back();
862 MemAccs.pop_back();
863 }
864
865 isl_set_free(Domain);
866 isl_map_free(Scattering);
867}
868
869void ScopStmt::print(raw_ostream &OS) const {
870 OS << "\t" << getBaseName() << "\n";
871
872 OS.indent(12) << "Domain :=\n";
873
874 if (Domain) {
875 OS.indent(16) << getDomainStr() << ";\n";
876 } else
877 OS.indent(16) << "n/a\n";
878
879 OS.indent(12) << "Scattering :=\n";
880
881 if (Domain) {
882 OS.indent(16) << getScatteringStr() << ";\n";
883 } else
884 OS.indent(16) << "n/a\n";
885
886 for (MemoryAccessVec::const_iterator I = MemAccs.begin(), E = MemAccs.end();
887 I != E; ++I)
888 (*I)->print(OS);
889}
890
891void ScopStmt::dump() const { print(dbgs()); }
892
893//===----------------------------------------------------------------------===//
894/// Scop class implement
895Scop::Scop(TempScop &tempScop, LoopInfo &LI, ScalarEvolution &ScalarEvolution)
896 : SE(&ScalarEvolution), R(tempScop.getMaxRegion()),
897 MaxLoopDepth(tempScop.getMaxLoopDepth()) {
898 isl_ctx *ctx = isl_ctx_alloc();
899
900 ParamSetType &Params = tempScop.getParamSet();
901 Parameters.insert(Parameters.begin(), Params.begin(), Params.end());
902
903 isl_dim *dim = isl_dim_set_alloc(ctx, getNumParams(), 0);
904
Tobias Grosser30b8a092011-08-18 07:51:37 +0000905 int i = 0;
906 for (ParamSetType::iterator PI = Params.begin(), PE = Params.end();
907 PI != PE; ++PI) {
908 const SCEV *scev = *PI;
909 isl_id *id = isl_id_alloc(ctx,
910 ("p" + convertInt(i)).c_str(),
911 (void *) scev);
912 dim = isl_dim_set_dim_id(dim, isl_dim_param, i, id);
913 i++;
914 }
915
Tobias Grosser75805372011-04-29 06:27:02 +0000916 // TODO: Insert relations between parameters.
917 // TODO: Insert constraints on parameters.
918 Context = isl_set_universe (dim);
919
920 SmallVector<Loop*, 8> NestLoops;
921 SmallVector<unsigned, 8> Scatter;
922
923 Scatter.assign(MaxLoopDepth + 1, 0);
924
925 // Build the iteration domain, access functions and scattering functions
926 // traversing the region tree.
927 buildScop(tempScop, getRegion(), NestLoops, Scatter, LI);
928 Stmts.push_back(new ScopStmt(*this, Scatter));
929
Tobias Grosser30b8a092011-08-18 07:51:37 +0000930 // FIXME: Temporarily remove dimension ids
931 Context = set_remove_dim_ids(Context);
932
Tobias Grosser75805372011-04-29 06:27:02 +0000933 assert(NestLoops.empty() && "NestLoops not empty at top level!");
934}
935
936Scop::~Scop() {
937 isl_set_free(Context);
938
939 // Free the statements;
940 for (iterator I = begin(), E = end(); I != E; ++I)
941 delete *I;
942
943 // Do we need a singleton to manage this?
944 //isl_ctx_free(ctx);
945}
946
947std::string Scop::getContextStr() const {
948 return stringFromIslObj(getContext());
949}
950
951std::string Scop::getNameStr() const {
952 std::string ExitName, EntryName;
953 raw_string_ostream ExitStr(ExitName);
954 raw_string_ostream EntryStr(EntryName);
955
956 WriteAsOperand(EntryStr, R.getEntry(), false);
957 EntryStr.str();
958
959 if (R.getExit()) {
960 WriteAsOperand(ExitStr, R.getExit(), false);
961 ExitStr.str();
962 } else
963 ExitName = "FunctionExit";
964
965 return EntryName + "---" + ExitName;
966}
967
968void Scop::printContext(raw_ostream &OS) const {
969 OS << "Context:\n";
970
971 if (!Context) {
972 OS.indent(4) << "n/a\n\n";
973 return;
974 }
975
976 OS.indent(4) << getContextStr() << "\n";
977}
978
979void Scop::printStatements(raw_ostream &OS) const {
980 OS << "Statements {\n";
981
982 for (const_iterator SI = begin(), SE = end();SI != SE; ++SI)
983 OS.indent(4) << (**SI);
984
985 OS.indent(4) << "}\n";
986}
987
988
989void Scop::print(raw_ostream &OS) const {
990 printContext(OS.indent(4));
991 printStatements(OS.indent(4));
992}
993
994void Scop::dump() const { print(dbgs()); }
995
996isl_ctx *Scop::getCtx() const { return isl_set_get_ctx(Context); }
997
998ScalarEvolution *Scop::getSE() const { return SE; }
999
1000bool Scop::isTrivialBB(BasicBlock *BB, TempScop &tempScop) {
1001 if (tempScop.getAccessFunctions(BB))
1002 return false;
1003
1004 return true;
1005}
1006
1007void Scop::buildScop(TempScop &tempScop,
1008 const Region &CurRegion,
1009 SmallVectorImpl<Loop*> &NestLoops,
1010 SmallVectorImpl<unsigned> &Scatter,
1011 LoopInfo &LI) {
1012 Loop *L = castToLoop(CurRegion, LI);
1013
1014 if (L)
1015 NestLoops.push_back(L);
1016
1017 unsigned loopDepth = NestLoops.size();
1018 assert(Scatter.size() > loopDepth && "Scatter not big enough!");
1019
1020 for (Region::const_element_iterator I = CurRegion.element_begin(),
1021 E = CurRegion.element_end(); I != E; ++I)
1022 if (I->isSubRegion())
1023 buildScop(tempScop, *(I->getNodeAs<Region>()), NestLoops, Scatter, LI);
1024 else {
1025 BasicBlock *BB = I->getNodeAs<BasicBlock>();
1026
1027 if (isTrivialBB(BB, tempScop))
1028 continue;
1029
1030 Stmts.push_back(new ScopStmt(*this, tempScop, CurRegion, *BB, NestLoops,
1031 Scatter));
1032
1033 // Increasing the Scattering function is OK for the moment, because
1034 // we are using a depth first iterator and the program is well structured.
1035 ++Scatter[loopDepth];
1036 }
1037
1038 if (!L)
1039 return;
1040
1041 // Exiting a loop region.
1042 Scatter[loopDepth] = 0;
1043 NestLoops.pop_back();
1044 ++Scatter[loopDepth-1];
1045}
1046
1047//===----------------------------------------------------------------------===//
1048
1049void ScopInfo::getAnalysisUsage(AnalysisUsage &AU) const {
1050 AU.addRequired<LoopInfo>();
1051 AU.addRequired<RegionInfo>();
1052 AU.addRequired<ScalarEvolution>();
1053 AU.addRequired<TempScopInfo>();
1054 AU.setPreservesAll();
1055}
1056
1057bool ScopInfo::runOnRegion(Region *R, RGPassManager &RGM) {
1058 LoopInfo &LI = getAnalysis<LoopInfo>();
1059 ScalarEvolution &SE = getAnalysis<ScalarEvolution>();
1060
1061 TempScop *tempScop = getAnalysis<TempScopInfo>().getTempScop(R);
1062
1063 // This region is no Scop.
1064 if (!tempScop) {
1065 scop = 0;
1066 return false;
1067 }
1068
1069 // Statistics.
1070 ++ScopFound;
1071 if (tempScop->getMaxLoopDepth() > 0) ++RichScopFound;
1072
1073 scop = new Scop(*tempScop, LI, SE);
1074
1075 return false;
1076}
1077
1078char ScopInfo::ID = 0;
1079
1080
1081static RegisterPass<ScopInfo>
1082X("polly-scops", "Polly - Create polyhedral description of Scops");
1083
1084Pass *polly::createScopInfoPass() {
1085 return new ScopInfo();
1086}