diff options
author | Hal Finkel <hfinkel@anl.gov> | 2012-10-26 04:28:02 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2012-10-26 04:28:02 +0000 |
commit | 102a7c088c16b8bbed7cf56da9994fa52a9028c5 (patch) | |
tree | 14513b8b3a258c0a9f4544ab306de0e07a64f8c5 | |
parent | 6b0db5f372057745c5e4a99d70401dc2615cc084 (diff) |
Add VectorTargetTransform::getNumberOfParts.
As discussed on IRC, add VectorTargetTransform::getNumberOfParts
to provide a stable interface to the vector legalization splitting factor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166751 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Target/TargetTransformImpl.h | 2 | ||||
-rw-r--r-- | include/llvm/TargetTransformInfo.h | 5 | ||||
-rw-r--r-- | lib/Target/TargetTransformImpl.cpp | 8 |
3 files changed, 15 insertions, 0 deletions
diff --git a/include/llvm/Target/TargetTransformImpl.h b/include/llvm/Target/TargetTransformImpl.h index 25a7edeb01..133be87194 100644 --- a/include/llvm/Target/TargetTransformImpl.h +++ b/include/llvm/Target/TargetTransformImpl.h @@ -68,6 +68,8 @@ public: virtual unsigned getMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment, unsigned AddressSpace) const; + + virtual unsigned getNumberOfParts(Type *Tp) const; }; } // end llvm namespace diff --git a/include/llvm/TargetTransformInfo.h b/include/llvm/TargetTransformInfo.h index 96470c30ca..71c78ec52e 100644 --- a/include/llvm/TargetTransformInfo.h +++ b/include/llvm/TargetTransformInfo.h @@ -156,6 +156,11 @@ public: return 1; } + /// Returns the number of pieces into which the provided type must be + /// split during legalization. Zero is returned when the answer is unknown. + virtual unsigned getNumberOfParts(Type *Tp) const { + return 0; + } }; } // End llvm namespace diff --git a/lib/Target/TargetTransformImpl.cpp b/lib/Target/TargetTransformImpl.cpp index c8bd80ea25..3bf4bf72e1 100644 --- a/lib/Target/TargetTransformImpl.cpp +++ b/lib/Target/TargetTransformImpl.cpp @@ -196,3 +196,11 @@ VectorTargetTransformImpl::getMemoryOpCost(unsigned Opcode, Type *Src, // Assume that all loads of legal types cost 1. return LT.first; } + +unsigned +VectorTargetTransformImpl::getNumberOfParts(Type *Tp) const { + std::pair<unsigned, EVT> LT = + getTypeLegalizationCost(Tp->getContext(), TLI->getValueType(Tp)); + return LT.first; +} + |