diff options
| author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-07-27 23:27:43 +0000 |
|---|---|---|
| committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-07-27 23:27:43 +0000 |
| commit | c3182d8c4320c9f76fb2cf01178bd6a3d340cb5b (patch) | |
| tree | 7d6958e03152938d0cf0c4e93ae36d06095ed578 | |
| parent | 83175276ef32cb7520d8061331a4c6115fe1c8e6 (diff) | |
| download | bcm5719-llvm-c3182d8c4320c9f76fb2cf01178bd6a3d340cb5b.tar.gz bcm5719-llvm-c3182d8c4320c9f76fb2cf01178bd6a3d340cb5b.zip | |
[TargetTransformInfo][NFCI] Add TargetTransformInfo::isZExtFree.
Summary:
This function is not used in this change but will be used in a
subsequent change.
Reviewers: mcrosier, chandlerc
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D9180
llvm-svn: 243347
| -rw-r--r-- | llvm/include/llvm/Analysis/TargetTransformInfo.h | 9 | ||||
| -rw-r--r-- | llvm/include/llvm/Analysis/TargetTransformInfoImpl.h | 2 | ||||
| -rw-r--r-- | llvm/include/llvm/CodeGen/BasicTTIImpl.h | 4 | ||||
| -rw-r--r-- | llvm/lib/Analysis/TargetTransformInfo.cpp | 4 |
4 files changed, 19 insertions, 0 deletions
diff --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h b/llvm/include/llvm/Analysis/TargetTransformInfo.h index eb6fa9da369..a85174a1081 100644 --- a/llvm/include/llvm/Analysis/TargetTransformInfo.h +++ b/llvm/include/llvm/Analysis/TargetTransformInfo.h @@ -331,6 +331,11 @@ public: /// by referencing its sub-register AX. bool isTruncateFree(Type *Ty1, Type *Ty2) const; + /// \brief Return true if it's free to zero extend a value of type Ty1 to type + /// Ty2. e.g. on x86-64, all instructions that define 32-bit values implicit + /// zero-extend the result out to 64 bits. + bool isZExtFree(Type *Ty1, Type *Ty2) const; + /// \brief Return true if it is profitable to hoist instruction in the /// then/else to before if. bool isProfitableToHoist(Instruction *I) const; @@ -571,6 +576,7 @@ public: int64_t BaseOffset, bool HasBaseReg, int64_t Scale, unsigned AddrSpace) = 0; virtual bool isTruncateFree(Type *Ty1, Type *Ty2) = 0; + virtual bool isZExtFree(Type *Ty1, Type *Ty2) = 0; virtual bool isProfitableToHoist(Instruction *I) = 0; virtual bool isTypeLegal(Type *Ty) = 0; virtual unsigned getJumpBufAlignment() = 0; @@ -704,6 +710,9 @@ public: bool isTruncateFree(Type *Ty1, Type *Ty2) override { return Impl.isTruncateFree(Ty1, Ty2); } + bool isZExtFree(Type *Ty1, Type *Ty2) override { + return Impl.isZExtFree(Ty1, Ty2); + } bool isProfitableToHoist(Instruction *I) override { return Impl.isProfitableToHoist(I); } diff --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h index 505126acc0a..2abe0a58b84 100644 --- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h +++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h @@ -216,6 +216,8 @@ public: bool isTruncateFree(Type *Ty1, Type *Ty2) { return false; } + bool isZExtFree(Type *Ty1, Type *Ty2) { return false; } + bool isProfitableToHoist(Instruction *I) { return true; } bool isTypeLegal(Type *Ty) { return false; } diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h index 9ba25169fda..796a78c16ac 100644 --- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h +++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h @@ -143,6 +143,10 @@ public: return getTLI()->isTruncateFree(Ty1, Ty2); } + bool isZExtFree(Type *Ty1, Type *Ty2) const { + return getTLI()->isZExtFree(Ty1, Ty2); + } + bool isProfitableToHoist(Instruction *I) { return getTLI()->isProfitableToHoist(I); } diff --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp index 7d1c3fbef68..b426b2f121c 100644 --- a/llvm/lib/Analysis/TargetTransformInfo.cpp +++ b/llvm/lib/Analysis/TargetTransformInfo.cpp @@ -129,6 +129,10 @@ bool TargetTransformInfo::isTruncateFree(Type *Ty1, Type *Ty2) const { return TTIImpl->isTruncateFree(Ty1, Ty2); } +bool TargetTransformInfo::isZExtFree(Type *Ty1, Type *Ty2) const { + return TTIImpl->isZExtFree(Ty1, Ty2); +} + bool TargetTransformInfo::isProfitableToHoist(Instruction *I) const { return TTIImpl->isProfitableToHoist(I); } |

