LLVM  3.7.0
Public Member Functions | List of all members
llvm::AssumptionCache Class Reference

A cache of .assume calls within a function. More...

#include <AssumptionCache.h>

Public Member Functions

 AssumptionCache (Function &F)
 Construct an AssumptionCache from a function by scanning all of its instructions. More...
 
void registerAssumption (CallInst *CI)
 Add an .assume intrinsic to this function's cache. More...
 
void clear ()
 Clear the cache of .assume intrinsics for a function. More...
 
MutableArrayRef< WeakVHassumptions ()
 Access the list of assumption handles currently tracked for this fuction. More...
 

Detailed Description

A cache of .assume calls within a function.

This cache provides fast lookup of assumptions within a function by caching them and amortizing the cost of scanning for them across all queries. The cache is also conservatively self-updating so that it will never return incorrect results about a function even as the function is being mutated. However, flushing the cache and rebuilding it (or explicitly updating it) may allow it to discover new assumptions.

Definition at line 43 of file AssumptionCache.h.

Constructor & Destructor Documentation

llvm::AssumptionCache::AssumptionCache ( Function F)
inline

Construct an AssumptionCache from a function by scanning all of its instructions.

Definition at line 65 of file AssumptionCache.h.

Member Function Documentation

MutableArrayRef<WeakVH> llvm::AssumptionCache::assumptions ( )
inline

Access the list of assumption handles currently tracked for this fuction.

Note that these produce weak handles that may be null. The caller must handle that case. FIXME: We should replace this with pointee_iterator<filter_iterator<...>> when we can write that to filter out the null values. Then caller code will become simpler.

Definition at line 89 of file AssumptionCache.h.

Referenced by llvm::CodeMetrics::collectEphemeralValues(), and llvm::AssumptionPrinterPass::run().

void llvm::AssumptionCache::clear ( )
inline

Clear the cache of .assume intrinsics for a function.

It will be re-scanned the next time it is requested.

Definition at line 76 of file AssumptionCache.h.

Referenced by llvm::InlineFunction(), and llvm::UnrollLoop().

void AssumptionCache::registerAssumption ( CallInst CI)

Add an .assume intrinsic to this function's cache.

The call passed in must be an instruction within this fuction and must not already be in the cache.

Definition at line 42 of file AssumptionCache.cpp.

References llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), getParent(), and llvm::PatternMatch::match().


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