Jlm
RvsdgModule.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2024 Nico Reißmann <nico.reissmann@gmail.com>
3  * See COPYING for terms of redistribution.
4  */
5 
6 #ifndef JLM_RVSDG_RVSDGMODULE_HPP
7 #define JLM_RVSDG_RVSDGMODULE_HPP
8 
9 #include <jlm/rvsdg/graph.hpp>
10 #include <jlm/util/file.hpp>
11 #include <optional>
12 
13 namespace jlm::rvsdg
14 {
15 
20 {
21 public:
22  virtual ~RvsdgModule() noexcept;
23 
24  RvsdgModule() = default;
25 
26  explicit RvsdgModule(util::FilePath sourceFilePath)
27  : rvsdg_(new Graph()),
28  SourceFilePath_(std::move(sourceFilePath))
29  {}
30 
31  RvsdgModule(util::FilePath sourceFilePath, std::unique_ptr<Graph> rvsdg)
32  : rvsdg_(std::move(rvsdg)),
33  SourceFilePath_(std::move(sourceFilePath))
34  {}
35 
36  RvsdgModule(const RvsdgModule &) = delete;
37 
38  RvsdgModule(RvsdgModule &&) = delete;
39 
40  RvsdgModule &
41  operator=(const RvsdgModule &) = delete;
42 
43  RvsdgModule &
44  operator=(RvsdgModule &&) = delete;
45 
49  [[nodiscard]] virtual std::unique_ptr<RvsdgModule>
50  copy() const;
51 
56  Graph &
57  Rvsdg() noexcept
58  {
59  return *rvsdg_;
60  }
61 
66  [[nodiscard]] const Graph &
67  Rvsdg() const noexcept
68  {
69  return *rvsdg_;
70  }
71 
72  [[nodiscard]] const std::optional<util::FilePath> &
73  SourceFilePath() const noexcept
74  {
75  return SourceFilePath_;
76  }
77 
78 private:
79  std::unique_ptr<Graph> rvsdg_{};
80  std::optional<util::FilePath> SourceFilePath_{};
81 };
82 
83 }
84 
85 #endif // JLM_RVSDG_RVSDGMODULE_HPP
RvsdgModule(util::FilePath sourceFilePath, std::unique_ptr< Graph > rvsdg)
Definition: RvsdgModule.hpp:31
std::optional< util::FilePath > SourceFilePath_
Definition: RvsdgModule.hpp:80
std::unique_ptr< Graph > rvsdg_
Definition: RvsdgModule.hpp:79
const std::optional< util::FilePath > & SourceFilePath() const noexcept
Definition: RvsdgModule.hpp:73
Graph & Rvsdg() noexcept
Definition: RvsdgModule.hpp:57
const Graph & Rvsdg() const noexcept
Definition: RvsdgModule.hpp:67
RvsdgModule(RvsdgModule &&)=delete
RvsdgModule & operator=(const RvsdgModule &)=delete
virtual std::unique_ptr< RvsdgModule > copy() const
Definition: RvsdgModule.cpp:15
RvsdgModule & operator=(RvsdgModule &&)=delete
RvsdgModule(const RvsdgModule &)=delete
virtual ~RvsdgModule() noexcept