[polly] r276268 - IslExprBuilder: allow to specify an external isl_id to ScopArrayInfo mapping
Tobias Grosser via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 21 06:15:51 PDT 2016
Author: grosser
Date: Thu Jul 21 08:15:51 2016
New Revision: 276268
URL: http://llvm.org/viewvc/llvm-project?rev=276268&view=rev
Log:
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.
Modified:
polly/trunk/include/polly/CodeGen/IslExprBuilder.h
polly/trunk/lib/CodeGen/IslExprBuilder.cpp
Modified: polly/trunk/include/polly/CodeGen/IslExprBuilder.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/IslExprBuilder.h?rev=276268&r1=276267&r2=276268&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/IslExprBuilder.h (original)
+++ polly/trunk/include/polly/CodeGen/IslExprBuilder.h Thu Jul 21 08:15:51 2016
@@ -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].
Modified: polly/trunk/lib/CodeGen/IslExprBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslExprBuilder.cpp?rev=276268&r1=276267&r2=276268&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslExprBuilder.cpp (original)
+++ polly/trunk/lib/CodeGen/IslExprBuilder.cpp Thu Jul 21 08:15:51 2016
@@ -223,7 +223,18 @@ Value *IslExprBuilder::createAccessAddre
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))
More information about the llvm-commits
mailing list