LLVM API Documentation

TailRecursionElimination.cpp File Reference

#include "llvm/Transforms/Scalar.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Function.h"
#include "llvm/Instructions.h"
#include "llvm/Pass.h"
#include "llvm/Support/CFG.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Support/Compiler.h"

Include dependency graph for TailRecursionElimination.cpp:

Go to the source code of this file.

Defines

#define DEBUG_TYPE   "tailcallelim"

Functions

 STATISTIC (NumEliminated,"Number of tail calls removed")
 STATISTIC (NumAccumAdded,"Number of accumulators introduced")
FunctionPassllvm::createTailCallEliminationPass ()
static bool AllocaMightEscapeToCalls (AllocaInst *AI)
static bool CheckForEscapingAllocas (BasicBlock *BB, bool &CannotTCETailMarkedCall)
static bool isDynamicConstant (Value *V, CallInst *CI)
static ValuegetCommonReturnValue (ReturnInst *TheRI, CallInst *CI)

Variables

static RegisterPass< TailCallElim > X ("tailcallelim","Tail Call Elimination")


Define Documentation

#define DEBUG_TYPE   "tailcallelim"

Definition at line 53 of file TailRecursionElimination.cpp.


Function Documentation

static bool AllocaMightEscapeToCalls ( AllocaInst AI  )  [static]

AllocaMightEscapeToCalls - Return true if this alloca may be accessed by callees of this function. We only do very simple analysis right now, this could be expanded in the future to use mod/ref information for particular call sites if desired.

Definition at line 98 of file TailRecursionElimination.cpp.

Referenced by CheckForEscapingAllocas().

static bool CheckForEscapingAllocas ( BasicBlock BB,
bool &  CannotTCETailMarkedCall 
) [static]

FunctionContainsAllocas - Scan the specified basic block for alloca instructions. If it contains any that might be accessed by calls, return true.

Definition at line 106 of file TailRecursionElimination.cpp.

References AI, AllocaMightEscapeToCalls(), llvm::BasicBlock::begin(), E, llvm::BasicBlock::end(), llvm::AllocationInst::getArraySize(), llvm::Function::getEntryBlock(), llvm::BasicBlock::getParent(), and I.

static Value* getCommonReturnValue ( ReturnInst TheRI,
CallInst CI 
) [static]

static bool isDynamicConstant ( Value V,
CallInst CI 
) [static]

STATISTIC ( NumAccumAdded  ,
"Number of accumulators introduced"   
)

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


Variable Documentation

char ID [static]

Definition at line 70 of file TailRecursionElimination.cpp.

RegisterPass<TailCallElim> X("tailcallelim","Tail Call Elimination") [static]




This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.