summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2019-10-10 20:39:27 +0000
committerDavid Greene <greened@obbligato.org>2019-10-10 20:39:27 +0000
commit7c562f12869f8eb11f08d1617e199e0909ce9761 (patch)
treec65273987bef5e82564de861b889ff9649baf813
parent366ada1d069c9ed944d993d8a000b370a9622a00 (diff)
downloadbcm5719-llvm-7c562f12869f8eb11f08d1617e199e0909ce9761.tar.gz
bcm5719-llvm-7c562f12869f8eb11f08d1617e199e0909ce9761.zip
[System Model] [TTI] Move default cache/prefetch implementations
Move the default implementations of cache and prefetch queries to TargetTransformInfoImplBase and delete them from NoTIIImpl. This brings these interfaces in line with how other TTI interfaces work. Differential Revision: https://reviews.llvm.org/D68804 llvm-svn: 374446
-rw-r--r--llvm/include/llvm/Analysis/TargetTransformInfoImpl.h28
-rw-r--r--llvm/include/llvm/CodeGen/BasicTTIImpl.h9
-rw-r--r--llvm/lib/Analysis/TargetTransformInfo.cpp28
3 files changed, 35 insertions, 30 deletions
diff --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
index cdb0ee32de1..fa8451e9d3e 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
@@ -371,6 +371,34 @@ public:
return false;
}
+ unsigned getCacheLineSize() const { return 0; }
+
+ llvm::Optional<unsigned> getCacheSize(TargetTransformInfo::CacheLevel Level) const {
+ switch (Level) {
+ case TargetTransformInfo::CacheLevel::L1D:
+ LLVM_FALLTHROUGH;
+ case TargetTransformInfo::CacheLevel::L2D:
+ return llvm::Optional<unsigned>();
+ }
+ llvm_unreachable("Unknown TargetTransformInfo::CacheLevel");
+ }
+
+ llvm::Optional<unsigned> getCacheAssociativity(
+ TargetTransformInfo::CacheLevel Level) const {
+ switch (Level) {
+ case TargetTransformInfo::CacheLevel::L1D:
+ LLVM_FALLTHROUGH;
+ case TargetTransformInfo::CacheLevel::L2D:
+ return llvm::Optional<unsigned>();
+ }
+
+ llvm_unreachable("Unknown TargetTransformInfo::CacheLevel");
+ }
+
+ unsigned getPrefetchDistance() const { return 0; }
+ unsigned getMinPrefetchStride() const { return 1; }
+ unsigned getMaxPrefetchIterationsAhead() const { return UINT_MAX; }
+
unsigned getMaxInterleaveFactor(unsigned VF) { return 1; }
unsigned getArithmeticInstrCost(unsigned Opcode, Type *Ty,
diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
index 199036f8400..8a0cce0f6a0 100644
--- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -523,8 +523,13 @@ public:
virtual Optional<unsigned>
getCacheAssociativity(TargetTransformInfo::CacheLevel Level) const {
- return Optional<unsigned>(
- getST()->getCacheAssociativity(static_cast<unsigned>(Level)));
+ Optional<unsigned> TargetResult =
+ getST()->getCacheAssociativity(static_cast<unsigned>(Level));
+
+ if (TargetResult)
+ return TargetResult;
+
+ return BaseT::getCacheAssociativity(Level);
}
virtual unsigned getCacheLineSize() const {
diff --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp
index b5467813094..f3d20ce984d 100644
--- a/llvm/lib/Analysis/TargetTransformInfo.cpp
+++ b/llvm/lib/Analysis/TargetTransformInfo.cpp
@@ -40,34 +40,6 @@ namespace {
struct NoTTIImpl : TargetTransformInfoImplCRTPBase<NoTTIImpl> {
explicit NoTTIImpl(const DataLayout &DL)
: TargetTransformInfoImplCRTPBase<NoTTIImpl>(DL) {}
-
- unsigned getCacheLineSize() const { return 0; }
-
- llvm::Optional<unsigned> getCacheSize(TargetTransformInfo::CacheLevel Level) const {
- switch (Level) {
- case TargetTransformInfo::CacheLevel::L1D:
- LLVM_FALLTHROUGH;
- case TargetTransformInfo::CacheLevel::L2D:
- return llvm::Optional<unsigned>();
- }
- llvm_unreachable("Unknown TargetTransformInfo::CacheLevel");
- }
-
- llvm::Optional<unsigned> getCacheAssociativity(
- TargetTransformInfo::CacheLevel Level) const {
- switch (Level) {
- case TargetTransformInfo::CacheLevel::L1D:
- LLVM_FALLTHROUGH;
- case TargetTransformInfo::CacheLevel::L2D:
- return llvm::Optional<unsigned>();
- }
-
- llvm_unreachable("Unknown TargetTransformInfo::CacheLevel");
- }
-
- unsigned getPrefetchDistance() const { return 0; }
- unsigned getMinPrefetchStride() const { return 1; }
- unsigned getMaxPrefetchIterationsAhead() const { return UINT_MAX; }
};
}
OpenPOWER on IntegriCloud