From 4ce9863d0bc423bb4616e6ca14337e6c900339b8 Mon Sep 17 00:00:00 2001 From: Juergen Ributzka Date: Fri, 11 Jul 2014 20:50:47 +0000 Subject: [FastISel] Make isInTailCallPosition independent of SelectionDAG. Break out the arguemnts required from SelectionDAG, so that this function can also be used by FastISel. llvm-svn: 212844 --- llvm/lib/CodeGen/Analysis.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'llvm/lib/CodeGen/Analysis.cpp') diff --git a/llvm/lib/CodeGen/Analysis.cpp b/llvm/lib/CodeGen/Analysis.cpp index 1bdf312e46c..3740d03b62d 100644 --- a/llvm/lib/CodeGen/Analysis.cpp +++ b/llvm/lib/CodeGen/Analysis.cpp @@ -475,7 +475,8 @@ static bool nextRealType(SmallVectorImpl &SubTypes, /// between it and the return. /// /// This function only tests target-independent requirements. -bool llvm::isInTailCallPosition(ImmutableCallSite CS, const SelectionDAG &DAG) { +bool llvm::isInTailCallPosition(ImmutableCallSite CS, const TargetMachine &TM, + const TargetLoweringBase &TLI) { const Instruction *I = CS.getInstruction(); const BasicBlock *ExitBB = I->getParent(); const TerminatorInst *Term = ExitBB->getTerminator(); @@ -490,8 +491,7 @@ bool llvm::isInTailCallPosition(ImmutableCallSite CS, const SelectionDAG &DAG) { // longjmp on x86), it can end up causing miscompilation that has not // been fully understood. if (!Ret && - (!DAG.getTarget().Options.GuaranteedTailCallOpt || - !isa(Term))) + (!TM.Options.GuaranteedTailCallOpt || !isa(Term))) return false; // If I will have a chain, make sure no other instruction that will have a @@ -509,8 +509,7 @@ bool llvm::isInTailCallPosition(ImmutableCallSite CS, const SelectionDAG &DAG) { return false; } - return returnTypeIsEligibleForTailCall(ExitBB->getParent(), I, Ret, - *DAG.getTarget().getTargetLowering()); + return returnTypeIsEligibleForTailCall(ExitBB->getParent(), I, Ret, TLI); } bool llvm::returnTypeIsEligibleForTailCall(const Function *F, -- cgit v1.2.3