Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,60 +28,64 @@ namespace psr {
*/
template <typename V> class JoinLatticeToSemiRingElem : public wali::SemElem {
public:
std::shared_ptr<EdgeFunction<V>> F;
JoinLattice<V> &L;
V v;
std::shared_ptr<EdgeFunction<V>> EdgeFunc;
JoinLattice<V> &Lattice;
V Val;

JoinLatticeToSemiRingElem(std::shared_ptr<EdgeFunction<V>> F,
JoinLattice<V> &L)
: wali::SemElem(), F(F), L(L) {}
: wali::SemElem(), EdgeFunc(F), Lattice(L) {}

~JoinLatticeToSemiRingElem() override = default;

std::ostream &print(std::ostream &os) const override { return os << *F; }
std::ostream &print(std::ostream &OS) const override {
return OS << *EdgeFunc;
}

[[nodiscard]] wali::sem_elem_t one() const override {
// std::cout << "JoinLatticeToSemiRingElem::one()" << std::endl;
return wali::ref_ptr<JoinLatticeToSemiRingElem<V>>(
new JoinLatticeToSemiRingElem(
std::make_shared<AllBottom<V>>(L.bottomElement()), L));
std::make_shared<AllBottom<V>>(Lattice.bottomElement()), Lattice));
}

[[nodiscard]] wali::sem_elem_t zero() const override {
// std::cout << "JoinLatticeToSemiRingElem::zero()" << std::endl;
return wali::ref_ptr<JoinLatticeToSemiRingElem<V>>(
new JoinLatticeToSemiRingElem(
std::make_shared<AllTop<V>>(L.topElement()), L));
std::make_shared<AllTop<V>>(Lattice.topElement()), Lattice));
}

wali::sem_elem_t extend(SemElem *se) override {
[[nodiscard]] wali::sem_elem_t extend(SemElem *SE) override {
// std::cout << "JoinLatticeToSemiRingElem::extend()" << std::endl;
auto ThisF = static_cast<JoinLatticeToSemiRingElem *>(this);
auto ThatF = static_cast<JoinLatticeToSemiRingElem *>(se);
auto ThatF = static_cast<JoinLatticeToSemiRingElem *>(SE);
return wali::ref_ptr<JoinLatticeToSemiRingElem<V>>(
new JoinLatticeToSemiRingElem(ThisF->F->composeWith(ThatF->F), L));
new JoinLatticeToSemiRingElem(ThisF->F->composeWith(ThatF->F),
Lattice));
}

wali::sem_elem_t combine(SemElem *se) override {
[[nodiscard]] wali::sem_elem_t combine(SemElem *SE) override {
// std::cout << "JoinLatticeToSemiRingElem::combine()" << std::endl;
auto ThisF = static_cast<JoinLatticeToSemiRingElem *>(this);
auto ThatF = static_cast<JoinLatticeToSemiRingElem *>(se);
auto ThatF = static_cast<JoinLatticeToSemiRingElem *>(SE);
return wali::ref_ptr<JoinLatticeToSemiRingElem<V>>(
new JoinLatticeToSemiRingElem(ThisF->F->joinWith(ThatF->F), L));
new JoinLatticeToSemiRingElem(ThisF->F->joinWith(ThatF->F), Lattice));
}

bool equal(SemElem *se) const override {
[[nodiscard]] bool equal(SemElem *SE) const override {
// std::cout << "JoinLatticeToSemiRingElem::equal()" << std::endl;
auto ThisF = static_cast<const JoinLatticeToSemiRingElem *>(this);
auto ThatF = static_cast<const JoinLatticeToSemiRingElem *>(se);
auto ThatF = static_cast<const JoinLatticeToSemiRingElem *>(SE);
return ThisF->F->equal_to(ThatF->F);
}
};

template <typename V>
std::ostream &operator<<(std::ostream &os,
std::ostream &operator<<(std::ostream &OS,
const JoinLatticeToSemiRingElem<V> &ETS) {
ETS.print(os);
return os;
ETS.print(OS);
return OS;
}

} // namespace psr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,44 +47,44 @@ class WPDSAliasCollector

~WPDSAliasCollector() override = default;

FlowFunctionPtrType getNormalFlowFunction(n_t curr, n_t succ) override;
FlowFunctionPtrType getCallFlowFunction(n_t callSite, f_t destFun) override;
FlowFunctionPtrType getRetFlowFunction(n_t callSite, f_t calleeFun,
n_t ExitInst, n_t retSite) override;
FlowFunctionPtrType getCallToRetFlowFunction(n_t callSite, n_t retSite,
std::set<f_t> callees) override;
FlowFunctionPtrType getSummaryFlowFunction(n_t curr, f_t destFun) override;
FlowFunctionPtrType getNormalFlowFunction(n_t Curr, n_t Succ) override;
FlowFunctionPtrType getCallFlowFunction(n_t CallSite, f_t DestFun) override;
FlowFunctionPtrType getRetFlowFunction(n_t CallSite, f_t CalleeFun,
n_t ExitInst, n_t RetSite) override;
FlowFunctionPtrType getCallToRetFlowFunction(n_t CallSite, n_t RetSite,
std::set<f_t> Callees) override;
FlowFunctionPtrType getSummaryFlowFunction(n_t Curr, f_t DestFun) override;

std::shared_ptr<EdgeFunction<l_t>>
getNormalEdgeFunction(n_t curr, d_t currNode, n_t succ,
d_t succNode) override;
getNormalEdgeFunction(n_t Curr, d_t CurrNode, n_t Succ,
d_t SuccNode) override;
std::shared_ptr<EdgeFunction<l_t>>
getCallEdgeFunction(n_t callSite, d_t srcNode, f_t destinationFunction,
d_t destNode) override;
getCallEdgeFunction(n_t CallSite, d_t SrcNode, f_t DestinationFunction,
d_t DestNode) override;
std::shared_ptr<EdgeFunction<l_t>>
getReturnEdgeFunction(n_t callSite, f_t calleeFunction, n_t ExitInst,
d_t exitNode, n_t reSite, d_t retNode) override;
getReturnEdgeFunction(n_t CallSite, f_t CalleeFunction, n_t ExitInst,
d_t ExitNode, n_t RetSite, d_t RetNode) override;
std::shared_ptr<EdgeFunction<l_t>>
getCallToRetEdgeFunction(n_t callSite, d_t callNode, n_t retSite,
d_t retSiteNode, std::set<f_t> callees) override;
getCallToRetEdgeFunction(n_t CallSite, d_t CallNode, n_t RetSite,
d_t RetSiteNode, std::set<f_t> Callees) override;
std::shared_ptr<EdgeFunction<l_t>>
getSummaryEdgeFunction(n_t curr, d_t currNode, n_t succ,
d_t succNode) override;
getSummaryEdgeFunction(n_t Curr, d_t CurrNode, n_t Succ,
d_t SuccNode) override;

l_t topElement() override;
l_t bottomElement() override;
l_t join(l_t lhs, l_t rhs) override;
l_t join(l_t Lhs, l_t Rhs) override;

bool isZeroValue(WPDSAliasCollector::d_t d) const override;
bool isZeroValue(WPDSAliasCollector::d_t Fact) const override;

InitialSeeds<n_t, d_t, l_t> initialSeeds() override;

std::shared_ptr<EdgeFunction<l_t>> allTopFunction() override;

void printNode(std::ostream &os, n_t n) const override;
void printDataFlowFact(std::ostream &os, d_t d) const override;
void printFunction(std::ostream &os, f_t m) const override;
void printEdgeFact(std::ostream &os, l_t v) const override;
void printNode(std::ostream &OS, n_t Stmt) const override;
void printDataFlowFact(std::ostream &OS, d_t Fact) const override;
void printFunction(std::ostream &OS, f_t Func) const override;
void printEdgeFact(std::ostream &OS, l_t L) const override;
};

} // namespace psr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,46 +42,46 @@ class WPDSSolverTest : public WPDSProblem<WPDSSolverTestAnalysisDomain> {
const LLVMBasedICFG *ICF, LLVMPointsToInfo *PT,
std::set<std::string> EntryPoints = {"main"});

FlowFunctionPtrType getNormalFlowFunction(n_t curr, n_t succ) override;
FlowFunctionPtrType getCallFlowFunction(n_t callSite, f_t destFun) override;
FlowFunctionPtrType getRetFlowFunction(n_t callSite, f_t calleeFun,
n_t ExitInst, n_t retSite) override;
FlowFunctionPtrType getCallToRetFlowFunction(n_t callSite, n_t retSite,
std::set<f_t> callees) override;
FlowFunctionPtrType getSummaryFlowFunction(n_t curr, f_t destFun) override;
FlowFunctionPtrType getNormalFlowFunction(n_t Curr, n_t Succ) override;
FlowFunctionPtrType getCallFlowFunction(n_t CallSite, f_t DestFun) override;
FlowFunctionPtrType getRetFlowFunction(n_t CallSite, f_t CalleeFun,
n_t ExitStmt, n_t RetSite) override;
FlowFunctionPtrType getCallToRetFlowFunction(n_t CallSite, n_t RetSite,
std::set<f_t> Callees) override;
FlowFunctionPtrType getSummaryFlowFunction(n_t Curr, f_t DestFun) override;

std::shared_ptr<EdgeFunction<l_t>>
getNormalEdgeFunction(n_t curr, d_t currNode, n_t succ,
d_t succNode) override;
getNormalEdgeFunction(n_t Curr, d_t CurrNode, n_t Succ,
d_t SuccNode) override;
std::shared_ptr<EdgeFunction<l_t>>
getCallEdgeFunction(n_t callSite, d_t srcNode, f_t destinationFunction,
d_t destNode) override;
getCallEdgeFunction(n_t CallSite, d_t SrcNode, f_t DestinationFunction,
d_t DestNode) override;
std::shared_ptr<EdgeFunction<l_t>>
getReturnEdgeFunction(n_t callSite, f_t calleeFunction, n_t ExitInst,
d_t exitNode, n_t reSite, d_t retNode) override;
getReturnEdgeFunction(n_t CallSite, f_t CalleeFunction, n_t ExitStmt,
d_t ExitNode, n_t RetSite, d_t RetNode) override;
std::shared_ptr<EdgeFunction<l_t>>
getCallToRetEdgeFunction(n_t callSite, d_t callNode, n_t retSite,
d_t retSiteNode, std::set<f_t> callees) override;
getCallToRetEdgeFunction(n_t CallSite, d_t CallNode, n_t RetSite,
d_t RetSiteNode, std::set<f_t> Callees) override;
std::shared_ptr<EdgeFunction<l_t>>
getSummaryEdgeFunction(n_t curr, d_t currNode, n_t succ,
d_t succNode) override;
getSummaryEdgeFunction(n_t Curr, d_t CurrNode, n_t Succ,
d_t SuccNode) override;

l_t topElement() override;
l_t bottomElement() override;
l_t join(l_t lhs, l_t rhs) override;
l_t join(l_t Lhs, l_t Rhs) override;

[[nodiscard]] d_t createZeroValue() const override;

bool isZeroValue(d_t d) const override;
[[nodiscard]] bool isZeroValue(d_t Fact) const override;

InitialSeeds<n_t, d_t, l_t> initialSeeds() override;

std::shared_ptr<EdgeFunction<l_t>> allTopFunction() override;

void printNode(std::ostream &os, n_t n) const override;
void printDataFlowFact(std::ostream &os, d_t d) const override;
void printFunction(std::ostream &os, f_t m) const override;
void printEdgeFact(std::ostream &os, l_t v) const override;
void printNode(std::ostream &OS, n_t Stmt) const override;
void printDataFlowFact(std::ostream &OS, d_t Fact) const override;
void printFunction(std::ostream &OS, f_t Func) const override;
void printEdgeFact(std::ostream &OS, l_t L) const override;
};

} // namespace psr
Expand Down
Loading