[cfe-commits] r48618 - in /cfe/trunk: include/clang/Analysis/Support/ExprDeclBitVector.h lib/Analysis/LiveVariables.cpp
Ted Kremenek
kremenek at apple.com
Thu Mar 20 14:46:49 PDT 2008
Author: kremenek
Date: Thu Mar 20 16:46:49 2008
New Revision: 48618
URL: http://llvm.org/viewvc/llvm-project?rev=48618&view=rev
Log:
LiveVariables analysis now uses intersect for the merge of block-level expression liveness information.
The rationale is that a block-level expression cannot be live in a parent block unless it is live in all of the successor blocks.
Modified:
cfe/trunk/include/clang/Analysis/Support/ExprDeclBitVector.h
cfe/trunk/lib/Analysis/LiveVariables.cpp
Modified: cfe/trunk/include/clang/Analysis/Support/ExprDeclBitVector.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/Support/ExprDeclBitVector.h?rev=48618&r1=48617&r2=48618&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/Support/ExprDeclBitVector.h (original)
+++ cfe/trunk/include/clang/Analysis/Support/ExprDeclBitVector.h Thu Mar 20 16:46:49 2008
@@ -119,7 +119,7 @@
const llvm::BitVector::reference getDeclBit(unsigned i) const {
return const_cast<llvm::BitVector&>(DeclBV)[i];
}
-
+
ValTy& operator|=(const ValTy& RHS) {
assert (sizesEqual(RHS));
DeclBV |= RHS.DeclBV;
@@ -132,6 +132,14 @@
return *this;
}
+ ValTy& OrDeclBits(const ValTy& RHS) {
+ return operator|=(RHS);
+ }
+
+ ValTy& AndDeclBits(const ValTy& RHS) {
+ return operator&=(RHS);
+ }
+
bool sizesEqual(const ValTy& RHS) const {
return DeclBV.size() == RHS.DeclBV.size();
}
@@ -225,6 +233,16 @@
return const_cast<llvm::BitVector&>(ExprBV)[i];
}
+ ValTy& OrExprBits(const ValTy& RHS) {
+ ExprBV |= RHS.ExprBV;
+ return *this;
+ }
+
+ ValTy& AndExprBits(const ValTy& RHS) {
+ ExprBV &= RHS.ExprBV;
+ return *this;
+ }
+
ValTy& operator|=(const ValTy& RHS) {
assert (sizesEqual(RHS));
ParentRef(*this) |= ParentRef(RHS);
Modified: cfe/trunk/lib/Analysis/LiveVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/LiveVariables.cpp?rev=48618&r1=48617&r2=48618&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/LiveVariables.cpp (original)
+++ cfe/trunk/lib/Analysis/LiveVariables.cpp Thu Mar 20 16:46:49 2008
@@ -168,8 +168,17 @@
//===----------------------------------------------------------------------===//
namespace {
-typedef ExprDeclBitVector_Types::Union Merge;
-typedef DataflowSolver<LiveVariables,TransferFuncs,Merge> Solver;
+
+struct Merge {
+ typedef ExprDeclBitVector_Types::ValTy ValTy;
+
+ void operator()(ValTy& Dst, const ValTy& Src) {
+ Dst.OrDeclBits(Src);
+ Dst.AndExprBits(Src);
+ }
+};
+
+typedef DataflowSolver<LiveVariables, TransferFuncs, Merge> Solver;
} // end anonymous namespace
//===----------------------------------------------------------------------===//
More information about the cfe-commits
mailing list