Skip to content

Commit

Permalink
[AArch64] Add an AArch64 pass for loop idiom transformations
Browse files Browse the repository at this point in the history
  • Loading branch information
xgupta committed Nov 26, 2023
1 parent db36431 commit da5bdc3
Show file tree
Hide file tree
Showing 12 changed files with 2,423 additions and 0 deletions.
8 changes: 8 additions & 0 deletions llvm/include/llvm/Analysis/TargetTransformInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,9 @@ class TargetTransformInfo {
/// \return The associativity of the cache level, if available.
std::optional<unsigned> getCacheAssociativity(CacheLevel Level) const;

/// \return The minimum architectural page size for the target.
std::optional<unsigned> getMinPageSize() const;

/// \return How much before a load we should place the prefetch
/// instruction. This is currently measured in number of
/// instructions.
Expand Down Expand Up @@ -1889,6 +1892,7 @@ class TargetTransformInfo::Concept {
virtual std::optional<unsigned> getCacheSize(CacheLevel Level) const = 0;
virtual std::optional<unsigned> getCacheAssociativity(CacheLevel Level)
const = 0;
virtual std::optional<unsigned> getMinPageSize() const = 0;

/// \return How much before a load we should place the prefetch
/// instruction. This is currently measured in number of
Expand Down Expand Up @@ -2475,6 +2479,10 @@ class TargetTransformInfo::Model final : public TargetTransformInfo::Concept {
return Impl.getCacheAssociativity(Level);
}

std::optional<unsigned> getMinPageSize() const override {
return Impl.getMinPageSize();
}

/// Return the preferred prefetch distance in terms of instructions.
///
unsigned getPrefetchDistance() const override {
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,8 @@ class TargetTransformInfoImplBase {
llvm_unreachable("Unknown TargetTransformInfo::CacheLevel");
}

std::optional<unsigned> getMinPageSize() const { return {}; }

unsigned getPrefetchDistance() const { return 0; }
unsigned getMinPrefetchStride(unsigned NumMemAccesses,
unsigned NumStridedMemAccesses,
Expand Down
4 changes: 4 additions & 0 deletions llvm/lib/Analysis/TargetTransformInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,10 @@ TargetTransformInfo::getCacheAssociativity(CacheLevel Level) const {
return TTIImpl->getCacheAssociativity(Level);
}

std::optional<unsigned> TargetTransformInfo::getMinPageSize() const {
return TTIImpl->getMinPageSize();
}

unsigned TargetTransformInfo::getPrefetchDistance() const {
return TTIImpl->getPrefetchDistance();
}
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Target/AArch64/AArch64.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ void initializeAArch64DeadRegisterDefinitionsPass(PassRegistry&);
void initializeAArch64ExpandPseudoPass(PassRegistry &);
void initializeAArch64GlobalsTaggingPass(PassRegistry &);
void initializeAArch64LoadStoreOptPass(PassRegistry&);
void initializeAArch64LoopIdiomTransformLegacyPassPass(PassRegistry &);
void initializeAArch64LowerHomogeneousPrologEpilogPass(PassRegistry &);
void initializeAArch64MIPeepholeOptPass(PassRegistry &);
void initializeAArch64O0PreLegalizerCombinerPass(PassRegistry &);
Expand Down
Loading

0 comments on commit da5bdc3

Please sign in to comment.