Jlm
Loading...
Searching...
No Matches
check-rhls.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2021 David Metz <david.c.metz@ntnu.no>
3 * See COPYING for terms of redistribution.
4 */
5
9#include <jlm/hls/ir/hls.hpp>
12
13namespace jlm::hls
14{
15
16static void
18{
22 // Ensure that there is no buffer between state_gate and addr_queue enq.
23 // This is SG1 in the paper. Otherwise, there might be a race condition in the disambiguation
26 // make sure there is enough buffer space on the output, so there can be no race condition with
27 // SG3
31}
32
33static void
35{
36 for (auto & node : rvsdg::TopDownTraverser(sr))
37 {
39 {
40 if (auto ln = dynamic_cast<LoopNode *>(node))
41 {
42 check_rhls(ln->subregion());
43 }
44 else
45 {
46 throw util::Error("There should be only simple nodes and loop nodes");
47 }
48 }
49 for (size_t i = 0; i < node->noutputs(); i++)
50 {
51 if (node->output(i)->nusers() == 0)
52 {
53 throw util::Error("Output has no users");
54 }
55 else if (node->output(i)->nusers() > 1)
56 {
57 throw util::Error("Output has more than one user");
58 }
59 }
61 {
62 CheckAddrQueue(node);
63 }
64 }
65}
66
67static void
69{
70 auto & graph = rm.Rvsdg();
71 auto root = &graph.GetRootRegion();
72 if (root->numNodes() != 1)
73 {
74 throw util::Error("Root should have only one node now");
75 }
76 auto ln = dynamic_cast<const rvsdg::LambdaNode *>(root->Nodes().begin().ptr());
77 if (!ln)
78 {
79 throw util::Error("Node needs to be a lambda");
80 }
81 check_rhls(ln->subregion());
82}
83
85
89
90void
95
96}
~RhlsVerification() noexcept override
void Run(rvsdg::RvsdgModule &rvsdgModule, util::StatisticsCollector &statisticsCollector) override
Perform RVSDG transformation.
Output * origin() const noexcept
Definition node.hpp:58
NodeInput * input(size_t index) const noexcept
Definition node.hpp:615
NodeOutput * output(size_t index) const noexcept
Definition node.hpp:650
UsersRange Users()
Definition node.hpp:354
Represent acyclic RVSDG subgraphs.
Definition region.hpp:213
Represents an RVSDG transformation.
#define JLM_ASSERT(x)
Definition common.hpp:16
rvsdg::Output * FindSourceNode(rvsdg::Output *out)
static void check_rhls(rvsdg::Region *sr)
static void CheckAddrQueue(rvsdg::Node *node)
NodeType * TryGetOwnerNode(const rvsdg::Input &input) noexcept
Checks if this is an input to a node of specified type.
Definition node.hpp:872
detail::TopDownTraverserGeneric< false > TopDownTraverser
Traverser for visiting every node in a region in a top down order.