summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/BasicTargetTransformInfo.cpp
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2013-05-31 21:29:03 +0000
committerQuentin Colombet <qcolombet@apple.com>2013-05-31 21:29:03 +0000
commitbf490d4a32a7904aba5271830091c0c2d0e1fa90 (patch)
tree55ff3dc92865faef0accea1bb3759a2844cfb0cf /llvm/lib/CodeGen/BasicTargetTransformInfo.cpp
parentfac51ab5e2462b0c1cbd7c7345175c25075b4d6a (diff)
downloadbcm5719-llvm-bf490d4a32a7904aba5271830091c0c2d0e1fa90.tar.gz
bcm5719-llvm-bf490d4a32a7904aba5271830091c0c2d0e1fa90.zip
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> llvm-svn: 183045
Diffstat (limited to 'llvm/lib/CodeGen/BasicTargetTransformInfo.cpp')
-rw-r--r--llvm/lib/CodeGen/BasicTargetTransformInfo.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/BasicTargetTransformInfo.cpp b/llvm/lib/CodeGen/BasicTargetTransformInfo.cpp
index 4a99184f5ee..92a5bb70f43 100644
--- a/llvm/lib/CodeGen/BasicTargetTransformInfo.cpp
+++ b/llvm/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);
}
OpenPOWER on IntegriCloud