aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis
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
commit06f5ebc5a1604b01689cf2d482dd05f956538af6 (patch)
tree052709f167b5eaa2b9cd8b704361e6f8c92b5236 /lib/Analysis
parente17388fd34a12dd0ecb8e347645b945db91d90a7 (diff)
downloadexternal_llvm-06f5ebc5a1604b01689cf2d482dd05f956538af6.zip
external_llvm-06f5ebc5a1604b01689cf2d482dd05f956538af6.tar.gz
external_llvm-06f5ebc5a1604b01689cf2d482dd05f956538af6.tar.bz2
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/Analysis')
-rw-r--r--lib/Analysis/TargetTransformInfo.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Analysis/TargetTransformInfo.cpp b/lib/Analysis/TargetTransformInfo.cpp
index 64f8e96..35ce794 100644
--- a/lib/Analysis/TargetTransformInfo.cpp
+++ b/lib/Analysis/TargetTransformInfo.cpp
@@ -108,6 +108,14 @@ bool TargetTransformInfo::isLegalAddressingMode(Type *Ty, GlobalValue *BaseGV,
Scale);
}
+int TargetTransformInfo::getScalingFactorCost(Type *Ty, GlobalValue *BaseGV,
+ int64_t BaseOffset,
+ bool HasBaseReg,
+ int64_t Scale) const {
+ return PrevTTI->getScalingFactorCost(Ty, BaseGV, BaseOffset, HasBaseReg,
+ Scale);
+}
+
bool TargetTransformInfo::isTruncateFree(Type *Ty1, Type *Ty2) const {
return PrevTTI->isTruncateFree(Ty1, Ty2);
}
@@ -457,6 +465,15 @@ struct NoTTI : ImmutablePass, TargetTransformInfo {
return !BaseGV && BaseOffset == 0 && Scale <= 1;
}
+ int getScalingFactorCost(Type *Ty, GlobalValue *BaseGV, int64_t BaseOffset,
+ bool HasBaseReg, int64_t Scale) const {
+ // Guess that all legal addressing mode are free.
+ if(isLegalAddressingMode(Ty, BaseGV, BaseOffset, HasBaseReg, Scale))
+ return 0;
+ return -1;
+ }
+
+
bool isTruncateFree(Type *Ty1, Type *Ty2) const {
return false;
}