summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2013-01-05 03:36:17 +0000
committerChandler Carruth <chandlerc@gmail.com>2013-01-05 03:36:17 +0000
commit64e407be0d91916d71c9259f62ba5c1f4b2993ca (patch)
tree0208576858a154b0f617862d40917565867f606f
parentb1a429fd1c79be7898bd014ade551f7138b1a84f (diff)
downloadllvm-64e407be0d91916d71c9259f62ba5c1f4b2993ca.tar.gz
llvm-64e407be0d91916d71c9259f62ba5c1f4b2993ca.tar.bz2
llvm-64e407be0d91916d71c9259f62ba5c1f4b2993ca.tar.xz
Refactor the ScalarTargetTransformInfo API for querying about the
legality of an address mode to not use a struct of four values and instead to accept them as parameters. I'd love to have named parameters here as most callers only care about one or two of these, but the defaults aren't terribly scary to write out. That said, there is no real impact of this as the passes aren't yet using STTI for this and are still relying upon TargetLowering. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171595 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Target/TargetTransformImpl.h4
-rw-r--r--include/llvm/TargetTransformInfo.h4
-rw-r--r--lib/Target/TargetTransformImpl.cpp10
3 files changed, 14 insertions, 4 deletions
diff --git a/include/llvm/Target/TargetTransformImpl.h b/include/llvm/Target/TargetTransformImpl.h
index a285f5ba8f..2069927619 100644
--- a/include/llvm/Target/TargetTransformImpl.h
+++ b/include/llvm/Target/TargetTransformImpl.h
@@ -37,7 +37,9 @@ public:
virtual bool isLegalICmpImmediate(int64_t imm) const;
- virtual bool isLegalAddressingMode(const AddrMode &AM, Type *Ty) const;
+ virtual bool isLegalAddressingMode(Type *Ty, GlobalValue *BaseGV,
+ int64_t BaseOffset, bool HasBaseReg,
+ int64_t Scale) const;
virtual bool isTruncateFree(Type *Ty1, Type *Ty2) const;
diff --git a/include/llvm/TargetTransformInfo.h b/include/llvm/TargetTransformInfo.h
index 7dd95a79c2..9a02e62104 100644
--- a/include/llvm/TargetTransformInfo.h
+++ b/include/llvm/TargetTransformInfo.h
@@ -109,7 +109,9 @@ public:
/// The type may be VoidTy, in which case only return true if the addressing
/// mode is legal for a load/store of any legal type.
/// TODO: Handle pre/postinc as well.
- virtual bool isLegalAddressingMode(const AddrMode &AM, Type *Ty) const {
+ virtual bool isLegalAddressingMode(Type *Ty, GlobalValue *BaseGV,
+ int64_t BaseOffset, bool HasBaseReg,
+ int64_t Scale) const {
return false;
}
/// isTruncateFree - Return true if it's free to truncate a value of
diff --git a/lib/Target/TargetTransformImpl.cpp b/lib/Target/TargetTransformImpl.cpp
index 08795fcaf1..63f34a8c90 100644
--- a/lib/Target/TargetTransformImpl.cpp
+++ b/lib/Target/TargetTransformImpl.cpp
@@ -27,8 +27,14 @@ bool ScalarTargetTransformImpl::isLegalICmpImmediate(int64_t imm) const {
return TLI->isLegalICmpImmediate(imm);
}
-bool ScalarTargetTransformImpl::isLegalAddressingMode(const AddrMode &AM,
- Type *Ty) const {
+bool ScalarTargetTransformImpl::isLegalAddressingMode(Type *Ty, GlobalValue *BaseGV,
+ int64_t BaseOffset, bool HasBaseReg,
+ int64_t Scale) const {
+ AddrMode AM;
+ AM.BaseGV = BaseGV;
+ AM.BaseOffs = BaseOffset;
+ AM.HasBaseReg = HasBaseReg;
+ AM.Scale = Scale;
return TLI->isLegalAddressingMode(AM, Ty);
}