summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2013-08-06 13:58:03 +0000
committerTim Northover <tnorthover@apple.com>2013-08-06 13:58:03 +0000
commitcc2e903bda2dc0f59f80dd4e159df3c8ba45bdf5 (patch)
tree36cc650b566c6859db410ab6dff45b7983cbf0ae /llvm/lib
parentb2be0b41aff167a83e6eacdd540b0b02beb9d1b3 (diff)
downloadbcm5719-llvm-cc2e903bda2dc0f59f80dd4e159df3c8ba45bdf5.tar.gz
bcm5719-llvm-cc2e903bda2dc0f59f80dd4e159df3c8ba45bdf5.zip
ARM: implement allowTruncateForTailCall
Now that it's in place, it seems silly not to let ARM make use of the extra tail call opportunities. llvm-svn: 187795
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/ARM/ARMISelLowering.cpp15
-rw-r--r--llvm/lib/Target/ARM/ARMISelLowering.h3
2 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index 61c5bd14c95..caec11e108f 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -9993,6 +9993,21 @@ bool ARMTargetLowering::isZExtFree(SDValue Val, EVT VT2) const {
return false;
}
+bool ARMTargetLowering::allowTruncateForTailCall(Type *Ty1, Type *Ty2) const {
+ if (!Ty1->isIntegerTy() || !Ty2->isIntegerTy())
+ return false;
+
+ if (!isTypeLegal(EVT::getEVT(Ty1)))
+ return false;
+
+ assert(Ty1->getPrimitiveSizeInBits() <= 64 && "i128 is probably not a noop");
+
+ // Assuming the caller doesn't have a zeroext or signext return parameter,
+ // truncation all the way down to i1 is valid.
+ return true;
+}
+
+
static bool isLegalT1AddressImmediate(int64_t V, EVT VT) {
if (V < 0)
return false;
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.h b/llvm/lib/Target/ARM/ARMISelLowering.h
index beba5ce7715..44c769f8221 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.h
+++ b/llvm/lib/Target/ARM/ARMISelLowering.h
@@ -298,6 +298,9 @@ namespace llvm {
using TargetLowering::isZExtFree;
virtual bool isZExtFree(SDValue Val, EVT VT2) const;
+ virtual bool allowTruncateForTailCall(Type *Ty1, Type *Ty2) const;
+
+
/// isLegalAddressingMode - Return true if the addressing mode represented
/// by AM is legal for this target, for a load/store of the specified type.
virtual bool isLegalAddressingMode(const AddrMode &AM, Type *Ty)const;
OpenPOWER on IntegriCloud