IslExprBuilder: allow to specify an external isl_id to ScopArrayInfo mapping
This is useful for external users using IslExprBuilder, in case they cannot embed ScopArrayInfo data into their isl_ids, because the isl_ids either already carry other information or the isl_ids have been created and their user pointers cannot be updated any more. llvm-svn: 276268
This commit is contained in:
parent
dace838138
commit
04b909fcca
@ -39,6 +39,7 @@ public:
|
||||
} // namespace llvm
|
||||
|
||||
namespace polly {
|
||||
class ScopArrayInfo;
|
||||
|
||||
/// @brief LLVM-IR generator for isl_ast_expr[essions]
|
||||
///
|
||||
@ -92,6 +93,25 @@ public:
|
||||
/// @brief A map from isl_ids to llvm::Values.
|
||||
typedef llvm::MapVector<isl_id *, llvm::AssertingVH<llvm::Value>> IDToValueTy;
|
||||
|
||||
typedef llvm::MapVector<isl_id *, const ScopArrayInfo *> IDToScopArrayInfoTy;
|
||||
|
||||
/// @brief A map from isl_ids to ScopArrayInfo objects.
|
||||
///
|
||||
/// This map is used to obtain ScopArrayInfo objects for isl_ids which do not
|
||||
/// carry a ScopArrayInfo object in their user pointer. This is useful if the
|
||||
/// construction of ScopArrayInfo objects happens only after references (e.g.
|
||||
/// in an AST) to an isl_id are generated and the user pointer of the isl_id
|
||||
/// can not be changed any more.
|
||||
///
|
||||
/// This is useful for external users who just use the IslExprBuilder for
|
||||
/// code generation.
|
||||
IDToScopArrayInfoTy *IDToSAI = nullptr;
|
||||
|
||||
/// @brief Set the isl_id to ScopArrayInfo map.
|
||||
///
|
||||
/// @param NewIDToSAI The new isl_id to ScopArrayInfo map to use.
|
||||
void setIDToSAI(IDToScopArrayInfoTy *NewIDToSAI) { IDToSAI = NewIDToSAI; }
|
||||
|
||||
/// @brief Construct an IslExprBuilder.
|
||||
///
|
||||
/// @param Builder The IRBuilder used to construct the isl_ast_expr[ession].
|
||||
|
@ -223,7 +223,18 @@ Value *IslExprBuilder::createAccessAddress(isl_ast_expr *Expr) {
|
||||
BaseId = isl_ast_expr_get_id(BaseExpr);
|
||||
isl_ast_expr_free(BaseExpr);
|
||||
|
||||
const ScopArrayInfo *SAI = ScopArrayInfo::getFromId(BaseId);
|
||||
const ScopArrayInfo *SAI = nullptr;
|
||||
|
||||
if (IDToSAI)
|
||||
SAI = (*IDToSAI)[BaseId];
|
||||
|
||||
if (!SAI)
|
||||
SAI = ScopArrayInfo::getFromId(BaseId);
|
||||
else
|
||||
isl_id_free(BaseId);
|
||||
|
||||
assert(SAI && "No ScopArrayInfo found for this isl_id.");
|
||||
|
||||
Base = SAI->getBasePtr();
|
||||
|
||||
if (auto NewBase = GlobalMap.lookup(Base))
|
||||
|
Loading…
x
Reference in New Issue
Block a user