diff options
author | Javed Absar <javed.absar@arm.com> | 2016-10-13 14:57:43 +0000 |
---|---|---|
committer | Javed Absar <javed.absar@arm.com> | 2016-10-13 14:57:43 +0000 |
commit | 85874a9360334ddb9619aca6344b8ee53296fa1e (patch) | |
tree | c3841773c33a70d7c4135d5f144ad869a4d48d25 /llvm/lib/Target/ARM/ARMISelLowering.h | |
parent | 1d4b163fc0fadab7ffe87149f3d1c897ded184f9 (diff) | |
download | bcm5719-llvm-85874a9360334ddb9619aca6344b8ee53296fa1e.tar.gz bcm5719-llvm-85874a9360334ddb9619aca6344b8ee53296fa1e.zip |
[ARM]: Assign cost of scaling used in addressing mode for ARM cores
This patch assigns cost of the scaling used in addressing.
On many ARM cores, a negated register offset takes longer than a
non-negated register offset, in a register-offset addressing mode.
For instance:
LDR R0, [R1, R2 LSL #2]
LDR R0, [R1, -R2 LSL #2]
Above, (1) takes less cycles than (2).
By assigning appropriate scaling factor cost, we enable the LLVM
to make the right trade-offs in the optimization and code-selection phase.
Differential Revision: http://reviews.llvm.org/D24857
Reviewers: jmolloy, rengolin
llvm-svn: 284127
Diffstat (limited to 'llvm/lib/Target/ARM/ARMISelLowering.h')
-rw-r--r-- | llvm/lib/Target/ARM/ARMISelLowering.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.h b/llvm/lib/Target/ARM/ARMISelLowering.h index 191235d491d..75da3584337 100644 --- a/llvm/lib/Target/ARM/ARMISelLowering.h +++ b/llvm/lib/Target/ARM/ARMISelLowering.h @@ -291,6 +291,14 @@ namespace llvm { /// by AM is legal for this target, for a load/store of the specified type. bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty, unsigned AS) const override; + + /// getScalingFactorCost - Return the cost of the scaling used in + /// addressing mode represented by AM. + /// If the AM is supported, the return value must be >= 0. + /// If the AM is not supported, the return value must be negative. + int getScalingFactorCost(const DataLayout &DL, const AddrMode &AM, Type *Ty, + unsigned AS) const override; + bool isLegalT2ScaledAddressingMode(const AddrMode &AM, EVT VT) const; /// isLegalICmpImmediate - Return true if the specified immediate is legal |