aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Analysis/TargetTransformInfo.h
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 /include/llvm/Analysis/TargetTransformInfo.h
parente17388fd34a12dd0ecb8e347645b945db91d90a7 (diff)
downloadexternal_llvm-06f5ebc5a1604b01689cf2d482dd05f956538af6.tar.gz
external_llvm-06f5ebc5a1604b01689cf2d482dd05f956538af6.tar.bz2
external_llvm-06f5ebc5a1604b01689cf2d482dd05f956538af6.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> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183045 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/TargetTransformInfo.h')
-rw-r--r--include/llvm/Analysis/TargetTransformInfo.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/llvm/Analysis/TargetTransformInfo.h b/include/llvm/Analysis/TargetTransformInfo.h
index a9d6725d86..eb29e3483d 100644
--- a/include/llvm/Analysis/TargetTransformInfo.h
+++ b/include/llvm/Analysis/TargetTransformInfo.h
@@ -225,6 +225,16 @@ public:
int64_t BaseOffset, bool HasBaseReg,
int64_t Scale) const;
+ /// \brief Return the cost of the scaling factor used in the addressing
+ /// mode represented by AM for this target, for a load/store
+ /// of the specified type.
+ /// If the AM is supported, the return value must be >= 0.
+ /// If the AM is not supported, it returns a negative value.
+ /// TODO: Handle pre/postinc as well.
+ virtual int getScalingFactorCost(Type *Ty, GlobalValue *BaseGV,
+ int64_t BaseOffset, bool HasBaseReg,
+ int64_t Scale) const;
+
/// isTruncateFree - Return true if it's free to truncate a value of
/// type Ty1 to type Ty2. e.g. On x86 it's free to truncate a i32 value in
/// register EAX to i16 by referencing its sub-register AX.