diff options
author | Tobias Grosser <tobias@grosser.es> | 2015-05-27 05:16:57 +0000 |
---|---|---|
committer | Tobias Grosser <tobias@grosser.es> | 2015-05-27 05:16:57 +0000 |
commit | 7c3bad52dd0bab7e4e9c14e4d21fff0b8d530a29 (patch) | |
tree | 9596d713f677ceb8f50a712a7a020496d4351d8c /polly/lib/Exchange | |
parent | aa9fa355559c24b18f9e05f0c26b98feba5ba34d (diff) | |
download | bcm5719-llvm-7c3bad52dd0bab7e4e9c14e4d21fff0b8d530a29.tar.gz bcm5719-llvm-7c3bad52dd0bab7e4e9c14e4d21fff0b8d530a29.zip |
Use value semantics for list of ScopStmt(s) instead of std::owningptr
David Blaike suggested this as an alternative to the use of owningptr(s) for our
memory management, as value semantics allow to avoid the additional interface
complexity caused by owningptr while still providing similar memory consistency
guarantees. We could also have used a std::vector, but the use of std::vector
would yield possibly changing pointers which currently causes problems as for
example the memory accesses carry pointers to their parent statements. Such
pointers should not change.
Reviewer: jblaikie, jdoerfert
Differential Revision: http://reviews.llvm.org/D10041
llvm-svn: 238290
Diffstat (limited to 'polly/lib/Exchange')
-rw-r--r-- | polly/lib/Exchange/JSONExporter.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/polly/lib/Exchange/JSONExporter.cpp b/polly/lib/Exchange/JSONExporter.cpp index 4415bbef0b5..d8392c38bf0 100644 --- a/polly/lib/Exchange/JSONExporter.cpp +++ b/polly/lib/Exchange/JSONExporter.cpp @@ -102,15 +102,15 @@ Json::Value JSONExporter::getJSON(Scop &S) const { root["location"] = Location; root["statements"]; - for (auto &Stmt : S) { + for (ScopStmt &Stmt : S) { Json::Value statement; - statement["name"] = Stmt->getBaseName(); - statement["domain"] = Stmt->getDomainStr(); - statement["schedule"] = Stmt->getScheduleStr(); + statement["name"] = Stmt.getBaseName(); + statement["domain"] = Stmt.getDomainStr(); + statement["schedule"] = Stmt.getScheduleStr(); statement["accesses"]; - for (MemoryAccess *MA : *Stmt) { + for (MemoryAccess *MA : Stmt) { Json::Value access; access["kind"] = MA->isRead() ? "read" : "write"; @@ -232,10 +232,10 @@ bool JSONImporter::runOnScop(Scop &S) { int index = 0; - for (auto &Stmt : S) { + for (ScopStmt &Stmt : S) { Json::Value schedule = jscop["statements"][index]["schedule"]; isl_map *m = isl_map_read_from_str(S.getIslCtx(), schedule.asCString()); - isl_space *Space = Stmt->getDomainSpace(); + isl_space *Space = Stmt.getDomainSpace(); // Copy the old tuple id. This is necessary to retain the user pointer, // that stores the reference to the ScopStmt this schedule belongs to. @@ -246,7 +246,7 @@ bool JSONImporter::runOnScop(Scop &S) { m = isl_map_set_dim_id(m, isl_dim_param, i, id); } isl_space_free(Space); - NewSchedule[&*Stmt] = m; + NewSchedule[&Stmt] = m; index++; } @@ -260,15 +260,15 @@ bool JSONImporter::runOnScop(Scop &S) { return false; } - for (auto &Stmt : S) { - if (NewSchedule.find(&*Stmt) != NewSchedule.end()) - Stmt->setSchedule(NewSchedule[&*Stmt]); + for (ScopStmt &Stmt : S) { + if (NewSchedule.find(&Stmt) != NewSchedule.end()) + Stmt.setSchedule(NewSchedule[&Stmt]); } int statementIdx = 0; - for (auto &Stmt : S) { + for (ScopStmt &Stmt : S) { int memoryAccessIdx = 0; - for (MemoryAccess *MA : *Stmt) { + for (MemoryAccess *MA : Stmt) { Json::Value accesses = jscop["statements"][statementIdx]["accesses"] [memoryAccessIdx]["relation"]; isl_map *newAccessMap = |