Skip to content

Commit

Permalink
Use typed enums to model MemoryKind and move MemoryKind out of ScopAr…
Browse files Browse the repository at this point in the history
…rayInfo

To benefit of the type safety guarantees of C++11 typed enums, which would have
caught the type mismatch fixed in r291960, we make MemoryKind a typed enum.
This change also allows us to drop the 'MK_' prefix and to instead use the more
descriptive full name of the enum as prefix. To reduce the amount of typing
needed, we use this opportunity to move MemoryKind from ScopArrayInfo to a
global scope, which means the ScopArrayInfo:: prefix is not needed. This move
also makes historically sense. In the beginning of Polly we had different
MemoryKind enums in both MemoryAccess and ScopArrayInfo, which were later
canonicalized to one. During this canonicalization we just choose the enum in
ScopArrayInfo, but did not consider to move this shared enum to global scope.

Reviewed-by: Michael Kruse <llvm@meinersbur.de>
Differential Revision: https://reviews.llvm.org/D28090

llvm-svn: 292030
  • Loading branch information
tobiasgrosser committed Jan 14, 2017
1 parent 12ed728 commit 4d5a917
Show file tree
Hide file tree
Showing 7 changed files with 233 additions and 233 deletions.
4 changes: 2 additions & 2 deletions polly/include/polly/CodeGen/BlockGenerators.h
Original file line number Diff line number Diff line change
Expand Up @@ -854,8 +854,8 @@ class RegionGenerator : public BlockGenerator {
/// leaving the subregion because the exiting block as an edge back into the
/// subregion.
///
/// @param MA The WRITE of MK_PHI/MK_ExitPHI for a PHI in the subregion's
/// exit block.
/// @param MA The WRITE of MemoryKind::PHI/MemoryKind::ExitPHI for a PHI in
/// the subregion's exit block.
/// @param LTS Virtual induction variable mapping.
/// @param BBMap A mapping from old values to their new values in this block.
/// @param L Loop surrounding this region statement.
Expand Down
13 changes: 6 additions & 7 deletions polly/include/polly/ScopBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,7 @@ class ScopBuilder {
Value *BaseAddress, Type *ElemType, bool Affine,
Value *AccessValue,
ArrayRef<const SCEV *> Subscripts,
ArrayRef<const SCEV *> Sizes,
ScopArrayInfo::MemoryKind Kind);
ArrayRef<const SCEV *> Sizes, MemoryKind Kind);

/// Create a MemoryAccess that represents either a LoadInst or
/// StoreInst.
Expand All @@ -186,7 +185,7 @@ class ScopBuilder {
/// @param Sizes The array dimension's sizes.
/// @param AccessValue Value read or written.
///
/// @see ScopArrayInfo::MemoryKind
/// @see MemoryKind
void addArrayAccess(MemAccInst MemAccInst, MemoryAccess::AccessType AccType,
Value *BaseAddress, Type *ElemType, bool IsAffine,
ArrayRef<const SCEV *> Subscripts,
Expand All @@ -199,7 +198,7 @@ class ScopBuilder {
/// @param Inst The instruction to be written.
///
/// @see ensureValueRead()
/// @see ScopArrayInfo::MemoryKind
/// @see MemoryKind
void ensureValueWrite(Instruction *Inst);

/// Ensure an llvm::Value is available in the BB's statement, creating a
Expand All @@ -209,7 +208,7 @@ class ScopBuilder {
/// @param UserBB Where to reload the value.
///
/// @see ensureValueStore()
/// @see ScopArrayInfo::MemoryKind
/// @see MemoryKind
void ensureValueRead(Value *V, BasicBlock *UserBB);

/// Create a write MemoryAccess for the incoming block of a phi node.
Expand All @@ -224,7 +223,7 @@ class ScopBuilder {
/// .phiops one. Required for values escaping through a
/// PHINode in the SCoP region's exit block.
/// @see addPHIReadAccess()
/// @see ScopArrayInfo::MemoryKind
/// @see MemoryKind
void ensurePHIWrite(PHINode *PHI, BasicBlock *IncomingBlock,
Value *IncomingValue, bool IsExitBlock);

Expand All @@ -238,7 +237,7 @@ class ScopBuilder {
/// here.
///
/// @see ensurePHIWrite()
/// @see ScopArrayInfo::MemoryKind
/// @see MemoryKind
void addPHIReadAccess(PHINode *PHI);

public:
Expand Down

0 comments on commit 4d5a917

Please sign in to comment.