Json::Value JSONExporter::getJSON(Scop &scop) const { Json::Value root; root["name"] = S->getRegion().getNameStr(); root["context"] = S->getContextStr(); root["statements"]; for (Scop::iterator SI = S->begin(), SE = S->end(); SI != SE; ++SI) { ScopStmt *Stmt = *SI; Json::Value statement; statement["name"] = Stmt->getBaseName(); statement["domain"] = Stmt->getDomainStr(); statement["schedule"] = Stmt->getScatteringStr(); statement["accesses"]; for (ScopStmt::memacc_iterator MI = Stmt->memacc_begin(), ME = Stmt->memacc_end(); MI != ME; ++MI) { Json::Value access; access["kind"] = (*MI)->isRead() ? "read" : "write"; access["relation"] = (*MI)->getAccessRelationStr(); statement["accesses"].append(access); } root["statements"].append(statement); } return root; }
CloogUnionDomain *Cloog::buildCloogUnionDomain() { CloogUnionDomain *DU = cloog_union_domain_alloc(S->getNumParams()); for (Scop::iterator SI = S->begin(), SE = S->end(); SI != SE; ++SI) { ScopStmt *Stmt = *SI; CloogScattering *Scattering; CloogDomain *Domain; Scattering = cloog_scattering_from_isl_map(Stmt->getScattering()); Domain = cloog_domain_from_isl_set(Stmt->getDomain()); std::string entryName = Stmt->getBaseName(); DU = cloog_union_domain_add_domain(DU, entryName.c_str(), Domain, Scattering, Stmt); } return DU; }
CloogUnionDomain *Cloog::buildCloogUnionDomain() { CloogUnionDomain *DU = cloog_union_domain_alloc(S->getNumParams()); for (Scop::iterator SI = S->begin(), SE = S->end(); SI != SE; ++SI) { ScopStmt *Stmt = *SI; if (Stmt->isFinalRead()) continue; CloogScattering *Scattering= cloog_scattering_from_isl_map(isl_map_copy(Stmt->getScattering())); CloogDomain *Domain = cloog_domain_from_isl_set(isl_set_copy(Stmt->getDomain())); std::string entryName = Stmt->getBaseName(); char *Name = (char*)malloc(sizeof(char) * (entryName.size() + 1)); strcpy(Name, entryName.c_str()); DU = cloog_union_domain_add_domain(DU, Name, Domain, Scattering, Stmt); } return DU; }