Commit 523e787f authored by Bill Wendling's avatar Bill Wendling
Browse files

--- Merging r127981 into '.':

U    include/llvm/Target/TargetLowering.h
U    lib/Target/X86/X86ISelLowering.cpp
U    lib/Target/X86/X86ISelLowering.h
U    lib/Target/ARM/ARMISelLowering.h
U    lib/Target/ARM/ARMISelLowering.cpp
U    lib/Transforms/Scalar/CodeGenPrepare.cpp
--- Merging r128194 into '.':
G    lib/Transforms/Scalar/CodeGenPrepare.cpp
--- Merging r128196 into '.':
G    lib/Transforms/Scalar/CodeGenPrepare.cpp
--- Merging r128197 into '.':
A    test/CodeGen/X86/tailcall-returndup-void.ll
G    lib/Transforms/Scalar/CodeGenPrepare.cpp

llvm-svn: 128200
parent 3506f1ad
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1287,6 +1287,14 @@ public:
    return false;
  }

  /// mayBeEmittedAsTailCall - Return true if the target may be able emit the
  /// call instruction as a tail call. This is used by optimization passes to
  /// determine if it's profitable to duplicate return instructions to enable
  /// tailcall optimization.
  virtual bool mayBeEmittedAsTailCall(CallInst *CI) const {
    return false;
  }

  /// LowerOperationWrapper - This callback is invoked by the type legalizer
  /// to legalize nodes with an illegal operand type but legal result types.
  /// It replaces the LowerOperation callback in the type Legalizer.
+10 −0
Original line number Diff line number Diff line
@@ -1803,6 +1803,16 @@ bool ARMTargetLowering::isUsedByReturnOnly(SDNode *N) const {
  return HasRet;
}

bool ARMTargetLowering::mayBeEmittedAsTailCall(CallInst *CI) const {
  if (!EnableARMTailCalls)
    return false;

  if (!CI->isTailCall())
    return false;

  return !Subtarget->isThumb1Only();
}

// ConstantPool, JumpTable, GlobalAddress, and ExternalSymbol are lowered as
// their target counterpart wrapped in the ARMISD::Wrapper node. Suppose N is
// one of the above mentioned nodes. It has to be wrapped because otherwise
+2 −0
Original line number Diff line number Diff line
@@ -455,6 +455,8 @@ namespace llvm {

    virtual bool isUsedByReturnOnly(SDNode *N) const;

    virtual bool mayBeEmittedAsTailCall(CallInst *CI) const;

    SDValue getARMCmp(SDValue LHS, SDValue RHS, ISD::CondCode CC,
                      SDValue &ARMcc, SelectionDAG &DAG, DebugLoc dl) const;
    SDValue getVFPCmp(SDValue LHS, SDValue RHS,
+13 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/VectorExtras.h"
#include "llvm/Support/CallSite.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ErrorHandling.h"
@@ -1580,6 +1581,18 @@ static bool IsTailCallConvention(CallingConv::ID CC) {
  return (CC == CallingConv::Fast || CC == CallingConv::GHC);
}

bool X86TargetLowering::mayBeEmittedAsTailCall(CallInst *CI) const {
  if (!CI->isTailCall())
    return false;

  CallSite CS(CI);
  CallingConv::ID CalleeCC = CS.getCallingConv();
  if (!IsTailCallConvention(CalleeCC) && CalleeCC != CallingConv::C)
    return false;

  return true;
}

/// FuncIsMadeTailCallSafe - Return true if the function is being made into
/// a tailcall target by changing its ABI.
static bool FuncIsMadeTailCallSafe(CallingConv::ID CC) {
+2 −0
Original line number Diff line number Diff line
@@ -843,6 +843,8 @@ namespace llvm {

    virtual bool isUsedByReturnOnly(SDNode *N) const;

    virtual bool mayBeEmittedAsTailCall(CallInst *CI) const;

    virtual bool
      CanLowerReturn(CallingConv::ID CallConv, bool isVarArg,
                     const SmallVectorImpl<ISD::OutputArg> &Outs,
Loading