summaryrefslogtreecommitdiff
path: root/include/llvm/Target
diff options
context:
space:
mode:
authorJuergen Ributzka <juergen@apple.com>2014-01-28 01:20:14 +0000
committerJuergen Ributzka <juergen@apple.com>2014-01-28 01:20:14 +0000
commitefbb39740c32b6b8311d27b0f279a7d523fbdf2d (patch)
tree098939cea9469e21535ce923015b5f0b4c1330d2 /include/llvm/Target
parenta47aa4b4efb2b6c5944c2edb9a4346c0f3ffcaf1 (diff)
downloadllvm-efbb39740c32b6b8311d27b0f279a7d523fbdf2d.tar.gz
llvm-efbb39740c32b6b8311d27b0f279a7d523fbdf2d.tar.bz2
llvm-efbb39740c32b6b8311d27b0f279a7d523fbdf2d.tar.xz
[TLI] Add a new hook to TargetLowering to query the target if a load of a constant should be converted to simply the constant itself.
Before this patch we used getIntImmCost from TargetTransformInfo to determine if a load of a constant should be converted to just a constant, but the threshold for this was set to an arbitrary value. This value works well for the two targets (X86 and ARM) that implement this target-hook, but it isn't target-independent at all. Now targets have the possibility to decide directly if this optimization should be performed. The default value is set to false to preserve the current behavior. The target hook has been moved to TargetLowering, which removed the last use and need of TargetTransformInfo in SelectionDAG. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200271 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Target')
-rw-r--r--include/llvm/Target/TargetLowering.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h
index c8351b7c5e..e9d87291aa 100644
--- a/include/llvm/Target/TargetLowering.h
+++ b/include/llvm/Target/TargetLowering.h
@@ -1287,6 +1287,15 @@ public:
return false;
}
+ /// \brief Return true if it is beneficial to convert a load of a constant to
+ /// just the constant itself.
+ /// On some targets it might be more efficient to use a combination of
+ /// arithmetic instructions to materialize the constant instead of loading it
+ /// from a constant pool.
+ virtual bool shouldConvertConstantLoadToIntImm(const APInt &Imm,
+ Type *Ty) const {
+ return false;
+ }
//===--------------------------------------------------------------------===//
// Runtime Library hooks
//