LLVM API Documentation

llvm::EscapeAnalysis Class Reference

#include <EscapeAnalysis.h>

Inheritance diagram for llvm::EscapeAnalysis:

Inheritance graph
[legend]
Collaboration diagram for llvm::EscapeAnalysis:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 EscapeAnalysis ()
bool runOnFunction (Function &F)
void releaseMemory ()
void getAnalysisUsage (AnalysisUsage &AU) const
bool escapes (Value *A)

Static Public Attributes

static char ID = 0


Detailed Description

EscapeAnalysis - This class determines whether an allocation (a MallocInst or an AllocaInst) can escape from the current function. It performs some precomputation, with the rest of the work happening on-demand.

Definition at line 28 of file EscapeAnalysis.h.


Constructor & Destructor Documentation

llvm::EscapeAnalysis::EscapeAnalysis (  )  [inline]

Definition at line 35 of file EscapeAnalysis.h.


Member Function Documentation

bool EscapeAnalysis::runOnFunction ( Function F  )  [virtual]

runOnFunction - Precomputation for escape analysis. This collects all know "escape points" in the def-use graph of the function. These are instructions which allow their inputs to escape from the current function.

Implements llvm::FunctionPass.

Definition at line 40 of file EscapeAnalysis.cpp.

References AA, AI, llvm::Function::arg_begin(), llvm::Function::arg_end(), GE, llvm::GlobalValue::getParent(), llvm::AllocationInst::getType(), llvm::TargetData::getTypeStoreSize(), I, II, llvm::inst_begin(), llvm::inst_end(), M, llvm::AliasAnalysis::NoAlias, R, and TD.

void llvm::EscapeAnalysis::releaseMemory (  )  [inline, virtual]

releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memory when it is no longer needed. The default behavior of passes is to hold onto memory for the entire duration of their lifetime (which is the entire compile time). For pipelined passes, this is not a big deal because that memory gets recycled every time the pass is invoked on another program unit. For IP passes, it is more important to free memory when it is unused.

Optionally implement this function to release pass memory when it is no longer used.

Reimplemented from llvm::Pass.

Definition at line 39 of file EscapeAnalysis.h.

void EscapeAnalysis::getAnalysisUsage ( AnalysisUsage  )  const [virtual]

getAnalysisUsage - This function should be overriden by passes that need analysis information to do their job. If a pass specifies that it uses a particular analysis result to this function, it can then use the getAnalysis<AnalysisType>() function, below.

Reimplemented from llvm::Pass.

Definition at line 31 of file EscapeAnalysis.cpp.

References llvm::AnalysisUsage::addRequiredTransitive(), and llvm::AnalysisUsage::setPreservesAll().

bool EscapeAnalysis::escapes ( Value A  ) 

escapes - returns true if the value, which must have a pointer type, can escape.

escapes - Determines whether the passed allocation can escape from the current function. It does this by using a simple worklist algorithm to search for a path in the def-use graph from the allocation to an escape point. FIXME: Once we've discovered a path, it would be a good idea to memoize it, and all of its subpaths, to amortize the cost of future queries.

Definition at line 112 of file EscapeAnalysis.cpp.

References llvm::CallingConv::C, llvm::dyn_cast(), llvm::BranchInst::getCondition(), llvm::User::getOperand(), llvm::Value::getType(), I, llvm::SmallPtrSet< PtrType, SmallSize >::insert(), llvm::Value::stripPointerCasts(), llvm::Value::use_begin(), and llvm::Value::use_end().


Member Data Documentation

char EscapeAnalysis::ID = 0 [static]

Definition at line 33 of file EscapeAnalysis.h.


The documentation for this class was generated from the following files:



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