mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-24 06:26:07 +00:00
Move ScopArrayInfo::getFromAccessFunction and getFromId to isl++
llvm-svn: 308892
This commit is contained in:
parent
fc638c11bb
commit
206e9e3b3b
@ -375,11 +375,10 @@ public:
|
||||
void print(raw_ostream &OS, bool SizeAsPwAff = false) const;
|
||||
|
||||
/// Access the ScopArrayInfo associated with an access function.
|
||||
static const ScopArrayInfo *
|
||||
getFromAccessFunction(__isl_keep isl_pw_multi_aff *PMA);
|
||||
static const ScopArrayInfo *getFromAccessFunction(isl::pw_multi_aff PMA);
|
||||
|
||||
/// Access the ScopArrayInfo associated with an isl Id.
|
||||
static const ScopArrayInfo *getFromId(__isl_take isl_id *Id);
|
||||
static const ScopArrayInfo *getFromId(isl::id Id);
|
||||
|
||||
/// Get the space of this array access.
|
||||
isl::space getSpace() const;
|
||||
|
@ -437,16 +437,15 @@ void ScopArrayInfo::print(raw_ostream &OS, bool SizeAsPwAff) const {
|
||||
}
|
||||
|
||||
const ScopArrayInfo *
|
||||
ScopArrayInfo::getFromAccessFunction(__isl_keep isl_pw_multi_aff *PMA) {
|
||||
isl_id *Id = isl_pw_multi_aff_get_tuple_id(PMA, isl_dim_out);
|
||||
assert(Id && "Output dimension didn't have an ID");
|
||||
ScopArrayInfo::getFromAccessFunction(isl::pw_multi_aff PMA) {
|
||||
isl::id Id = PMA.get_tuple_id(isl::dim::out);
|
||||
assert(!Id.is_null() && "Output dimension didn't have an ID");
|
||||
return getFromId(Id);
|
||||
}
|
||||
|
||||
const ScopArrayInfo *ScopArrayInfo::getFromId(__isl_take isl_id *Id) {
|
||||
void *User = isl_id_get_user(Id);
|
||||
const ScopArrayInfo *ScopArrayInfo::getFromId(isl::id Id) {
|
||||
void *User = Id.get_user();
|
||||
const ScopArrayInfo *SAI = static_cast<ScopArrayInfo *>(User);
|
||||
isl_id_free(Id);
|
||||
return SAI;
|
||||
}
|
||||
|
||||
@ -1017,7 +1016,7 @@ MemoryAccess::MemoryAccess(ScopStmt *Stmt, AccessType AccType,
|
||||
Statement(Stmt), InvalidDomain(nullptr), AccessInstruction(nullptr),
|
||||
IsAffine(true), AccessRelation(nullptr),
|
||||
NewAccessRelation(isl::manage(AccRel)), FAD(nullptr) {
|
||||
auto *ArrayInfoId = NewAccessRelation.get_tuple_id(isl::dim::out).release();
|
||||
isl::id ArrayInfoId = NewAccessRelation.get_tuple_id(isl::dim::out);
|
||||
auto *SAI = ScopArrayInfo::getFromId(ArrayInfoId);
|
||||
Sizes.push_back(nullptr);
|
||||
for (unsigned i = 1; i < SAI->getNumberOfDimensions(); i++)
|
||||
@ -4719,6 +4718,16 @@ Scop::getAccessesOfType(std::function<bool(MemoryAccess &)> Predicate) {
|
||||
Accesses = isl_union_map_add_map(Accesses, AccessDomain);
|
||||
}
|
||||
}
|
||||
|
||||
return isl_union_map_coalesce(Accesses);
|
||||
|
||||
for (auto X : this->getInvariantAccesses())
|
||||
for (auto A : X.InvariantAccesses) {
|
||||
if (!Predicate(*A))
|
||||
continue;
|
||||
Accesses =
|
||||
isl_union_map_add_map(Accesses, A->getAccessRelation().release());
|
||||
}
|
||||
return isl_union_map_coalesce(Accesses);
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,7 @@ Value *IslExprBuilder::createAccessAddress(isl_ast_expr *Expr) {
|
||||
SAI = (*IDToSAI)[BaseId];
|
||||
|
||||
if (!SAI)
|
||||
SAI = ScopArrayInfo::getFromId(BaseId);
|
||||
SAI = ScopArrayInfo::getFromId(isl::manage(BaseId));
|
||||
else
|
||||
isl_id_free(BaseId);
|
||||
|
||||
|
@ -1512,7 +1512,7 @@ GPUNodeBuilder::createLaunchParameters(ppcg_kernel *Kernel, Function *F,
|
||||
continue;
|
||||
|
||||
isl_id *Id = isl_space_get_tuple_id(Prog->array[i].space, isl_dim_set);
|
||||
const ScopArrayInfo *SAI = ScopArrayInfo::getFromId(Id);
|
||||
const ScopArrayInfo *SAI = ScopArrayInfo::getFromId(isl::manage(Id));
|
||||
|
||||
ArgSizes[Index] = SAI->getElemSizeInBytes();
|
||||
|
||||
@ -1785,7 +1785,7 @@ GPUNodeBuilder::createKernelFunctionDecl(ppcg_kernel *Kernel,
|
||||
|
||||
if (gpu_array_is_read_only_scalar(&Prog->array[i])) {
|
||||
isl_id *Id = isl_space_get_tuple_id(Prog->array[i].space, isl_dim_set);
|
||||
const ScopArrayInfo *SAI = ScopArrayInfo::getFromId(Id);
|
||||
const ScopArrayInfo *SAI = ScopArrayInfo::getFromId(isl::manage(Id));
|
||||
Args.push_back(SAI->getElementType());
|
||||
MemoryType.push_back(
|
||||
ConstantAsMetadata::get(ConstantInt::get(Builder.getInt32Ty(), 0)));
|
||||
@ -1865,7 +1865,8 @@ GPUNodeBuilder::createKernelFunctionDecl(ppcg_kernel *Kernel,
|
||||
Arg->setName(Kernel->array[i].array->name);
|
||||
|
||||
isl_id *Id = isl_space_get_tuple_id(Prog->array[i].space, isl_dim_set);
|
||||
const ScopArrayInfo *SAI = ScopArrayInfo::getFromId(isl_id_copy(Id));
|
||||
const ScopArrayInfo *SAI =
|
||||
ScopArrayInfo::getFromId(isl::manage(isl_id_copy(Id)));
|
||||
Type *EleTy = SAI->getElementType();
|
||||
Value *Val = &*Arg;
|
||||
SmallVector<const SCEV *, 4> Sizes;
|
||||
@ -1996,7 +1997,8 @@ void GPUNodeBuilder::prepareKernelArguments(ppcg_kernel *Kernel, Function *FN) {
|
||||
continue;
|
||||
|
||||
isl_id *Id = isl_space_get_tuple_id(Prog->array[i].space, isl_dim_set);
|
||||
const ScopArrayInfo *SAI = ScopArrayInfo::getFromId(isl_id_copy(Id));
|
||||
const ScopArrayInfo *SAI =
|
||||
ScopArrayInfo::getFromId(isl::manage(isl_id_copy(Id)));
|
||||
isl_id_free(Id);
|
||||
|
||||
if (SAI->getNumberOfDimensions() > 0) {
|
||||
@ -2029,7 +2031,8 @@ void GPUNodeBuilder::finalizeKernelArguments(ppcg_kernel *Kernel) {
|
||||
continue;
|
||||
|
||||
isl_id *Id = isl_space_get_tuple_id(Prog->array[i].space, isl_dim_set);
|
||||
const ScopArrayInfo *SAI = ScopArrayInfo::getFromId(isl_id_copy(Id));
|
||||
const ScopArrayInfo *SAI =
|
||||
ScopArrayInfo::getFromId(isl::manage(isl_id_copy(Id)));
|
||||
isl_id_free(Id);
|
||||
|
||||
if (SAI->getNumberOfDimensions() > 0) {
|
||||
@ -2068,7 +2071,7 @@ void GPUNodeBuilder::createKernelVariables(ppcg_kernel *Kernel, Function *FN) {
|
||||
for (int i = 0; i < Kernel->n_var; ++i) {
|
||||
struct ppcg_kernel_var &Var = Kernel->var[i];
|
||||
isl_id *Id = isl_space_get_tuple_id(Var.array->space, isl_dim_set);
|
||||
Type *EleTy = ScopArrayInfo::getFromId(Id)->getElementType();
|
||||
Type *EleTy = ScopArrayInfo::getFromId(isl::manage(Id))->getElementType();
|
||||
|
||||
Type *ArrayTy = EleTy;
|
||||
SmallVector<const SCEV *, 4> Sizes;
|
||||
|
@ -480,7 +480,7 @@ bool JSONImporter::importAccesses(Scop &S, Json::Value &JScop,
|
||||
NewOutId = isl_map_get_tuple_id(NewAccessMap, isl_dim_out);
|
||||
auto *SAI = S.getArrayInfoByName(isl_id_get_name(NewOutId));
|
||||
isl_id *OutId = isl_map_get_tuple_id(CurrentAccessMap, isl_dim_out);
|
||||
auto *OutSAI = ScopArrayInfo::getFromId(OutId);
|
||||
auto *OutSAI = ScopArrayInfo::getFromId(isl::manage(OutId));
|
||||
if (!SAI || SAI->getElementType() != OutSAI->getElementType()) {
|
||||
errs() << "JScop file contains access function with undeclared "
|
||||
"ScopArrayInfo\n";
|
||||
|
Loading…
x
Reference in New Issue
Block a user