Skip to content

Commit

Permalink
Integrate free-functions NToString and DToString into ExplicitESG
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianbs96 committed Aug 25, 2023
1 parent df3511d commit 5cdca10
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class PathAwareIDESolver : public IDESolver<AnalysisDomainTy, Container> {

explicit PathAwareIDESolver(
IDETabulationProblem<domain_t, container_type> &Problem, const i_t *ICF)
: base_t(Problem, ICF), ESG(Problem.getZeroValue(), Problem, Problem) {
: base_t(Problem, ICF), ESG(Problem.getZeroValue()) {

if (Problem.getIFDSIDESolverConfig().autoAddZero()) {
PHASAR_LOG_LEVEL(
Expand Down
32 changes: 12 additions & 20 deletions include/phasar/DataFlow/PathSensitivity/ExplodedSuperGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,9 @@ template <typename AnalysisDomainTy> class ExplodedSuperGraph {
const ExplodedSuperGraph *Owner{};
};

explicit ExplodedSuperGraph(
d_t ZeroValue, const psr::NodePrinter<AnalysisDomainTy> &NPrinter,
const psr::DataFlowFactPrinter<AnalysisDomainTy>
&DPrinter) noexcept(std::is_nothrow_move_constructible_v<d_t>)
: ZeroValue(std::move(ZeroValue)), NPrinter(NPrinter),
DPrinter(DPrinter) {}
explicit ExplodedSuperGraph(d_t ZeroValue) noexcept(
std::is_nothrow_move_constructible_v<d_t>)
: ZeroValue(std::move(ZeroValue)) {}

explicit ExplodedSuperGraph(const ExplodedSuperGraph &) = default;
ExplodedSuperGraph &operator=(const ExplodedSuperGraph &) = delete;
Expand Down Expand Up @@ -239,11 +236,11 @@ template <typename AnalysisDomainTy> class ExplodedSuperGraph {
for (size_t I = 0, End = NodeDataOwner.size(); I != End; ++I) {
auto Nod = NodeRef(I, this);
OS << I << "[label=\"";
OS.write_escaped(DPrinter.DtoString(Nod.value())) << "\"];\n";
OS.write_escaped(DToString(Nod.value())) << "\"];\n";

OS << I << "->" << intptr_t(Nod.predecessor().id())
<< R"([style="bold" label=")";
OS.write_escaped(NPrinter.NtoString(Nod.source())) << "\"];\n";
OS.write_escaped(NToString(Nod.source())) << "\"];\n";
for (auto NB : Nod.neighbors()) {
OS << I << "->" << NB.id() << "[color=\"red\"];\n";
}
Expand All @@ -257,8 +254,8 @@ template <typename AnalysisDomainTy> class ExplodedSuperGraph {

void printESGNodes(llvm::raw_ostream &OS) const {
for (const auto &[Node, _] : FlowFactVertexMap) {
OS << "( " << NPrinter.NtoString(Node.first) << "; "
<< DPrinter.DtoString(Node.second) << " )\n";
OS << "( " << NToString(Node.first) << "; " << DToString(Node.second)
<< " )\n";
}
}

Expand Down Expand Up @@ -355,12 +352,11 @@ template <typename AnalysisDomainTy> class ExplodedSuperGraph {
abort();
}
if (Nod == SuccVtxIt->second) {
PHASAR_LOG_LEVEL_CAT(INFO, "PathSensitivityManager",
"> saveEdge -- skip meaningless loop: ("
<< NPrinter.NtoString(Curr) << ", "
<< DPrinter.DtoString(CurrNode) << ") --> ("
<< NPrinter.NtoString(Succ) << ", "
<< DPrinter.DtoString(SuccNode) << ")");
PHASAR_LOG_LEVEL_CAT(
INFO, "PathSensitivityManager",
"> saveEdge -- skip meaningless loop: ("
<< NToString(Curr) << ", " << DToString(CurrNode) << ") --> ("
<< NToString(Succ) << ", " << DToString(SuccNode) << ")");
return;
}
Nod = NodeAdjOwner[Nod].PredecessorIdx;
Expand Down Expand Up @@ -396,10 +392,6 @@ template <typename AnalysisDomainTy> class ExplodedSuperGraph {

// ZeroValue
d_t ZeroValue;
// References to Node and DataFlowFactPrinters required for visualizing the
// results
const psr::NodePrinter<AnalysisDomainTy> &NPrinter;
const psr::DataFlowFactPrinter<AnalysisDomainTy> &DPrinter;
};

} // namespace psr
Expand Down

0 comments on commit 5cdca10

Please sign in to comment.