forked from OSchip/llvm-project
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. llvm-svn: 48618
This commit is contained in:
parent
5ca2ea6479
commit
b7151c7ca8
|
@ -119,7 +119,7 @@ struct DeclBitVector_Types {
|
|||
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 @@ struct DeclBitVector_Types {
|
|||
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 @@ struct ExprDeclBitVector_Types {
|
|||
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);
|
||||
|
|
|
@ -168,8 +168,17 @@ void TransferFuncs::VisitDeclStmt(DeclStmt* DS) {
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
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
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
Loading…
Reference in New Issue