From a258d57c4a31aea67d2ac26ae5a180caf7c4bd2a Mon Sep 17 00:00:00 2001 From: lrlrl Date: Tue, 13 May 2025 22:23:10 +0800 Subject: [PATCH 1/3] add risc-v.kat --- kat/riscv-genmc.kat | 89 ++++++++++++++++++++++++++++++++++++++++++++ src/GenMCPrinter.cpp | 10 ++--- 2 files changed, 94 insertions(+), 5 deletions(-) create mode 100644 kat/riscv-genmc.kat diff --git a/kat/riscv-genmc.kat b/kat/riscv-genmc.kat new file mode 100644 index 0000000..88cbb38 --- /dev/null +++ b/kat/riscv-genmc.kat @@ -0,0 +1,89 @@ +let fence_r_r = [R]; po; [F]; po; [R] +let fence_r_w = [R]; po; [F]; po; [W] +let fence_r_rw = [R]; po; [F]; po; [R|W] +let fence_w_r = [W]; po; [F]; po; [R] +let fence_w_w = [W]; po; [F]; po; [W] +let fence_w_rw = [W]; po; [F]; po; [R|W] +let fence_rw_r = [R|W]; po; [F]; po; [R] +let fence_rw_w = [R|W]; po; [F]; po; [W] +let fence_rw_rw = [R|W]; po; [F]; po; [R|W] + +// TSO special fence +let fence_tso = ([W]; po; [F]; po; [W]) | ([R]; po; [F]; po; [R|W]) + +// Atomic RMW relation +let amo = rmw +let riscv_rmw = amo + +let rdw = fre ; po-loc ;rfe +let AQ = [R ; ACQ] +let RL = [W ; REL] + +let fence = fence_r_r|fence_r_w|fence_r_rw + |fence_w_r|fence_w_w|fence_w_rw + |fence_rw_r|fence_rw_w|fence_rw_rw + |fence_tso + +// Overlapping-Address Orderings +let r1 = [R|W];po-loc;[W] +let r2 = [R];po-loc;[R] +let r3 = [amo|UW];rfi;[R] +// Explicit Synchronization +let r4 = fence +let r5 = [AQ];po +let r6 = po;[RL] +let r7 = [RL];po;[AQ] +let r8 = riscv_rmw +// Syntactic Dependencies +let r9 = addr +let r10 = data;[W] +let r11 = ctrl;[W] +// Pipeline Dependencies +let r12 = [R];(addr|data);[W];rfi;[R] +let r13 = [R];addr;[R|W];po;[W] + +let ppo = + r1 +| r2 +| r3 +| r4 +| r5 +| r6 +| r7 +| r8 +| r9 +| r10 +| r11 +| r12 +| r13 + + +let risc = mo | rfe | fr | ppo + +view hb_stable = (ppo)+ +export coherence hb_stable + +export acyclic risc + +// --------------------------------------------------------------------- +// RISC-V error detection +// --------------------------------------------------------------------- + +let ww_conflict = [W] ; loc-overlap ; [W] +let wr_conflict = [W] ; loc-overlap ; [R] | [R] ; loc-overlap ; [W] +let conflicting = ww_conflict | wr_conflict +let na_conflict = [NA] ; conflicting | conflicting ; [NA] +view porf_stable = (po | (rf | tc | tj); po)+ + +// GenMC needs to handle the no-alloc case (access validity) + +export error VE_AccessNonMalloc unless alloc <= hb_stable +export error VE_DoubleFree unless [FREE|HPRET] ; loc-overlap ; [FREE|HPRET] = 0 + +export error VE_AccessFreed unless alloc^-1? ; free ; [FREE] <= hb_stable +export error VE_AccessFreed unless [FREE] ; free^-1 ; alloc = 0 +export error VE_AccessFreed unless [NOTHPPROT] ; alloc^-1? ; free ; [HPRET] <= hb_stable +export error VE_AccessFreed unless [HPRET] ; free^-1 ; alloc ; [NOTHPPROT] = 0 + +export error VE_RaceNotAtomic unless na_conflict <= hb_stable +export warning VE_WWRace unless ww_conflict <= porf_stable diff --git a/src/GenMCPrinter.cpp b/src/GenMCPrinter.cpp index 01a1b11..c9932a0 100644 --- a/src/GenMCPrinter.cpp +++ b/src/GenMCPrinter.cpp @@ -85,7 +85,7 @@ std::vector { std::vector result; - for (const auto &lab : labels(getGraph())) { + for (const auto &lab : getGraph().labels()) { if (auto *rLab = llvm::dyn_cast(&lab)) if (rLab->getRf()->getPos().isInitializer() && rLab->getAddr() == addr) result.push_back(rLab->getPos()); @@ -1179,8 +1179,8 @@ void GenMCPrinter::printSubset(const SubsetConstraint *subCst, std::string prefi << "\t\tif (" << paramsLHS.status << "Accepting[i] && !" << paramsRHS.status << "Accepting[i]) {\n"; if (counterexample) { - cpp() << "\t\t\tcexLab = &*std::find_if(label_begin(g), " - "label_end(g), " + cpp() << "\t\t\tcexLab = &*std::find_if(g.label_begin(), " + "g.label_end(), " "[&](auto &lab){ " "return " "lab.getStamp() == i; });\n"; @@ -1318,7 +1318,7 @@ void GenMCPrinter::printAcyclic(const AcyclicConstraint *acycCst, std::string pr printInitializations(); cpp() << "\treturn true"; for (auto &sUP : nfa.accepting()) { - cpp() << "\n\t\t&& std::ranges::all_of(labels(g), [&](auto &lab){ return "; + cpp() << "\n\t\t&& std::ranges::all_of(g.labels(), [&](auto &lab){ return "; if (params.visit.at(&*sUP)) { cpp() << params.status << "_" << params.ids.at(&*sUP) << "[lab.getStamp().get()]" @@ -1388,7 +1388,7 @@ void GenMCPrinter::printCoherence(const CoherenceConstraint *cohCst) printInitializations(); cpp() << "\treturn true"; for (auto &sUP : nfa.accepting()) { - cpp() << "\n\t\t&& std::ranges::all_of(labels(g), [&](auto &lab){ return "; + cpp() << "\n\t\t&& std::ranges::all_of(g.labels(), [&](auto &lab){ return "; if (params.visit.at(&*sUP)) { cpp() << params.status << "_" << params.ids.at(&*sUP) << "[lab.getStamp().get()]" From 0459d1f0c12ec07c83898657cded4e14c215d9b1 Mon Sep 17 00:00:00 2001 From: lrlrl Date: Mon, 18 Aug 2025 16:06:32 +0800 Subject: [PATCH 2/3] fixed r2 rule Signed-off-by: lrlrl --- code/RISCVDriver.cpp | 5105 ++++++++++++++++++++++++++++++++++++++++++ code/RISCVDriver.hpp | 313 +++ kat/riscv-genmc.kat | 13 +- 3 files changed, 5426 insertions(+), 5 deletions(-) create mode 100644 code/RISCVDriver.cpp create mode 100644 code/RISCVDriver.hpp diff --git a/code/RISCVDriver.cpp b/code/RISCVDriver.cpp new file mode 100644 index 0000000..f067379 --- /dev/null +++ b/code/RISCVDriver.cpp @@ -0,0 +1,5105 @@ +/* + * GenMC -- Generic Model Checking. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you can access it online at + * http://www.gnu.org/licenses/gpl-3.0.html. + * + * Author: Michalis Kokologiannakis + */ + +/******************************************************************************* + * CAUTION: This file is generated automatically by Kater -- DO NOT EDIT. + *******************************************************************************/ + +#include "RISCVDriver.hpp" +#include "Static/ModuleInfo.hpp" + +RISCVDriver::RISCVDriver(std::shared_ptr conf, std::unique_ptr mod, + std::unique_ptr MI, GenMCDriver::Mode mode /* = GenMCDriver::VerificationMode{} */) + : GenMCDriver(conf, std::move(mod), std::move(MI), mode) {} + +bool RISCVDriver::isDepTracking() const +{ + return 1; +} + +bool RISCVDriver::visitCalc89_0(const EventLabel *lab, View &calcRes) const +{ + auto &g = getGraph(); + + + + + return true; +} + +bool RISCVDriver::visitCalc89_1(const EventLabel *lab, View &calcRes) const +{ + auto &g = getGraph(); + + + if (auto pLab = lab; true)if (calcRes.update(pLab->view(0)); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + + return true; +} + +bool RISCVDriver::visitCalc89_2(const EventLabel *lab, View &calcRes) const +{ + auto &g = getGraph(); + + if (visitedCalc89_2[lab->getStamp().get()] != NodeStatus::unseen) + return true; + visitedCalc89_2[lab->getStamp().get()] = NodeStatus::entered; + + if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = poloc_imm_pred(g, lab); pLab) { + auto status = visitedCalc89_2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) { + if (!visitCalc89_2(pLab, calcRes)){ + return false; + } + + } else if (status == NodeStatus::entered) { + + } else if (status == NodeStatus::left) { + + } + } + if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab))if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab))if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + + visitedCalc89_2[lab->getStamp().get()] = NodeStatus::left; + return true; +} + +bool RISCVDriver::visitCalc89_3(const EventLabel *lab, View &calcRes) const +{ + auto &g = getGraph(); + + + if (true && llvm::isa(lab))for (auto &p : ctrl_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (true && llvm::isa(lab))for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (true && llvm::isa(lab) && ((llvm::isa(lab) && g.isRMWLoad(lab)) || (llvm::isa(lab) && g.isRMWStore(lab))))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto status = visitedCalc89_6[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) { + if (!visitCalc89_6(pLab, calcRes)){ + return false; + } + + } else if (status == NodeStatus::entered) { + + } else if (status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto status = visitedCalc89_6[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) { + if (!visitCalc89_6(pLab, calcRes)){ + return false; + } + + } else if (status == NodeStatus::entered) { + + } else if (status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedCalc89_7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) { + if (!visitCalc89_7(pLab, calcRes)){ + return false; + } + + } else if (status == NodeStatus::entered) { + + } else if (status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedCalc89_7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) { + if (!visitCalc89_7(pLab, calcRes)){ + return false; + } + + } else if (status == NodeStatus::entered) { + + } else if (status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedCalc89_5[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) { + if (!visitCalc89_5(pLab, calcRes)){ + return false; + } + + } else if (status == NodeStatus::entered) { + + } else if (status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab) { + auto status = visitedCalc89_2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) { + if (!visitCalc89_2(pLab, calcRes)){ + return false; + } + + } else if (status == NodeStatus::entered) { + + } else if (status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + if (!visitCalc89_4(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + if (!visitCalc89_4(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + if (!visitCalc89_4(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + if (!visitCalc89_4(pLab, calcRes)){ + return false; + } + + } + if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + if (!visitCalc89_11(pLab, calcRes)){ + return false; + } + + } + if (true && llvm::isa(lab))for (auto &p : ctrl_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (true && llvm::isa(lab))for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab))))if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab))if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab))if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire())if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease())if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC())if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire())if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease())if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC())if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire())if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease())if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC())if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (true && llvm::isa(lab) && ((llvm::isa(lab) && g.isRMWLoad(lab)) || (llvm::isa(lab) && g.isRMWStore(lab))))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab))))if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + if (!visitCalc89_12(pLab, calcRes)){ + return false; + } + + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + if (!visitCalc89_12(pLab, calcRes)){ + return false; + } + + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedCalc89_10[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) { + if (!visitCalc89_10(pLab, calcRes)){ + return false; + } + + } else if (status == NodeStatus::entered) { + + } else if (status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedCalc89_10[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) { + if (!visitCalc89_10(pLab, calcRes)){ + return false; + } + + } else if (status == NodeStatus::entered) { + + } else if (status == NodeStatus::left) { + + } + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedCalc89_10[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) { + if (!visitCalc89_10(pLab, calcRes)){ + return false; + } + + } else if (status == NodeStatus::entered) { + + } else if (status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab) && ((llvm::isa(lab) && g.isRMWLoad(lab)) || (llvm::isa(lab) && g.isRMWStore(lab))))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto status = visitedCalc89_10[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) { + if (!visitCalc89_10(pLab, calcRes)){ + return false; + } + + } else if (status == NodeStatus::entered) { + + } else if (status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedCalc89_9[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) { + if (!visitCalc89_9(pLab, calcRes)){ + return false; + } + + } else if (status == NodeStatus::entered) { + + } else if (status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedCalc89_9[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) { + if (!visitCalc89_9(pLab, calcRes)){ + return false; + } + + } else if (status == NodeStatus::entered) { + + } else if (status == NodeStatus::left) { + + } + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedCalc89_9[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) { + if (!visitCalc89_9(pLab, calcRes)){ + return false; + } + + } else if (status == NodeStatus::entered) { + + } else if (status == NodeStatus::left) { + + } + } + + return true; +} + +bool RISCVDriver::visitCalc89_4(const EventLabel *lab, View &calcRes) const +{ + auto &g = getGraph(); + + + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab))))if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + + return true; +} + +bool RISCVDriver::visitCalc89_5(const EventLabel *lab, View &calcRes) const +{ + auto &g = getGraph(); + + if (visitedCalc89_5[lab->getStamp().get()] != NodeStatus::unseen) + return true; + visitedCalc89_5[lab->getStamp().get()] = NodeStatus::entered; + + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedCalc89_5[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) { + if (!visitCalc89_5(pLab, calcRes)){ + return false; + } + + } else if (status == NodeStatus::entered) { + + } else if (status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + if (!visitCalc89_12(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + if (!visitCalc89_12(pLab, calcRes)){ + return false; + } + + } + + visitedCalc89_5[lab->getStamp().get()] = NodeStatus::left; + return true; +} + +bool RISCVDriver::visitCalc89_6(const EventLabel *lab, View &calcRes) const +{ + auto &g = getGraph(); + + if (visitedCalc89_6[lab->getStamp().get()] != NodeStatus::unseen) + return true; + visitedCalc89_6[lab->getStamp().get()] = NodeStatus::entered; + + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedCalc89_6[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) { + if (!visitCalc89_6(pLab, calcRes)){ + return false; + } + + } else if (status == NodeStatus::entered) { + + } else if (status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab))if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab))if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + + visitedCalc89_6[lab->getStamp().get()] = NodeStatus::left; + return true; +} + +bool RISCVDriver::visitCalc89_7(const EventLabel *lab, View &calcRes) const +{ + auto &g = getGraph(); + + if (visitedCalc89_7[lab->getStamp().get()] != NodeStatus::unseen) + return true; + visitedCalc89_7[lab->getStamp().get()] = NodeStatus::entered; + + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto status = visitedCalc89_6[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) { + if (!visitCalc89_6(pLab, calcRes)){ + return false; + } + + } else if (status == NodeStatus::entered) { + + } else if (status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedCalc89_7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) { + if (!visitCalc89_7(pLab, calcRes)){ + return false; + } + + } else if (status == NodeStatus::entered) { + + } else if (status == NodeStatus::left) { + + } + } + + visitedCalc89_7[lab->getStamp().get()] = NodeStatus::left; + return true; +} + +bool RISCVDriver::visitCalc89_8(const EventLabel *lab, View &calcRes) const +{ + auto &g = getGraph(); + + + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire())if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease())if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC())if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = po_imm_pred(g, lab); pLab) { + if (!visitCalc89_8(pLab, calcRes)){ + return false; + } + + } + + return true; +} + +bool RISCVDriver::visitCalc89_9(const EventLabel *lab, View &calcRes) const +{ + auto &g = getGraph(); + + if (visitedCalc89_9[lab->getStamp().get()] != NodeStatus::unseen) + return true; + visitedCalc89_9[lab->getStamp().get()] = NodeStatus::entered; + + if (auto pLab = po_imm_pred(g, lab); pLab) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedCalc89_9[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) { + if (!visitCalc89_9(pLab, calcRes)){ + return false; + } + + } else if (status == NodeStatus::entered) { + + } else if (status == NodeStatus::left) { + + } + } + + visitedCalc89_9[lab->getStamp().get()] = NodeStatus::left; + return true; +} + +bool RISCVDriver::visitCalc89_10(const EventLabel *lab, View &calcRes) const +{ + auto &g = getGraph(); + + if (visitedCalc89_10[lab->getStamp().get()] != NodeStatus::unseen) + return true; + visitedCalc89_10[lab->getStamp().get()] = NodeStatus::entered; + + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + if (!visitCalc89_4(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire())if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease())if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC())if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedCalc89_10[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) { + if (!visitCalc89_10(pLab, calcRes)){ + return false; + } + + } else if (status == NodeStatus::entered) { + + } else if (status == NodeStatus::left) { + + } + } + + visitedCalc89_10[lab->getStamp().get()] = NodeStatus::left; + return true; +} + +bool RISCVDriver::visitCalc89_11(const EventLabel *lab, View &calcRes) const +{ + auto &g = getGraph(); + + + for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab))if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab))if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + + return true; +} + +bool RISCVDriver::visitCalc89_12(const EventLabel *lab, View &calcRes) const +{ + auto &g = getGraph(); + + + for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { + if (!visitCalc89_1(pLab, calcRes)){ + return false; + } + + } + for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab))if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc89_0(pLab, calcRes)){ + return false; + } + + } + + return true; +} + +View RISCVDriver::visitCalc89(const EventLabel *lab) const +{ + auto &g = getGraph(); + View calcRes; + + visitedCalc89_2.clear(); + visitedCalc89_2.resize(g.getMaxStamp().get() + 1); + visitedCalc89_5.clear(); + visitedCalc89_5.resize(g.getMaxStamp().get() + 1); + visitedCalc89_6.clear(); + visitedCalc89_6.resize(g.getMaxStamp().get() + 1); + visitedCalc89_7.clear(); + visitedCalc89_7.resize(g.getMaxStamp().get() + 1); + visitedCalc89_9.clear(); + visitedCalc89_9.resize(g.getMaxStamp().get() + 1); + visitedCalc89_10.clear(); + visitedCalc89_10.resize(g.getMaxStamp().get() + 1); + + visitCalc89_3(lab, calcRes); + visitCalc89_8(lab, calcRes); + return calcRes; +} +auto RISCVDriver::checkCalc89(const EventLabel *lab) const +{ + auto &g = getGraph(); + + return visitCalc89(lab); +} +bool RISCVDriver::visitCalc94_0(const EventLabel *lab, View &calcRes) const +{ + auto &g = getGraph(); + + + + + return true; +} + +bool RISCVDriver::visitCalc94_1(const EventLabel *lab, View &calcRes) const +{ + auto &g = getGraph(); + + + if (auto pLab = lab; true)if (calcRes.update(pLab->view(1)); true) { + if (!visitCalc94_0(pLab, calcRes)){ + return false; + } + + } + + return true; +} + +bool RISCVDriver::visitCalc94_2(const EventLabel *lab, View &calcRes) const +{ + auto &g = getGraph(); + + + if (auto pLab = po_imm_pred(g, lab); pLab) { + if (!visitCalc94_1(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = po_imm_pred(g, lab); pLab) { + if (!visitCalc94_3(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc94_0(pLab, calcRes)){ + return false; + } + + } + + return true; +} + +bool RISCVDriver::visitCalc94_3(const EventLabel *lab, View &calcRes) const +{ + auto &g = getGraph(); + + + if (auto pLab = tc_pred(g, lab); pLab) { + if (!visitCalc94_1(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = tj_pred(g, lab); pLab) { + if (!visitCalc94_1(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = rf_pred(g, lab); pLab) { + if (!visitCalc94_1(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = tc_pred(g, lab); pLab)if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc94_0(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = tj_pred(g, lab); pLab)if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc94_0(pLab, calcRes)){ + return false; + } + + } + if (auto pLab = rf_pred(g, lab); pLab)if (calcRes.updateIdx(pLab->getPos()); true) { + if (!visitCalc94_0(pLab, calcRes)){ + return false; + } + + } + + return true; +} + +View RISCVDriver::visitCalc94(const EventLabel *lab) const +{ + auto &g = getGraph(); + View calcRes; + + + visitCalc94_2(lab, calcRes); + return calcRes; +} +auto RISCVDriver::checkCalc94(const EventLabel *lab) const +{ + auto &g = getGraph(); + + return visitCalc94(lab); +} +void RISCVDriver::calculateSaved(EventLabel *lab) +{ +} + +void RISCVDriver::calculateViews(EventLabel *lab) +{ + lab->addView(checkCalc89(lab)); + lab->addView(checkCalc94(lab)); +} + +void RISCVDriver::updateMMViews(EventLabel *lab) +{ + calculateViews(lab); + calculateSaved(lab); +} + +const View &RISCVDriver::getHbView(const EventLabel *lab) const +{ + return lab->view(0); +} + + +bool RISCVDriver::isWriteRfBefore(Event a, Event b) +{ + auto &g = getGraph(); + auto &before = g.getEventLabel(b)->view(0); + if (before.contains(a)) + return true; + + const EventLabel *lab = g.getEventLabel(a); + + BUG_ON(!llvm::isa(lab)); + auto *wLab = static_cast(lab); + for (auto &rLab : wLab->readers()) + if (before.contains(rLab.getPos())) + return true; + return false; +} + +std::vector +RISCVDriver::getInitRfsAtLoc(SAddr addr) +{ + std::vector result; + + for (const auto &lab : getGraph().labels()) { + if (auto *rLab = llvm::dyn_cast(&lab)) + if (rLab->getRf()->getPos().isInitializer() && rLab->getAddr() == addr) + result.push_back(rLab->getPos()); + } + return result; +} + +bool RISCVDriver::isHbOptRfBefore(const Event e, const Event write) +{ + auto &g = getGraph(); + const EventLabel *lab = g.getEventLabel(write); + + BUG_ON(!llvm::isa(lab)); + auto *sLab = static_cast(lab); + if (sLab->view(0).contains(e)) + return true; + + for (auto &rLab : sLab->readers()) { + if (rLab.view(0).contains(e)) + return true; + } + return false; +} + +ExecutionGraph::co_iterator +RISCVDriver::splitLocMOBefore(SAddr addr, Event e) +{ + auto &g = getGraph(); + auto rit = std::find_if(g.co_rbegin(addr), g.co_rend(addr), [&](auto &lab){ + return isWriteRfBefore(lab.getPos(), e); + }); + /* Convert to forward iterator, but be _really_ careful */ + if (rit == g.co_rend(addr)) + return g.co_begin(addr); + return ++ExecutionGraph::co_iterator(*rit); +} + +ExecutionGraph::co_iterator +RISCVDriver::splitLocMOAfterHb(SAddr addr, const Event read) +{ + auto &g = getGraph(); + + auto initRfs = g.getInitRfsAtLoc(addr); + if (std::any_of(initRfs.begin(), initRfs.end(), [&read,&g](const Event &rf){ + return g.getEventLabel(rf)->view(0).contains(read); + })) + return g.co_begin(addr); + + auto it = std::find_if(g.co_begin(addr), g.co_end(addr), [&](auto &lab){ + return isHbOptRfBefore(read, lab.getPos()); + }); + if (it == g.co_end(addr) || it->view(0).contains(read)) + return it; + return ++it; +} + +ExecutionGraph::co_iterator +RISCVDriver::splitLocMOAfter(SAddr addr, const Event e) +{ + auto &g = getGraph(); + return std::find_if(g.co_begin(addr), g.co_end(addr), [&](auto &lab){ + return isHbOptRfBefore(e, lab.getPos()); + }); +} + +std::vector +RISCVDriver::getCoherentStores(SAddr addr, Event read) +{ + auto &g = getGraph(); + std::vector stores; + + /* Fastpath: co_max(G) is po-before R */ + auto comax = g.co_rbegin(addr) == g.co_rend(addr) ? Event::getInit() : + g.co_rbegin(addr)->getPos(); + if (comax.thread == read.thread && comax.index < read.index) + return {comax}; + + /* + * If there are no stores (rf?;hb)-before the current event + * then we can read read from all concurrent stores and the + * initializer store. Otherwise, we can read from all concurrent + * stores and the mo-latest of the (rf?;hb)-before stores. + */ + auto begIt = splitLocMOBefore(addr, read); + if (begIt == g.co_begin(addr)) + stores.push_back(Event::getInit()); + else { + stores.push_back((--begIt)->getPos()); + ++begIt; + } + + /* + * If the model supports out-of-order execution we have to also + * account for the possibility the read is hb-before some other + * store, or some read that reads from a store. + */ + auto endIt = (isDepTracking()) ? splitLocMOAfterHb(addr, read) : g.co_end(addr); + std::transform(begIt, endIt, std::back_inserter(stores), [&](auto &lab){ + return lab.getPos(); + }); + return stores; +} + +std::vector +RISCVDriver::getMOOptRfAfter(const WriteLabel *sLab) +{ + std::vector after; + std::vector rfAfter; + + const auto &g = getGraph(); + std::for_each(g.co_succ_begin(sLab), g.co_succ_end(sLab), + [&](auto &wLab){ + after.push_back(wLab.getPos()); + std::transform(wLab.readers_begin(), wLab.readers_end(), std::back_inserter(rfAfter), + [&](auto &rLab){ return &rLab; }); + }); + std::transform(rfAfter.begin(), rfAfter.end(), std::back_inserter(after), [](auto *rLab){ + return rLab->getPos(); + }); + return after; +} + +std::vector +RISCVDriver::getMOInvOptRfAfter(const WriteLabel *sLab) +{ + auto &g = getGraph(); + std::vector after; + std::vector rfAfter; + + /* First, add (mo;rf?)-before */ + std::for_each(g.co_pred_begin(sLab), + g.co_pred_end(sLab), [&](auto &wLab){ + after.push_back(wLab.getPos()); + std::transform(wLab.readers_begin(), wLab.readers_end(), std::back_inserter(rfAfter), + [&](auto &rLab){ return &rLab; }); + }); + std::transform(rfAfter.begin(), rfAfter.end(), std::back_inserter(after), [](auto *rLab){ + return rLab->getPos(); + }); + + /* Then, we add the reader list for the initializer */ + auto initRfs = g.getInitRfsAtLoc(sLab->getAddr()); + after.insert(after.end(), initRfs.begin(), initRfs.end()); + return after; +} + +static std::vector +getRevisitableFrom(const ExecutionGraph &g, const WriteLabel *sLab, + const VectorClock &pporf, const WriteLabel *coPred) +{ + auto pendingRMW = g.getPendingRMW(sLab); + std::vector loads; + + for (auto &rLab : coPred->readers()) { + if (!pporf.contains(rLab.getPos()) && rLab.getAddr() == sLab->getAddr() && + rLab.isRevisitable() && rLab.wasAddedMax()) + loads.push_back(rLab.getPos()); + } + if (!pendingRMW.isInitializer()) + loads.erase(std::remove_if(loads.begin(), loads.end(), + [&](Event &e) { + auto *confLab = g.getEventLabel(pendingRMW); + return g.getEventLabel(e)->getStamp() > + confLab->getStamp(); + }), + loads.end()); + return loads; +} + +std::vector +RISCVDriver::getCoherentRevisits(const WriteLabel *sLab, const VectorClock &pporf) +{ + auto &g = getGraph(); + std::vector ls; + + /* Fastpath: previous co-max is ppo-before SLAB */ + auto prevCoMaxIt = std::find_if(g.co_rbegin(sLab->getAddr()), g.co_rend(sLab->getAddr()), + [&](auto &lab) { return lab.getPos() != sLab->getPos(); }); + if (prevCoMaxIt != g.co_rend(sLab->getAddr()) && pporf.contains(prevCoMaxIt->getPos())) { + ls = getRevisitableFrom(g, sLab, pporf, &*prevCoMaxIt); + } else { + ls = g.getRevisitable(sLab, pporf); + } + + /* If this store is po- and mo-maximal then we are done */ + if (!isDepTracking() && g.isCoMaximal(sLab->getAddr(), sLab->getPos())) + return ls; + + /* First, we have to exclude (mo;rf?;hb?;sb)-after reads */ + auto optRfs = getMOOptRfAfter(sLab); + ls.erase(std::remove_if(ls.begin(), ls.end(), [&](Event e) + { const View &before = g.getEventLabel(e)->view(0); + return std::any_of(optRfs.begin(), optRfs.end(), + [&](Event ev) + { return before.contains(ev); }); + }), ls.end()); + + /* If out-of-order event addition is not supported, then we are done + * due to po-maximality */ + if (!isDepTracking()) + return ls; + + /* Otherwise, we also have to exclude hb-before loads */ + ls.erase(std::remove_if(ls.begin(), ls.end(), [&](Event e) + { return g.getEventLabel(sLab->getPos())->view(0).contains(e); }), + ls.end()); + + /* ...and also exclude (mo^-1; rf?; (hb^-1)?; sb^-1)-after reads in + * the resulting graph */ + auto &before = pporf; + auto moInvOptRfs = getMOInvOptRfAfter(sLab); + ls.erase(std::remove_if(ls.begin(), ls.end(), [&](Event e) + { auto *eLab = g.getEventLabel(e); + auto v = g.getViewFromStamp(eLab->getStamp()); + v->update(before); + return std::any_of(moInvOptRfs.begin(), + moInvOptRfs.end(), + [&](Event ev) + { return v->contains(ev) && + g.getEventLabel(ev)->view(0).contains(e); }); + }), + ls.end()); + + return ls; +} + +std::vector +RISCVDriver::getCoherentPlacings(SAddr addr, Event store, bool isRMW) +{ + auto &g = getGraph(); + std::vector result; + + /* If it is an RMW store, there is only one possible position in MO */ + if (isRMW) { + auto *rLab = llvm::dyn_cast(g.getEventLabel(store.prev())); + BUG_ON(!rLab); + auto *rfLab = rLab->getRf(); + BUG_ON(!rfLab); + result.push_back(rfLab->getPos()); + return result; + } + + /* Otherwise, we calculate the full range and add the store */ + auto rangeBegin = splitLocMOBefore(addr, store); + auto rangeEnd = (isDepTracking()) ? splitLocMOAfter(addr, store) : g.co_end(addr); + auto cos = llvm::iterator_range(rangeBegin, rangeEnd) | + std::views::filter([&](auto &sLab) { return !g.isRMWStore(sLab.getPos()); }) | + std::views::transform([&](auto &sLab) { + auto *pLab = g.co_imm_pred(&sLab); + return pLab ? pLab->getPos() : Event::getInit(); + }); + std::ranges::copy(cos, std::back_inserter(result)); + result.push_back(rangeEnd == g.co_end(addr) ? g.co_max(addr)->getPos() + : !g.co_imm_pred(&*rangeEnd) ? Event::getInit() + : g.co_imm_pred(&*rangeEnd)->getPos()); + return result; +} +bool RISCVDriver::visitCoherence_0(const EventLabel *lab) const +{ + auto &g = getGraph(); + + ++visitedCoherenceAccepting; + + + --visitedCoherenceAccepting; + return true; +} + +bool RISCVDriver::visitCoherence_1(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedCoherence_1[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::entered }; + + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedCoherence_8[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_8(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedCoherence_8[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_8(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedCoherence_8[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_8(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedCoherence_4[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_4(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedCoherence_7[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_7(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab) { + auto &node = visitedCoherence_2[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_2(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))for (auto &p : ctrl_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (true && llvm::isa(lab))for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (true && llvm::isa(lab) && ((llvm::isa(lab) && g.isRMWLoad(lab)) || (llvm::isa(lab) && g.isRMWStore(lab))))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto &node = visitedCoherence_3[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_3(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto &node = visitedCoherence_3[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_3(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto &node = visitedCoherence_3[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_3(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto &node = visitedCoherence_3[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_3(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedCoherence_6[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_6(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedCoherence_6[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_6(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedCoherence_11[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_11(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedCoherence_11[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_11(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))for (auto &p : ctrl_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab) && ((llvm::isa(lab) && g.isRMWLoad(lab)) || (llvm::isa(lab) && g.isRMWStore(lab))))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + if (!visitCoherence_10(pLab)){ + return false; + } + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedCoherence_9[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_9(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedCoherence_9[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_9(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedCoherence_9[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_9(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab) && ((llvm::isa(lab) && g.isRMWLoad(lab)) || (llvm::isa(lab) && g.isRMWStore(lab))))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto &node = visitedCoherence_9[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_9(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedCoherence_5[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_5(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedCoherence_5[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_5(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + visitedCoherence_1[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::left }; + return true; +} + +bool RISCVDriver::visitCoherence_2(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedCoherence_2[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::entered }; + + if (auto pLab = poloc_imm_pred(g, lab); pLab) { + auto &node = visitedCoherence_2[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_2(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + visitedCoherence_2[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::left }; + return true; +} + +bool RISCVDriver::visitCoherence_3(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedCoherence_3[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::entered }; + + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + visitedCoherence_3[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::left }; + return true; +} + +bool RISCVDriver::visitCoherence_4(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedCoherence_4[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::entered }; + + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedCoherence_4[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_4(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedCoherence_11[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_11(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedCoherence_11[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_11(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + visitedCoherence_4[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::left }; + return true; +} + +bool RISCVDriver::visitCoherence_5(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedCoherence_5[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::entered }; + + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedCoherence_5[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_5(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + visitedCoherence_5[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::left }; + return true; +} + +bool RISCVDriver::visitCoherence_6(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedCoherence_6[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::entered }; + + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedCoherence_6[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_6(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedCoherence_5[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_5(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + visitedCoherence_6[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::left }; + return true; +} + +bool RISCVDriver::visitCoherence_7(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedCoherence_7[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::entered }; + + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedCoherence_7[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_7(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + visitedCoherence_7[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::left }; + return true; +} + +bool RISCVDriver::visitCoherence_8(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedCoherence_8[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::entered }; + + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedCoherence_8[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_8(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + visitedCoherence_8[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::left }; + return true; +} + +bool RISCVDriver::visitCoherence_9(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedCoherence_9[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::entered }; + + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto &node = visitedCoherence_3[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_3(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedCoherence_9[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_9(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + visitedCoherence_9[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::left }; + return true; +} + +bool RISCVDriver::visitCoherence_10(const EventLabel *lab) const +{ + auto &g = getGraph(); + + + for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + return true; +} + +bool RISCVDriver::visitCoherence_11(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedCoherence_11[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::entered }; + + for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { + if (!visitCoherence_0(pLab)){ + return false; + } + } + for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { + auto &node = visitedCoherence_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitCoherence_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + visitedCoherence_11[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::left }; + return true; +} + +bool RISCVDriver::visitCoherenceFull() const +{ + auto &g = getGraph(); + + visitedCoherenceAccepting = 0; + visitedCoherence_1.clear(); + visitedCoherence_1.resize(g.getMaxStamp().get() + 1); + visitedCoherence_2.clear(); + visitedCoherence_2.resize(g.getMaxStamp().get() + 1); + visitedCoherence_3.clear(); + visitedCoherence_3.resize(g.getMaxStamp().get() + 1); + visitedCoherence_4.clear(); + visitedCoherence_4.resize(g.getMaxStamp().get() + 1); + visitedCoherence_5.clear(); + visitedCoherence_5.resize(g.getMaxStamp().get() + 1); + visitedCoherence_6.clear(); + visitedCoherence_6.resize(g.getMaxStamp().get() + 1); + visitedCoherence_7.clear(); + visitedCoherence_7.resize(g.getMaxStamp().get() + 1); + visitedCoherence_8.clear(); + visitedCoherence_8.resize(g.getMaxStamp().get() + 1); + visitedCoherence_9.clear(); + visitedCoherence_9.resize(g.getMaxStamp().get() + 1); + visitedCoherence_11.clear(); + visitedCoherence_11.resize(g.getMaxStamp().get() + 1); + return true + && std::ranges::all_of(g.labels(), [&](auto &lab){ return visitedCoherence_1[lab.getStamp().get()].status != NodeStatus::unseen || visitCoherence_1(&lab); }); +} + +bool RISCVDriver::visitConsAcyclic1_0(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedConsAcyclic1_0[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::entered }; + + if (auto pLab = poloc_imm_pred(g, lab); pLab) { + auto &node = visitedConsAcyclic1_0[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_0(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + visitedConsAcyclic1_0[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::left }; + return true; +} + +bool RISCVDriver::visitConsAcyclic1_1(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedConsAcyclic1_1[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::entered }; + + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + visitedConsAcyclic1_1[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::left }; + return true; +} + +bool RISCVDriver::visitConsAcyclic1_2(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedConsAcyclic1_2[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::entered }; + + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedConsAcyclic1_2[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_2(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + visitedConsAcyclic1_2[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::left }; + return true; +} + +bool RISCVDriver::visitConsAcyclic1_3(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedConsAcyclic1_3[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::entered }; + + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedConsAcyclic1_2[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_2(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedConsAcyclic1_3[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_3(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + visitedConsAcyclic1_3[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::left }; + return true; +} + +bool RISCVDriver::visitConsAcyclic1_4(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedConsAcyclic1_4[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::entered }; + + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedConsAcyclic1_4[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_4(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedConsAcyclic1_9[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_9(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedConsAcyclic1_9[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_9(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + visitedConsAcyclic1_4[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::left }; + return true; +} + +bool RISCVDriver::visitConsAcyclic1_5(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedConsAcyclic1_5[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::entered }; + + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedConsAcyclic1_5[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_5(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + visitedConsAcyclic1_5[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::left }; + return true; +} + +bool RISCVDriver::visitConsAcyclic1_6(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedConsAcyclic1_6[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::entered }; + + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedConsAcyclic1_6[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_6(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + visitedConsAcyclic1_6[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::left }; + return true; +} + +bool RISCVDriver::visitConsAcyclic1_7(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedConsAcyclic1_7[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::entered }; + + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto &node = visitedConsAcyclic1_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedConsAcyclic1_7[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_7(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + visitedConsAcyclic1_7[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::left }; + return true; +} + +bool RISCVDriver::visitConsAcyclic1_8(const EventLabel *lab) const +{ + auto &g = getGraph(); + + + for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + return true; +} + +bool RISCVDriver::visitConsAcyclic1_9(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedConsAcyclic1_9[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::entered }; + + for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + visitedConsAcyclic1_9[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::left }; + return true; +} + +bool RISCVDriver::visitConsAcyclic1_10(const EventLabel *lab) const +{ + auto &g = getGraph(); + + ++visitedConsAcyclic1Accepting; + visitedConsAcyclic1_10[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::entered }; + + + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedConsAcyclic1_2[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_2(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedConsAcyclic1_2[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_2(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedConsAcyclic1_4[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_4(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto &node = visitedConsAcyclic1_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto &node = visitedConsAcyclic1_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto &node = visitedConsAcyclic1_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto &node = visitedConsAcyclic1_1[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_1(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab) { + auto &node = visitedConsAcyclic1_0[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_0(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedConsAcyclic1_7[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_7(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedConsAcyclic1_7[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_7(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedConsAcyclic1_7[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_7(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab) && ((llvm::isa(lab) && g.isRMWLoad(lab)) || (llvm::isa(lab) && g.isRMWStore(lab))))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto &node = visitedConsAcyclic1_7[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_7(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedConsAcyclic1_5[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_5(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedConsAcyclic1_3[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_3(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedConsAcyclic1_3[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_3(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = co_imm_pred(g, lab); pLab) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + for (auto &tmp : fr_imm_preds(g, lab)) if (auto *pLab = &tmp; true) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = rfe_pred(g, lab); pLab) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))for (auto &p : ctrl_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab) && ((llvm::isa(lab) && g.isRMWLoad(lab)) || (llvm::isa(lab) && g.isRMWStore(lab))))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_10(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedConsAcyclic1_6[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_6(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedConsAcyclic1_6[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_6(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto &node = visitedConsAcyclic1_6[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_6(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedConsAcyclic1_9[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_9(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto &node = visitedConsAcyclic1_9[pLab->getStamp().get()]; + if (node.status == NodeStatus::unseen) { + if (!visitConsAcyclic1_9(pLab)){ + return false; + } + } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { + + return false; + } else if (node.status == NodeStatus::left) { + + } + } + if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + if (!visitConsAcyclic1_8(pLab)){ + return false; + } + } + --visitedConsAcyclic1Accepting; + visitedConsAcyclic1_10[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::left }; + return true; +} + +bool RISCVDriver::visitConsAcyclic1(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedConsAcyclic1Accepting = 0; + visitedConsAcyclic1_0.clear(); + visitedConsAcyclic1_0.resize(g.getMaxStamp().get() + 1); + visitedConsAcyclic1_1.clear(); + visitedConsAcyclic1_1.resize(g.getMaxStamp().get() + 1); + visitedConsAcyclic1_2.clear(); + visitedConsAcyclic1_2.resize(g.getMaxStamp().get() + 1); + visitedConsAcyclic1_3.clear(); + visitedConsAcyclic1_3.resize(g.getMaxStamp().get() + 1); + visitedConsAcyclic1_4.clear(); + visitedConsAcyclic1_4.resize(g.getMaxStamp().get() + 1); + visitedConsAcyclic1_5.clear(); + visitedConsAcyclic1_5.resize(g.getMaxStamp().get() + 1); + visitedConsAcyclic1_6.clear(); + visitedConsAcyclic1_6.resize(g.getMaxStamp().get() + 1); + visitedConsAcyclic1_7.clear(); + visitedConsAcyclic1_7.resize(g.getMaxStamp().get() + 1); + visitedConsAcyclic1_9.clear(); + visitedConsAcyclic1_9.resize(g.getMaxStamp().get() + 1); + visitedConsAcyclic1_10.clear(); + visitedConsAcyclic1_10.resize(g.getMaxStamp().get() + 1); + return true + && (visitedConsAcyclic1_10[lab->getStamp().get()].status != NodeStatus::unseen || visitConsAcyclic1_10(lab)); +} + +bool RISCVDriver::visitConsAcyclic1Full() const +{ + auto &g = getGraph(); + + visitedConsAcyclic1Accepting = 0; + visitedConsAcyclic1_0.clear(); + visitedConsAcyclic1_0.resize(g.getMaxStamp().get() + 1); + visitedConsAcyclic1_1.clear(); + visitedConsAcyclic1_1.resize(g.getMaxStamp().get() + 1); + visitedConsAcyclic1_2.clear(); + visitedConsAcyclic1_2.resize(g.getMaxStamp().get() + 1); + visitedConsAcyclic1_3.clear(); + visitedConsAcyclic1_3.resize(g.getMaxStamp().get() + 1); + visitedConsAcyclic1_4.clear(); + visitedConsAcyclic1_4.resize(g.getMaxStamp().get() + 1); + visitedConsAcyclic1_5.clear(); + visitedConsAcyclic1_5.resize(g.getMaxStamp().get() + 1); + visitedConsAcyclic1_6.clear(); + visitedConsAcyclic1_6.resize(g.getMaxStamp().get() + 1); + visitedConsAcyclic1_7.clear(); + visitedConsAcyclic1_7.resize(g.getMaxStamp().get() + 1); + visitedConsAcyclic1_9.clear(); + visitedConsAcyclic1_9.resize(g.getMaxStamp().get() + 1); + visitedConsAcyclic1_10.clear(); + visitedConsAcyclic1_10.resize(g.getMaxStamp().get() + 1); + return true + && std::ranges::all_of(g.labels(), [&](auto &lab){ return visitedConsAcyclic1_10[lab.getStamp().get()].status != NodeStatus::unseen || visitConsAcyclic1_10(&lab); }); +} + +bool RISCVDriver::checkConsAcyclic1(const EventLabel *lab) const +{ + auto &g = getGraph(); + + + return visitConsAcyclic1(lab); +} +bool RISCVDriver::visitError2(const EventLabel *lab) const +{ + return false; +} + +bool RISCVDriver::visitLHSUnlessError2_0(const EventLabel *lab, const View &v) const +{ + auto &g = getGraph(); + + + if (!v.contains(lab->getPos())) { +cexLab = lab; + return false; + } + + + return true; +} + +bool RISCVDriver::visitLHSUnlessError2_1(const EventLabel *lab, const View &v) const +{ + auto &g = getGraph(); + + + if (auto pLab = alloc_pred(g, lab); pLab) { + if (!visitLHSUnlessError2_0(pLab, v)){ + return false; + } + + } + + return true; +} + +bool RISCVDriver::visitUnlessError2(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedLHSUnlessError2Accepting.clear(); + visitedLHSUnlessError2Accepting.resize(g.getMaxStamp().get() + 1, false); + auto &v = lab->view(0); + + return true + && visitLHSUnlessError2_1(lab, v); +} + +bool RISCVDriver::checkError2(const EventLabel *lab) const +{ + auto &g = getGraph(); + + + if (visitUnlessError2(lab)) + return true; + + return visitError2(lab); +} +bool RISCVDriver::visitError3(const EventLabel *lab) const +{ + return false; +} + +bool RISCVDriver::visitLHSUnlessError3_0(const EventLabel *lab) const +{ + auto &g = getGraph(); + + + return false; + + + return true; +} + +bool RISCVDriver::visitLHSUnlessError3_1(const EventLabel *lab) const +{ + auto &g = getGraph(); + + + if (true && llvm::isa(lab) && !llvm::isa(lab))for (auto &tmp : samelocs(g, lab)) if (auto *pLab = &tmp; true)if (true && llvm::isa(pLab) && !llvm::isa(pLab)) { + if (!visitLHSUnlessError3_0(pLab)){ + return false; + } + + } + if (true && llvm::isa(lab) && !llvm::isa(lab))for (auto &tmp : samelocs(g, lab)) if (auto *pLab = &tmp; true)if (true && llvm::isa(pLab)) { + if (!visitLHSUnlessError3_0(pLab)){ + return false; + } + + } + if (true && llvm::isa(lab))for (auto &tmp : samelocs(g, lab)) if (auto *pLab = &tmp; true)if (true && llvm::isa(pLab) && !llvm::isa(pLab)) { + if (!visitLHSUnlessError3_0(pLab)){ + return false; + } + + } + if (true && llvm::isa(lab))for (auto &tmp : samelocs(g, lab)) if (auto *pLab = &tmp; true)if (true && llvm::isa(pLab)) { + if (!visitLHSUnlessError3_0(pLab)){ + return false; + } + + } + + return true; +} + +bool RISCVDriver::visitUnlessError3(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedLHSUnlessError3Accepting.clear(); + visitedLHSUnlessError3Accepting.resize(g.getMaxStamp().get() + 1, false); + visitedRHSUnlessError3Accepting.clear(); + visitedRHSUnlessError3Accepting.resize(g.getMaxStamp().get() + 1, false); + + if (!visitLHSUnlessError3_1(lab)) + return false; + for (auto i = 0u; i < visitedLHSUnlessError3Accepting.size(); i++) { + if (visitedLHSUnlessError3Accepting[i] && !visitedRHSUnlessError3Accepting[i]) { + cexLab = &*std::find_if(g.label_begin(), g.label_end(), [&](auto &lab){ return lab.getStamp() == i; }); + return false; + } + } + return true; +} + +bool RISCVDriver::checkError3(const EventLabel *lab) const +{ + auto &g = getGraph(); + + + if (visitUnlessError3(lab)) + return true; + + return visitError3(lab); +} +bool RISCVDriver::visitError4(const EventLabel *lab) const +{ + return false; +} + +bool RISCVDriver::visitLHSUnlessError4_0(const EventLabel *lab, const View &v) const +{ + auto &g = getGraph(); + + + if (!v.contains(lab->getPos())) { +cexLab = lab; + return false; + } + + + return true; +} + +bool RISCVDriver::visitLHSUnlessError4_1(const EventLabel *lab, const View &v) const +{ + auto &g = getGraph(); + + + for (auto &tmp : alloc_succs(g, lab)) if (auto *pLab = &tmp; true) { + if (!visitLHSUnlessError4_0(pLab, v)){ + return false; + } + + } + + return true; +} + +bool RISCVDriver::visitLHSUnlessError4_2(const EventLabel *lab, const View &v) const +{ + auto &g = getGraph(); + + + if (true && llvm::isa(lab) && !llvm::isa(lab))if (auto pLab = free_pred(g, lab); pLab) { + if (!visitLHSUnlessError4_1(pLab, v)){ + return false; + } + + } + if (true && llvm::isa(lab) && !llvm::isa(lab))if (auto pLab = free_pred(g, lab); pLab) { + if (!visitLHSUnlessError4_0(pLab, v)){ + return false; + } + + } + + return true; +} + +bool RISCVDriver::visitUnlessError4(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedLHSUnlessError4Accepting.clear(); + visitedLHSUnlessError4Accepting.resize(g.getMaxStamp().get() + 1, false); + auto &v = lab->view(0); + + return true + && visitLHSUnlessError4_2(lab, v); +} + +bool RISCVDriver::checkError4(const EventLabel *lab) const +{ + auto &g = getGraph(); + + + if (visitUnlessError4(lab)) + return true; + + return visitError4(lab); +} +bool RISCVDriver::visitError5(const EventLabel *lab) const +{ + return false; +} + +bool RISCVDriver::visitLHSUnlessError5_0(const EventLabel *lab) const +{ + auto &g = getGraph(); + + + return false; + + + return true; +} + +bool RISCVDriver::visitLHSUnlessError5_1(const EventLabel *lab) const +{ + auto &g = getGraph(); + + + if (auto pLab = free_succ(g, lab); pLab)if (true && llvm::isa(pLab) && !llvm::isa(pLab)) { + if (!visitLHSUnlessError5_0(pLab)){ + return false; + } + + } + + return true; +} + +bool RISCVDriver::visitLHSUnlessError5_2(const EventLabel *lab) const +{ + auto &g = getGraph(); + + + if (auto pLab = alloc_pred(g, lab); pLab) { + if (!visitLHSUnlessError5_1(pLab)){ + return false; + } + + } + + return true; +} + +bool RISCVDriver::visitUnlessError5(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedLHSUnlessError5Accepting.clear(); + visitedLHSUnlessError5Accepting.resize(g.getMaxStamp().get() + 1, false); + visitedRHSUnlessError5Accepting.clear(); + visitedRHSUnlessError5Accepting.resize(g.getMaxStamp().get() + 1, false); + + if (!visitLHSUnlessError5_2(lab)) + return false; + for (auto i = 0u; i < visitedLHSUnlessError5Accepting.size(); i++) { + if (visitedLHSUnlessError5Accepting[i] && !visitedRHSUnlessError5Accepting[i]) { + cexLab = &*std::find_if(g.label_begin(), g.label_end(), [&](auto &lab){ return lab.getStamp() == i; }); + return false; + } + } + return true; +} + +bool RISCVDriver::checkError5(const EventLabel *lab) const +{ + auto &g = getGraph(); + + + if (visitUnlessError5(lab)) + return true; + + return visitError5(lab); +} +bool RISCVDriver::visitError6(const EventLabel *lab) const +{ + return false; +} + +bool RISCVDriver::visitLHSUnlessError6_0(const EventLabel *lab, const View &v) const +{ + auto &g = getGraph(); + + + if (!v.contains(lab->getPos())) { +cexLab = lab; + return false; + } + + + return true; +} + +bool RISCVDriver::visitLHSUnlessError6_1(const EventLabel *lab, const View &v) const +{ + auto &g = getGraph(); + + + for (auto &tmp : alloc_succs(g, lab)) if (auto *pLab = &tmp; true)if (true && llvm::isa(pLab) && llvm::dyn_cast(pLab)->getAddr().isDynamic() && !isHazptrProtected(llvm::dyn_cast(pLab))) { + if (!visitLHSUnlessError6_0(pLab, v)){ + return false; + } + + } + + return true; +} + +bool RISCVDriver::visitLHSUnlessError6_2(const EventLabel *lab, const View &v) const +{ + auto &g = getGraph(); + + + if (true && llvm::isa(lab))if (auto pLab = free_pred(g, lab); pLab) { + if (!visitLHSUnlessError6_1(pLab, v)){ + return false; + } + + } + if (true && llvm::isa(lab))if (auto pLab = free_pred(g, lab); pLab)if (true && llvm::isa(pLab) && llvm::dyn_cast(pLab)->getAddr().isDynamic() && !isHazptrProtected(llvm::dyn_cast(pLab))) { + if (!visitLHSUnlessError6_0(pLab, v)){ + return false; + } + + } + + return true; +} + +bool RISCVDriver::visitUnlessError6(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedLHSUnlessError6Accepting.clear(); + visitedLHSUnlessError6Accepting.resize(g.getMaxStamp().get() + 1, false); + auto &v = lab->view(0); + + return true + && visitLHSUnlessError6_2(lab, v); +} + +bool RISCVDriver::checkError6(const EventLabel *lab) const +{ + auto &g = getGraph(); + + + if (visitUnlessError6(lab)) + return true; + + return visitError6(lab); +} +bool RISCVDriver::visitError7(const EventLabel *lab) const +{ + return false; +} + +bool RISCVDriver::visitLHSUnlessError7_0(const EventLabel *lab) const +{ + auto &g = getGraph(); + + + return false; + + + return true; +} + +bool RISCVDriver::visitLHSUnlessError7_1(const EventLabel *lab) const +{ + auto &g = getGraph(); + + + if (auto pLab = free_succ(g, lab); pLab)if (true && llvm::isa(pLab)) { + if (!visitLHSUnlessError7_0(pLab)){ + return false; + } + + } + + return true; +} + +bool RISCVDriver::visitLHSUnlessError7_2(const EventLabel *lab) const +{ + auto &g = getGraph(); + + + if (true && llvm::isa(lab) && llvm::dyn_cast(lab)->getAddr().isDynamic() && !isHazptrProtected(llvm::dyn_cast(lab)))if (auto pLab = alloc_pred(g, lab); pLab) { + if (!visitLHSUnlessError7_1(pLab)){ + return false; + } + + } + + return true; +} + +bool RISCVDriver::visitUnlessError7(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedLHSUnlessError7Accepting.clear(); + visitedLHSUnlessError7Accepting.resize(g.getMaxStamp().get() + 1, false); + visitedRHSUnlessError7Accepting.clear(); + visitedRHSUnlessError7Accepting.resize(g.getMaxStamp().get() + 1, false); + + if (!visitLHSUnlessError7_2(lab)) + return false; + for (auto i = 0u; i < visitedLHSUnlessError7Accepting.size(); i++) { + if (visitedLHSUnlessError7Accepting[i] && !visitedRHSUnlessError7Accepting[i]) { + cexLab = &*std::find_if(g.label_begin(), g.label_end(), [&](auto &lab){ return lab.getStamp() == i; }); + return false; + } + } + return true; +} + +bool RISCVDriver::checkError7(const EventLabel *lab) const +{ + auto &g = getGraph(); + + + if (visitUnlessError7(lab)) + return true; + + return visitError7(lab); +} +bool RISCVDriver::visitError8(const EventLabel *lab) const +{ + return false; +} + +bool RISCVDriver::visitLHSUnlessError8_0(const EventLabel *lab, const View &v) const +{ + auto &g = getGraph(); + + + if (!v.contains(lab->getPos())) { +cexLab = lab; + return false; + } + + + return true; +} + +bool RISCVDriver::visitLHSUnlessError8_1(const EventLabel *lab, const View &v) const +{ + auto &g = getGraph(); + + + if (true && lab->isNotAtomic() && llvm::isa(lab))for (auto &tmp : samelocs(g, lab)) if (auto *pLab = &tmp; true)if (true && llvm::isa(pLab)) { + if (!visitLHSUnlessError8_0(pLab, v)){ + return false; + } + + } + if (true && lab->isNotAtomic() && llvm::isa(lab))for (auto &tmp : samelocs(g, lab)) if (auto *pLab = &tmp; true)if (true && llvm::isa(pLab)) { + if (!visitLHSUnlessError8_0(pLab, v)){ + return false; + } + + } + if (true && lab->isNotAtomic() && llvm::isa(lab))for (auto &tmp : samelocs(g, lab)) if (auto *pLab = &tmp; true)if (true && llvm::isa(pLab)) { + if (!visitLHSUnlessError8_0(pLab, v)){ + return false; + } + + } + if (true && llvm::isa(lab))for (auto &tmp : samelocs(g, lab)) if (auto *pLab = &tmp; true)if (true && pLab->isNotAtomic() && llvm::isa(pLab)) { + if (!visitLHSUnlessError8_0(pLab, v)){ + return false; + } + + } + if (true && llvm::isa(lab))for (auto &tmp : samelocs(g, lab)) if (auto *pLab = &tmp; true)if (true && pLab->isNotAtomic() && llvm::isa(pLab)) { + if (!visitLHSUnlessError8_0(pLab, v)){ + return false; + } + + } + if (true && llvm::isa(lab))for (auto &tmp : samelocs(g, lab)) if (auto *pLab = &tmp; true)if (true && pLab->isNotAtomic() && llvm::isa(pLab)) { + if (!visitLHSUnlessError8_0(pLab, v)){ + return false; + } + + } + + return true; +} + +bool RISCVDriver::visitUnlessError8(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedLHSUnlessError8Accepting.clear(); + visitedLHSUnlessError8Accepting.resize(g.getMaxStamp().get() + 1, false); + auto &v = lab->view(0); + + return true + && visitLHSUnlessError8_1(lab, v); +} + +bool RISCVDriver::checkError8(const EventLabel *lab) const +{ + auto &g = getGraph(); + + + if (visitUnlessError8(lab)) + return true; + + return visitError8(lab); +} +bool RISCVDriver::visitWarning9(const EventLabel *lab) const +{ + return false; +} + +bool RISCVDriver::visitLHSUnlessWarning9_0(const EventLabel *lab, const View &v) const +{ + auto &g = getGraph(); + + + if (!v.contains(lab->getPos())) { +cexLab = lab; + return false; + } + + + return true; +} + +bool RISCVDriver::visitLHSUnlessWarning9_1(const EventLabel *lab, const View &v) const +{ + auto &g = getGraph(); + + + if (true && llvm::isa(lab))for (auto &tmp : samelocs(g, lab)) if (auto *pLab = &tmp; true)if (true && llvm::isa(pLab)) { + if (!visitLHSUnlessWarning9_0(pLab, v)){ + return false; + } + + } + + return true; +} + +bool RISCVDriver::visitUnlessWarning9(const EventLabel *lab) const +{ + auto &g = getGraph(); + + visitedLHSUnlessWarning9Accepting.clear(); + visitedLHSUnlessWarning9Accepting.resize(g.getMaxStamp().get() + 1, false); + auto &v = lab->view(1); + + return true + && visitLHSUnlessWarning9_1(lab, v); +} + +bool RISCVDriver::checkWarning9(const EventLabel *lab) const +{ + auto &g = getGraph(); + + + if (visitUnlessWarning9(lab)) + return true; + + return visitWarning9(lab); +} +VerificationError RISCVDriver::checkErrors(const EventLabel *lab, const EventLabel *&race) const +{ + if (!checkError2(lab)) { + race = cexLab; + return VerificationError::VE_AccessNonMalloc; + } + + if (!checkError3(lab)) { + race = cexLab; + return VerificationError::VE_DoubleFree; + } + + if (!checkError4(lab)) { + race = cexLab; + return VerificationError::VE_AccessFreed; + } + + if (!checkError5(lab)) { + race = cexLab; + return VerificationError::VE_AccessFreed; + } + + if (!checkError6(lab)) { + race = cexLab; + return VerificationError::VE_AccessFreed; + } + + if (!checkError7(lab)) { + race = cexLab; + return VerificationError::VE_AccessFreed; + } + + if (!checkError8(lab)) { + race = cexLab; + return VerificationError::VE_RaceNotAtomic; + } + + return VerificationError::VE_OK; +} + +std::vector RISCVDriver::checkWarnings(const EventLabel *lab, const VSet &seenWarnings, std::vector &racyLabs) const +{ + std::vector result; + + if (seenWarnings.count(VerificationError::VE_WWRace) == 0 && !checkWarning9(lab)) { + racyLabs.push_back(cexLab); + result.push_back(VerificationError::VE_WWRace); + } + + return result; +} + +bool RISCVDriver::isConsistent(const EventLabel *lab) const +{ + + return true + && checkConsAcyclic1(lab); +} + +void RISCVDriver::visitPPoRf0(const EventLabel *lab, DepView &pporf) const +{ + auto &g = getGraph(); + + visitedPPoRf0[lab->getStamp().get()] = NodeStatus::entered; + pporf.updateIdx(lab->getPos()); + visitedPPoRf0[lab->getStamp().get()] = NodeStatus::left; +} + +void RISCVDriver::visitPPoRf1(const EventLabel *lab, DepView &pporf) const +{ + auto &g = getGraph(); + + visitedPPoRf1[lab->getStamp().get()] = NodeStatus::entered; + if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab))if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab))if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (auto pLab = poloc_imm_pred(g, lab); pLab) { + auto status = visitedPPoRf1[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf1(pLab, pporf); + } + if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + visitedPPoRf1[lab->getStamp().get()] = NodeStatus::left; +} + +void RISCVDriver::visitPPoRf2(const EventLabel *lab, DepView &pporf) const +{ + auto &g = getGraph(); + + visitedPPoRf2[lab->getStamp().get()] = NodeStatus::entered; + if (auto pLab = tc_pred(g, lab); pLab)if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (auto pLab = tj_pred(g, lab); pLab)if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (auto pLab = rfe_pred(g, lab); pLab)if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (true && llvm::isa(lab))for (auto &p : ctrl_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (true && llvm::isa(lab))for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab))))if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab))if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab))if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire())if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease())if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC())if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire())if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease())if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC())if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire())if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease())if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC())if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (true && llvm::isa(lab) && ((llvm::isa(lab) && g.isRMWLoad(lab)) || (llvm::isa(lab) && g.isRMWStore(lab))))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab))))if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedPPoRf3[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf3(pLab, pporf); + } + if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto status = visitedPPoRf8[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf8(pLab, pporf); + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto status = visitedPPoRf8[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf8(pLab, pporf); + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto status = visitedPPoRf8[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf8(pLab, pporf); + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto status = visitedPPoRf8[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf8(pLab, pporf); + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedPPoRf6[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf6(pLab, pporf); + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedPPoRf6[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf6(pLab, pporf); + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf4[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf4(pLab, pporf); + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf4[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf4(pLab, pporf); + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf5[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf5(pLab, pporf); + } + if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf5[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf5(pLab, pporf); + } + if (auto pLab = tc_pred(g, lab); pLab) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (auto pLab = tj_pred(g, lab); pLab) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (auto pLab = rfe_pred(g, lab); pLab) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (true && llvm::isa(lab))for (auto &p : ctrl_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (true && llvm::isa(lab))for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (true && llvm::isa(lab) && ((llvm::isa(lab) && g.isRMWLoad(lab)) || (llvm::isa(lab) && g.isRMWStore(lab))))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf9[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf9(pLab, pporf); + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf9[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf9(pLab, pporf); + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf9[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf9(pLab, pporf); + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedPPoRf10[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf10(pLab, pporf); + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedPPoRf10[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf10(pLab, pporf); + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedPPoRf10[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf10(pLab, pporf); + } + if (true && llvm::isa(lab) && ((llvm::isa(lab) && g.isRMWLoad(lab)) || (llvm::isa(lab) && g.isRMWStore(lab))))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto status = visitedPPoRf10[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf10(pLab, pporf); + } + if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab) { + auto status = visitedPPoRf1[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf1(pLab, pporf); + } + if (auto pLab = tc_pred(g, lab); pLab) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + if (auto pLab = tj_pred(g, lab); pLab) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + if (auto pLab = rfe_pred(g, lab); pLab) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + if (true && llvm::isa(lab))for (auto &p : ctrl_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + if (true && llvm::isa(lab))for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + if (true && llvm::isa(lab) && ((llvm::isa(lab) && g.isRMWLoad(lab)) || (llvm::isa(lab) && g.isRMWStore(lab))))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf11[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf11(pLab, pporf); + } + visitedPPoRf2[lab->getStamp().get()] = NodeStatus::left; +} + +void RISCVDriver::visitPPoRf3(const EventLabel *lab, DepView &pporf) const +{ + auto &g = getGraph(); + + visitedPPoRf3[lab->getStamp().get()] = NodeStatus::entered; + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedPPoRf3[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf3(pLab, pporf); + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf4[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf4(pLab, pporf); + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf4[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf4(pLab, pporf); + } + visitedPPoRf3[lab->getStamp().get()] = NodeStatus::left; +} + +void RISCVDriver::visitPPoRf4(const EventLabel *lab, DepView &pporf) const +{ + auto &g = getGraph(); + + visitedPPoRf4[lab->getStamp().get()] = NodeStatus::entered; + for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab))if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + visitedPPoRf4[lab->getStamp().get()] = NodeStatus::left; +} + +void RISCVDriver::visitPPoRf5(const EventLabel *lab, DepView &pporf) const +{ + auto &g = getGraph(); + + visitedPPoRf5[lab->getStamp().get()] = NodeStatus::entered; + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab))if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab))if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedPPoRf5[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf5(pLab, pporf); + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + visitedPPoRf5[lab->getStamp().get()] = NodeStatus::left; +} + +void RISCVDriver::visitPPoRf6(const EventLabel *lab, DepView &pporf) const +{ + auto &g = getGraph(); + + visitedPPoRf6[lab->getStamp().get()] = NodeStatus::entered; + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedPPoRf6[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf6(pLab, pporf); + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf5[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf5(pLab, pporf); + } + visitedPPoRf6[lab->getStamp().get()] = NodeStatus::left; +} + +void RISCVDriver::visitPPoRf7(const EventLabel *lab, DepView &pporf) const +{ + auto &g = getGraph(); + + visitedPPoRf7[lab->getStamp().get()] = NodeStatus::entered; + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire())if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease())if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC())if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + visitedPPoRf7[lab->getStamp().get()] = NodeStatus::left; +} + +void RISCVDriver::visitPPoRf8(const EventLabel *lab, DepView &pporf) const +{ + auto &g = getGraph(); + + visitedPPoRf8[lab->getStamp().get()] = NodeStatus::entered; + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab))))if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + visitedPPoRf8[lab->getStamp().get()] = NodeStatus::left; +} + +void RISCVDriver::visitPPoRf9(const EventLabel *lab, DepView &pporf) const +{ + auto &g = getGraph(); + + visitedPPoRf9[lab->getStamp().get()] = NodeStatus::entered; + pporf.updateIdx(lab->getPos()); + if (auto pLab = po_imm_pred(g, lab); pLab)if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf9[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf9(pLab, pporf); + } + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + visitedPPoRf9[lab->getStamp().get()] = NodeStatus::left; +} + +void RISCVDriver::visitPPoRf10(const EventLabel *lab, DepView &pporf) const +{ + auto &g = getGraph(); + + visitedPPoRf10[lab->getStamp().get()] = NodeStatus::entered; + if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { + auto status = visitedPPoRf8[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf8(pLab, pporf); + } + if (auto pLab = po_imm_pred(g, lab); pLab) { + auto status = visitedPPoRf10[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf10(pLab, pporf); + } + visitedPPoRf10[lab->getStamp().get()] = NodeStatus::left; +} + +void RISCVDriver::visitPPoRf11(const EventLabel *lab, DepView &pporf) const +{ + auto &g = getGraph(); + + visitedPPoRf11[lab->getStamp().get()] = NodeStatus::entered; + for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab))if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab))if (pporf.updateIdx(pLab->getPos()); true) { + auto status = visitedPPoRf0[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf0(pLab, pporf); + } + for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf7[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf7(pLab, pporf); + } + for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { + auto status = visitedPPoRf2[pLab->getStamp().get()]; + if (status == NodeStatus::unseen) + visitPPoRf2(pLab, pporf); + } + visitedPPoRf11[lab->getStamp().get()] = NodeStatus::left; +} + +DepView RISCVDriver::calcPPoRfBefore(const EventLabel *lab) const +{ + auto &g = getGraph(); + DepView pporf; + pporf.updateIdx(lab->getPos()); + visitedPPoRf0.clear(); + visitedPPoRf0.resize(g.getMaxStamp().get() + 1, NodeStatus::unseen); + visitedPPoRf1.clear(); + visitedPPoRf1.resize(g.getMaxStamp().get() + 1, NodeStatus::unseen); + visitedPPoRf2.clear(); + visitedPPoRf2.resize(g.getMaxStamp().get() + 1, NodeStatus::unseen); + visitedPPoRf3.clear(); + visitedPPoRf3.resize(g.getMaxStamp().get() + 1, NodeStatus::unseen); + visitedPPoRf4.clear(); + visitedPPoRf4.resize(g.getMaxStamp().get() + 1, NodeStatus::unseen); + visitedPPoRf5.clear(); + visitedPPoRf5.resize(g.getMaxStamp().get() + 1, NodeStatus::unseen); + visitedPPoRf6.clear(); + visitedPPoRf6.resize(g.getMaxStamp().get() + 1, NodeStatus::unseen); + visitedPPoRf7.clear(); + visitedPPoRf7.resize(g.getMaxStamp().get() + 1, NodeStatus::unseen); + visitedPPoRf8.clear(); + visitedPPoRf8.resize(g.getMaxStamp().get() + 1, NodeStatus::unseen); + visitedPPoRf9.clear(); + visitedPPoRf9.resize(g.getMaxStamp().get() + 1, NodeStatus::unseen); + visitedPPoRf10.clear(); + visitedPPoRf10.resize(g.getMaxStamp().get() + 1, NodeStatus::unseen); + visitedPPoRf11.clear(); + visitedPPoRf11.resize(g.getMaxStamp().get() + 1, NodeStatus::unseen); + + visitPPoRf2(lab, pporf); + visitPPoRf7(lab, pporf); + return pporf; +} +std::unique_ptr RISCVDriver::calculatePrefixView(const EventLabel *lab) const +{ + return std::make_unique(calcPPoRfBefore(lab)); +} + diff --git a/code/RISCVDriver.hpp b/code/RISCVDriver.hpp new file mode 100644 index 0000000..e15121d --- /dev/null +++ b/code/RISCVDriver.hpp @@ -0,0 +1,313 @@ +/* + * GenMC -- Generic Model Checking. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you can access it online at + * http://www.gnu.org/licenses/gpl-3.0.html. + * + * Author: Michalis Kokologiannakis + */ + +/******************************************************************************* + * CAUTION: This file is generated automatically by Kater -- DO NOT EDIT. + *******************************************************************************/ + +#ifndef GENMC_RISCV_DRIVER_HPP +#define GENMC_RISCV_DRIVER_HPP + +#include "config.h" +#include "ADT/VSet.hpp" +#include "ExecutionGraph/ExecutionGraph.hpp" +#include "ExecutionGraph/GraphIterators.hpp" +#include "ExecutionGraph/MaximalIterator.hpp" +#include "Verification/GenMCDriver.hpp" +#include "Verification/VerificationError.hpp" +#include +#include + +class RISCVDriver : public GenMCDriver { + +private: + enum class NodeStatus : unsigned char { unseen, entered, left }; + + struct NodeVisitStatus { + NodeVisitStatus() = default; + NodeVisitStatus(uint32_t c, NodeStatus s) : count(c), status(s) {} + uint32_t count{}; + NodeStatus status{}; + }; + +public: + RISCVDriver(std::shared_ptr conf, std::unique_ptr mod, + std::unique_ptr MI, GenMCDriver::Mode mode = GenMCDriver::VerificationMode{}); + + void calculateSaved(EventLabel *lab); + void calculateViews(EventLabel *lab); + void updateMMViews(EventLabel *lab) override; + bool isDepTracking() const override; + bool isConsistent(const EventLabel *lab) const override; + VerificationError checkErrors(const EventLabel *lab, const EventLabel *&race) const override; + std::vector checkWarnings(const EventLabel *lab, const VSet &seenWarnings, std::vector &racyLabs) const; + std::unique_ptr calculatePrefixView(const EventLabel *lab) const override; + const View &getHbView(const EventLabel *lab) const override; + std::vector getCoherentStores(SAddr addr, Event read) override; + std::vector getCoherentRevisits(const WriteLabel *sLab, const VectorClock &pporf) override; + std::vector getCoherentPlacings(SAddr addr, Event store, bool isRMW) override; + +private: + bool isWriteRfBefore(Event a, Event b); + std::vector getInitRfsAtLoc(SAddr addr); + bool isHbOptRfBefore(const Event e, const Event write); + ExecutionGraph::co_iterator splitLocMOBefore(SAddr addr, Event e); + ExecutionGraph::co_iterator splitLocMOAfterHb(SAddr addr, const Event read); + ExecutionGraph::co_iterator splitLocMOAfter(SAddr addr, const Event e); + std::vector getMOOptRfAfter(const WriteLabel *sLab); + std::vector getMOInvOptRfAfter(const WriteLabel *sLab); + mutable const EventLabel *cexLab{}; + + mutable std::vector visitedCalc89_0; + mutable std::vector visitedCalc89_1; + mutable std::vector visitedCalc89_2; + mutable std::vector visitedCalc89_3; + mutable std::vector visitedCalc89_4; + mutable std::vector visitedCalc89_5; + mutable std::vector visitedCalc89_6; + mutable std::vector visitedCalc89_7; + mutable std::vector visitedCalc89_8; + mutable std::vector visitedCalc89_9; + mutable std::vector visitedCalc89_10; + mutable std::vector visitedCalc89_11; + mutable std::vector visitedCalc89_12; + + bool visitCalc89_0(const EventLabel *lab, View &calcRes) const; + bool visitCalc89_1(const EventLabel *lab, View &calcRes) const; + bool visitCalc89_2(const EventLabel *lab, View &calcRes) const; + bool visitCalc89_3(const EventLabel *lab, View &calcRes) const; + bool visitCalc89_4(const EventLabel *lab, View &calcRes) const; + bool visitCalc89_5(const EventLabel *lab, View &calcRes) const; + bool visitCalc89_6(const EventLabel *lab, View &calcRes) const; + bool visitCalc89_7(const EventLabel *lab, View &calcRes) const; + bool visitCalc89_8(const EventLabel *lab, View &calcRes) const; + bool visitCalc89_9(const EventLabel *lab, View &calcRes) const; + bool visitCalc89_10(const EventLabel *lab, View &calcRes) const; + bool visitCalc89_11(const EventLabel *lab, View &calcRes) const; + bool visitCalc89_12(const EventLabel *lab, View &calcRes) const; + + View visitCalc89(const EventLabel *lab) const; + const View&getHbStableView(const EventLabel *lab) const { return lab->view(0); } + + auto checkCalc89(const EventLabel *lab) const; + mutable std::vector visitedCalc94_0; + mutable std::vector visitedCalc94_1; + mutable std::vector visitedCalc94_2; + mutable std::vector visitedCalc94_3; + + bool visitCalc94_0(const EventLabel *lab, View &calcRes) const; + bool visitCalc94_1(const EventLabel *lab, View &calcRes) const; + bool visitCalc94_2(const EventLabel *lab, View &calcRes) const; + bool visitCalc94_3(const EventLabel *lab, View &calcRes) const; + + View visitCalc94(const EventLabel *lab) const; + const View&getPorfStableView(const EventLabel *lab) const { return lab->view(1); } + + auto checkCalc94(const EventLabel *lab) const; + mutable std::vector visitedCoherence_0; + mutable std::vector visitedCoherence_1; + mutable std::vector visitedCoherence_2; + mutable std::vector visitedCoherence_3; + mutable std::vector visitedCoherence_4; + mutable std::vector visitedCoherence_5; + mutable std::vector visitedCoherence_6; + mutable std::vector visitedCoherence_7; + mutable std::vector visitedCoherence_8; + mutable std::vector visitedCoherence_9; + mutable std::vector visitedCoherence_10; + mutable std::vector visitedCoherence_11; + mutable uint32_t visitedCoherenceAccepting; + + bool visitCoherence_0(const EventLabel *lab) const; + bool visitCoherence_1(const EventLabel *lab) const; + bool visitCoherence_2(const EventLabel *lab) const; + bool visitCoherence_3(const EventLabel *lab) const; + bool visitCoherence_4(const EventLabel *lab) const; + bool visitCoherence_5(const EventLabel *lab) const; + bool visitCoherence_6(const EventLabel *lab) const; + bool visitCoherence_7(const EventLabel *lab) const; + bool visitCoherence_8(const EventLabel *lab) const; + bool visitCoherence_9(const EventLabel *lab) const; + bool visitCoherence_10(const EventLabel *lab) const; + bool visitCoherence_11(const EventLabel *lab) const; + + bool visitCoherenceFull() const; + + mutable std::vector visitedConsAcyclic1_0; + mutable std::vector visitedConsAcyclic1_1; + mutable std::vector visitedConsAcyclic1_2; + mutable std::vector visitedConsAcyclic1_3; + mutable std::vector visitedConsAcyclic1_4; + mutable std::vector visitedConsAcyclic1_5; + mutable std::vector visitedConsAcyclic1_6; + mutable std::vector visitedConsAcyclic1_7; + mutable std::vector visitedConsAcyclic1_8; + mutable std::vector visitedConsAcyclic1_9; + mutable std::vector visitedConsAcyclic1_10; + mutable uint32_t visitedConsAcyclic1Accepting; + + bool visitConsAcyclic1_0(const EventLabel *lab) const; + bool visitConsAcyclic1_1(const EventLabel *lab) const; + bool visitConsAcyclic1_2(const EventLabel *lab) const; + bool visitConsAcyclic1_3(const EventLabel *lab) const; + bool visitConsAcyclic1_4(const EventLabel *lab) const; + bool visitConsAcyclic1_5(const EventLabel *lab) const; + bool visitConsAcyclic1_6(const EventLabel *lab) const; + bool visitConsAcyclic1_7(const EventLabel *lab) const; + bool visitConsAcyclic1_8(const EventLabel *lab) const; + bool visitConsAcyclic1_9(const EventLabel *lab) const; + bool visitConsAcyclic1_10(const EventLabel *lab) const; + + bool visitConsAcyclic1(const EventLabel *lab) const; + + bool visitConsAcyclic1Full() const; + + bool checkUnlessConsAcyclic1(const EventLabel *lab) { return false; } + bool checkConsAcyclic1(const EventLabel *lab) const; + bool visitError2(const EventLabel *lab) const; + mutable std::vector visitedLHSUnlessError2_0; + mutable std::vector visitedLHSUnlessError2_1; + + bool visitLHSUnlessError2_0(const EventLabel *lab, const View &v) const; + bool visitLHSUnlessError2_1(const EventLabel *lab, const View &v) const; + + mutable std::vector visitedLHSUnlessError2Accepting; + bool visitUnlessError2(const EventLabel *lab) const; + bool checkError2(const EventLabel *lab) const; + bool visitError3(const EventLabel *lab) const; + mutable std::vector visitedLHSUnlessError3_0; + mutable std::vector visitedLHSUnlessError3_1; + + bool visitLHSUnlessError3_0(const EventLabel *lab) const; + bool visitLHSUnlessError3_1(const EventLabel *lab) const; + + + + mutable std::vector visitedLHSUnlessError3Accepting; + mutable std::vector visitedRHSUnlessError3Accepting; + bool visitUnlessError3(const EventLabel *lab) const; + bool checkError3(const EventLabel *lab) const; + bool visitError4(const EventLabel *lab) const; + mutable std::vector visitedLHSUnlessError4_0; + mutable std::vector visitedLHSUnlessError4_1; + mutable std::vector visitedLHSUnlessError4_2; + + bool visitLHSUnlessError4_0(const EventLabel *lab, const View &v) const; + bool visitLHSUnlessError4_1(const EventLabel *lab, const View &v) const; + bool visitLHSUnlessError4_2(const EventLabel *lab, const View &v) const; + + mutable std::vector visitedLHSUnlessError4Accepting; + bool visitUnlessError4(const EventLabel *lab) const; + bool checkError4(const EventLabel *lab) const; + bool visitError5(const EventLabel *lab) const; + mutable std::vector visitedLHSUnlessError5_0; + mutable std::vector visitedLHSUnlessError5_1; + mutable std::vector visitedLHSUnlessError5_2; + + bool visitLHSUnlessError5_0(const EventLabel *lab) const; + bool visitLHSUnlessError5_1(const EventLabel *lab) const; + bool visitLHSUnlessError5_2(const EventLabel *lab) const; + + + + mutable std::vector visitedLHSUnlessError5Accepting; + mutable std::vector visitedRHSUnlessError5Accepting; + bool visitUnlessError5(const EventLabel *lab) const; + bool checkError5(const EventLabel *lab) const; + bool visitError6(const EventLabel *lab) const; + mutable std::vector visitedLHSUnlessError6_0; + mutable std::vector visitedLHSUnlessError6_1; + mutable std::vector visitedLHSUnlessError6_2; + + bool visitLHSUnlessError6_0(const EventLabel *lab, const View &v) const; + bool visitLHSUnlessError6_1(const EventLabel *lab, const View &v) const; + bool visitLHSUnlessError6_2(const EventLabel *lab, const View &v) const; + + mutable std::vector visitedLHSUnlessError6Accepting; + bool visitUnlessError6(const EventLabel *lab) const; + bool checkError6(const EventLabel *lab) const; + bool visitError7(const EventLabel *lab) const; + mutable std::vector visitedLHSUnlessError7_0; + mutable std::vector visitedLHSUnlessError7_1; + mutable std::vector visitedLHSUnlessError7_2; + + bool visitLHSUnlessError7_0(const EventLabel *lab) const; + bool visitLHSUnlessError7_1(const EventLabel *lab) const; + bool visitLHSUnlessError7_2(const EventLabel *lab) const; + + + + mutable std::vector visitedLHSUnlessError7Accepting; + mutable std::vector visitedRHSUnlessError7Accepting; + bool visitUnlessError7(const EventLabel *lab) const; + bool checkError7(const EventLabel *lab) const; + bool visitError8(const EventLabel *lab) const; + mutable std::vector visitedLHSUnlessError8_0; + mutable std::vector visitedLHSUnlessError8_1; + + bool visitLHSUnlessError8_0(const EventLabel *lab, const View &v) const; + bool visitLHSUnlessError8_1(const EventLabel *lab, const View &v) const; + + mutable std::vector visitedLHSUnlessError8Accepting; + bool visitUnlessError8(const EventLabel *lab) const; + bool checkError8(const EventLabel *lab) const; + bool visitWarning9(const EventLabel *lab) const; + mutable std::vector visitedLHSUnlessWarning9_0; + mutable std::vector visitedLHSUnlessWarning9_1; + + bool visitLHSUnlessWarning9_0(const EventLabel *lab, const View &v) const; + bool visitLHSUnlessWarning9_1(const EventLabel *lab, const View &v) const; + + mutable std::vector visitedLHSUnlessWarning9Accepting; + bool visitUnlessWarning9(const EventLabel *lab) const; + bool checkWarning9(const EventLabel *lab) const; + + void visitPPoRf0(const EventLabel *lab, DepView &pporf) const; + void visitPPoRf1(const EventLabel *lab, DepView &pporf) const; + void visitPPoRf2(const EventLabel *lab, DepView &pporf) const; + void visitPPoRf3(const EventLabel *lab, DepView &pporf) const; + void visitPPoRf4(const EventLabel *lab, DepView &pporf) const; + void visitPPoRf5(const EventLabel *lab, DepView &pporf) const; + void visitPPoRf6(const EventLabel *lab, DepView &pporf) const; + void visitPPoRf7(const EventLabel *lab, DepView &pporf) const; + void visitPPoRf8(const EventLabel *lab, DepView &pporf) const; + void visitPPoRf9(const EventLabel *lab, DepView &pporf) const; + void visitPPoRf10(const EventLabel *lab, DepView &pporf) const; + void visitPPoRf11(const EventLabel *lab, DepView &pporf) const; + + DepView calcPPoRfBefore(const EventLabel *lab) const; + + mutable std::vector visitedPPoRf0; + mutable std::vector visitedPPoRf1; + mutable std::vector visitedPPoRf2; + mutable std::vector visitedPPoRf3; + mutable std::vector visitedPPoRf4; + mutable std::vector visitedPPoRf5; + mutable std::vector visitedPPoRf6; + mutable std::vector visitedPPoRf7; + mutable std::vector visitedPPoRf8; + mutable std::vector visitedPPoRf9; + mutable std::vector visitedPPoRf10; + mutable std::vector visitedPPoRf11; + + +}; + +#endif /* GENMC_RISCV_DRIVER_HPP */ diff --git a/kat/riscv-genmc.kat b/kat/riscv-genmc.kat index 88cbb38..0ddab26 100644 --- a/kat/riscv-genmc.kat +++ b/kat/riscv-genmc.kat @@ -15,9 +15,12 @@ let fence_tso = ([W]; po; [F]; po; [W]) | ([R]; po; [F]; po; [R|W]) let amo = rmw let riscv_rmw = amo -let rdw = fre ; po-loc ;rfe -let AQ = [R ; ACQ] -let RL = [W ; REL] +let rdw = [R];po-loc;[R];([W]; fre; [W])?; rfe +let AcqRel = [ACQ] | [REL] | [SC] +let AQ = [ACQ] | [AcqRel] +let RL = [REL] | [AcqRel] +let RCsc_test = [ACQ] | [REL] | [AcqRel] | [amo] +let RCsc = [RCsc_test] let fence = fence_r_r|fence_r_w|fence_r_rw |fence_w_r|fence_w_w|fence_w_rw @@ -26,13 +29,13 @@ let fence = fence_r_r|fence_r_w|fence_r_rw // Overlapping-Address Orderings let r1 = [R|W];po-loc;[W] -let r2 = [R];po-loc;[R] +let r2 = rdw let r3 = [amo|UW];rfi;[R] // Explicit Synchronization let r4 = fence let r5 = [AQ];po let r6 = po;[RL] -let r7 = [RL];po;[AQ] +let r7 = [RCsc]; po; [RCsc] let r8 = riscv_rmw // Syntactic Dependencies let r9 = addr From 9e3980f961b16806524fc60ffd16dbba316c58a1 Mon Sep 17 00:00:00 2001 From: lrlrl Date: Tue, 26 Aug 2025 20:48:19 +0800 Subject: [PATCH 3/3] update r2 rule Signed-off-by: Jia Geng Signed-off-by: lrlrl --- code/RISCVDriver.cpp | 5105 ------------------------------------------ code/RISCVDriver.hpp | 313 --- kat/riscv-genmc.kat | 4 +- 3 files changed, 2 insertions(+), 5420 deletions(-) delete mode 100644 code/RISCVDriver.cpp delete mode 100644 code/RISCVDriver.hpp diff --git a/code/RISCVDriver.cpp b/code/RISCVDriver.cpp deleted file mode 100644 index f067379..0000000 --- a/code/RISCVDriver.cpp +++ /dev/null @@ -1,5105 +0,0 @@ -/* - * GenMC -- Generic Model Checking. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you can access it online at - * http://www.gnu.org/licenses/gpl-3.0.html. - * - * Author: Michalis Kokologiannakis - */ - -/******************************************************************************* - * CAUTION: This file is generated automatically by Kater -- DO NOT EDIT. - *******************************************************************************/ - -#include "RISCVDriver.hpp" -#include "Static/ModuleInfo.hpp" - -RISCVDriver::RISCVDriver(std::shared_ptr conf, std::unique_ptr mod, - std::unique_ptr MI, GenMCDriver::Mode mode /* = GenMCDriver::VerificationMode{} */) - : GenMCDriver(conf, std::move(mod), std::move(MI), mode) {} - -bool RISCVDriver::isDepTracking() const -{ - return 1; -} - -bool RISCVDriver::visitCalc89_0(const EventLabel *lab, View &calcRes) const -{ - auto &g = getGraph(); - - - - - return true; -} - -bool RISCVDriver::visitCalc89_1(const EventLabel *lab, View &calcRes) const -{ - auto &g = getGraph(); - - - if (auto pLab = lab; true)if (calcRes.update(pLab->view(0)); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - - return true; -} - -bool RISCVDriver::visitCalc89_2(const EventLabel *lab, View &calcRes) const -{ - auto &g = getGraph(); - - if (visitedCalc89_2[lab->getStamp().get()] != NodeStatus::unseen) - return true; - visitedCalc89_2[lab->getStamp().get()] = NodeStatus::entered; - - if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = poloc_imm_pred(g, lab); pLab) { - auto status = visitedCalc89_2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) { - if (!visitCalc89_2(pLab, calcRes)){ - return false; - } - - } else if (status == NodeStatus::entered) { - - } else if (status == NodeStatus::left) { - - } - } - if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab))if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab))if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - - visitedCalc89_2[lab->getStamp().get()] = NodeStatus::left; - return true; -} - -bool RISCVDriver::visitCalc89_3(const EventLabel *lab, View &calcRes) const -{ - auto &g = getGraph(); - - - if (true && llvm::isa(lab))for (auto &p : ctrl_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (true && llvm::isa(lab))for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (true && llvm::isa(lab) && ((llvm::isa(lab) && g.isRMWLoad(lab)) || (llvm::isa(lab) && g.isRMWStore(lab))))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto status = visitedCalc89_6[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) { - if (!visitCalc89_6(pLab, calcRes)){ - return false; - } - - } else if (status == NodeStatus::entered) { - - } else if (status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto status = visitedCalc89_6[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) { - if (!visitCalc89_6(pLab, calcRes)){ - return false; - } - - } else if (status == NodeStatus::entered) { - - } else if (status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedCalc89_7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) { - if (!visitCalc89_7(pLab, calcRes)){ - return false; - } - - } else if (status == NodeStatus::entered) { - - } else if (status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedCalc89_7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) { - if (!visitCalc89_7(pLab, calcRes)){ - return false; - } - - } else if (status == NodeStatus::entered) { - - } else if (status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedCalc89_5[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) { - if (!visitCalc89_5(pLab, calcRes)){ - return false; - } - - } else if (status == NodeStatus::entered) { - - } else if (status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab) { - auto status = visitedCalc89_2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) { - if (!visitCalc89_2(pLab, calcRes)){ - return false; - } - - } else if (status == NodeStatus::entered) { - - } else if (status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - if (!visitCalc89_4(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - if (!visitCalc89_4(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - if (!visitCalc89_4(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - if (!visitCalc89_4(pLab, calcRes)){ - return false; - } - - } - if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - if (!visitCalc89_11(pLab, calcRes)){ - return false; - } - - } - if (true && llvm::isa(lab))for (auto &p : ctrl_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (true && llvm::isa(lab))for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab))))if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab))if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab))if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire())if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease())if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC())if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire())if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease())if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC())if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire())if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease())if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC())if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (true && llvm::isa(lab) && ((llvm::isa(lab) && g.isRMWLoad(lab)) || (llvm::isa(lab) && g.isRMWStore(lab))))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab))))if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - if (!visitCalc89_12(pLab, calcRes)){ - return false; - } - - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - if (!visitCalc89_12(pLab, calcRes)){ - return false; - } - - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedCalc89_10[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) { - if (!visitCalc89_10(pLab, calcRes)){ - return false; - } - - } else if (status == NodeStatus::entered) { - - } else if (status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedCalc89_10[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) { - if (!visitCalc89_10(pLab, calcRes)){ - return false; - } - - } else if (status == NodeStatus::entered) { - - } else if (status == NodeStatus::left) { - - } - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedCalc89_10[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) { - if (!visitCalc89_10(pLab, calcRes)){ - return false; - } - - } else if (status == NodeStatus::entered) { - - } else if (status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab) && ((llvm::isa(lab) && g.isRMWLoad(lab)) || (llvm::isa(lab) && g.isRMWStore(lab))))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto status = visitedCalc89_10[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) { - if (!visitCalc89_10(pLab, calcRes)){ - return false; - } - - } else if (status == NodeStatus::entered) { - - } else if (status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedCalc89_9[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) { - if (!visitCalc89_9(pLab, calcRes)){ - return false; - } - - } else if (status == NodeStatus::entered) { - - } else if (status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedCalc89_9[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) { - if (!visitCalc89_9(pLab, calcRes)){ - return false; - } - - } else if (status == NodeStatus::entered) { - - } else if (status == NodeStatus::left) { - - } - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedCalc89_9[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) { - if (!visitCalc89_9(pLab, calcRes)){ - return false; - } - - } else if (status == NodeStatus::entered) { - - } else if (status == NodeStatus::left) { - - } - } - - return true; -} - -bool RISCVDriver::visitCalc89_4(const EventLabel *lab, View &calcRes) const -{ - auto &g = getGraph(); - - - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab))))if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - - return true; -} - -bool RISCVDriver::visitCalc89_5(const EventLabel *lab, View &calcRes) const -{ - auto &g = getGraph(); - - if (visitedCalc89_5[lab->getStamp().get()] != NodeStatus::unseen) - return true; - visitedCalc89_5[lab->getStamp().get()] = NodeStatus::entered; - - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedCalc89_5[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) { - if (!visitCalc89_5(pLab, calcRes)){ - return false; - } - - } else if (status == NodeStatus::entered) { - - } else if (status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - if (!visitCalc89_12(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - if (!visitCalc89_12(pLab, calcRes)){ - return false; - } - - } - - visitedCalc89_5[lab->getStamp().get()] = NodeStatus::left; - return true; -} - -bool RISCVDriver::visitCalc89_6(const EventLabel *lab, View &calcRes) const -{ - auto &g = getGraph(); - - if (visitedCalc89_6[lab->getStamp().get()] != NodeStatus::unseen) - return true; - visitedCalc89_6[lab->getStamp().get()] = NodeStatus::entered; - - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedCalc89_6[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) { - if (!visitCalc89_6(pLab, calcRes)){ - return false; - } - - } else if (status == NodeStatus::entered) { - - } else if (status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab))if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab))if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - - visitedCalc89_6[lab->getStamp().get()] = NodeStatus::left; - return true; -} - -bool RISCVDriver::visitCalc89_7(const EventLabel *lab, View &calcRes) const -{ - auto &g = getGraph(); - - if (visitedCalc89_7[lab->getStamp().get()] != NodeStatus::unseen) - return true; - visitedCalc89_7[lab->getStamp().get()] = NodeStatus::entered; - - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto status = visitedCalc89_6[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) { - if (!visitCalc89_6(pLab, calcRes)){ - return false; - } - - } else if (status == NodeStatus::entered) { - - } else if (status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedCalc89_7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) { - if (!visitCalc89_7(pLab, calcRes)){ - return false; - } - - } else if (status == NodeStatus::entered) { - - } else if (status == NodeStatus::left) { - - } - } - - visitedCalc89_7[lab->getStamp().get()] = NodeStatus::left; - return true; -} - -bool RISCVDriver::visitCalc89_8(const EventLabel *lab, View &calcRes) const -{ - auto &g = getGraph(); - - - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire())if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease())if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC())if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = po_imm_pred(g, lab); pLab) { - if (!visitCalc89_8(pLab, calcRes)){ - return false; - } - - } - - return true; -} - -bool RISCVDriver::visitCalc89_9(const EventLabel *lab, View &calcRes) const -{ - auto &g = getGraph(); - - if (visitedCalc89_9[lab->getStamp().get()] != NodeStatus::unseen) - return true; - visitedCalc89_9[lab->getStamp().get()] = NodeStatus::entered; - - if (auto pLab = po_imm_pred(g, lab); pLab) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedCalc89_9[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) { - if (!visitCalc89_9(pLab, calcRes)){ - return false; - } - - } else if (status == NodeStatus::entered) { - - } else if (status == NodeStatus::left) { - - } - } - - visitedCalc89_9[lab->getStamp().get()] = NodeStatus::left; - return true; -} - -bool RISCVDriver::visitCalc89_10(const EventLabel *lab, View &calcRes) const -{ - auto &g = getGraph(); - - if (visitedCalc89_10[lab->getStamp().get()] != NodeStatus::unseen) - return true; - visitedCalc89_10[lab->getStamp().get()] = NodeStatus::entered; - - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - if (!visitCalc89_4(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire())if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease())if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC())if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedCalc89_10[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) { - if (!visitCalc89_10(pLab, calcRes)){ - return false; - } - - } else if (status == NodeStatus::entered) { - - } else if (status == NodeStatus::left) { - - } - } - - visitedCalc89_10[lab->getStamp().get()] = NodeStatus::left; - return true; -} - -bool RISCVDriver::visitCalc89_11(const EventLabel *lab, View &calcRes) const -{ - auto &g = getGraph(); - - - for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab))if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab))if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - - return true; -} - -bool RISCVDriver::visitCalc89_12(const EventLabel *lab, View &calcRes) const -{ - auto &g = getGraph(); - - - for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { - if (!visitCalc89_1(pLab, calcRes)){ - return false; - } - - } - for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab))if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc89_0(pLab, calcRes)){ - return false; - } - - } - - return true; -} - -View RISCVDriver::visitCalc89(const EventLabel *lab) const -{ - auto &g = getGraph(); - View calcRes; - - visitedCalc89_2.clear(); - visitedCalc89_2.resize(g.getMaxStamp().get() + 1); - visitedCalc89_5.clear(); - visitedCalc89_5.resize(g.getMaxStamp().get() + 1); - visitedCalc89_6.clear(); - visitedCalc89_6.resize(g.getMaxStamp().get() + 1); - visitedCalc89_7.clear(); - visitedCalc89_7.resize(g.getMaxStamp().get() + 1); - visitedCalc89_9.clear(); - visitedCalc89_9.resize(g.getMaxStamp().get() + 1); - visitedCalc89_10.clear(); - visitedCalc89_10.resize(g.getMaxStamp().get() + 1); - - visitCalc89_3(lab, calcRes); - visitCalc89_8(lab, calcRes); - return calcRes; -} -auto RISCVDriver::checkCalc89(const EventLabel *lab) const -{ - auto &g = getGraph(); - - return visitCalc89(lab); -} -bool RISCVDriver::visitCalc94_0(const EventLabel *lab, View &calcRes) const -{ - auto &g = getGraph(); - - - - - return true; -} - -bool RISCVDriver::visitCalc94_1(const EventLabel *lab, View &calcRes) const -{ - auto &g = getGraph(); - - - if (auto pLab = lab; true)if (calcRes.update(pLab->view(1)); true) { - if (!visitCalc94_0(pLab, calcRes)){ - return false; - } - - } - - return true; -} - -bool RISCVDriver::visitCalc94_2(const EventLabel *lab, View &calcRes) const -{ - auto &g = getGraph(); - - - if (auto pLab = po_imm_pred(g, lab); pLab) { - if (!visitCalc94_1(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = po_imm_pred(g, lab); pLab) { - if (!visitCalc94_3(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc94_0(pLab, calcRes)){ - return false; - } - - } - - return true; -} - -bool RISCVDriver::visitCalc94_3(const EventLabel *lab, View &calcRes) const -{ - auto &g = getGraph(); - - - if (auto pLab = tc_pred(g, lab); pLab) { - if (!visitCalc94_1(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = tj_pred(g, lab); pLab) { - if (!visitCalc94_1(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = rf_pred(g, lab); pLab) { - if (!visitCalc94_1(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = tc_pred(g, lab); pLab)if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc94_0(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = tj_pred(g, lab); pLab)if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc94_0(pLab, calcRes)){ - return false; - } - - } - if (auto pLab = rf_pred(g, lab); pLab)if (calcRes.updateIdx(pLab->getPos()); true) { - if (!visitCalc94_0(pLab, calcRes)){ - return false; - } - - } - - return true; -} - -View RISCVDriver::visitCalc94(const EventLabel *lab) const -{ - auto &g = getGraph(); - View calcRes; - - - visitCalc94_2(lab, calcRes); - return calcRes; -} -auto RISCVDriver::checkCalc94(const EventLabel *lab) const -{ - auto &g = getGraph(); - - return visitCalc94(lab); -} -void RISCVDriver::calculateSaved(EventLabel *lab) -{ -} - -void RISCVDriver::calculateViews(EventLabel *lab) -{ - lab->addView(checkCalc89(lab)); - lab->addView(checkCalc94(lab)); -} - -void RISCVDriver::updateMMViews(EventLabel *lab) -{ - calculateViews(lab); - calculateSaved(lab); -} - -const View &RISCVDriver::getHbView(const EventLabel *lab) const -{ - return lab->view(0); -} - - -bool RISCVDriver::isWriteRfBefore(Event a, Event b) -{ - auto &g = getGraph(); - auto &before = g.getEventLabel(b)->view(0); - if (before.contains(a)) - return true; - - const EventLabel *lab = g.getEventLabel(a); - - BUG_ON(!llvm::isa(lab)); - auto *wLab = static_cast(lab); - for (auto &rLab : wLab->readers()) - if (before.contains(rLab.getPos())) - return true; - return false; -} - -std::vector -RISCVDriver::getInitRfsAtLoc(SAddr addr) -{ - std::vector result; - - for (const auto &lab : getGraph().labels()) { - if (auto *rLab = llvm::dyn_cast(&lab)) - if (rLab->getRf()->getPos().isInitializer() && rLab->getAddr() == addr) - result.push_back(rLab->getPos()); - } - return result; -} - -bool RISCVDriver::isHbOptRfBefore(const Event e, const Event write) -{ - auto &g = getGraph(); - const EventLabel *lab = g.getEventLabel(write); - - BUG_ON(!llvm::isa(lab)); - auto *sLab = static_cast(lab); - if (sLab->view(0).contains(e)) - return true; - - for (auto &rLab : sLab->readers()) { - if (rLab.view(0).contains(e)) - return true; - } - return false; -} - -ExecutionGraph::co_iterator -RISCVDriver::splitLocMOBefore(SAddr addr, Event e) -{ - auto &g = getGraph(); - auto rit = std::find_if(g.co_rbegin(addr), g.co_rend(addr), [&](auto &lab){ - return isWriteRfBefore(lab.getPos(), e); - }); - /* Convert to forward iterator, but be _really_ careful */ - if (rit == g.co_rend(addr)) - return g.co_begin(addr); - return ++ExecutionGraph::co_iterator(*rit); -} - -ExecutionGraph::co_iterator -RISCVDriver::splitLocMOAfterHb(SAddr addr, const Event read) -{ - auto &g = getGraph(); - - auto initRfs = g.getInitRfsAtLoc(addr); - if (std::any_of(initRfs.begin(), initRfs.end(), [&read,&g](const Event &rf){ - return g.getEventLabel(rf)->view(0).contains(read); - })) - return g.co_begin(addr); - - auto it = std::find_if(g.co_begin(addr), g.co_end(addr), [&](auto &lab){ - return isHbOptRfBefore(read, lab.getPos()); - }); - if (it == g.co_end(addr) || it->view(0).contains(read)) - return it; - return ++it; -} - -ExecutionGraph::co_iterator -RISCVDriver::splitLocMOAfter(SAddr addr, const Event e) -{ - auto &g = getGraph(); - return std::find_if(g.co_begin(addr), g.co_end(addr), [&](auto &lab){ - return isHbOptRfBefore(e, lab.getPos()); - }); -} - -std::vector -RISCVDriver::getCoherentStores(SAddr addr, Event read) -{ - auto &g = getGraph(); - std::vector stores; - - /* Fastpath: co_max(G) is po-before R */ - auto comax = g.co_rbegin(addr) == g.co_rend(addr) ? Event::getInit() : - g.co_rbegin(addr)->getPos(); - if (comax.thread == read.thread && comax.index < read.index) - return {comax}; - - /* - * If there are no stores (rf?;hb)-before the current event - * then we can read read from all concurrent stores and the - * initializer store. Otherwise, we can read from all concurrent - * stores and the mo-latest of the (rf?;hb)-before stores. - */ - auto begIt = splitLocMOBefore(addr, read); - if (begIt == g.co_begin(addr)) - stores.push_back(Event::getInit()); - else { - stores.push_back((--begIt)->getPos()); - ++begIt; - } - - /* - * If the model supports out-of-order execution we have to also - * account for the possibility the read is hb-before some other - * store, or some read that reads from a store. - */ - auto endIt = (isDepTracking()) ? splitLocMOAfterHb(addr, read) : g.co_end(addr); - std::transform(begIt, endIt, std::back_inserter(stores), [&](auto &lab){ - return lab.getPos(); - }); - return stores; -} - -std::vector -RISCVDriver::getMOOptRfAfter(const WriteLabel *sLab) -{ - std::vector after; - std::vector rfAfter; - - const auto &g = getGraph(); - std::for_each(g.co_succ_begin(sLab), g.co_succ_end(sLab), - [&](auto &wLab){ - after.push_back(wLab.getPos()); - std::transform(wLab.readers_begin(), wLab.readers_end(), std::back_inserter(rfAfter), - [&](auto &rLab){ return &rLab; }); - }); - std::transform(rfAfter.begin(), rfAfter.end(), std::back_inserter(after), [](auto *rLab){ - return rLab->getPos(); - }); - return after; -} - -std::vector -RISCVDriver::getMOInvOptRfAfter(const WriteLabel *sLab) -{ - auto &g = getGraph(); - std::vector after; - std::vector rfAfter; - - /* First, add (mo;rf?)-before */ - std::for_each(g.co_pred_begin(sLab), - g.co_pred_end(sLab), [&](auto &wLab){ - after.push_back(wLab.getPos()); - std::transform(wLab.readers_begin(), wLab.readers_end(), std::back_inserter(rfAfter), - [&](auto &rLab){ return &rLab; }); - }); - std::transform(rfAfter.begin(), rfAfter.end(), std::back_inserter(after), [](auto *rLab){ - return rLab->getPos(); - }); - - /* Then, we add the reader list for the initializer */ - auto initRfs = g.getInitRfsAtLoc(sLab->getAddr()); - after.insert(after.end(), initRfs.begin(), initRfs.end()); - return after; -} - -static std::vector -getRevisitableFrom(const ExecutionGraph &g, const WriteLabel *sLab, - const VectorClock &pporf, const WriteLabel *coPred) -{ - auto pendingRMW = g.getPendingRMW(sLab); - std::vector loads; - - for (auto &rLab : coPred->readers()) { - if (!pporf.contains(rLab.getPos()) && rLab.getAddr() == sLab->getAddr() && - rLab.isRevisitable() && rLab.wasAddedMax()) - loads.push_back(rLab.getPos()); - } - if (!pendingRMW.isInitializer()) - loads.erase(std::remove_if(loads.begin(), loads.end(), - [&](Event &e) { - auto *confLab = g.getEventLabel(pendingRMW); - return g.getEventLabel(e)->getStamp() > - confLab->getStamp(); - }), - loads.end()); - return loads; -} - -std::vector -RISCVDriver::getCoherentRevisits(const WriteLabel *sLab, const VectorClock &pporf) -{ - auto &g = getGraph(); - std::vector ls; - - /* Fastpath: previous co-max is ppo-before SLAB */ - auto prevCoMaxIt = std::find_if(g.co_rbegin(sLab->getAddr()), g.co_rend(sLab->getAddr()), - [&](auto &lab) { return lab.getPos() != sLab->getPos(); }); - if (prevCoMaxIt != g.co_rend(sLab->getAddr()) && pporf.contains(prevCoMaxIt->getPos())) { - ls = getRevisitableFrom(g, sLab, pporf, &*prevCoMaxIt); - } else { - ls = g.getRevisitable(sLab, pporf); - } - - /* If this store is po- and mo-maximal then we are done */ - if (!isDepTracking() && g.isCoMaximal(sLab->getAddr(), sLab->getPos())) - return ls; - - /* First, we have to exclude (mo;rf?;hb?;sb)-after reads */ - auto optRfs = getMOOptRfAfter(sLab); - ls.erase(std::remove_if(ls.begin(), ls.end(), [&](Event e) - { const View &before = g.getEventLabel(e)->view(0); - return std::any_of(optRfs.begin(), optRfs.end(), - [&](Event ev) - { return before.contains(ev); }); - }), ls.end()); - - /* If out-of-order event addition is not supported, then we are done - * due to po-maximality */ - if (!isDepTracking()) - return ls; - - /* Otherwise, we also have to exclude hb-before loads */ - ls.erase(std::remove_if(ls.begin(), ls.end(), [&](Event e) - { return g.getEventLabel(sLab->getPos())->view(0).contains(e); }), - ls.end()); - - /* ...and also exclude (mo^-1; rf?; (hb^-1)?; sb^-1)-after reads in - * the resulting graph */ - auto &before = pporf; - auto moInvOptRfs = getMOInvOptRfAfter(sLab); - ls.erase(std::remove_if(ls.begin(), ls.end(), [&](Event e) - { auto *eLab = g.getEventLabel(e); - auto v = g.getViewFromStamp(eLab->getStamp()); - v->update(before); - return std::any_of(moInvOptRfs.begin(), - moInvOptRfs.end(), - [&](Event ev) - { return v->contains(ev) && - g.getEventLabel(ev)->view(0).contains(e); }); - }), - ls.end()); - - return ls; -} - -std::vector -RISCVDriver::getCoherentPlacings(SAddr addr, Event store, bool isRMW) -{ - auto &g = getGraph(); - std::vector result; - - /* If it is an RMW store, there is only one possible position in MO */ - if (isRMW) { - auto *rLab = llvm::dyn_cast(g.getEventLabel(store.prev())); - BUG_ON(!rLab); - auto *rfLab = rLab->getRf(); - BUG_ON(!rfLab); - result.push_back(rfLab->getPos()); - return result; - } - - /* Otherwise, we calculate the full range and add the store */ - auto rangeBegin = splitLocMOBefore(addr, store); - auto rangeEnd = (isDepTracking()) ? splitLocMOAfter(addr, store) : g.co_end(addr); - auto cos = llvm::iterator_range(rangeBegin, rangeEnd) | - std::views::filter([&](auto &sLab) { return !g.isRMWStore(sLab.getPos()); }) | - std::views::transform([&](auto &sLab) { - auto *pLab = g.co_imm_pred(&sLab); - return pLab ? pLab->getPos() : Event::getInit(); - }); - std::ranges::copy(cos, std::back_inserter(result)); - result.push_back(rangeEnd == g.co_end(addr) ? g.co_max(addr)->getPos() - : !g.co_imm_pred(&*rangeEnd) ? Event::getInit() - : g.co_imm_pred(&*rangeEnd)->getPos()); - return result; -} -bool RISCVDriver::visitCoherence_0(const EventLabel *lab) const -{ - auto &g = getGraph(); - - ++visitedCoherenceAccepting; - - - --visitedCoherenceAccepting; - return true; -} - -bool RISCVDriver::visitCoherence_1(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedCoherence_1[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::entered }; - - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedCoherence_8[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_8(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedCoherence_8[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_8(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedCoherence_8[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_8(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedCoherence_4[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_4(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedCoherence_7[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_7(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab) { - auto &node = visitedCoherence_2[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_2(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))for (auto &p : ctrl_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (true && llvm::isa(lab))for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (true && llvm::isa(lab) && ((llvm::isa(lab) && g.isRMWLoad(lab)) || (llvm::isa(lab) && g.isRMWStore(lab))))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto &node = visitedCoherence_3[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_3(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto &node = visitedCoherence_3[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_3(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto &node = visitedCoherence_3[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_3(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto &node = visitedCoherence_3[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_3(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedCoherence_6[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_6(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedCoherence_6[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_6(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedCoherence_11[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_11(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedCoherence_11[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_11(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))for (auto &p : ctrl_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab) && ((llvm::isa(lab) && g.isRMWLoad(lab)) || (llvm::isa(lab) && g.isRMWStore(lab))))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - if (!visitCoherence_10(pLab)){ - return false; - } - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedCoherence_9[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_9(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedCoherence_9[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_9(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedCoherence_9[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_9(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab) && ((llvm::isa(lab) && g.isRMWLoad(lab)) || (llvm::isa(lab) && g.isRMWStore(lab))))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto &node = visitedCoherence_9[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_9(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedCoherence_5[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_5(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedCoherence_5[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_5(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - visitedCoherence_1[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::left }; - return true; -} - -bool RISCVDriver::visitCoherence_2(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedCoherence_2[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::entered }; - - if (auto pLab = poloc_imm_pred(g, lab); pLab) { - auto &node = visitedCoherence_2[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_2(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - visitedCoherence_2[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::left }; - return true; -} - -bool RISCVDriver::visitCoherence_3(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedCoherence_3[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::entered }; - - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - visitedCoherence_3[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::left }; - return true; -} - -bool RISCVDriver::visitCoherence_4(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedCoherence_4[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::entered }; - - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedCoherence_4[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_4(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedCoherence_11[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_11(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedCoherence_11[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_11(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - visitedCoherence_4[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::left }; - return true; -} - -bool RISCVDriver::visitCoherence_5(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedCoherence_5[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::entered }; - - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedCoherence_5[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_5(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - visitedCoherence_5[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::left }; - return true; -} - -bool RISCVDriver::visitCoherence_6(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedCoherence_6[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::entered }; - - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedCoherence_6[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_6(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedCoherence_5[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_5(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - visitedCoherence_6[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::left }; - return true; -} - -bool RISCVDriver::visitCoherence_7(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedCoherence_7[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::entered }; - - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedCoherence_7[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_7(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - visitedCoherence_7[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::left }; - return true; -} - -bool RISCVDriver::visitCoherence_8(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedCoherence_8[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::entered }; - - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedCoherence_8[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_8(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - visitedCoherence_8[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::left }; - return true; -} - -bool RISCVDriver::visitCoherence_9(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedCoherence_9[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::entered }; - - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto &node = visitedCoherence_3[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_3(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedCoherence_9[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_9(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - visitedCoherence_9[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::left }; - return true; -} - -bool RISCVDriver::visitCoherence_10(const EventLabel *lab) const -{ - auto &g = getGraph(); - - - for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - return true; -} - -bool RISCVDriver::visitCoherence_11(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedCoherence_11[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::entered }; - - for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { - if (!visitCoherence_0(pLab)){ - return false; - } - } - for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { - auto &node = visitedCoherence_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitCoherence_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedCoherenceAccepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - visitedCoherence_11[lab->getStamp().get()] = { visitedCoherenceAccepting, NodeStatus::left }; - return true; -} - -bool RISCVDriver::visitCoherenceFull() const -{ - auto &g = getGraph(); - - visitedCoherenceAccepting = 0; - visitedCoherence_1.clear(); - visitedCoherence_1.resize(g.getMaxStamp().get() + 1); - visitedCoherence_2.clear(); - visitedCoherence_2.resize(g.getMaxStamp().get() + 1); - visitedCoherence_3.clear(); - visitedCoherence_3.resize(g.getMaxStamp().get() + 1); - visitedCoherence_4.clear(); - visitedCoherence_4.resize(g.getMaxStamp().get() + 1); - visitedCoherence_5.clear(); - visitedCoherence_5.resize(g.getMaxStamp().get() + 1); - visitedCoherence_6.clear(); - visitedCoherence_6.resize(g.getMaxStamp().get() + 1); - visitedCoherence_7.clear(); - visitedCoherence_7.resize(g.getMaxStamp().get() + 1); - visitedCoherence_8.clear(); - visitedCoherence_8.resize(g.getMaxStamp().get() + 1); - visitedCoherence_9.clear(); - visitedCoherence_9.resize(g.getMaxStamp().get() + 1); - visitedCoherence_11.clear(); - visitedCoherence_11.resize(g.getMaxStamp().get() + 1); - return true - && std::ranges::all_of(g.labels(), [&](auto &lab){ return visitedCoherence_1[lab.getStamp().get()].status != NodeStatus::unseen || visitCoherence_1(&lab); }); -} - -bool RISCVDriver::visitConsAcyclic1_0(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedConsAcyclic1_0[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::entered }; - - if (auto pLab = poloc_imm_pred(g, lab); pLab) { - auto &node = visitedConsAcyclic1_0[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_0(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - visitedConsAcyclic1_0[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::left }; - return true; -} - -bool RISCVDriver::visitConsAcyclic1_1(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedConsAcyclic1_1[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::entered }; - - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - visitedConsAcyclic1_1[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::left }; - return true; -} - -bool RISCVDriver::visitConsAcyclic1_2(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedConsAcyclic1_2[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::entered }; - - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedConsAcyclic1_2[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_2(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - visitedConsAcyclic1_2[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::left }; - return true; -} - -bool RISCVDriver::visitConsAcyclic1_3(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedConsAcyclic1_3[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::entered }; - - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedConsAcyclic1_2[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_2(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedConsAcyclic1_3[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_3(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - visitedConsAcyclic1_3[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::left }; - return true; -} - -bool RISCVDriver::visitConsAcyclic1_4(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedConsAcyclic1_4[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::entered }; - - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedConsAcyclic1_4[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_4(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedConsAcyclic1_9[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_9(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedConsAcyclic1_9[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_9(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - visitedConsAcyclic1_4[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::left }; - return true; -} - -bool RISCVDriver::visitConsAcyclic1_5(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedConsAcyclic1_5[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::entered }; - - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedConsAcyclic1_5[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_5(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - visitedConsAcyclic1_5[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::left }; - return true; -} - -bool RISCVDriver::visitConsAcyclic1_6(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedConsAcyclic1_6[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::entered }; - - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedConsAcyclic1_6[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_6(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - visitedConsAcyclic1_6[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::left }; - return true; -} - -bool RISCVDriver::visitConsAcyclic1_7(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedConsAcyclic1_7[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::entered }; - - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto &node = visitedConsAcyclic1_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedConsAcyclic1_7[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_7(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - visitedConsAcyclic1_7[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::left }; - return true; -} - -bool RISCVDriver::visitConsAcyclic1_8(const EventLabel *lab) const -{ - auto &g = getGraph(); - - - for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - return true; -} - -bool RISCVDriver::visitConsAcyclic1_9(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedConsAcyclic1_9[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::entered }; - - for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - visitedConsAcyclic1_9[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::left }; - return true; -} - -bool RISCVDriver::visitConsAcyclic1_10(const EventLabel *lab) const -{ - auto &g = getGraph(); - - ++visitedConsAcyclic1Accepting; - visitedConsAcyclic1_10[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::entered }; - - - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedConsAcyclic1_2[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_2(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedConsAcyclic1_2[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_2(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedConsAcyclic1_4[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_4(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto &node = visitedConsAcyclic1_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto &node = visitedConsAcyclic1_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto &node = visitedConsAcyclic1_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto &node = visitedConsAcyclic1_1[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_1(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab) { - auto &node = visitedConsAcyclic1_0[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_0(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedConsAcyclic1_7[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_7(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedConsAcyclic1_7[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_7(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedConsAcyclic1_7[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_7(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab) && ((llvm::isa(lab) && g.isRMWLoad(lab)) || (llvm::isa(lab) && g.isRMWStore(lab))))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto &node = visitedConsAcyclic1_7[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_7(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedConsAcyclic1_5[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_5(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedConsAcyclic1_3[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_3(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedConsAcyclic1_3[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_3(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = co_imm_pred(g, lab); pLab) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - for (auto &tmp : fr_imm_preds(g, lab)) if (auto *pLab = &tmp; true) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = rfe_pred(g, lab); pLab) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))for (auto &p : ctrl_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab) && ((llvm::isa(lab) && g.isRMWLoad(lab)) || (llvm::isa(lab) && g.isRMWStore(lab))))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto &node = visitedConsAcyclic1_10[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_10(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 1)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedConsAcyclic1_6[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_6(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedConsAcyclic1_6[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_6(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto &node = visitedConsAcyclic1_6[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_6(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedConsAcyclic1_9[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_9(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto &node = visitedConsAcyclic1_9[pLab->getStamp().get()]; - if (node.status == NodeStatus::unseen) { - if (!visitConsAcyclic1_9(pLab)){ - return false; - } - } else if (node.status == NodeStatus::entered && (visitedConsAcyclic1Accepting > node.count || 0)) { - - return false; - } else if (node.status == NodeStatus::left) { - - } - } - if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - if (!visitConsAcyclic1_8(pLab)){ - return false; - } - } - --visitedConsAcyclic1Accepting; - visitedConsAcyclic1_10[lab->getStamp().get()] = { visitedConsAcyclic1Accepting, NodeStatus::left }; - return true; -} - -bool RISCVDriver::visitConsAcyclic1(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedConsAcyclic1Accepting = 0; - visitedConsAcyclic1_0.clear(); - visitedConsAcyclic1_0.resize(g.getMaxStamp().get() + 1); - visitedConsAcyclic1_1.clear(); - visitedConsAcyclic1_1.resize(g.getMaxStamp().get() + 1); - visitedConsAcyclic1_2.clear(); - visitedConsAcyclic1_2.resize(g.getMaxStamp().get() + 1); - visitedConsAcyclic1_3.clear(); - visitedConsAcyclic1_3.resize(g.getMaxStamp().get() + 1); - visitedConsAcyclic1_4.clear(); - visitedConsAcyclic1_4.resize(g.getMaxStamp().get() + 1); - visitedConsAcyclic1_5.clear(); - visitedConsAcyclic1_5.resize(g.getMaxStamp().get() + 1); - visitedConsAcyclic1_6.clear(); - visitedConsAcyclic1_6.resize(g.getMaxStamp().get() + 1); - visitedConsAcyclic1_7.clear(); - visitedConsAcyclic1_7.resize(g.getMaxStamp().get() + 1); - visitedConsAcyclic1_9.clear(); - visitedConsAcyclic1_9.resize(g.getMaxStamp().get() + 1); - visitedConsAcyclic1_10.clear(); - visitedConsAcyclic1_10.resize(g.getMaxStamp().get() + 1); - return true - && (visitedConsAcyclic1_10[lab->getStamp().get()].status != NodeStatus::unseen || visitConsAcyclic1_10(lab)); -} - -bool RISCVDriver::visitConsAcyclic1Full() const -{ - auto &g = getGraph(); - - visitedConsAcyclic1Accepting = 0; - visitedConsAcyclic1_0.clear(); - visitedConsAcyclic1_0.resize(g.getMaxStamp().get() + 1); - visitedConsAcyclic1_1.clear(); - visitedConsAcyclic1_1.resize(g.getMaxStamp().get() + 1); - visitedConsAcyclic1_2.clear(); - visitedConsAcyclic1_2.resize(g.getMaxStamp().get() + 1); - visitedConsAcyclic1_3.clear(); - visitedConsAcyclic1_3.resize(g.getMaxStamp().get() + 1); - visitedConsAcyclic1_4.clear(); - visitedConsAcyclic1_4.resize(g.getMaxStamp().get() + 1); - visitedConsAcyclic1_5.clear(); - visitedConsAcyclic1_5.resize(g.getMaxStamp().get() + 1); - visitedConsAcyclic1_6.clear(); - visitedConsAcyclic1_6.resize(g.getMaxStamp().get() + 1); - visitedConsAcyclic1_7.clear(); - visitedConsAcyclic1_7.resize(g.getMaxStamp().get() + 1); - visitedConsAcyclic1_9.clear(); - visitedConsAcyclic1_9.resize(g.getMaxStamp().get() + 1); - visitedConsAcyclic1_10.clear(); - visitedConsAcyclic1_10.resize(g.getMaxStamp().get() + 1); - return true - && std::ranges::all_of(g.labels(), [&](auto &lab){ return visitedConsAcyclic1_10[lab.getStamp().get()].status != NodeStatus::unseen || visitConsAcyclic1_10(&lab); }); -} - -bool RISCVDriver::checkConsAcyclic1(const EventLabel *lab) const -{ - auto &g = getGraph(); - - - return visitConsAcyclic1(lab); -} -bool RISCVDriver::visitError2(const EventLabel *lab) const -{ - return false; -} - -bool RISCVDriver::visitLHSUnlessError2_0(const EventLabel *lab, const View &v) const -{ - auto &g = getGraph(); - - - if (!v.contains(lab->getPos())) { -cexLab = lab; - return false; - } - - - return true; -} - -bool RISCVDriver::visitLHSUnlessError2_1(const EventLabel *lab, const View &v) const -{ - auto &g = getGraph(); - - - if (auto pLab = alloc_pred(g, lab); pLab) { - if (!visitLHSUnlessError2_0(pLab, v)){ - return false; - } - - } - - return true; -} - -bool RISCVDriver::visitUnlessError2(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedLHSUnlessError2Accepting.clear(); - visitedLHSUnlessError2Accepting.resize(g.getMaxStamp().get() + 1, false); - auto &v = lab->view(0); - - return true - && visitLHSUnlessError2_1(lab, v); -} - -bool RISCVDriver::checkError2(const EventLabel *lab) const -{ - auto &g = getGraph(); - - - if (visitUnlessError2(lab)) - return true; - - return visitError2(lab); -} -bool RISCVDriver::visitError3(const EventLabel *lab) const -{ - return false; -} - -bool RISCVDriver::visitLHSUnlessError3_0(const EventLabel *lab) const -{ - auto &g = getGraph(); - - - return false; - - - return true; -} - -bool RISCVDriver::visitLHSUnlessError3_1(const EventLabel *lab) const -{ - auto &g = getGraph(); - - - if (true && llvm::isa(lab) && !llvm::isa(lab))for (auto &tmp : samelocs(g, lab)) if (auto *pLab = &tmp; true)if (true && llvm::isa(pLab) && !llvm::isa(pLab)) { - if (!visitLHSUnlessError3_0(pLab)){ - return false; - } - - } - if (true && llvm::isa(lab) && !llvm::isa(lab))for (auto &tmp : samelocs(g, lab)) if (auto *pLab = &tmp; true)if (true && llvm::isa(pLab)) { - if (!visitLHSUnlessError3_0(pLab)){ - return false; - } - - } - if (true && llvm::isa(lab))for (auto &tmp : samelocs(g, lab)) if (auto *pLab = &tmp; true)if (true && llvm::isa(pLab) && !llvm::isa(pLab)) { - if (!visitLHSUnlessError3_0(pLab)){ - return false; - } - - } - if (true && llvm::isa(lab))for (auto &tmp : samelocs(g, lab)) if (auto *pLab = &tmp; true)if (true && llvm::isa(pLab)) { - if (!visitLHSUnlessError3_0(pLab)){ - return false; - } - - } - - return true; -} - -bool RISCVDriver::visitUnlessError3(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedLHSUnlessError3Accepting.clear(); - visitedLHSUnlessError3Accepting.resize(g.getMaxStamp().get() + 1, false); - visitedRHSUnlessError3Accepting.clear(); - visitedRHSUnlessError3Accepting.resize(g.getMaxStamp().get() + 1, false); - - if (!visitLHSUnlessError3_1(lab)) - return false; - for (auto i = 0u; i < visitedLHSUnlessError3Accepting.size(); i++) { - if (visitedLHSUnlessError3Accepting[i] && !visitedRHSUnlessError3Accepting[i]) { - cexLab = &*std::find_if(g.label_begin(), g.label_end(), [&](auto &lab){ return lab.getStamp() == i; }); - return false; - } - } - return true; -} - -bool RISCVDriver::checkError3(const EventLabel *lab) const -{ - auto &g = getGraph(); - - - if (visitUnlessError3(lab)) - return true; - - return visitError3(lab); -} -bool RISCVDriver::visitError4(const EventLabel *lab) const -{ - return false; -} - -bool RISCVDriver::visitLHSUnlessError4_0(const EventLabel *lab, const View &v) const -{ - auto &g = getGraph(); - - - if (!v.contains(lab->getPos())) { -cexLab = lab; - return false; - } - - - return true; -} - -bool RISCVDriver::visitLHSUnlessError4_1(const EventLabel *lab, const View &v) const -{ - auto &g = getGraph(); - - - for (auto &tmp : alloc_succs(g, lab)) if (auto *pLab = &tmp; true) { - if (!visitLHSUnlessError4_0(pLab, v)){ - return false; - } - - } - - return true; -} - -bool RISCVDriver::visitLHSUnlessError4_2(const EventLabel *lab, const View &v) const -{ - auto &g = getGraph(); - - - if (true && llvm::isa(lab) && !llvm::isa(lab))if (auto pLab = free_pred(g, lab); pLab) { - if (!visitLHSUnlessError4_1(pLab, v)){ - return false; - } - - } - if (true && llvm::isa(lab) && !llvm::isa(lab))if (auto pLab = free_pred(g, lab); pLab) { - if (!visitLHSUnlessError4_0(pLab, v)){ - return false; - } - - } - - return true; -} - -bool RISCVDriver::visitUnlessError4(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedLHSUnlessError4Accepting.clear(); - visitedLHSUnlessError4Accepting.resize(g.getMaxStamp().get() + 1, false); - auto &v = lab->view(0); - - return true - && visitLHSUnlessError4_2(lab, v); -} - -bool RISCVDriver::checkError4(const EventLabel *lab) const -{ - auto &g = getGraph(); - - - if (visitUnlessError4(lab)) - return true; - - return visitError4(lab); -} -bool RISCVDriver::visitError5(const EventLabel *lab) const -{ - return false; -} - -bool RISCVDriver::visitLHSUnlessError5_0(const EventLabel *lab) const -{ - auto &g = getGraph(); - - - return false; - - - return true; -} - -bool RISCVDriver::visitLHSUnlessError5_1(const EventLabel *lab) const -{ - auto &g = getGraph(); - - - if (auto pLab = free_succ(g, lab); pLab)if (true && llvm::isa(pLab) && !llvm::isa(pLab)) { - if (!visitLHSUnlessError5_0(pLab)){ - return false; - } - - } - - return true; -} - -bool RISCVDriver::visitLHSUnlessError5_2(const EventLabel *lab) const -{ - auto &g = getGraph(); - - - if (auto pLab = alloc_pred(g, lab); pLab) { - if (!visitLHSUnlessError5_1(pLab)){ - return false; - } - - } - - return true; -} - -bool RISCVDriver::visitUnlessError5(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedLHSUnlessError5Accepting.clear(); - visitedLHSUnlessError5Accepting.resize(g.getMaxStamp().get() + 1, false); - visitedRHSUnlessError5Accepting.clear(); - visitedRHSUnlessError5Accepting.resize(g.getMaxStamp().get() + 1, false); - - if (!visitLHSUnlessError5_2(lab)) - return false; - for (auto i = 0u; i < visitedLHSUnlessError5Accepting.size(); i++) { - if (visitedLHSUnlessError5Accepting[i] && !visitedRHSUnlessError5Accepting[i]) { - cexLab = &*std::find_if(g.label_begin(), g.label_end(), [&](auto &lab){ return lab.getStamp() == i; }); - return false; - } - } - return true; -} - -bool RISCVDriver::checkError5(const EventLabel *lab) const -{ - auto &g = getGraph(); - - - if (visitUnlessError5(lab)) - return true; - - return visitError5(lab); -} -bool RISCVDriver::visitError6(const EventLabel *lab) const -{ - return false; -} - -bool RISCVDriver::visitLHSUnlessError6_0(const EventLabel *lab, const View &v) const -{ - auto &g = getGraph(); - - - if (!v.contains(lab->getPos())) { -cexLab = lab; - return false; - } - - - return true; -} - -bool RISCVDriver::visitLHSUnlessError6_1(const EventLabel *lab, const View &v) const -{ - auto &g = getGraph(); - - - for (auto &tmp : alloc_succs(g, lab)) if (auto *pLab = &tmp; true)if (true && llvm::isa(pLab) && llvm::dyn_cast(pLab)->getAddr().isDynamic() && !isHazptrProtected(llvm::dyn_cast(pLab))) { - if (!visitLHSUnlessError6_0(pLab, v)){ - return false; - } - - } - - return true; -} - -bool RISCVDriver::visitLHSUnlessError6_2(const EventLabel *lab, const View &v) const -{ - auto &g = getGraph(); - - - if (true && llvm::isa(lab))if (auto pLab = free_pred(g, lab); pLab) { - if (!visitLHSUnlessError6_1(pLab, v)){ - return false; - } - - } - if (true && llvm::isa(lab))if (auto pLab = free_pred(g, lab); pLab)if (true && llvm::isa(pLab) && llvm::dyn_cast(pLab)->getAddr().isDynamic() && !isHazptrProtected(llvm::dyn_cast(pLab))) { - if (!visitLHSUnlessError6_0(pLab, v)){ - return false; - } - - } - - return true; -} - -bool RISCVDriver::visitUnlessError6(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedLHSUnlessError6Accepting.clear(); - visitedLHSUnlessError6Accepting.resize(g.getMaxStamp().get() + 1, false); - auto &v = lab->view(0); - - return true - && visitLHSUnlessError6_2(lab, v); -} - -bool RISCVDriver::checkError6(const EventLabel *lab) const -{ - auto &g = getGraph(); - - - if (visitUnlessError6(lab)) - return true; - - return visitError6(lab); -} -bool RISCVDriver::visitError7(const EventLabel *lab) const -{ - return false; -} - -bool RISCVDriver::visitLHSUnlessError7_0(const EventLabel *lab) const -{ - auto &g = getGraph(); - - - return false; - - - return true; -} - -bool RISCVDriver::visitLHSUnlessError7_1(const EventLabel *lab) const -{ - auto &g = getGraph(); - - - if (auto pLab = free_succ(g, lab); pLab)if (true && llvm::isa(pLab)) { - if (!visitLHSUnlessError7_0(pLab)){ - return false; - } - - } - - return true; -} - -bool RISCVDriver::visitLHSUnlessError7_2(const EventLabel *lab) const -{ - auto &g = getGraph(); - - - if (true && llvm::isa(lab) && llvm::dyn_cast(lab)->getAddr().isDynamic() && !isHazptrProtected(llvm::dyn_cast(lab)))if (auto pLab = alloc_pred(g, lab); pLab) { - if (!visitLHSUnlessError7_1(pLab)){ - return false; - } - - } - - return true; -} - -bool RISCVDriver::visitUnlessError7(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedLHSUnlessError7Accepting.clear(); - visitedLHSUnlessError7Accepting.resize(g.getMaxStamp().get() + 1, false); - visitedRHSUnlessError7Accepting.clear(); - visitedRHSUnlessError7Accepting.resize(g.getMaxStamp().get() + 1, false); - - if (!visitLHSUnlessError7_2(lab)) - return false; - for (auto i = 0u; i < visitedLHSUnlessError7Accepting.size(); i++) { - if (visitedLHSUnlessError7Accepting[i] && !visitedRHSUnlessError7Accepting[i]) { - cexLab = &*std::find_if(g.label_begin(), g.label_end(), [&](auto &lab){ return lab.getStamp() == i; }); - return false; - } - } - return true; -} - -bool RISCVDriver::checkError7(const EventLabel *lab) const -{ - auto &g = getGraph(); - - - if (visitUnlessError7(lab)) - return true; - - return visitError7(lab); -} -bool RISCVDriver::visitError8(const EventLabel *lab) const -{ - return false; -} - -bool RISCVDriver::visitLHSUnlessError8_0(const EventLabel *lab, const View &v) const -{ - auto &g = getGraph(); - - - if (!v.contains(lab->getPos())) { -cexLab = lab; - return false; - } - - - return true; -} - -bool RISCVDriver::visitLHSUnlessError8_1(const EventLabel *lab, const View &v) const -{ - auto &g = getGraph(); - - - if (true && lab->isNotAtomic() && llvm::isa(lab))for (auto &tmp : samelocs(g, lab)) if (auto *pLab = &tmp; true)if (true && llvm::isa(pLab)) { - if (!visitLHSUnlessError8_0(pLab, v)){ - return false; - } - - } - if (true && lab->isNotAtomic() && llvm::isa(lab))for (auto &tmp : samelocs(g, lab)) if (auto *pLab = &tmp; true)if (true && llvm::isa(pLab)) { - if (!visitLHSUnlessError8_0(pLab, v)){ - return false; - } - - } - if (true && lab->isNotAtomic() && llvm::isa(lab))for (auto &tmp : samelocs(g, lab)) if (auto *pLab = &tmp; true)if (true && llvm::isa(pLab)) { - if (!visitLHSUnlessError8_0(pLab, v)){ - return false; - } - - } - if (true && llvm::isa(lab))for (auto &tmp : samelocs(g, lab)) if (auto *pLab = &tmp; true)if (true && pLab->isNotAtomic() && llvm::isa(pLab)) { - if (!visitLHSUnlessError8_0(pLab, v)){ - return false; - } - - } - if (true && llvm::isa(lab))for (auto &tmp : samelocs(g, lab)) if (auto *pLab = &tmp; true)if (true && pLab->isNotAtomic() && llvm::isa(pLab)) { - if (!visitLHSUnlessError8_0(pLab, v)){ - return false; - } - - } - if (true && llvm::isa(lab))for (auto &tmp : samelocs(g, lab)) if (auto *pLab = &tmp; true)if (true && pLab->isNotAtomic() && llvm::isa(pLab)) { - if (!visitLHSUnlessError8_0(pLab, v)){ - return false; - } - - } - - return true; -} - -bool RISCVDriver::visitUnlessError8(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedLHSUnlessError8Accepting.clear(); - visitedLHSUnlessError8Accepting.resize(g.getMaxStamp().get() + 1, false); - auto &v = lab->view(0); - - return true - && visitLHSUnlessError8_1(lab, v); -} - -bool RISCVDriver::checkError8(const EventLabel *lab) const -{ - auto &g = getGraph(); - - - if (visitUnlessError8(lab)) - return true; - - return visitError8(lab); -} -bool RISCVDriver::visitWarning9(const EventLabel *lab) const -{ - return false; -} - -bool RISCVDriver::visitLHSUnlessWarning9_0(const EventLabel *lab, const View &v) const -{ - auto &g = getGraph(); - - - if (!v.contains(lab->getPos())) { -cexLab = lab; - return false; - } - - - return true; -} - -bool RISCVDriver::visitLHSUnlessWarning9_1(const EventLabel *lab, const View &v) const -{ - auto &g = getGraph(); - - - if (true && llvm::isa(lab))for (auto &tmp : samelocs(g, lab)) if (auto *pLab = &tmp; true)if (true && llvm::isa(pLab)) { - if (!visitLHSUnlessWarning9_0(pLab, v)){ - return false; - } - - } - - return true; -} - -bool RISCVDriver::visitUnlessWarning9(const EventLabel *lab) const -{ - auto &g = getGraph(); - - visitedLHSUnlessWarning9Accepting.clear(); - visitedLHSUnlessWarning9Accepting.resize(g.getMaxStamp().get() + 1, false); - auto &v = lab->view(1); - - return true - && visitLHSUnlessWarning9_1(lab, v); -} - -bool RISCVDriver::checkWarning9(const EventLabel *lab) const -{ - auto &g = getGraph(); - - - if (visitUnlessWarning9(lab)) - return true; - - return visitWarning9(lab); -} -VerificationError RISCVDriver::checkErrors(const EventLabel *lab, const EventLabel *&race) const -{ - if (!checkError2(lab)) { - race = cexLab; - return VerificationError::VE_AccessNonMalloc; - } - - if (!checkError3(lab)) { - race = cexLab; - return VerificationError::VE_DoubleFree; - } - - if (!checkError4(lab)) { - race = cexLab; - return VerificationError::VE_AccessFreed; - } - - if (!checkError5(lab)) { - race = cexLab; - return VerificationError::VE_AccessFreed; - } - - if (!checkError6(lab)) { - race = cexLab; - return VerificationError::VE_AccessFreed; - } - - if (!checkError7(lab)) { - race = cexLab; - return VerificationError::VE_AccessFreed; - } - - if (!checkError8(lab)) { - race = cexLab; - return VerificationError::VE_RaceNotAtomic; - } - - return VerificationError::VE_OK; -} - -std::vector RISCVDriver::checkWarnings(const EventLabel *lab, const VSet &seenWarnings, std::vector &racyLabs) const -{ - std::vector result; - - if (seenWarnings.count(VerificationError::VE_WWRace) == 0 && !checkWarning9(lab)) { - racyLabs.push_back(cexLab); - result.push_back(VerificationError::VE_WWRace); - } - - return result; -} - -bool RISCVDriver::isConsistent(const EventLabel *lab) const -{ - - return true - && checkConsAcyclic1(lab); -} - -void RISCVDriver::visitPPoRf0(const EventLabel *lab, DepView &pporf) const -{ - auto &g = getGraph(); - - visitedPPoRf0[lab->getStamp().get()] = NodeStatus::entered; - pporf.updateIdx(lab->getPos()); - visitedPPoRf0[lab->getStamp().get()] = NodeStatus::left; -} - -void RISCVDriver::visitPPoRf1(const EventLabel *lab, DepView &pporf) const -{ - auto &g = getGraph(); - - visitedPPoRf1[lab->getStamp().get()] = NodeStatus::entered; - if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab))if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab))if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (auto pLab = poloc_imm_pred(g, lab); pLab) { - auto status = visitedPPoRf1[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf1(pLab, pporf); - } - if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - visitedPPoRf1[lab->getStamp().get()] = NodeStatus::left; -} - -void RISCVDriver::visitPPoRf2(const EventLabel *lab, DepView &pporf) const -{ - auto &g = getGraph(); - - visitedPPoRf2[lab->getStamp().get()] = NodeStatus::entered; - if (auto pLab = tc_pred(g, lab); pLab)if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (auto pLab = tj_pred(g, lab); pLab)if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (auto pLab = rfe_pred(g, lab); pLab)if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (true && llvm::isa(lab))for (auto &p : ctrl_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (true && llvm::isa(lab))for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab))))if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab))if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab))if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire())if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease())if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC())if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire())if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease())if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC())if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire())if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease())if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC())if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (true && llvm::isa(lab) && ((llvm::isa(lab) && g.isRMWLoad(lab)) || (llvm::isa(lab) && g.isRMWStore(lab))))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab))))if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedPPoRf3[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf3(pLab, pporf); - } - if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto status = visitedPPoRf8[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf8(pLab, pporf); - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto status = visitedPPoRf8[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf8(pLab, pporf); - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto status = visitedPPoRf8[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf8(pLab, pporf); - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto status = visitedPPoRf8[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf8(pLab, pporf); - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedPPoRf6[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf6(pLab, pporf); - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedPPoRf6[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf6(pLab, pporf); - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf4[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf4(pLab, pporf); - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf4[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf4(pLab, pporf); - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf5[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf5(pLab, pporf); - } - if (true && llvm::isa(lab))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf5[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf5(pLab, pporf); - } - if (auto pLab = tc_pred(g, lab); pLab) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (auto pLab = tj_pred(g, lab); pLab) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (auto pLab = rfe_pred(g, lab); pLab) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (true && llvm::isa(lab))for (auto &p : ctrl_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (true && llvm::isa(lab))for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (true && llvm::isa(lab) && ((llvm::isa(lab) && g.isRMWLoad(lab)) || (llvm::isa(lab) && g.isRMWStore(lab))))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf9[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf9(pLab, pporf); - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf9[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf9(pLab, pporf); - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf9[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf9(pLab, pporf); - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedPPoRf10[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf10(pLab, pporf); - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedPPoRf10[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf10(pLab, pporf); - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedPPoRf10[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf10(pLab, pporf); - } - if (true && llvm::isa(lab) && ((llvm::isa(lab) && g.isRMWLoad(lab)) || (llvm::isa(lab) && g.isRMWStore(lab))))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto status = visitedPPoRf10[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf10(pLab, pporf); - } - if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab) { - auto status = visitedPPoRf1[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf1(pLab, pporf); - } - if (auto pLab = tc_pred(g, lab); pLab) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - if (auto pLab = tj_pred(g, lab); pLab) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - if (auto pLab = rfe_pred(g, lab); pLab) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - if (true && llvm::isa(lab))for (auto &p : ctrl_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - if (true && llvm::isa(lab))for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - if (true && llvm::isa(lab))if (auto pLab = poloc_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - if (true && lab->isAtLeastAcquire())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - if (true && lab->isAtLeastRelease())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - if (true && lab->isSC())if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - if (true && llvm::isa(lab) && ((llvm::isa(lab) && g.isRMWLoad(lab)) || (llvm::isa(lab) && g.isRMWStore(lab))))if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - if (true && llvm::isa(lab))if (auto pLab = rfi_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf11[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf11(pLab, pporf); - } - visitedPPoRf2[lab->getStamp().get()] = NodeStatus::left; -} - -void RISCVDriver::visitPPoRf3(const EventLabel *lab, DepView &pporf) const -{ - auto &g = getGraph(); - - visitedPPoRf3[lab->getStamp().get()] = NodeStatus::entered; - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedPPoRf3[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf3(pLab, pporf); - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf4[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf4(pLab, pporf); - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf4[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf4(pLab, pporf); - } - visitedPPoRf3[lab->getStamp().get()] = NodeStatus::left; -} - -void RISCVDriver::visitPPoRf4(const EventLabel *lab, DepView &pporf) const -{ - auto &g = getGraph(); - - visitedPPoRf4[lab->getStamp().get()] = NodeStatus::entered; - for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab))if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - visitedPPoRf4[lab->getStamp().get()] = NodeStatus::left; -} - -void RISCVDriver::visitPPoRf5(const EventLabel *lab, DepView &pporf) const -{ - auto &g = getGraph(); - - visitedPPoRf5[lab->getStamp().get()] = NodeStatus::entered; - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab))if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab))if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedPPoRf5[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf5(pLab, pporf); - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - visitedPPoRf5[lab->getStamp().get()] = NodeStatus::left; -} - -void RISCVDriver::visitPPoRf6(const EventLabel *lab, DepView &pporf) const -{ - auto &g = getGraph(); - - visitedPPoRf6[lab->getStamp().get()] = NodeStatus::entered; - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedPPoRf6[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf6(pLab, pporf); - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf5[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf5(pLab, pporf); - } - visitedPPoRf6[lab->getStamp().get()] = NodeStatus::left; -} - -void RISCVDriver::visitPPoRf7(const EventLabel *lab, DepView &pporf) const -{ - auto &g = getGraph(); - - visitedPPoRf7[lab->getStamp().get()] = NodeStatus::entered; - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire())if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease())if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC())if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastAcquire()) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isAtLeastRelease()) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && pLab->isSC()) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - visitedPPoRf7[lab->getStamp().get()] = NodeStatus::left; -} - -void RISCVDriver::visitPPoRf8(const EventLabel *lab, DepView &pporf) const -{ - auto &g = getGraph(); - - visitedPPoRf8[lab->getStamp().get()] = NodeStatus::entered; - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab))))if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - visitedPPoRf8[lab->getStamp().get()] = NodeStatus::left; -} - -void RISCVDriver::visitPPoRf9(const EventLabel *lab, DepView &pporf) const -{ - auto &g = getGraph(); - - visitedPPoRf9[lab->getStamp().get()] = NodeStatus::entered; - pporf.updateIdx(lab->getPos()); - if (auto pLab = po_imm_pred(g, lab); pLab)if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf9[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf9(pLab, pporf); - } - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - visitedPPoRf9[lab->getStamp().get()] = NodeStatus::left; -} - -void RISCVDriver::visitPPoRf10(const EventLabel *lab, DepView &pporf) const -{ - auto &g = getGraph(); - - visitedPPoRf10[lab->getStamp().get()] = NodeStatus::entered; - if (auto pLab = po_imm_pred(g, lab); pLab)if (true && llvm::isa(pLab) && ((llvm::isa(pLab) && g.isRMWLoad(pLab)) || (llvm::isa(pLab) && g.isRMWStore(pLab)))) { - auto status = visitedPPoRf8[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf8(pLab, pporf); - } - if (auto pLab = po_imm_pred(g, lab); pLab) { - auto status = visitedPPoRf10[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf10(pLab, pporf); - } - visitedPPoRf10[lab->getStamp().get()] = NodeStatus::left; -} - -void RISCVDriver::visitPPoRf11(const EventLabel *lab, DepView &pporf) const -{ - auto &g = getGraph(); - - visitedPPoRf11[lab->getStamp().get()] = NodeStatus::entered; - for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab))if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab))if (pporf.updateIdx(pLab->getPos()); true) { - auto status = visitedPPoRf0[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf0(pLab, pporf); - } - for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf7[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf7(pLab, pporf); - } - for (auto &p : addr_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - for (auto &p : data_preds(g, lab)) if (auto *pLab = g.getEventLabel(p); true)if (true && llvm::isa(pLab)) { - auto status = visitedPPoRf2[pLab->getStamp().get()]; - if (status == NodeStatus::unseen) - visitPPoRf2(pLab, pporf); - } - visitedPPoRf11[lab->getStamp().get()] = NodeStatus::left; -} - -DepView RISCVDriver::calcPPoRfBefore(const EventLabel *lab) const -{ - auto &g = getGraph(); - DepView pporf; - pporf.updateIdx(lab->getPos()); - visitedPPoRf0.clear(); - visitedPPoRf0.resize(g.getMaxStamp().get() + 1, NodeStatus::unseen); - visitedPPoRf1.clear(); - visitedPPoRf1.resize(g.getMaxStamp().get() + 1, NodeStatus::unseen); - visitedPPoRf2.clear(); - visitedPPoRf2.resize(g.getMaxStamp().get() + 1, NodeStatus::unseen); - visitedPPoRf3.clear(); - visitedPPoRf3.resize(g.getMaxStamp().get() + 1, NodeStatus::unseen); - visitedPPoRf4.clear(); - visitedPPoRf4.resize(g.getMaxStamp().get() + 1, NodeStatus::unseen); - visitedPPoRf5.clear(); - visitedPPoRf5.resize(g.getMaxStamp().get() + 1, NodeStatus::unseen); - visitedPPoRf6.clear(); - visitedPPoRf6.resize(g.getMaxStamp().get() + 1, NodeStatus::unseen); - visitedPPoRf7.clear(); - visitedPPoRf7.resize(g.getMaxStamp().get() + 1, NodeStatus::unseen); - visitedPPoRf8.clear(); - visitedPPoRf8.resize(g.getMaxStamp().get() + 1, NodeStatus::unseen); - visitedPPoRf9.clear(); - visitedPPoRf9.resize(g.getMaxStamp().get() + 1, NodeStatus::unseen); - visitedPPoRf10.clear(); - visitedPPoRf10.resize(g.getMaxStamp().get() + 1, NodeStatus::unseen); - visitedPPoRf11.clear(); - visitedPPoRf11.resize(g.getMaxStamp().get() + 1, NodeStatus::unseen); - - visitPPoRf2(lab, pporf); - visitPPoRf7(lab, pporf); - return pporf; -} -std::unique_ptr RISCVDriver::calculatePrefixView(const EventLabel *lab) const -{ - return std::make_unique(calcPPoRfBefore(lab)); -} - diff --git a/code/RISCVDriver.hpp b/code/RISCVDriver.hpp deleted file mode 100644 index e15121d..0000000 --- a/code/RISCVDriver.hpp +++ /dev/null @@ -1,313 +0,0 @@ -/* - * GenMC -- Generic Model Checking. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you can access it online at - * http://www.gnu.org/licenses/gpl-3.0.html. - * - * Author: Michalis Kokologiannakis - */ - -/******************************************************************************* - * CAUTION: This file is generated automatically by Kater -- DO NOT EDIT. - *******************************************************************************/ - -#ifndef GENMC_RISCV_DRIVER_HPP -#define GENMC_RISCV_DRIVER_HPP - -#include "config.h" -#include "ADT/VSet.hpp" -#include "ExecutionGraph/ExecutionGraph.hpp" -#include "ExecutionGraph/GraphIterators.hpp" -#include "ExecutionGraph/MaximalIterator.hpp" -#include "Verification/GenMCDriver.hpp" -#include "Verification/VerificationError.hpp" -#include -#include - -class RISCVDriver : public GenMCDriver { - -private: - enum class NodeStatus : unsigned char { unseen, entered, left }; - - struct NodeVisitStatus { - NodeVisitStatus() = default; - NodeVisitStatus(uint32_t c, NodeStatus s) : count(c), status(s) {} - uint32_t count{}; - NodeStatus status{}; - }; - -public: - RISCVDriver(std::shared_ptr conf, std::unique_ptr mod, - std::unique_ptr MI, GenMCDriver::Mode mode = GenMCDriver::VerificationMode{}); - - void calculateSaved(EventLabel *lab); - void calculateViews(EventLabel *lab); - void updateMMViews(EventLabel *lab) override; - bool isDepTracking() const override; - bool isConsistent(const EventLabel *lab) const override; - VerificationError checkErrors(const EventLabel *lab, const EventLabel *&race) const override; - std::vector checkWarnings(const EventLabel *lab, const VSet &seenWarnings, std::vector &racyLabs) const; - std::unique_ptr calculatePrefixView(const EventLabel *lab) const override; - const View &getHbView(const EventLabel *lab) const override; - std::vector getCoherentStores(SAddr addr, Event read) override; - std::vector getCoherentRevisits(const WriteLabel *sLab, const VectorClock &pporf) override; - std::vector getCoherentPlacings(SAddr addr, Event store, bool isRMW) override; - -private: - bool isWriteRfBefore(Event a, Event b); - std::vector getInitRfsAtLoc(SAddr addr); - bool isHbOptRfBefore(const Event e, const Event write); - ExecutionGraph::co_iterator splitLocMOBefore(SAddr addr, Event e); - ExecutionGraph::co_iterator splitLocMOAfterHb(SAddr addr, const Event read); - ExecutionGraph::co_iterator splitLocMOAfter(SAddr addr, const Event e); - std::vector getMOOptRfAfter(const WriteLabel *sLab); - std::vector getMOInvOptRfAfter(const WriteLabel *sLab); - mutable const EventLabel *cexLab{}; - - mutable std::vector visitedCalc89_0; - mutable std::vector visitedCalc89_1; - mutable std::vector visitedCalc89_2; - mutable std::vector visitedCalc89_3; - mutable std::vector visitedCalc89_4; - mutable std::vector visitedCalc89_5; - mutable std::vector visitedCalc89_6; - mutable std::vector visitedCalc89_7; - mutable std::vector visitedCalc89_8; - mutable std::vector visitedCalc89_9; - mutable std::vector visitedCalc89_10; - mutable std::vector visitedCalc89_11; - mutable std::vector visitedCalc89_12; - - bool visitCalc89_0(const EventLabel *lab, View &calcRes) const; - bool visitCalc89_1(const EventLabel *lab, View &calcRes) const; - bool visitCalc89_2(const EventLabel *lab, View &calcRes) const; - bool visitCalc89_3(const EventLabel *lab, View &calcRes) const; - bool visitCalc89_4(const EventLabel *lab, View &calcRes) const; - bool visitCalc89_5(const EventLabel *lab, View &calcRes) const; - bool visitCalc89_6(const EventLabel *lab, View &calcRes) const; - bool visitCalc89_7(const EventLabel *lab, View &calcRes) const; - bool visitCalc89_8(const EventLabel *lab, View &calcRes) const; - bool visitCalc89_9(const EventLabel *lab, View &calcRes) const; - bool visitCalc89_10(const EventLabel *lab, View &calcRes) const; - bool visitCalc89_11(const EventLabel *lab, View &calcRes) const; - bool visitCalc89_12(const EventLabel *lab, View &calcRes) const; - - View visitCalc89(const EventLabel *lab) const; - const View&getHbStableView(const EventLabel *lab) const { return lab->view(0); } - - auto checkCalc89(const EventLabel *lab) const; - mutable std::vector visitedCalc94_0; - mutable std::vector visitedCalc94_1; - mutable std::vector visitedCalc94_2; - mutable std::vector visitedCalc94_3; - - bool visitCalc94_0(const EventLabel *lab, View &calcRes) const; - bool visitCalc94_1(const EventLabel *lab, View &calcRes) const; - bool visitCalc94_2(const EventLabel *lab, View &calcRes) const; - bool visitCalc94_3(const EventLabel *lab, View &calcRes) const; - - View visitCalc94(const EventLabel *lab) const; - const View&getPorfStableView(const EventLabel *lab) const { return lab->view(1); } - - auto checkCalc94(const EventLabel *lab) const; - mutable std::vector visitedCoherence_0; - mutable std::vector visitedCoherence_1; - mutable std::vector visitedCoherence_2; - mutable std::vector visitedCoherence_3; - mutable std::vector visitedCoherence_4; - mutable std::vector visitedCoherence_5; - mutable std::vector visitedCoherence_6; - mutable std::vector visitedCoherence_7; - mutable std::vector visitedCoherence_8; - mutable std::vector visitedCoherence_9; - mutable std::vector visitedCoherence_10; - mutable std::vector visitedCoherence_11; - mutable uint32_t visitedCoherenceAccepting; - - bool visitCoherence_0(const EventLabel *lab) const; - bool visitCoherence_1(const EventLabel *lab) const; - bool visitCoherence_2(const EventLabel *lab) const; - bool visitCoherence_3(const EventLabel *lab) const; - bool visitCoherence_4(const EventLabel *lab) const; - bool visitCoherence_5(const EventLabel *lab) const; - bool visitCoherence_6(const EventLabel *lab) const; - bool visitCoherence_7(const EventLabel *lab) const; - bool visitCoherence_8(const EventLabel *lab) const; - bool visitCoherence_9(const EventLabel *lab) const; - bool visitCoherence_10(const EventLabel *lab) const; - bool visitCoherence_11(const EventLabel *lab) const; - - bool visitCoherenceFull() const; - - mutable std::vector visitedConsAcyclic1_0; - mutable std::vector visitedConsAcyclic1_1; - mutable std::vector visitedConsAcyclic1_2; - mutable std::vector visitedConsAcyclic1_3; - mutable std::vector visitedConsAcyclic1_4; - mutable std::vector visitedConsAcyclic1_5; - mutable std::vector visitedConsAcyclic1_6; - mutable std::vector visitedConsAcyclic1_7; - mutable std::vector visitedConsAcyclic1_8; - mutable std::vector visitedConsAcyclic1_9; - mutable std::vector visitedConsAcyclic1_10; - mutable uint32_t visitedConsAcyclic1Accepting; - - bool visitConsAcyclic1_0(const EventLabel *lab) const; - bool visitConsAcyclic1_1(const EventLabel *lab) const; - bool visitConsAcyclic1_2(const EventLabel *lab) const; - bool visitConsAcyclic1_3(const EventLabel *lab) const; - bool visitConsAcyclic1_4(const EventLabel *lab) const; - bool visitConsAcyclic1_5(const EventLabel *lab) const; - bool visitConsAcyclic1_6(const EventLabel *lab) const; - bool visitConsAcyclic1_7(const EventLabel *lab) const; - bool visitConsAcyclic1_8(const EventLabel *lab) const; - bool visitConsAcyclic1_9(const EventLabel *lab) const; - bool visitConsAcyclic1_10(const EventLabel *lab) const; - - bool visitConsAcyclic1(const EventLabel *lab) const; - - bool visitConsAcyclic1Full() const; - - bool checkUnlessConsAcyclic1(const EventLabel *lab) { return false; } - bool checkConsAcyclic1(const EventLabel *lab) const; - bool visitError2(const EventLabel *lab) const; - mutable std::vector visitedLHSUnlessError2_0; - mutable std::vector visitedLHSUnlessError2_1; - - bool visitLHSUnlessError2_0(const EventLabel *lab, const View &v) const; - bool visitLHSUnlessError2_1(const EventLabel *lab, const View &v) const; - - mutable std::vector visitedLHSUnlessError2Accepting; - bool visitUnlessError2(const EventLabel *lab) const; - bool checkError2(const EventLabel *lab) const; - bool visitError3(const EventLabel *lab) const; - mutable std::vector visitedLHSUnlessError3_0; - mutable std::vector visitedLHSUnlessError3_1; - - bool visitLHSUnlessError3_0(const EventLabel *lab) const; - bool visitLHSUnlessError3_1(const EventLabel *lab) const; - - - - mutable std::vector visitedLHSUnlessError3Accepting; - mutable std::vector visitedRHSUnlessError3Accepting; - bool visitUnlessError3(const EventLabel *lab) const; - bool checkError3(const EventLabel *lab) const; - bool visitError4(const EventLabel *lab) const; - mutable std::vector visitedLHSUnlessError4_0; - mutable std::vector visitedLHSUnlessError4_1; - mutable std::vector visitedLHSUnlessError4_2; - - bool visitLHSUnlessError4_0(const EventLabel *lab, const View &v) const; - bool visitLHSUnlessError4_1(const EventLabel *lab, const View &v) const; - bool visitLHSUnlessError4_2(const EventLabel *lab, const View &v) const; - - mutable std::vector visitedLHSUnlessError4Accepting; - bool visitUnlessError4(const EventLabel *lab) const; - bool checkError4(const EventLabel *lab) const; - bool visitError5(const EventLabel *lab) const; - mutable std::vector visitedLHSUnlessError5_0; - mutable std::vector visitedLHSUnlessError5_1; - mutable std::vector visitedLHSUnlessError5_2; - - bool visitLHSUnlessError5_0(const EventLabel *lab) const; - bool visitLHSUnlessError5_1(const EventLabel *lab) const; - bool visitLHSUnlessError5_2(const EventLabel *lab) const; - - - - mutable std::vector visitedLHSUnlessError5Accepting; - mutable std::vector visitedRHSUnlessError5Accepting; - bool visitUnlessError5(const EventLabel *lab) const; - bool checkError5(const EventLabel *lab) const; - bool visitError6(const EventLabel *lab) const; - mutable std::vector visitedLHSUnlessError6_0; - mutable std::vector visitedLHSUnlessError6_1; - mutable std::vector visitedLHSUnlessError6_2; - - bool visitLHSUnlessError6_0(const EventLabel *lab, const View &v) const; - bool visitLHSUnlessError6_1(const EventLabel *lab, const View &v) const; - bool visitLHSUnlessError6_2(const EventLabel *lab, const View &v) const; - - mutable std::vector visitedLHSUnlessError6Accepting; - bool visitUnlessError6(const EventLabel *lab) const; - bool checkError6(const EventLabel *lab) const; - bool visitError7(const EventLabel *lab) const; - mutable std::vector visitedLHSUnlessError7_0; - mutable std::vector visitedLHSUnlessError7_1; - mutable std::vector visitedLHSUnlessError7_2; - - bool visitLHSUnlessError7_0(const EventLabel *lab) const; - bool visitLHSUnlessError7_1(const EventLabel *lab) const; - bool visitLHSUnlessError7_2(const EventLabel *lab) const; - - - - mutable std::vector visitedLHSUnlessError7Accepting; - mutable std::vector visitedRHSUnlessError7Accepting; - bool visitUnlessError7(const EventLabel *lab) const; - bool checkError7(const EventLabel *lab) const; - bool visitError8(const EventLabel *lab) const; - mutable std::vector visitedLHSUnlessError8_0; - mutable std::vector visitedLHSUnlessError8_1; - - bool visitLHSUnlessError8_0(const EventLabel *lab, const View &v) const; - bool visitLHSUnlessError8_1(const EventLabel *lab, const View &v) const; - - mutable std::vector visitedLHSUnlessError8Accepting; - bool visitUnlessError8(const EventLabel *lab) const; - bool checkError8(const EventLabel *lab) const; - bool visitWarning9(const EventLabel *lab) const; - mutable std::vector visitedLHSUnlessWarning9_0; - mutable std::vector visitedLHSUnlessWarning9_1; - - bool visitLHSUnlessWarning9_0(const EventLabel *lab, const View &v) const; - bool visitLHSUnlessWarning9_1(const EventLabel *lab, const View &v) const; - - mutable std::vector visitedLHSUnlessWarning9Accepting; - bool visitUnlessWarning9(const EventLabel *lab) const; - bool checkWarning9(const EventLabel *lab) const; - - void visitPPoRf0(const EventLabel *lab, DepView &pporf) const; - void visitPPoRf1(const EventLabel *lab, DepView &pporf) const; - void visitPPoRf2(const EventLabel *lab, DepView &pporf) const; - void visitPPoRf3(const EventLabel *lab, DepView &pporf) const; - void visitPPoRf4(const EventLabel *lab, DepView &pporf) const; - void visitPPoRf5(const EventLabel *lab, DepView &pporf) const; - void visitPPoRf6(const EventLabel *lab, DepView &pporf) const; - void visitPPoRf7(const EventLabel *lab, DepView &pporf) const; - void visitPPoRf8(const EventLabel *lab, DepView &pporf) const; - void visitPPoRf9(const EventLabel *lab, DepView &pporf) const; - void visitPPoRf10(const EventLabel *lab, DepView &pporf) const; - void visitPPoRf11(const EventLabel *lab, DepView &pporf) const; - - DepView calcPPoRfBefore(const EventLabel *lab) const; - - mutable std::vector visitedPPoRf0; - mutable std::vector visitedPPoRf1; - mutable std::vector visitedPPoRf2; - mutable std::vector visitedPPoRf3; - mutable std::vector visitedPPoRf4; - mutable std::vector visitedPPoRf5; - mutable std::vector visitedPPoRf6; - mutable std::vector visitedPPoRf7; - mutable std::vector visitedPPoRf8; - mutable std::vector visitedPPoRf9; - mutable std::vector visitedPPoRf10; - mutable std::vector visitedPPoRf11; - - -}; - -#endif /* GENMC_RISCV_DRIVER_HPP */ diff --git a/kat/riscv-genmc.kat b/kat/riscv-genmc.kat index 0ddab26..4f3f232 100644 --- a/kat/riscv-genmc.kat +++ b/kat/riscv-genmc.kat @@ -15,7 +15,7 @@ let fence_tso = ([W]; po; [F]; po; [W]) | ([R]; po; [F]; po; [R|W]) let amo = rmw let riscv_rmw = amo -let rdw = [R];po-loc;[R];([W]; fre; [W])?; rfe +let rdw = [po-loc ; (fre ; rfe)] ; [W] let AcqRel = [ACQ] | [REL] | [SC] let AQ = [ACQ] | [AcqRel] let RL = [REL] | [AcqRel] @@ -63,7 +63,7 @@ let ppo = let risc = mo | rfe | fr | ppo -view hb_stable = (ppo)+ +view hb_stable = (po | (rf | tc | tj); po)+ export coherence hb_stable export acyclic risc