Refactor the ScalarTargetTransformInfo API for querying about the
authorChandler Carruth <chandlerc@gmail.com>
Sat, 5 Jan 2013 03:36:17 +0000 (03:36 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sat, 5 Jan 2013 03:36:17 +0000 (03:36 +0000)
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

include/llvm/Target/TargetTransformImpl.h
include/llvm/TargetTransformInfo.h
lib/Target/TargetTransformImpl.cpp

index a285f5ba8f4bf55c0afb302fde5db8ba6be10d73..20699276196f2496405f5fc7d869f85d063eac3f 100644 (file)
@@ -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;
 
index 7dd95a79c2da8e59fd2cf9652d61b2f7b5712020..9a02e621043df6b1247494a230d10ee81f235bf5 100644 (file)
@@ -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
index 08795fcaf1f1921e2b4db7933f32f98f7dfbfde7..63f34a8c909c7a7474f340ec29bba93993d88f8d 100644 (file)
@@ -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);
 }