[cfe-commits] r46758 - in /cfe/trunk/Analysis: RValues.h ValueState.cpp ValueState.h
Ted Kremenek
kremenek at apple.com
Tue Feb 5 10:51:06 PST 2008
Author: kremenek
Date: Tue Feb 5 12:51:06 2008
New Revision: 46758
URL: http://llvm.org/viewvc/llvm-project?rev=46758&view=rev
Log:
Added a "ConstantNotEq" map to ValueState (and added necessary typedefs and factory objects to ValueStateManager).
Modified:
cfe/trunk/Analysis/RValues.h
cfe/trunk/Analysis/ValueState.cpp
cfe/trunk/Analysis/ValueState.h
Modified: cfe/trunk/Analysis/RValues.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/RValues.h?rev=46758&r1=46757&r2=46758&view=diff
==============================================================================
--- cfe/trunk/Analysis/RValues.h (original)
+++ cfe/trunk/Analysis/RValues.h Tue Feb 5 12:51:06 2008
@@ -50,6 +50,12 @@
bool isInitialized() const { return Data != (unsigned) ~0; }
operator unsigned() const { assert (isInitialized()); return Data; }
+
+ void Profile(llvm::FoldingSetNodeID& ID) const { ID.AddInteger(Data); }
+
+ static inline void Profile(llvm::FoldingSetNodeID& ID, SymbolID X) {
+ X.Profile(ID);
+ }
};
class SymbolData {
Modified: cfe/trunk/Analysis/ValueState.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/ValueState.cpp?rev=46758&r1=46757&r2=46758&view=diff
==============================================================================
--- cfe/trunk/Analysis/ValueState.cpp (original)
+++ cfe/trunk/Analysis/ValueState.cpp Tue Feb 5 12:51:06 2008
@@ -162,7 +162,8 @@
ValueStateManager::getInitialState() {
// Create a state with empty variable bindings.
- ValueStateImpl StateImpl(VBFactory.GetEmptyMap());
+ ValueStateImpl StateImpl(VBFactory.GetEmptyMap(),
+ CNEFactory.GetEmptyMap());
return getPersistentState(StateImpl);
}
Modified: cfe/trunk/Analysis/ValueState.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/ValueState.h?rev=46758&r1=46757&r2=46758&view=diff
==============================================================================
--- cfe/trunk/Analysis/ValueState.h (original)
+++ cfe/trunk/Analysis/ValueState.h Tue Feb 5 12:51:06 2008
@@ -114,7 +114,10 @@
//===----------------------------------------------------------------------===//
namespace vstate {
+ typedef llvm::ImmutableSet<llvm::APSInt*> IntSetTy;
+
typedef llvm::ImmutableMap<VarBindKey,RValue> VariableBindingsTy;
+ typedef llvm::ImmutableMap<SymbolID,IntSetTy> ConstantNotEqTy;
}
/// ValueStateImpl - This class encapsulates the actual data values for
@@ -123,19 +126,27 @@
/// "persistent" in a FoldingSet its values will never change.
struct ValueStateImpl : public llvm::FoldingSetNode {
vstate::VariableBindingsTy VariableBindings;
+ vstate::ConstantNotEqTy ConstantNotEq;
- ValueStateImpl(vstate::VariableBindingsTy VB)
- : VariableBindings(VB) {}
+ /// This ctor is used when creating the first ValueStateImpl object.
+ ValueStateImpl(vstate::VariableBindingsTy VB, vstate::ConstantNotEqTy CNE)
+ : VariableBindings(VB), ConstantNotEq(CNE) {}
+ /// Copy ctor - We must explicitly define this or else the "Next" ptr
+ /// in FoldingSetNode will also get copied.
ValueStateImpl(const ValueStateImpl& RHS)
: llvm::FoldingSetNode(),
- VariableBindings(RHS.VariableBindings) {}
-
+ VariableBindings(RHS.VariableBindings),
+ ConstantNotEq(RHS.ConstantNotEq) {}
+ /// Profile - Profile the contents of a ValueStateImpl object for use
+ /// in a FoldingSet.
static void Profile(llvm::FoldingSetNodeID& ID, const ValueStateImpl& V) {
V.VariableBindings.Profile(ID);
}
-
+
+ /// Profile - Used to profile the contents of this object for inclusion
+ /// in a FoldingSet.
void Profile(llvm::FoldingSetNodeID& ID) const {
Profile(ID, *this);
}
@@ -159,12 +170,16 @@
// Accessors.
ValueStateImpl* getImpl() const { return Data; }
-
- // Iterators.
+
+
+ // Binding maps typedefs.
typedef vstate::VariableBindingsTy VariableBindingsTy;
- typedef VariableBindingsTy::iterator vb_iterator;
-
+ typedef vstate::ConstantNotEqTy ConstantNotEqTy;
+
+ // Iterators.
+
+ typedef VariableBindingsTy::iterator vb_iterator;
vb_iterator begin() { return Data->VariableBindings.begin(); }
vb_iterator end() { return Data->VariableBindings.end(); }
@@ -199,6 +214,10 @@
private:
ValueState::VariableBindingsTy::Factory VBFactory;
+ ValueState::ConstantNotEqTy::Factory CNEFactory;
+
+ /// StateSet - FoldingSet containing all the states created for analyzing
+ /// a particular function. This is used to unique states.
llvm::FoldingSet<ValueStateImpl> StateSet;
/// ValueMgr - Object that manages the data for all created RValues.
More information about the cfe-commits
mailing list