|
29 | 29 | #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h" |
30 | 30 | #include "llvm/ADT/ImmutableMap.h" |
31 | 31 | #include "llvm/ADT/STLExtras.h" |
| 32 | +#include "llvm/Support/TimeProfiler.h" |
32 | 33 | #include "llvm/Support/raw_ostream.h" |
33 | 34 | #include <optional> |
34 | 35 | #include <utility> |
@@ -112,6 +113,13 @@ class BindingKey { |
112 | 113 |
|
113 | 114 | LLVM_DUMP_METHOD void dump() const; |
114 | 115 | }; |
| 116 | + |
| 117 | +std::string locDescr(Loc L) { |
| 118 | + std::string S; |
| 119 | + llvm::raw_string_ostream OS(S); |
| 120 | + L.dumpToStream(OS); |
| 121 | + return OS.str(); |
| 122 | +} |
115 | 123 | } // end anonymous namespace |
116 | 124 |
|
117 | 125 | BindingKey BindingKey::Make(const MemRegion *R, Kind k) { |
@@ -2408,6 +2416,8 @@ StoreRef RegionStoreManager::killBinding(Store ST, Loc L) { |
2408 | 2416 |
|
2409 | 2417 | RegionBindingsRef |
2410 | 2418 | RegionStoreManager::bind(RegionBindingsConstRef B, Loc L, SVal V) { |
| 2419 | + llvm::TimeTraceScope TimeScope("RegionStoreManager::bind", |
| 2420 | + [&L]() { return locDescr(L); }); |
2411 | 2421 | // We only care about region locations. |
2412 | 2422 | auto MemRegVal = L.getAs<loc::MemRegionVal>(); |
2413 | 2423 | if (!MemRegVal) |
@@ -2514,6 +2524,8 @@ RegionBindingsRef |
2514 | 2524 | RegionStoreManager::bindArray(RegionBindingsConstRef B, |
2515 | 2525 | const TypedValueRegion* R, |
2516 | 2526 | SVal Init) { |
| 2527 | + llvm::TimeTraceScope TimeScope("RegionStoreManager::bindArray", |
| 2528 | + [R]() { return R->getDescriptiveName(); }); |
2517 | 2529 |
|
2518 | 2530 | const ArrayType *AT =cast<ArrayType>(Ctx.getCanonicalType(R->getValueType())); |
2519 | 2531 | QualType ElementTy = AT->getElementType(); |
@@ -2578,6 +2590,8 @@ RegionStoreManager::bindArray(RegionBindingsConstRef B, |
2578 | 2590 | RegionBindingsRef RegionStoreManager::bindVector(RegionBindingsConstRef B, |
2579 | 2591 | const TypedValueRegion* R, |
2580 | 2592 | SVal V) { |
| 2593 | + llvm::TimeTraceScope TimeScope("RegionStoreManager::bindVector", |
| 2594 | + [R]() { return R->getDescriptiveName(); }); |
2581 | 2595 | QualType T = R->getValueType(); |
2582 | 2596 | const VectorType *VT = T->castAs<VectorType>(); // Use castAs for typedefs. |
2583 | 2597 |
|
@@ -2700,6 +2714,8 @@ std::optional<RegionBindingsRef> RegionStoreManager::tryBindSmallStruct( |
2700 | 2714 | RegionBindingsRef RegionStoreManager::bindStruct(RegionBindingsConstRef B, |
2701 | 2715 | const TypedValueRegion *R, |
2702 | 2716 | SVal V) { |
| 2717 | + llvm::TimeTraceScope TimeScope("RegionStoreManager::bindStruct", |
| 2718 | + [R]() { return R->getDescriptiveName(); }); |
2703 | 2719 | QualType T = R->getValueType(); |
2704 | 2720 | assert(T->isStructureOrClassType()); |
2705 | 2721 |
|
@@ -2818,6 +2834,8 @@ RegionBindingsRef |
2818 | 2834 | RegionStoreManager::bindAggregate(RegionBindingsConstRef B, |
2819 | 2835 | const TypedRegion *R, |
2820 | 2836 | SVal Val) { |
| 2837 | + llvm::TimeTraceScope TimeScope("RegionStoreManager::bindAggregate", |
| 2838 | + [R]() { return R->getDescriptiveName(); }); |
2821 | 2839 | // Remove the old bindings, using 'R' as the root of all regions |
2822 | 2840 | // we will invalidate. Then add the new binding. |
2823 | 2841 | return removeSubRegionBindings(B, R).addBinding(R, BindingKey::Default, Val); |
|
0 commit comments