diff options
author | Quentin Colombet <qcolombet@apple.com> | 2013-05-31 21:29:03 +0000 |
---|---|---|
committer | Quentin Colombet <qcolombet@apple.com> | 2013-05-31 21:29:03 +0000 |
commit | 06f5ebc5a1604b01689cf2d482dd05f956538af6 (patch) | |
tree | 052709f167b5eaa2b9cd8b704361e6f8c92b5236 /lib/CodeGen/BasicTargetTransformInfo.cpp | |
parent | e17388fd34a12dd0ecb8e347645b945db91d90a7 (diff) | |
download | llvm-06f5ebc5a1604b01689cf2d482dd05f956538af6.tar.gz llvm-06f5ebc5a1604b01689cf2d482dd05f956538af6.tar.bz2 llvm-06f5ebc5a1604b01689cf2d482dd05f956538af6.tar.xz |
Loop Strength Reduce: Scaling factor cost.
Account for the cost of scaling factor in Loop Strength Reduce when rating the
formulae. This uses a target hook.
The default implementation of the hook is: if the addressing mode is legal, the
scaling factor is free.
<rdar://problem/13806271>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183045 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/BasicTargetTransformInfo.cpp')
-rw-r--r-- | lib/CodeGen/BasicTargetTransformInfo.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/CodeGen/BasicTargetTransformInfo.cpp b/lib/CodeGen/BasicTargetTransformInfo.cpp index 4a99184f5e..92a5bb70f4 100644 --- a/lib/CodeGen/BasicTargetTransformInfo.cpp +++ b/lib/CodeGen/BasicTargetTransformInfo.cpp @@ -71,6 +71,9 @@ public: virtual bool isLegalAddressingMode(Type *Ty, GlobalValue *BaseGV, int64_t BaseOffset, bool HasBaseReg, int64_t Scale) const; + virtual int getScalingFactorCost(Type *Ty, GlobalValue *BaseGV, + int64_t BaseOffset, bool HasBaseReg, + int64_t Scale) const; virtual bool isTruncateFree(Type *Ty1, Type *Ty2) const; virtual bool isTypeLegal(Type *Ty) const; virtual unsigned getJumpBufAlignment() const; @@ -139,6 +142,17 @@ bool BasicTTI::isLegalAddressingMode(Type *Ty, GlobalValue *BaseGV, return TLI->isLegalAddressingMode(AM, Ty); } +int BasicTTI::getScalingFactorCost(Type *Ty, GlobalValue *BaseGV, + int64_t BaseOffset, bool HasBaseReg, + int64_t Scale) const { + TargetLoweringBase::AddrMode AM; + AM.BaseGV = BaseGV; + AM.BaseOffs = BaseOffset; + AM.HasBaseReg = HasBaseReg; + AM.Scale = Scale; + return TLI->getScalingFactorCost(AM, Ty); +} + bool BasicTTI::isTruncateFree(Type *Ty1, Type *Ty2) const { return TLI->isTruncateFree(Ty1, Ty2); } |