LLVM: lib/Transforms/Scalar/TailRecursionElimination.cpp File Reference (original) (raw)

Go to the source code of this file.

Macros
#define DEBUG_TYPE "tailcallelim"
Functions
STATISTIC (NumEliminated, "Number of tail calls removed")
STATISTIC (NumRetDuped, "Number of return duplicated")
STATISTIC (NumAccumAdded, "Number of accumulators introduced")
static bool canTRE (Function &F)
Scan the specified function for alloca instructions.
static bool markTails (Function &F, OptimizationRemarkEmitter *ORE)
static bool canMoveAboveCall (Instruction *I, CallInst *CI, AliasAnalysis *AA)
Return true if it is safe to move the specified instruction from after the call to before the call, assuming that all instructions between the call and this instruction are movable.
static bool canTransformAccumulatorRecursion (Instruction *I, CallInst *CI)
INITIALIZE_PASS_BEGIN (TailCallElim, "tailcallelim", "Tail Call Elimination", false, false) INITIALIZE_PASS_END(TailCallElim
Variables
static cl::opt< bool > ForceDisableBFI ("tre-disable-entrycount-recompute", cl::init(false), cl::Hidden, cl::desc("Force disabling recomputing of function entry count, on " "successful tail recursion elimination."))
tailcallelim
Tail Call Elimination
Tail Call false

DEBUG_TYPE

#define DEBUG_TYPE "tailcallelim"

canMoveAboveCall()

canTransformAccumulatorRecursion()

canTRE()

INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( TailCallElim ,
"tailcallelim" ,
"Tail Call Elimination" ,
false ,
false )

markTails()

Definition at line 197 of file TailRecursionElimination.cpp.

References A(), llvm::CallBase::args(), llvm::dbgs(), DEBUG_TYPE, llvm::CallBase::doesNotAccessMemory(), llvm::dyn_cast(), llvm::OptimizationRemarkEmitter::emit(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), F, llvm::CallBase::hasOperandBundlesOtherThan(), I, II, llvm::isa(), llvm::CallInst::isNoTailCall(), llvm::CallInst::isTailCall(), LLVM_DEBUG, Modified, llvm::LLVMContext::OB_clang_arc_attachedcall, llvm::LLVMContext::OB_kcfi, llvm::LLVMContext::OB_ptrauth, llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::CallInst::setTailCall(), and llvm::successors().

STATISTIC() [1/3]

STATISTIC ( NumAccumAdded ,
"Number of accumulators introduced" )

STATISTIC() [2/3]

STATISTIC ( NumEliminated ,
"Number of tail calls removed" )

STATISTIC() [3/3]

STATISTIC ( NumRetDuped ,
"Number of return duplicated" )

Elimination

false

ForceDisableBFI

cl::opt< bool > ForceDisableBFI("tre-disable-entrycount-recompute", cl::init(false), cl::Hidden, cl::desc("Force disabling recomputing of function entry count, on " "successful tail recursion elimination.")) ( "tre-disable-entrycount-recompute" , cl::init(false) , cl::Hidden , cl::desc("Force disabling recomputing of function entry count, on " "successful tail recursion elimination.") ) static

tailcallelim