diff options
| author | Ted Kremenek <kremenek@apple.com> | 2009-08-06 01:20:57 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2009-08-06 01:20:57 +0000 |
| commit | fa41714d8d3919a044fc27d17c46d2810219cb45 (patch) | |
| tree | 2470f03014b39bf9c25f5c3a3e4d414a825c8afe /clang/lib/Analysis/SVals.cpp | |
| parent | eb869768f98e32a65f98de019780bc1a24e622bd (diff) | |
| download | bcm5719-llvm-fa41714d8d3919a044fc27d17c46d2810219cb45.tar.gz bcm5719-llvm-fa41714d8d3919a044fc27d17c46d2810219cb45.zip | |
Implement lazy "copying" of structures and arrays in RegionStore. While
RegionStore already lazily abstracted the contents of arrays and structs, when
doing an assignment from one array/struct to another we did an explicit
element-wise copy, which resulted in a loss of laziness and huge performance
problem when analyzing many code bases.
Now RegionStoreManager handles such assignments using a new SVal could
'LazyCompoundSVal', which basically means the value of a given struct or array
(a MemRegion*) in a specific state (GRState). When we do a load from a field
whose encompassing struct binds to a LazyCompoundSVal, we essentially do a field
lookup in the original structure. This means we have essentially zero copying of
data for structs/arrays and everything stays lazy.
llvm-svn: 78268
Diffstat (limited to 'clang/lib/Analysis/SVals.cpp')
| -rw-r--r-- | clang/lib/Analysis/SVals.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/clang/lib/Analysis/SVals.cpp b/clang/lib/Analysis/SVals.cpp index 5ac18a15065..c597ba459e7 100644 --- a/clang/lib/Analysis/SVals.cpp +++ b/clang/lib/Analysis/SVals.cpp @@ -158,6 +158,14 @@ void SVal::symbol_iterator::expand() { assert(false && "unhandled expansion case"); } +const GRState *nonloc::LazyCompoundVal::getState() const { + return static_cast<const LazyCompoundValData*>(Data)->getState(); +} + +const TypedRegion *nonloc::LazyCompoundVal::getRegion() const { + return static_cast<const LazyCompoundValData*>(Data)->getRegion(); +} + //===----------------------------------------------------------------------===// // Other Iterators. //===----------------------------------------------------------------------===// @@ -289,7 +297,13 @@ void NonLoc::dumpToStream(llvm::raw_ostream& os) const { } os << "}"; break; - } + } + case nonloc::LazyCompoundValKind: { + const nonloc::LazyCompoundVal &C = *cast<nonloc::LazyCompoundVal>(this); + os << "lazyCompoundVal{" << (void*) C.getState() << ',' << C.getRegion() + << '}'; + break; + } default: assert (false && "Pretty-printed not implemented for this NonLoc."); break; |

