aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/TargetTransformInfo.cpp
diff options
context:
space:
mode:
authorSjoerd Meijer <sjoerd.meijer@arm.com>2016-07-14 07:44:20 +0000
committerSjoerd Meijer <sjoerd.meijer@arm.com>2016-07-14 07:44:20 +0000
commit38c2cd0c14993e4dc30f84dc7489b49e5f1ac3c5 (patch)
tree7d6ecf44c459865f2e62773e3b23da961bc58a16 /llvm/lib/Analysis/TargetTransformInfo.cpp
parentbeb1aa907d6ff298c860c3ab571017c81321766e (diff)
downloadllvm-38c2cd0c14993e4dc30f84dc7489b49e5f1ac3c5.zip
llvm-38c2cd0c14993e4dc30f84dc7489b49e5f1ac3c5.tar.gz
llvm-38c2cd0c14993e4dc30f84dc7489b49e5f1ac3c5.tar.bz2
This implements a more optimal algorithm for selecting a base constant in
constant hoisting. It not only takes into account the number of uses and the cost of expressions in which constants appear, but now also the resulting integer range of the offsets. Thus, the algorithm maximizes the number of uses within an integer range that will enable more efficient code generation. On ARM, for example, this will enable code size optimisations because less negative offsets will be created. Negative offsets/immediates are not supported by Thumb1 thus preventing more compact instruction encoding. Differential Revision: http://reviews.llvm.org/D21183 llvm-svn: 275382
Diffstat (limited to 'llvm/lib/Analysis/TargetTransformInfo.cpp')
-rw-r--r--llvm/lib/Analysis/TargetTransformInfo.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp
index 55b50ae..52013f7 100644
--- a/llvm/lib/Analysis/TargetTransformInfo.cpp
+++ b/llvm/lib/Analysis/TargetTransformInfo.cpp
@@ -209,6 +209,14 @@ int TargetTransformInfo::getFPOpCost(Type *Ty) const {
return Cost;
}
+int TargetTransformInfo::getIntImmCodeSizeCost(unsigned Opcode, unsigned Idx,
+ const APInt &Imm,
+ Type *Ty) const {
+ int Cost = TTIImpl->getIntImmCodeSizeCost(Opcode, Idx, Imm, Ty);
+ assert(Cost >= 0 && "TTI should not produce negative costs!");
+ return Cost;
+}
+
int TargetTransformInfo::getIntImmCost(const APInt &Imm, Type *Ty) const {
int Cost = TTIImpl->getIntImmCost(Imm, Ty);
assert(Cost >= 0 && "TTI should not produce negative costs!");